I have a list of equations with annotations like the one below:
\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}
\begin{align*}
aaaa &= 1 &&\text{for $X$} \\
bbbb &= 1 &&\text{for $Y$} \\
c &= 1 &&\text{for $Z$} \\
d &= 12 &&\text{for $Z$}
\end{align*}
\end{document}
Since the last two lines have the same annotation, I'd like to add a brace there and put the annotation next to the brace. I know that I can do that like this:
\documentclass{scrartcl}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\left. \begin{aligned}
c &= 1 \\
d &= 12 \\
\end{aligned} \right\} &&\text{for $Z$}
\end{align*}
\end{document}
But how to join the two? The last two lines will only be aligned among themselves, not with the first two. Is there a way out of this?
Thanks in advance.
Best Answer
Here is a naive attempt at positioning braces in
align
:The combination of
\smash
(removing any vertical height),\raisebox
(for vertical movement) and\llap
(removing horizontal width using al
eft overlap
) allows for manipulating the position of the brace.Of course, the (horizontal) location of the brace can be adjusted.