The definitions of the "align" environments are
\newenvironment{alignat}
{\start@align\z@\st@rredfalse}
{\endalign}
\newenvironment{xalignat}
{\start@align\@ne\st@rredfalse}
{\endalign}
\newenvironment{xxalignat}
{\start@align\tw@\st@rredtrue}
{\endalign}
\newenvironment{align}
{\start@align\@ne\st@rredfalse\m@ne}
{...}
\newenvironment{flalign}
{\start@align\tw@\st@rredfalse\m@ne}
{\endalign}
The first argument to \start@align
(which has three of them) is a number telling what type of alignment is desired, with respect to the intercolumn spaces; the second declares what \ifst@rred
should mean (the *-variants, of course, have \st@rredtrue
) and the third is the number of column groups, which is -1
for align
and flalign
that haven't a predefined number of them. In the case of alignat
, the third argument is the (apparent) argument to \begin{alignat}
(and the same for xalignat
and xxalignat
).
The number of columns (if set) is important for the later measurements for accommodating the equation numbers.
One could argue that the argument to \begin{alignat}
is not really necessary, but since one uses the environment for stating explicitly what the spacing between (groups of two) columns is, the number is useful for making users certain about where they are and if no \\
has been forgotten. Maybe the argument could have been made optional, but amsmath
is a direct descendant of AMS-TeX, where optional arguments weren't used; so the syntax has been preserved and I see good uses of it.
Since alignedat
is the "inner" version of alignat
it must have the same syntax. And the same considerations about its usefulness apply as well.
This is even more than in your answer (now comment). In any form of math mode, \par
and equivalent forms, like an empty line, causes an error. The reason is in the Chapter 16, p. 135 of The TeXbook
Conversely, a blank line or \par is not permitted in math mode. This gives
TeX another way to recover from a missing $; such errors will be confined to
the paragraph in which they occur.
Best Answer
This is inherited from the original amstex code. It certainly isn't required by the implementation which just uses it to raise an error if the number of
&
doesn't match the number of column-pairs specified by the argument. It is an undocumented secret but the value of -1 is used as a flag byalign
to allow an arbitrary number of columns, and would also work here.Clearly it could have been defined to always work without the number of columns check then the number of columns argument wouldn't be needed. Presumably the original author thought that the syntax was confusing and getting the document author to be explicit would help catch errors.