How can I \renewcommand{\todo} to give single spacing in the todonotes of an otherwise double spaced document?

What I have tried

The documentation (p. 11, section 1.8.6) suggests that something like this should work (with todonotes.sty in the proper directory), but it doesn't:

    {\todo[caption={#2}, #1]
\smalltodo[inline]{testing todonotes here with single spacing}

giving the following error:

Runaway argument?
{\todo [caption={##2}, ##1] {\begin {spacing}{0.5}##2\end {spacing}} \ETC.
! File ended while scanning use of \@xargdef.

But I can't figure out the error.

Once I get this to work, can I just replace \newcommand{\smalltodo} with \renewcommand{\todo} ?

  • Your example compiles fine on my system (both with TeX Live 2010 and 2009). What versions of todonotes and setspace are you using?
    – Caramdir
    Commented Jan 5, 2011 at 17:26
  • @Caramdir I was trying to compile the test case on LaTeXLab, I see that it does compile on my desktop installation, but am not sure how to tell what versions of the packages I am using. Commented Jan 5, 2011 at 17:54
  • on your desktop you can see the version in todonotes.sty (the optional argument to \ProvidesPackage at the top) for LaTeXLab I have no idea.
    – Caramdir
    Commented Jan 5, 2011 at 20:20
  • @Caramdir okay, this provides me with a date: \ProvidesPackage{todonotes}[2009/04/02], I was looking for a version number. Commented Jan 5, 2011 at 20:25
  • This is the same version I have installed and it works for me. Strange.
    – Caramdir
    Commented Jan 5, 2011 at 21:12

1 Answer 1


While I don't know why it doesn't compile for you, here is an answer to your second question:

No, you can't just use \renewcommend as that would create an infinite loop; every call to \todo would have another call to \todo inside it. However, \todo is actually just an alias for \@todo (apparently the author thought that people might want to redefine it), so you can simply do the following:

    \@todo[caption={#2}, #1]{\begin{spacing}{0.5}#2\end{spacing}}%
  • thanks for your help. What does \makeatletter, \makeatother do? Commented Jan 5, 2011 at 17:55
  • 3
    @David: per default, @ does not work in command names in the “end user” document, but only works in internal (class/package) files. The \makeatletter changes that and \makeatother resets it.
    – Caramdir
    Commented Jan 5, 2011 at 20:15
  • @Caramidir Thanks for your answer and explanation Commented Jan 5, 2011 at 20:17
  • @Caramdir I implemented this solution but when I insert a todo after a \newline command and a line break in Latex source code (so just at the beginning of a new paragraph) the line space between the previous and the new paragraph disappears. Any idea why is happening, and/or a workaround? Commented Nov 26, 2023 at 12:12

You must log in to answer this question.

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