Missing number, treated as zero.

A command that needs a number or length (\vspace, \setcounter, a width) got a word or nothing. Give it a value such as 1em or 3.

Help centre › LaTeX errors › Commands and packages · Error: the build stops or the output is wrong

What the log says

! Missing number, treated as zero.
<to be read again>
                   b
l.4 \vspace{big}

What it means

TeX was expecting a number, or a length such as 2cm, and found something else, so it used zero. It is usually followed by Illegal unit of measure (pt inserted) for the same spot. The command near the end of the l.<n> line is the one that received the bad value.

Causes and fixes

Most common first. Each example is a complete document; the first fails with this message, the second is the same document fixed.

1. A length command got a word instead of a length

\vspace, \hspace, \setlength and width= options need a number with a unit (1em, 0.5\textwidth, 12pt) or a length command (\baselineskip). For the named sizes, use \bigskip, \medskip or \smallskip instead of \vspace{big}.

Fails
\documentclass{article}
\begin{document}
First part.
\vspace{big}
Second part.
\end{document}
Fixed
\documentclass{article}
\begin{document}
First part.
\vspace{2em}
Second part.
\end{document}

2. A counter set to a word

\setcounter and \addtocounter need an integer: write \setcounter{page}{1}, not {one}.

Fails
\documentclass{article}
\begin{document}
\setcounter{page}{one}
Text.
\end{document}
Fixed
\documentclass{article}
\begin{document}
\setcounter{page}{1}
Text.
\end{document}

3. A number taken from something that is not a number

Writing \ref{…} or a macro that prints text where a number is expected (for example \setcounter{section}{\ref{sec:a}}) gives this error, because \ref produces typeset text. Use a counter value (\value{section}) or a fixed number.

In Manulyx

The editor shows the error beside the line with an explanation, and the compile log is parsed into a list of problems.

Write in Manulyx for free · Journal templates

More in commands and packages

Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors