In a LaTeX document (using revtex-4.2 and todonotes) I run into issues with todo note related errors – which seem erratic and which I somehow cannot debug. The issue seems to be related to a certain number of todonotos, somewhere around 40, but here's the wider story:
Compiling the document with pdflatex (14159265-2.6-1.40.20, TeX Live 2019) I get the following error
./document.tex:441: Undefined control sequence.
<argument> ...tally@float \expandafter {\@captype
}
l.441 not?}
closer to the cation the Coulomb attraction grows and results ...
./document.tex:441: Missing \endcsname inserted.
<to be read again>
\ftype@
l.441 not?}
closer to the cation the Coulomb attraction grows and results ...
./document.tex:441: Extra \endcsname.
\tally@float ...ame ftype@#1\endcsname \endcsname
\@ifnotrelax \@tempa {\@if...l.441 not?}
closer to the cation the Coulomb attraction grows and results ...
Commenting out either the first or the second half to the text (or any good chunk of the document) this works without error as long as the overall number of todonotes is <~40. That is, no single todonote or any other code of the document causes the error as such, only in the sum the errors occur.
However, creating a minimal example I see that todonotes as such has no problem with 100 notes:
\pdfoutput=1
%\documentclass[galley]{revtex4-2}
\documentclass{article}
\usepackage[textsize=tiny]{todonotes}
\usepackage{forloop}
\begin{document}
\noindent Testing the number of todonotes without error \\
\newcounter{ct}
\forloop{ct}{1}{\value{ct} < 101}%
{%
\noindent testing \todo{Note \thect}note \thect. \par
}
\end{document}
If I choose the revtex4-2 document class instead of article in the example above, I get some other error (which I assume to be an revtex4-2 vs. forloop incompatibility)
./minimal.tex:13: Output loop---100 consecutive dead cycles.
<argument> ...do {Note \thect }note \thect . \par
\addtocounter {ct}{1}\forl...l.13 }
Now, is there a know issue here? What could be the actual problem with my original document? How could I go ahead and investigate this systematically?
Let me point out that I see this same behavior repeatedly when I add a significant numbers of todonotes to a revtex document.
revtex
nortodonotes
, but the “Undefined control sequence:\@captype
” error could happen as a result of using\caption
outside anyfigure
ortable
environment. As for theOutput loop---100 consecutive dead cycles
, this suggests that something is retaining contents, delaying its shipping out via the\output
routine. Maybe you need to add normal text to allow the retained material to find a place? (just a humble guess since I don't know these packages)\pdfoutput=1
?todonotes
but to the fact thattodonotes
uses\marginpar
internally, you get the same error with just\marginpar{test}
. I tend to use thefixme
package instead oftodonotes
. Fixme can be configured to use themarginnote
package and then does not rely on the\marginpar
command.pdfcnote
:-Olayout=marginnote
, also withinnerlayout=inline
/or similar does not really provide useful output – horizontal alignment does not work on all pages, notes overlap each other, etc... But that's for another day and question;-) fixme it is now:-)