Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
1  
Do the answers to this question help? –  Ian Thompson Aug 21 '12 at 12:33
    
@IanThompson: I'm not sure. The problem seems related but one solution uses an array environment (which does not allow me to number lines) and the doesn't address the problem afaict. –  anonymous Aug 23 '12 at 9:43
add comment

1 Answer

up vote 3 down vote accepted

Here is a naive attempt at positioning braces in align:

enter image description here

\documentclass{scrartcl}% http://ctan.org/pkg/koma-script
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  aaaa &= 1  &&\text{for $X$} \\
  bbbb &= 1  &&\text{for $Y$} \\
  c    &= 1  && \\
  d    &= 12 &&\llap{\smash{\raisebox{\dimexpr.5\normalbaselineskip+.5\jot}{$\left.\begin{array}{c}\null\\[\jot]\null\end{array}\right\}\quad$}}}
      \text{\smash{\raisebox{\dimexpr.5\normalbaselineskip+.5\jot}{for $Z$}}}
\end{align*}
\end{document}

The combination of \smash (removing any vertical height), \raisebox (for vertical movement) and \llap (removing horizontal width using a left overlap) allows for manipulating the position of the brace.

Of course, the (horizontal) location of the brace can be adjusted.

share|improve this answer
    
Cool, thanks :) –  anonymous Aug 21 '12 at 20:04
    
So \smash{\raisebox{\dimexpr.5\normalbaselineskip+.5\jot}{<content>}} is an idiom for positioning something centered between two lines. On top of that, \left.\begin{array}{c}\null\\[\jot]\null\end{array}\right\} creates a brace of the right height through an empty array of the right height, if I understand correctly. Is there no easier way to create some kind of phantom of the right height? The array seems a bit scary in there :) –  anonymous Aug 22 '12 at 7:42
    
(Sorry, I have to ask): If I replace the align* environment with an align environment, the last line will now get two numbers. Is there a way around that? –  anonymous Aug 22 '12 at 7:55
    
@anonymous: There are other ways of doing this; not sure whether they would be considered easier though. You can use \nonumber on every line where you want to suppress the equation number. However, using your setup, this will not work since the number will be aligned with the equations, not the "descriptors" (the "for ..." part). Then you need to consider something else, which might require a different solution. Perhaps consider asking a follow-up question. –  Werner Aug 22 '12 at 14:31
    
I've now asked the follow-up question tex.stackexchange.com/questions/68547/… –  anonymous Aug 24 '12 at 7:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.