What is the mandatory argument of alignedat for?

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.


Well I came across a reason to not use a large number for the mandatory parameter, and instead to specify exactly the precise number: so that an error message is issued if one accidentally forgets a trailing \\ at the end of a line. Using a large number will not result in an error message:

enter image description here

Notes:

  • Now that I reread the comments, I think that this what Werner and cmhughes were getting at in their comments, but didn't understand that until I actually encountered this problem just now.

  • The example below uses alignat*, but alignedat exhibits similar issues.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\noindent
This will flag an error \verb|Package amsmath Error: Extra & on this line| if the double backslash is missing:
\begin{alignat*}{3}
    v_5 &= v_4 - v_3 +1 &&= 1 - 3 +1 &&= 1, \\
    v_6 &= v_5 - v_4 +1 &&= 1 - 1 +1 &&= 0,
\end{alignat*}
But if a large number is used \LaTeX will happily typeset it without warning:
\begin{alignat*}{999}
    v_5 &= v_4 - v_3 +1 &&= 1 - 3 +1 &&= 1, 
    v_6 &= v_5 - v_4 +1 &&= 1 - 1 +1 &&= 0,
\end{alignat*}
\end{document}