### 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!

-
@LaRiFaRi: Just because its outdated doesn't mean it's off-topic. Why do you want to close a four year old question with an accepted answer, both with good up-votes? Just let it be as it is. It's a concluded question. Closing it doesn't improve anything. – Martin Scharrer Jul 20 '15 at 19:10
@LaRiFaRi: Also useful info for those who have not necessary updated from TeXLive2011. – Peter Grill Jul 20 '15 at 19:33
@MartinScharrer I retracted my close vote (I hope, I did). But to be honest, I think it improves quite a lot. Like now, the topic is "solved", but having it closed, it tells me "this is not the post you wanna read, if your system is up to date". Posts on fixed issues are very localized and not relevant for most users. But they are still browsable and therefore I voted to close, not to delete. However, your first block with the update is a nice feature which many of such posts do not provide. As you are a moderator, I would be interested in your opinion on how to handle this in general. – LaRiFaRi Jul 20 '15 at 22:12

\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