TeXpad

LaTeX error: Illegal unit of measure (pt inserted)

Lengths in TeX are a number plus a unit. When a command such as \vspace, \hspace, or \setlength gets a bare number, TeX inserts pt and reports this error (often together with "Missing number, treated as zero").

! Illegal unit of measure (pt inserted).

Try it: this example has the error

Edit the example using the steps below, then press Compile. What pdfTeX printed for it:

! Illegal unit of measure (pt inserted).
<to be read again> 
                   \vskip 
l.4 \vspace{2}
or paste your own document

Ready. Press Compile (or Ctrl/Cmd + Enter).

Open in the full editor →

Common causes

How to fix it

  1. Add a unit: pt, mm, cm, in, em (font width), or ex (x-height).
  2. For widths relative to the page, use 0.5\linewidth or 0.8\textwidth.

The fixed example

\documentclass{article}
\begin{document}
Text.
\vspace{2em}
More.
\end{document}

Related errors