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.
\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}\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.
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw[domain=0:12, samples=50] plot (\x, {exp(\x)});
\end{tikzpicture}
\end{document}\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
- LaTeX Error: There's no line here to endA line break (\\ or \newline) comes where no line has started, typically after a blank line. Use \vspace or \medskip for vertical space.
- LaTeX Error: Not in outer par modeA figure, table or \marginpar is inside a box, minipage, table cell or another float. Floats must be in the main text; put the box inside the float.
- LaTeX Error: Too many unprocessed floatsFigures and tables are queued faster than LaTeX can place them, often behind one that cannot be placed. Relax placements, shrink it, or add \clearpage.
- LaTeX Error: Float(s) lostA figure or table sits inside a footnote, a framed box or a similar construct LaTeX cannot place floats from, and it disappears. Move it into the text.
- Overfull \hbox (<n>pt too wide) in paragraph at lines <a>--<b>A line sticks out into the margin because TeX found no acceptable place to break it: a long URL or word, or an image or equation wider than the column.
- Underfull \hbox (badness <n>) in paragraph at lines <a>--<b>A line had to be stretched more than TeX likes, leaving wide gaps between words. Usually caused by \\ or \linebreak in running text.
Every example on this page was compiled with pdfLaTeX to check that it fails and is fixed as described. All LaTeX errors