FormaTeX
FatalMath Mode

Missing Number in Math or Dimension

! Missing number, treated as zero.

What this error means

LaTeX expected a number (for a dimension, counter, or numeric argument) but found something unexpected. This often happens when a \hspace, \vspace, or \rule command is given a non-numeric argument.

Common causes

  • \hspace{} or \vspace{} with an invalid or missing dimension unit
  • \setcounter or \addtocounter given a non-integer value
  • A command that requires a number received text or an empty argument

How to fix it

Provide a valid numeric dimension (e.g. \hspace{1em} or \vspace{12pt}). Dimensions require a unit — never write \hspace{1} without specifying pt, em, cm, etc.

Code examples

Causes the error
\documentclass{article}
\begin{document}

\hspace{1}  % Missing unit — error!

\end{document}
Fixed
\documentclass{article}
\begin{document}

\hspace{1em}  % Correct: number + unit

\end{document}

Related errors

Test the fix live

Paste your LaTeX into the playground and compile instantly.

One quick thing

We track anonymous usage — page views, feature usage, compilation events — to understand what works and what doesn't. No ads, no personal data, no third-party sharing.

Cookie policy