I'am using tikz for helping me at work. I want to produce a results sheet for an exam in which each students have different numerical results (there is a free parameter that is the alphabetical position of each student). Usually it work, but sometimes tikz fail to evaluate some of the results. Usually when there are big numbers. I have the following message

! Dimension too large. \pgfmath@x l.97 } I can't work with sizes bigger than about 19 feet. Continue and I'll use the largest value I can.

This came from the following code

\node[scale=3]at(6,26){Soluzioni primo esercizio};
\foreach \k/\nome in {1...25}

Tikz fail to calculate y_max (max altitude) and x_max (horizontal displacement), in particular when k=1 one must find

  • angle = 3.5999°
  • initial velocity = 5624.58 m/s
  • y_max = 6356 m
  • x_max = 404209 m

instead tikz cannot reproduce the correct results. Why?

  • 1
    Just try with Km/s and Km and convert only the needed (last) results... Usually such changes are the best way to solve this problems – koleygr Jul 3 '18 at 21:46

The numerical capabilities of pgf are limited, you probably exceeded the limit. The xfp package, and its \fpeval, can however handle larger numbers. A quite simple implementation is found below. I also used siunitx to print the values, and changed the coordinates of the nodes a bit.

\usepackage{xfp} % for fpeval
\usepackage{siunitx} % for \num, number printing

\node[scale=3]at(5.5,26.5){Soluzioni primo esercizio};
\foreach \k/\nome in {1,...,25}
  \node at (0,\y){\nome};
  \node at (1,\y){$\gamma=\k$};
  \node [left] at (3.5,\y) {$\SI{\angolo}{\degree}$};
  \node [left] at (5.5,\y) {$\num{\vzero}$};
  \node [left] at (8,\y)   {$\num{\ymax}$};
  \node [left] at (11,\y)  {$\num{\xmax}$};

enter image description here

  • 1
    For better efficiency, I'd use \edef\angolo{\fpeval{18*\k/5}} and similarly for the other computations. – egreg Jul 3 '18 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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