4

I am using the todonotes package and I wanted to add a note inside a caption like:

\caption{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.

Thanks.

2

3 Answers 3

4

As far as I know \todo does not work in a caption, but \todo[inline] will do, however, the remark text is not in the margin!

\documentclass{article}

\usepackage{todonotes}

\begin{document}

\begin{figure}
\caption{This is the section heading\todo[inline]{We should rethink the section title.}}
\end{figure}
\end{document}

enter image description here

5
  • I should have tried that first. Thanks. Not as good as having it at the margin, but it'll do for now.
    – ozsu
    Commented Feb 24, 2017 at 21:06
  • @ozsu: Well, or tex.stackexchange.com/users/586/torbj%c3%b8rn-t's solution with LuaLaTeX....
    – user31729
    Commented Feb 24, 2017 at 21:07
  • I now need to add a todo inside a section header -- can that be done? The method proposed by Christian Hupfer did not work.
    – ozsu
    Commented Feb 25, 2017 at 0:56
  • Actually, I thought that having this additional question here would be confusing, so I posted a separate question for this at tex.stackexchange.com/questions/355628/…
    – ozsu
    Commented Feb 25, 2017 at 1:10
  • The method does not work because you can't write the \todo code into the ToC, which would be the case for \section{foo \todo[inline]{some text}}
    – user31729
    Commented Feb 25, 2017 at 16:27
3

You can add a todo (not only todo[inline], but todo in margins) inside floating environments (like table, figure, etc). You just need to add the following patch:

\usepackage{marginnote}
\let\marginpar\marginnote

Source: the todonotes package manual http://tug.ctan.org/macros/latex/contrib/todonotes/todonotes.pdf section 1.6.9.

I have tested your code with this patch and it works correctly. Although 4 years have passed since this question was asked I post the solution here in case someone need it in the future, like myself today.

2

This may or may not be useful, but the luatodonotes package works in captions. It requires the use of lualatex for compiling the document though.

\documentclass{article}
\usepackage{luatodonotes}
\begin{document}
\begin{figure}
\caption{This is the section heading\todo{We should rethink the section title.}}
\end{figure}
\end{document}

enter image description here

1
  • Thanks. I can't move to luatex for this project, unfortunately.
    – ozsu
    Commented Feb 24, 2017 at 21:06

You must log in to answer this question.

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