[Tex/LaTex] Align-environment: Align on the left side

align

Why doesn't the following code align the two equations in the middle?
It does only if I remove the alignment on the left.

\begin{align*}
    &ABC  &= ABC - AB\\
    &ABCD &= ABC - ABCDEFG
\end{align*}

enter image description here

Best Answer

An align or align* environment is a set of rl column pairs, with a wide space between each pair.

You want to use alignat, which does the same, but adds no space between pairs of columns.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{alignat*}{2}
&ABC  &&= ABC - AB\\
&ABCD &&= ABC - ABCDEFG
\end{alignat*}

\end{document}

enter image description here

With \begin{alignat*}{2} you allocate four columns, in the form rlrl, so you want & to get into the l column and && to get in the next l column; note that cells in l columns have an automatic {} inserted so as to give correct spacing for the relation or operation symbols.

Related Question