[Tex/LaTex] How the `\alignat` works in ams package

alignatamsmath

I have read the related question(Difference between align and alignat environments), which had detailed answer but still don't know what the meaning of the \alignat's argument. It is said in http://people.cs.uchicago.edu/~ivan/math/amsldoc.pdf that

This environment takes one argument, the number of “equation
columns”: count the maximum number of &s in any row, add 1 and and
divide by 2.

What is the meaning of adding one in & number and divide by two? I presumed the argument is given by the user, not automatically generated by the system?

Best Answer

I've always found the description of alignat based on the number of & tokens confusing. It's simpler than that: first you decide how many parts your alignment consists of, then adjust the number of & tokens.

Both align and alignat build tables consisting of pairs of a right aligned column and a left aligned column.

The argument to \begin{alignat} tells how many pairs you want. So, for instance, \begin{alignat}{3} sets things up for a total of six columns (three pairs); therefore the number of & in each line is five.