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}.
\documentclass{article}
\begin{document}
First part.
\vspace{big}
Second part.
\end{document}\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}.
\documentclass{article}
\begin{document}
\setcounter{page}{one}
Text.
\end{document}\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
- LaTeX Error: Command \<name> already defined.\newcommand or a package tried to define a name that already exists. Pick another name, use \renewcommand, or drop the clashing package.
- Illegal parameter number in definition of \<name>.A # in a definition does not refer to a declared argument: #1 without [1], #1 in an environment's end code, or a # in a URL. Fix the count or escape it.
- Use of \<name> doesn't match its definition.A command with a special argument syntax, such as \put(x,y) or a \def with delimiters, was called without that syntax. Follow its exact form.
- LaTeX Error: Environment <name> undefined\begin{…} names an environment no loaded package defines: load the package (amsmath for align), fix the spelling, or define it with \newtheorem.
- LaTeX Error: Option clash for package <name>A package is loaded twice with different options, often because the class or another package loaded it first. Load it once, with all options.
- LaTeX Error: Unknown option `<opt>' for package `<pkg>'A package was given an option it does not accept: a typo, an option meant for the class or another package, or a babel language name it does not know.
Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors