1

I found that if you put a multi-line todo note underneath an itemize, I get an error. What could be the cause?

I am compiling with overleaf, using pdfLaTex

Error:

TeX capacity exceeded, sorry [input stack size=5000].

\par ->\@restorepar 
        \clubpenalty \@clubpenalty \everypar {}\par \@endpefalse 
l.13 inline}

MWE:

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{todonotes}

\begin{document}

\begin{itemize}
    \item item
\end{itemize}
\todo[inline]{Two line 

inline}

\end{document}
1
  • I adjusted your MWE so that it shows the error. As posted it had a blank line before the \todo which avoids the error (and is the simplest answer) May 30, 2021 at 15:35

1 Answer 1

2

The error occurs if the \todo follows immediately after the enviornment with no blank line (\par`) in between.

This modifies \todo so that if it detects latex's after display environment code (\if@endpe is true) it adds a \par automatically.

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage{todonotes}
\let\oldtodo\todo
\makeatletter
\renewcommand\todo{%
\if@endpe\par\fi
\oldtodo}
\makeatother

\begin{document}

\begin{itemize}
    \item item
\end{itemize}
\todo[inline]{Two line 

inline}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .