# Problem with todonotes and onlyamsmath

I have document that use the todo from the todonotes package. Unfortunaly, I always get the following error message (everything works fine on my machine at work):

Package tikz Error: Sorry, some package has redefined the meaning of the matht cause unrecoverable errors. ...nn nach "explicit comp. schemes" angeben}

There seems to be clash with onlyamsmath.

Minimal working example:

\documentclass{article}

\usepackage{todonotes}
\usepackage[all, warning]{onlyamsmath}

\begin{document}

\todo{Blabla}

\end{document}

• I've got an idea: Please post the document (reduced to the minimum) that generates this error ;-)
– user31729
Oct 24, 2015 at 11:55
• @ChristianHupfer Yes, good idea ;). Oct 24, 2015 at 12:13

The onlyamsmath package (which personally I find useless), does

\AtBeginDocument{\catcode$=13 }  which is the cause of your troubles. The purpose of that declaration is to catch $$...$$, but this disrupts TikZ working. If you really want to use the package together with TikZ (which is implicitly loaded by todonotes), then you must give up recognizing usage of $$...$$: \documentclass{article} \usepackage[all, warning]{onlyamsmath} \AtBeginDocument{\catcode$=3 }
\usepackage{todonotes}

\begin{document}

\todo{Blabla}

\end{document}

• Just curious: why do you find onlyamsmath useless?
– Seub
Aug 29, 2020 at 12:28
• @Seub It offers nothing except some fragile hack to protect one from deprecated commands; it's easier to learn the correct ones. Aug 29, 2020 at 12:33

The incompatibility between the todonotes and onlyamsmath packages seems to have been fixed in v3.1.6a of the TikZ & PGF packages, available as of 2020/10/01. The ChangeLog file for PGF (also available on GitHub) notes the following on 2020-09-28:

- Revert "Added sanity check for the catcode of '\$' to avoid incompatibilities with onlyamsmath package"


Thus, if you are still experiencing the incompatibility, the solution is to update your packages and then all should be fine. It is no longer necessary to give up recognizing the use of $$...$$.