1

Consider the code

\documentclass{article}
\usepackage{todonotes}
\begin{document}
%\todo{
\begin{tabular}{l}X\end{tabular}
  %}
\end{document}

I want the contents of the table (above: X), to be inside \todo, whether inlined or not. This feature would be useful, e.g., for putting matrices into todo boxes, of course, with arrays in math mode. However, pdflatex complains when I remove the comment symbols %. What to do?

  • 1
    The argument to \todo is a “moving” one; \begin and \end need to be prefixed by \protect. – egreg May 07 '17 at 22:19

1 Answers1

2

See What is the difference between Fragile and Robust commands?

The argument of \todo is written in the .aux file because it is used for the “list of todos”, so it is a moving argument in which fragile commands need to be prefixed by \protect; \begin and \end are the prototypes of fragile commands.

\documentclass{article}
\usepackage{todonotes}

\begin{document}

\todo{%
  \protect\begin{tabular}{l}X\protect\end{tabular}%
}

\end{document}
egreg
  • 1,121,712