# hyperref conflicts with todonotes and chemfig packages

I'm using TexLive 2012 from the openSUSE buildservice publishing repository, and a document that would compile with TeXLive 2011 now effects error messages such as:

Package PGF Math Error: The function add' already exists.

Package PGF Math Error: The function subtract' already exists.

and so on.

This is caused by todonotes and chemfig, since both load tikz. Is there a way to resolve this conflict?

An example, as requested:

\documentclass[a4paper]{scrbook}
\usepackage{hyperref}
\usepackage{todonotes}
\begin{document}
test
\end{document}


The relevant excerpt of the log from texlive 2011:

(/usr/share/texmf/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty
Package: pgfcomp-version-1-18 2007/07/23 v2.10 (rcs-revision 1.1)
))
(/usr/share/texmf/tex/latex/pgf/utilities/pgffor.sty
(/usr/share/texmf/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex))
(/usr/share/texmf/tex/generic/pgf/utilities/pgffor.code.tex
Package: pgffor 2010/03/23 v2.10 (rcs-revision 1.18)


and that of the log from texlive 2012:

(/usr/share/texmf/tex/latex/pgf/compatibility/pgfcomp-version-1-18.sty
Package: pgfcomp-version-1-18 2007/07/23 v2.10 (rcs-revision 1.1)
))
(/usr/share/texmf/tex/latex/pgf/utilities/pgffor.sty
(/usr/share/texmf/tex/latex/pgf/utilities/pgfkeys.sty
(/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex))
(/usr/share/texmf/tex/latex/pgf/math/pgfmath.sty
(/usr/share/texmf/tex/generic/pgf/math/pgfmath.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathcalc.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathutil.code.tex)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathparser.code.tex
\pgfmath@dimen=\dimen142
\pgfmath@count=\count113
\pgfmath@box=\box35
\pgfmath@toks=\toks24
\pgfmath@stack@operand=\toks25
\pgfmath@stack@operation=\toks26
)
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.code.tex
(/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. –  egreg Sep 16 '12 at 20:23
Thanks, example added. –  auxsvr Sep 16 '12 at 20:35
'Works for me'. Perhaps you could add \listfiles to your example and report what file list you get: I suspect a version conflict with a locally-installed version of one or more files. –  Joseph Wright Sep 16 '12 at 20:41
Unfortunately the example doesn't produce any error even if I add \usepackage{chemfig}. –  egreg Sep 16 '12 at 20:43
I tried the given MWE with several sequences of todonotes, hyperref and chemfig without any error or warning on MiKTeX 2.9. Please update your MWE to reproduce the mentioned errors (more packages loaded? Own definitions used?) –  Kurt Sep 16 '12 at 21:11

\RequirePackage{pgfmath}

in tex/latex/pgf/utilities/pgffor.sty. If I comment it out, then everything works fine. Here is the bug report for this.