# Conflict between program and todonotes package

I want to add some pseudo-like code to my document using the program package, but when I add the package to my document, I get the following errors. I found out the problem being caused by a conflict between the package todonotes and program. Here is a minimum (non) working example, to reproduce my issue. My question: Is there any possibility to solve this issue (which means, I would like to keep both packages, as I currently use the todonotes heavily in my document).

\documentclass{scrbook}
\usepackage{program}
\usepackage[textsize=footnotesize]{todonotes}
\begin{document}
Hello world!
\end{document}


The errors I get:

There were errors in your LaTeX source

/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or}        {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or}        {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or}        {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or}        {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/math/pgfmathparser.code.tex:673: Missing \endcsname inserted. [...eoperator{||}{or}        {2}{infix} {200}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:15: No room for a new \dimen . [\newdimen\pgf@pt@x]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:16: No room for a new \dimen . [\newdimen\pgf@pt@y]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex:18: No room for a new \dimen . [\newdimen\pgf@pt@temp]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Extra \endcsname. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Extra \else. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Missing \endcsname inserted. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex:562: Package pgf Error: Arrow end type \relax \@dovar\hbox {}'' already defined. [}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex:15: No room for a new \dimen . [\newdimen\pgf@max]
/usr/local/texlive/2012/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty:466: No room for a new \dimen . [\newdimen\pgf@nodesepstart]
/usr/local/texlive/2012/texmf-dist/tex/latex/pgf/compatibility/pgfcomp-version-0-65.sty:467: No room for a new \dimen . [\newdimen\pgf@nodesepend]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex:13: No room for a new \dimen . [\newdimen\pgffor@iter]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/utilities/pgffor.code.tex:14: No room for a new \dimen . [\newdimen\pgffor@skip]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/libraries/pgflibraryplothandlers.code.tex:872: No room for a new \dimen . [\newdimen\pgfplotmarksize]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:17: No room for a new \dimen . [\newdimen\tikz@lastx]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:18: No room for a new \dimen . [\newdimen\tikz@lasty]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:19: No room for a new \dimen . [\newdimen\tikz@lastxsaved]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:20: No room for a new \dimen . [\newdimen\tikz@lastysaved]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:22: No room for a new \dimen . [\newdimen\tikzleveldistance]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:23: No room for a new \dimen . [\newdimen\tikzsiblingdistance]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: LaTeX Error: Missing \begin{document}. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Extra \endcsname. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Extra \else. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Use of \csname doesn't match its definition. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing control sequence inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Argument of \next has an extra }. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Paragraph ended before \next was complete. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Package pgf Error: Arrow end type tikz@>\endgroup \let \par . [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: Missing \endcsname inserted. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/generic/pgf/frontendlayer/tikz/tikz.code.tex:885: LaTeX Error: Variable name ended by end of line.. [\tikz@set@pointed{\pgf@arrows@invertto}{to}]
/usr/local/texlive/2012/texmf-dist/tex/latex/tools/calc.sty:54: No room for a new \dimen . [\newdimen\calc@Adimen]
/usr/local/texlive/2012/texmf-dist/tex/latex/tools/calc.sty:54: No room for a new \dimen . [\newdimen\calc@Adimen   \newdimen\calc@Bdimen]
/usr/local/texlive/2012/texmf-dist/tex/latex/subfigure/subfigure.sty:97: No room for a new \dimen . [\newdimen\subfigcaptopadj]
/usr/local/texlive/2012/texmf-dist/tex/latex/subfigure/subfigure.sty:99: No room for a new \dimen . [\newdimen\subfigcapmargin]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Undefined control sequence. [\include{Header}]
./Document.tex:1: Extra \else. [\include{Header}]

• Welcome to TeX.SX! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. When you have time, please have a look at our page for starters – egreg Jul 9 '13 at 9:13
• Thank you, egreg and apologies for not having considered the starter page in advance. Using the MWE, I was able to track back the problem on a package conflict. I will edit my question accordingly. – qqilihq Jul 9 '13 at 9:27
• The first measure should be changing the loading order: first todonotes, then program. The "No room for a new" errors can be cured by \usepackage{etex} just after the \documentclass line. – egreg Jul 9 '13 at 9:33
• Yes; changing the package order solved the issue. Superb, thank you! – qqilihq Jul 9 '13 at 9:35

A first measure when adding a package produces errors is to change the loading order; the present problem is due to some internal shuffling program does with “category codes” that confuse todonotes or, more properly, the TikZ engine it uses.

So

\documentclass{scrbook}

\usepackage[textsize=footnotesize]{todonotes}
\usepackage{program}

\begin{document}
Hello world!
\end{document}


should be the solution.

From the error messages you report, there seems to be another problem; program makes intensive usage of internal registers and TikZ is quite hungry for them too, so other packages may cause overflowing the available number of registers. Just add \usepackage{etex} (see No room for a new \dimen); below I simulate a “real world” situation with <other packages> to remark that etex should be loaded as soon as possible.

\documentclass{scrbook}
\usepackage{etex}

<other packages>

\usepackage[textsize=footnotesize]{todonotes}
\usepackage{program}

<other packages>

\begin{document}
Hello world!
\end{document}