Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 8 down vote accepted

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

share|improve this answer
    
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 at 8:35
1  
@watain Yes, TeX and hence TikZ works with pt and internally things are always converted to pt. –  percusse May 7 at 8:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.