After using a new version (2.10) of PGF, certain parts of my old TikZ code stopped functioning properly. For instance, the plot for a power function:

  \draw[domain=0.0000125:1] plot (\x,{(\x)^(0.5)-\x});

I now get the "Dimension too large" error for this.

The problem has something to do with the power function: \draw[domain=0.0000125:1] plot (\x,{(\x)^(2)-\x}); would cause no problem at all under the new version. More specifically, the problem seems to lie in taking square roots.

I noticed the problem quite some time ago, but since I am able to revert back to an older version (2.00) of PGF under which the above piece of code causes no problem, I didn't bother to ask about it. Now, however, when other people run my code, they often get problems because they have newer versions of PGF.

My question is:

How can I rewrite the code such that the intended function gets plotted without any problem under the current version of PGF?

  • Also, about which PGF versions are we talking now (i.e. which is the old and which the new one)? Oct 29, 2011 at 21:16
  • Old: 2.00 New: 2.10 (not sure about build dates)
    – Jed
    Oct 29, 2011 at 22:17
  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Oct 30, 2011 at 0:06
  • Maybe this is related?
    – percusse
    Oct 30, 2011 at 1:45
  • Thanks. It was that post gave me the idea to revert back to 2.00 as a workaround. Unfortunately, the solution therein doesn't solve my problem. Neither does adding parentheses do. It seems that the problem is related to taking square roots, to be more specific. Oct 30, 2011 at 2:50

1 Answer 1


Apparently, this is (was) a bug in pgf 2.10 : I can reproduce it with pgf 2.10 and it works in the current pgf CVS.

As a workaround, I suggest to use sqrt(x) which seems to use a special implementation - it works in pgf 2.10 as well.

To really solve the problem, you may need to upgrade to a more recent pgf version (I believe there are still unstable pgf builds on texample.net (?) ).

If that is infeasible, you may want to explain more about your use-case such that others can comment on alternatives.


According to your comment, you really search for a more general solution without upgrading pgf. There is further solution. I did not mention it in the first place because I have never used it. The idea is to use the fpu library of PGF (maybe the fp library also does the job).

With fpu, the solution is as follows:

\usepgflibrary{fpu}%----- this
     /pgf/fpu,/pgf/fpu/output format=fixed%------ this
  ] plot (\x,{(\x)^(0.8)-\x});

I suppose this will always work. If replaces the internal PGF math engine (but only for that specific drawing command). The solution comes with minor changes to your documents and should not change the nature of your figures at all.

In case you are generally interested in plots (perhaps with more flexible plot handlers, 3d, or large data ranges, combined with a complete axis), you may also want to take a look at \usepackage{pgfplots}. This, however, changes your figures considerably.

  • There are builds on TeXample, but the last one is from september of last year. Alain Matthes has newer builds on Altermundus.com, and there are also builds on Sourceforge. Oct 30, 2011 at 13:24
  • Thank you Christian, for your suggestion. It solves the problem perfectly for the '(\x)^(0.5)' case. Functions like "(\x)^(0.8)" are more problematic. Using another version of pfg isn't a very convenient solution for me either since not all my collaborators know how to manually switch between different versions of certain packages. However, good to know that the bug got fixed in the CVS version so it's likely such problems won't appear in future versions of pgf. Thank you Torbjørn, for the information too. Oct 30, 2011 at 17:56
  • In this case, you really need an alternative solution. I edited my answer. Now, it contains 1.5 alternative solutions which work with pgf 2.10 . Nov 1, 2011 at 14:40
  • Christian, your new solution works like a charm. It solved the problem I had for almost a year now. Thanks also for the suggestion of your pgfplots which is very helpful in presenting empirical results. Nov 3, 2011 at 3:30

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.