Using & in align

Consider the following code and its outcome:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{align}
A >& B > C &> D \\
A >& E &>D
\end{align}

\begin{eqnarray}
A >& B > C &> D \\
A >& E &> D
\end{eqnarray}

\end{document}


I want the outcome to be the second one rather than the first one. However, I want to achieve this in the align environment.

1. Can I do this?
2. What does the & exactly do anyway?

EDIT: Thanks for the help so far. I like (and upvoted) all options proposed, but what if I want BOTH lines to be numbered? So instead of align*, align.

• Does it need to be align, or can it be one of the other AMS environments? Jan 19, 2017 at 16:53
• I am curious about align, but another environment would be fine for now - as long as it is in amsmath. Jan 19, 2017 at 16:57

A variant with alignat and eqmakebox, mimicking the construction of the \vdotswithin command from mathtools: \documentclass{article}

\usepackage{amsmath}
\usepackage{eqparbox}
\begin{document}

\begin{alignat}{3}
A & > B & & \eqmakebox[A]{${}>{}$} C &&> D \\
A & > & & \eqmakebox[A]{$E$}& & >D
\end{alignat}

\end{document}


An explanation on the ampersands usage

The only difference between align and alignat is that the spacing between the columns of aligned equations is chosen by the user in the case of the alignat environment.

For n columns, you have to use 2n – 1 &: from the 2nd one, each & marks the beginning of a new column, the following & marks the alignment point in its column.

Here, I set 3 columns, whence 5&, with no spacing between the columns.

This is better realized with an array:

\documentclass{article}
\usepackage{array}

\begin{document}

$\setlength{\arraycolsep}{0pt} \renewcommand{\arraystretch}{1.5} \begin{array}{c *{3}{ >{{}}c<{{}} c } } A &> & B &> & C &> & D \\ A &> & \multicolumn{3}{c}{E} &> & D \end{array}$

\end{document}


Seven points of alignment, the even numbered column for the relation symbol, so surrounded by empty subformula in order to produce the correct space. Intercolumn padding is set (locally) to zero.

• Thanks, this seems to be a good solution +1 But what if, additionally, I want to number both (chains of inequalities). If I replace the [ with, say, \begin{align}, \end{align} I only get a single number tag. Jan 19, 2017 at 17:12
• @Bayesian That's more complicated and possibly requires to see the real thing. Jan 19, 2017 at 18:08

You can use alignat instead of align and then some low level commands to get the centering or you can use the eqnarray package.

alignat

\documentclass{article}

\usepackage{amsmath}

\makeatletter
\newcommand{\ccol}[1]{\omit\column@plus\hfill$\m@th\displaystyle #1$\hfill\span}
\makeatother

\begin{document}

\begin{alignat}{2}
A >{}& B > C &&> D \\
A >{}&\ccol{E}&>D
\end{alignat}

\end{document}


equationarray

\documentclass{article}

\usepackage{eqnarray}

\begin{document}

\arraycolsep 0pt
\begin{equationarray}{rcl}
A >{}& B > C &{}> D \\
A >{}&E&{}>D
\end{equationarray}

\end{document}

• Also a nice option! +1 But as with the answet above: If I wanted to number both lines, alignat would just number the first one, right? Jan 19, 2017 at 17:32
• No, alignat numbers each line. I have updated the code and provided a convenient macro for the centered column. Jan 19, 2017 at 17:54

As long as you don't need the individual equations numbered, here it is with a TABstack.

\documentclass[a4paper]{article}
\usepackage{tabstackengine}
\TABstackMath
\begin{document}
$\setstacktabulargap{0pt} \TABbinary \tabularCenterstack{rcl}{ A >& B > C &> D \\ A >& E &> D }$
\end{document}