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 Jan 5 '11 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. – David LeBauer Jan 5 '11 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 Jan 5 '11 at 20:20
  • @Caramdir okay, this provides me with a date: \ProvidesPackage{todonotes}[2009/04/02], I was looking for a version number. – David LeBauer Jan 5 '11 at 20:25
  • This is the same version I have installed and it works for me. Strange. – Caramdir Jan 5 '11 at 21:12

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? – David LeBauer Jan 5 '11 at 17:55
  • 2
    @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 Jan 5 '11 at 20:15
  • @Caramidir Thanks for your answer and explanation – David LeBauer Jan 5 '11 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.