Consider the following MWE:





It generates both the "Missing number, treated as zero" and "Illegal unit of measure (pt inserted)" error messages. Why?

(My goal is to have 2 spaced equations on one line but no equation number for that line. I realize I can accomplish this with something like \begin{align} \nonumber a&=1 & b&=2\\ c\end{align} but why is this necessary?)

  • 1
    And what's wrong with \begin{align} \nonumber a&=1 & b&=2\\ c\end{align}? That seems to be the correct thing to do... – yo' May 1 '14 at 20:51
  • If you want one line why are you breaking the line with double back slashes? – Sigur May 1 '14 at 20:53
  • And \begin{align*} ... \end{align*} would drop the equation number! – user31729 May 1 '14 at 20:54
  • Using \cr instead of \\ avoids generating an equation number for that line. E.g. \begin{align}a\cr b\end{align} only generates one equation number whereas \begin{align}a\\ b\end{align} generates 2. (@Sigur: I actually want more than one line or, sometimes, I just want the equation number on a new line) – whackyusername1 May 1 '14 at 20:55
  • 4
    even though \cr may underly the double backslash mechanism for ending a line, it isn't recommended to use "plain tex" code in the multi-line display structures defined by amsmath. stick to what's documented in the user manual (texdoc amsmath). \notag will suppress the equation number for one line. – barbara beeton May 1 '14 at 21:00

\cr is not a LaTeX command (it is a TeX primitive) and its use in the middle of an AMS alignment causes a chunk of the alignment code to be omitted as the correct code \\sets up a lot of the internal measurement data before calling \cr internally to finish the row.

If you add \tracingall and compare the logs with \cr and \\ then you will see that the specific cause of the error is that \cr did not terminate the cell as intended and so the \maxcolumn@widths macro was not correctly updated with the column widths.

With \cr it is

\maxcolumn@widths -> \or 0.0pt \or 0.0pt

but with \\ it is

\maxcolumn@widths -> \or 0.0pt \or 0.0pt \or 0.0pt \or 0.0pt \or 0.0pt

align uses an \ifcase to extract the relevant length as it considers each column

but as it is too short, once it gets to column 3 it uses \ifcase3 which means that it tries to read past this \or list and you get:

\maxcolumn@widths -> \or 0.0pt \or 0.0pt
{case 3}
! Missing number, treated as zero.
<to be read again> 

Don't use TeX primitives in the middle of complicated LaTeX code:-)

  • OK. That's a very informative answer (and I also want to acknowledge @barbarabeeton who gave a similar, though less detailed, comment). It's funny that I haven't really seen this point stressed anywhere (in fact, if I search for "latex amsmath cr" in google right now, this question is the second result ;-). It's easy enough to remedy this with a macro defined as `\nonumber\`. – whackyusername1 May 2 '14 at 11:35

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.