Align two inequalities

alignat is your friend:

\begin{alignat*}{2}
\sum a &\le &\sum b &\le \sum c \\
\log \sum a &\le{} &\log \sum b &\le \log \sum c
\end{alignat*}

produces:

alt text

I needed to add two extra alignment characters between the columns, and a {} to make the \le a binary operator. The number of &'s should be 2n-1 where n is the argument given (2 in the case above).


Although now that I read the question again I realize I didn't answer it. It seems that you want the \sum term to be centered...

The only way I can think of doing it is a bit ugly:

\newlength{\yuckkyhack}
\settowidth{\yuckkyhack}{$\displaystyle\log \sum b$}
\begin{alignat*}{2}
\sum a &{}\le{} &\makebox[\yuckkyhack]{$\displaystyle\sum b$} {}&\le \sum c \\
\log \sum a &\le{} &\log \sum b &\le \log \sum c
\end{alignat*}

which gives the desired result (I think):

alt text

but requires manual selection of the largest bit of text, and use of a length...any ideas for improvement?


Is this horse dead yet....Since my other answer got accepted, I don't want to change it. So, instead, I'm adding my thoughts here in a new answer.


How about this:

\begin{equation*}
\begin{aligned}\sum a &\le{}\\ \log \sum a &\le{} \end{aligned}\!
\begin{gathered}\sum b\\ \log \sum b \end{gathered}\!
\begin{aligned}{}&\le \sum c\\ {}&\le \log \sum c \end{aligned}
\end{equation*}

which produces:

image

No hackery involved, but the writing isn't as "linear" since you need to split the equations into columns yourself. Note also the negative space that is required to get better spacing between the columns.

Here is one more solution:

\usepackage{array}
\begin{document}

\newcolumntype{C}{>{\(\displaystyle}c<{\)}@{}} 
\newcolumntype{L}{>{\(\displaystyle}l<{\)}@{}} 
\newcolumntype{R}{>{\(\displaystyle}r<{\)}@{}}

\center{
\begin{tabular}{RCL}
\sum a \le{} & \sum b &\le \sum c \\
\log \sum a\le{} &\log \sum b &{}\le \log \sum c
\end{tabular}

\end{document}

Oh, one caveat: I have no idea how to have more than one equation number with this solution.


As documented in amsmath's doc if you want to have all the equivalence symbols aligned use && for the second equivalence:

\begin{alignat}{2}
x& = y_1-y_2+y_3-y_5+y_8-\dots
&\quad& \text{by \eqref{eq:C}}\\
& = y’\circ y^* && \text{by \eqref{eq:D}}\\
& = y(0) y’
&& \text {by Axiom 1.}
\end{alignat}