I'm using TiKZ 2.10 to create a document that includes a tikzpicture with \pgfmathmin (yes, I also have \usetikzlibrary{calc}). Previously the document compiled fine but now I get an error like:

Package PGF Math Error: Unknown function `getargs' (in 'getargs(3,4)')

I can eliminate this by replacing the occurrence of \pgfmathmin{3}{4} with \pgfmathparse{min(3,4)} but I'm not sure why the former no longer works.

Am I misusing the \pgfmathmin command?

EDIT: A minimal example to compile (with a version of TiKZ approximately 2.10, the version included in miktex 2.9)

\pgfmathmin{1}{2} \pgfmathresult % This yields an error message about getargs
  • 6
    Please post a full minimal example. – Joseph Wright Jan 26 '11 at 8:37
  • @Joseph, I don't like unnecessarily cluttering up my questions with the surrounding code. Is it a policy of the site that these minimal examples should be included?, because it seems to me that anyone who could potentially answer my question would know how to put in the surrounding code. – bryn Jan 26 '11 at 10:23
  • 3
    @bryn. For a question where 'something doesn't work', a minimal example is usually a good idea as people have various ideas of 'standard' preambles. – Joseph Wright Jan 26 '11 at 10:52
  • 5
    @bryn: a lot of times this errors occur because of additional loaded packages. Many times the error disappears when the existing document is minimised. Also, the chance that people answer your question is much higher if people can just copy&paste your example and run it on their machines instead of having to code it by themselves. – Martin Scharrer Jan 26 '11 at 10:52
  • 4
    @bryn: The act of preparing a minimal example is an important step to pinpointing the error, and can often eliminate the need to ask a question. – Matthew Leingang Jan 26 '11 at 13:46

It seems like something's wrong in the implementation of the \pgfmathmin and \pgfmathmax commands.

In pgfmathfunctions.misc.code.tex (in the folder texlive/2010/texmf-dist/tex/generic/pgf/math), you can change the two occurrences of the line




Then the following code should work


\pgfmathmin{1,-3,5}{0,2} \pgfmathresult % This doesn't work without the fix

\pgfmathparse{min(1,-3,5,0,2)} \pgfmathresult % This does

  • 1
    Which version of PGF did you use here? There's been a new release on texlive in the past few days. I wonder if this bug has already been fixed. If not, consider sending the patch to the pgf-users mailing list. – Matthew Leingang Jan 26 '11 at 13:48
  • @Matthew Thanks for the pointer. The error is still present in the CVS version; I submitted the patch. – Jake Jan 26 '11 at 15:29

The problem occurs with pgf 2.00 cvs and now with pgf 2.1. The problem occurs also with pgfmathmax. The first version of pgfmathmin works with only 2 arguments. The best way is to avoid pgfmathmin and pgfmathmax actually and to use the new function and to write pgfmathparse{min(1,-3,5,0,2)} With pgfmathmin you use pgfmathparse indirectly.

Alain Matthes

  • 1
    "With pgfmathmin you use pgfmathparse indirectly." -- this is interesting. I assumed that pgfmathmin was a (faster) primitive operation, and that pgfmathparse would be slower since it needs to call pgfmathmin. – bryn Jan 26 '11 at 20:36
  • @bryn, someone might think so. But the code comments say that \pgfmathmin and \pgfmathmax are only defined for backwards compatibility. – Martin Scharrer Jan 27 '11 at 9:59

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.