6

Why does the following code trigger the error ! Dimension too large. when compiling it with pdflatex, even though the dimension should only be 11in (which is below \maxdimen)?

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{fpu}

\begin{document}
\begin{tikzpicture}

\pgfkeys{/pgf/fpu=true, /pgf/fpu/output format=fixed}
\pgfmathparse{10in + 1in}
\def\y{\pgfmathresult}
\node at ( 0, \y ) { y-position: \y };
\pgfkeys{/pgf/fpu=false}

\end{tikzpicture}
\end{document}

Basically I want to be able to calculate node positions using PGF's FPU, due to the \maxdimen limitation. Expressions like sqrt(pow(10in, 2) + pow(12in, 2)) don't seem to be possible in TikZ, even tho the actual result is only ~15.6in.

1 Answer 1

8

The result is within TeX dimension limits but you use the value without a unit, 794.96.... is understood as centimeters and it becomes 22K+ pts. So add pt after the \y

\node at ( 0, \y pt ) { y-position: \y };

enter image description here

2
  • This seems to work, makes sense. Is the result of \pgfmathresult always implicitly converted to pt, even though inches are used in the calculation?
    – watain
    May 7, 2014 at 8:35
  • 1
    @watain Yes, TeX and hence TikZ works with pt and internally things are always converted to pt.
    – percusse
    May 7, 2014 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .