I am using the todonotes
package and I wanted to add a note inside a section title like:
\section{This is the section heading\todo{We should rethink the section title.}}
However, this is throwing the “Not in outer par mode” error. I understand why, but I wonder if there is a way to do this.
I had previously asked about putting todo inside a caption, and the proposed solution of \todo[inline]{...}
works in that case, but not inside \section{...}
EDIT: After some help, I realized that the error is in the generation of the table of contents. Here is a MWP:
\documentclass{book}
\usepackage{todonotes}
\long\def\intodo#1{\todo[inline]{#1}}
\begin{document}
\tableofcontents
\chapter{Chapter 1}
\section{Another Section Name \intodo{We should rethink the section title for this as well.}}
\end{document}
The error that I get is:
./test.toc:2: Leaders not followed by proper glue.
<to be read again>
\hfill
l.2 ...e]{We should rethink the section title}}{3}
\documentclass{article} \usepackage{todonotes} \begin{document} \section{This is the section heading\todo{We should rethink the section title.}} bla \end{document}
inline
option works for me, please see my answer.\todo
command in the\section
macros etc. unless it is not written to the ToC.