18

I'd like to format two groups of equations such that all their equal signs line up and such that I can put a big brace to the right of each block to annotate that block. The last part is easily achieved using the aligned environment of amsmath:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
  \left.\begin{aligned}
    \alpha_X \times \alpha_Y &= \chi \\
    \alpha_X \times \beta_Y &= \xi \\
    \beta_X \times \beta_Y &= \zeta
  \end{aligned}\right\} \quad X<Y \\[2em]
  \left.\begin{aligned}
    \Upsilon_j &= 0 \\
    \Psi_j &= \sqrt{\sinh E - \tan^2\tfrac{F}{2}} \\
    \Gamma_j &= F
  \end{aligned}\right\} \quad j=1,\ldots,g
\end{align}
\end{document}

But that doesn't line up the equal signs. I guess I could achieve this with some manual horizontal white space, but I'd like something automatic. Something like the split environment which supports reusing the anchor points of the outside 'align' environment:

\begin{align}
  A &= 0 \\
  BB &= AVE + VEA + EAV \\
  \begin{split}
  CCC &= UVWXY + VWXYU + WXYUV \\
      &\quad {} + XYUVW + YUVWX
  \end{split}
\end{align}

Is there a way to make aligned reuse the anchor points of the outside align?

Also, is there an automatic way to additionally line up the big braces in the first example?

7

Here's a solution using the widths of the widest expression on each side. You have to specify which expression it is:

\documentclass{article}
\usepackage{amsmath}
\newlength{\leftside}
\newlength{\rightside}
\newcommand*{\leftterm}{}
\newcommand*{\rightterm}{}
\newcommand*{\term}[1]{$\displaystyle#1$}
\begin{document}
\[
\renewcommand*{\leftterm}{\alpha_X \times \alpha_Y}
\renewcommand*{\rightterm}{\sqrt{\sinh E - \tan^2\tfrac{F}{2}}}
\settowidth{\leftside}{\term{\leftterm}}
\settowidth{\rightside}{\term{\rightterm}}
\begin{array}{l}
  \left.\begin{aligned}
    \leftterm &= \makebox[\rightside][l]{\term{\chi}} \\
    \alpha_X \times \beta_Y &= \xi \\
    \beta_X \times \beta_Y &= \zeta
  \end{aligned}\right\} \quad X<Y \\[2em]
  \left.\begin{aligned}
    \makebox[\leftside][r]{\term{\Upsilon_j}} &= 0 \\
    \Psi_j &= \rightterm \\
    \Gamma_j &= F
  \end{aligned}\right\} \quad j=1,\ldots,g
\end{array}
\]
\end{document}

Equal signs as well as the big braces line up:

alt text

  • This is not exactly what I hoped for (since it still involves whitespace fiddling), but in the absence of better alternatives, I think this is a good solution. So, thanks! – Torsten Schönfeld Aug 24 '10 at 9:29
9

I have a solution as well. It is taken from the MathMode documentation on CTAN, page 112.

\documentclass{article}
\usepackage{amssymb}
\usepackage{amsmath}
\newcommand{\fakealign}{%
   \mbox{\hspace{5cm}} & \mbox{\hspace{5cm}} \nonumber\\%
}
\begin{document}
An equation;
\vspace{-1cm}
\begin{align}
   \fakealign
   D &= I\left(1+r\right)^t
\end{align}
Equation with a long left hand side;
\vspace{-1cm}
\begin{align}
   \fakealign
   \left(1+d\right)^{-T} &= U
\end{align}
Equation with a long right hand side
\vspace{-1cm}
\begin{align}
   \fakealign
   PV &= \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
\end{align}
They all align with the = sign :)
\end{document}

I can't post an image because I am a new user and therefore don't have enough reputation. But build it and observe!

I think this simpler and more elegant than Stefan's solution, but hey. Horses for courses.

Enjoy!

  • Nice solution! I think it would be even more elegant if you would add the negative vertical space at the end of the line in the macro: \[-1cm] – lex82 Mar 3 '13 at 16:53
1

You could adopt Andrew's or my answer to this question.

  • While I like TikZ, I think it's a little overkill in this case. But thanks for the suggestion anyway. The \tikzmark macro is definitely something to remember. – Torsten Schönfeld Aug 24 '10 at 9:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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