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.

Consider the following MWE:

\documentclass{article}
\usepackage{amsmath,bbm}

\begin{document}

\begin{align}
  &&&\cr
\end{align}

\end{document}

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?)

share|improve this question
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... –  tohecz May 1 at 20:51
    
If you want one line why are you breaking the line with double back slashes? –  Sigur May 1 at 20:53
    
Welcome to the site! –  cmhughes May 1 at 20:53
    
And \begin{align*} ... \end{align*} would drop the equation number! –  Christian Hupfer May 1 at 20:54
3  
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 at 21:00

1 Answer 1

up vote 8 down vote accepted

\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> 
                   \relax 

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

share|improve this answer
    
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\`. –  jondaman21 May 2 at 11:35

Your Answer

 
discard

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.