47

What is the difference between align and alignat environments?

64

The first difference we find is in the syntax for calling the two environments:

\begin{align}

doesn't want an additional argument, while

\begin{alignat}{<number>}

requires it. Both environments create alignments based on pairs of rl columns; align will create as many as desired based on the environment's contents, while alignat requires you to specify how many pairs you want in advance.

However, the two environments differ much more than described above. The align environment will add horizontal space between the column pairs

<r col><l col> <space> <r col><l col> <space> <...>

while alignat will insert no horizontal space. For an instance, see Align-environment: Align on the left side, where an alignment of type

<l col><l col>

is desired, which is obtained by using empty right aligned columns:

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

Both environments have an implicit {} at the beginning of cells in the left aligned columns, to help getting good spacing when a cell starts with a relation or operation symbol.

Other uses of alignat are when we want finer control on the horizontal spacing between (pairs of) columns. Such spacing should be specified explicitly such as in

\begin{alignat*}{3}
& m   \quad && \text{módulo}            \quad && m>0\\
& a   \quad && \text{multiplicador}     \quad && 0<a<m\\
& c   \quad && \text{constante aditiva} \quad && 0\leq c<m\\
& x_0 \quad && \text{valor inicial}     \quad && 0\leq x_0 <m
\end{alignat*}

(see Aligning equations with text with alignat). Such a control is not possible with align, because it adds the same horizontal space between all column pairs.

Both environments have the * form and accept \tag or \notag in any row.

There are also the “inner” versions aligned and alignedat, that obey the same rules, for use inside math mode (inline formulas, displayed formulas, math alignments).

  • 1
    small quibble with your last sentence ... "inside other alignments" is a bit narrower than it needs to be. these "inner" versions should work within any display environment, and in fact i've seen both used within in-line $...$ following \item in a list; see Enumerate formulas. – barbara beeton Sep 12 '14 at 13:29
  • @barbarabeeton Thanks for the worthy (as always) remark. – egreg Sep 12 '14 at 13:39
  • @barbarabeeton Isn't the last paragraph what you were asking for? – egreg Feb 6 '16 at 16:23
  • @egreg Does an equation inside the alignedat environment break between pages? – QGravity Jul 7 '18 at 23:27
  • 1
    @QGravity alignat honors \displaybreak. But alignedat makes an unbreakable unit. – egreg Jul 7 '18 at 23:28

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.