[Tex/LaTex] getting the PGF Math Error: Unknown function `getargs’

tikz-pgf

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)

\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\pgfmathmin{1}{2} \pgfmathresult % This yields an error message about getargs
\end{document}

Best Answer

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

    \pgfmathparse{getargs(#1,#2)}%

to

    \pgfmathparse{#1,#2}%

Then the following code should work

\documentclass{minimal}
\usepackage{tikz}
\begin{document}

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

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

\end{document}
Related Question