11

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

  • Welcome to TeX.SX! An align environment is basically a sequence of rl column pairs, with a wide space between pairs. – egreg Sep 10 '14 at 15:16
  • here's another question that addresses this problem: Multiple alignments in align environment. there are probably others. – barbara beeton Sep 10 '14 at 15:31
11

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.

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.