Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

alignedat has a mandatory argument. But Herbert (in his mathmode.pdf) wrote as follows,

enter image description here

I have made a trial and error, I noticed that the largest number that can be passed is 1073741823 and no failure occurs.

    \item The degree of (C) is 3.
    \item The degree of (A) is 1.
                  &&=\rlap{$-3x^2-3x-2x^2+2x+v$} \\
              &   &&\hphantom{{}={}}{+}4x^2&&-12x-4\\
              &   &&=-3x^2 &&-3x-2x^2+2x+v \\
              &   &&       &&+4x^2-12x-4 \\
              &   &&=\rlap{$-x^2-13x-4$}

My question: What is this argument for? Why is it mandatory if it is not necessary? It should be an optional argument, I think.

share|improve this question
The mbox file format strikes again! –  Mariano Suárez-Alvarez Jan 31 '13 at 4:35
It stores the value in \maxfields@ and is used avoid using more than the specified number of alignment points. So, of course, using a large number would have no impact. –  Werner Jan 31 '13 at 4:41
... (continuing from Werner's comment) - indeed, you'll get errors if you use a value that is too small... –  cmhughes Jan 31 '13 at 4:56
...it also relates to a shared "base function" \start@aligned. It is shared between aligned and alignedat; the mandatory argument distinguishes a specific use of the base function. –  Werner Jan 31 '13 at 5:21
It's mandatory because you want to use it for alignments you build the intercolumn spaces of and you want to be in control of what you're doing. If Herbert Voß has different opinions about this, they're just opinions: mine is that users should specify precisely what they want or use align. In any case, keep in mind that amsmath descends from AMS-TeX, where the argument to \alignedat was necessary. –  egreg Jan 31 '13 at 8:04
add comment

2 Answers

up vote 12 down vote accepted

The definitions of the "align" environments are


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.

share|improve this answer
add comment

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


  • 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.



This will flag an error \verb|Package amsmath Error: Extra & on this line| if the double backslash is missing:
    v_5 &= v_4 - v_3 +1 &&= 1 - 3 +1 &&= 1, \\
    v_6 &= v_5 - v_4 +1 &&= 1 - 1 +1 &&= 0,
But if a large number is used \LaTeX will happily typeset it without warning:
    v_5 &= v_4 - v_3 +1 &&= 1 - 3 +1 &&= 1, 
    v_6 &= v_5 - v_4 +1 &&= 1 - 1 +1 &&= 0,
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.