Dimension too large.

A length went past TeX's limit of about 16383pt (5.75 m). Usually a TikZ plot with large coordinates or a scale factor gone wrong.

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

What the log says

! Dimension too large.
<recently read> \pgf@xx

l.6 \draw[->] (0,0) -- (2000,0)
                              ;

What it means

TeX stores every length as a whole number of tiny units, and the largest it can hold is just under 16384 points (about 5.75 meters). A calculation produced something bigger. The figure or length involved is wrong in the PDF, if it appears at all.

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. TikZ coordinates taken from data, in their raw units

TikZ reads (2000,0) as 2000 cm. Scale the data down (x=0.005cm in the picture's options, or divide the values), or plot with pgfplots, which handles large and small numbers itself.

Fails
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[->] (0,0) -- (2000,0) node[right] {year};
\draw[->] (0,0) -- (0,5) node[above] {count};
\end{tikzpicture}
\end{document}
Fixed
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[x=0.005cm]
\draw[->] (0,0) -- (2000,0) node[right] {year};
\draw[->] (0,0) -- (0,5) node[above] {count};
\end{tikzpicture}
\end{document}

2. A plotted function grows beyond the limit

A TikZ plot evaluates every point, and a function like exp(x) passes the limit long before the end of the domain. Shrink the domain, rescale the y values, or use pgfplots with restrict y to domain.

Fails
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[domain=0:12, samples=50] plot (\x, {exp(\x)});
\end{tikzpicture}
\end{document}
Fixed
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[domain=0:2.5, samples=50] plot (\x, {exp(\x)});
\end{tikzpicture}
\end{document}

3. A length set or multiplied far too large

Check \setlength, \vspace and scale factors near the line: \vspace{1000cm}, or a length multiplied by another large factor, overflows. pgfmath intermediate results are limited the same way, so divide before you multiply.

In Manulyx

The editor shows the error beside the line of the drawing or length that overflowed, with an explanation.

Write in Manulyx for free · Journal templates

More in floats and layout

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