### Update Oct 30th 2011

This has now been fixed in the CVS repository of PGF due to my bug report. With this version \usepackage{pgfmath} should work.

I would like to use pgfmath in one of my packages to do math, but don't like to load the whole pgf package just for that. I like to keep the used resources to a minimum. However a simple \usepackage{pgfmath} returns an error message that it doesn't know \pgfkeys. Loading also pgfkeys gives leaves me with the error message:

! Undefined control sequence.

l.1451 \pgfkeys{/pgf/number format/std}

Is it possible to load pgfmath without loading the whole pgf package? Also, any idea why the pgfmath package doesn't load all its dependencies itself? Is that by intention?

MWE:

\documentclass{article}

\usepackage{pgfkeys}
%\usepackage{???}% what extra pgfxxx package(s) is/are missing?
\usepackage{pgfmath}

\begin{document}
\pgfmathparse{1+1}
\pgfmathresult
\end{document}

I also reported this on the PGF/TikZ bug tracker. IMHO \usepackage{pgfmath} should load all required dependencies. The v2.10 PGF manual states in section 61.1 Loading the Mathematical Engine, that this is supposed to be the case, so this is indeed a bug!

-

\listfiles
\documentclass{article}

\usepackage{pgfkeys}
\input{pgfutil-common}
\input{pgfmath.code}

\begin{document}
\pgfmathparse{1+1}
\pgfmathresult
\end{document}
-
Thanks, that works! I now figured I could also load any package which loads pgfutil-common, e.g.: \usepackage{pgfrcs,pgfkeys,pgfmath}, but I like your solution better. –  Martin Scharrer Jul 11 '11 at 16:24
Ok, if then the pgf package is loaded afterwards all the math functions like add are installed again and cause an error :-( It's a pity that PGF doesn't check if the .code.tex files were already loaded. –  Martin Scharrer Jul 30 '11 at 22:59