How can I achieve this in LaTeX?
Asked
Active
Viewed 777 times
0
Troy
- 13,741
user401393
- 37
-
The preferred method is to use \tikzmark. See http://tex.stackexchange.com/questions/183189/matrix-row-alignment-on-two-sides-of-an-equation-with-rules for example. – John Kormylo Mar 20 '17 at 01:12
-
1@JohnKormylo I think it's more like this: http://tex.stackexchange.com/a/234906/101651 – CarLaTeX Mar 20 '17 at 04:53
1 Answers
3
Your question is probably a duplicate of this one, but I like to show you an alternative solution with tikzmark.
\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{tikzmark, calc}
\newcommand{\mybrace}[3]{%
\draw[decorate,decoration={brace,mirror}]
($(pic cs:#1)+(-.3,.3)$) -- node[xshift=-1em, align=left, text width=4em]{#3} ($(pic cs:#2)+(-.3,-.1)$);}
\renewcommand*{\arraystretch}{1.25}
\begin{document}
\[
\begin{bmatrix}
\tikzmark{lp} P \\
\tikzmark{lq} Q \\
\tikzmark{gp} P \\
\tikzmark{gq} Q \\
\end{bmatrix}
\]
\begin{tikzpicture}[overlay,remember picture,baseline]
\mybrace{lp}{lq}{Load}
\mybrace{gp}{gq}{Gen}
\end{tikzpicture}
\end{document}

