[Tex/LaTex] How to set single spacing in todonotes

errorsmacrossetspacetodonotes

Question

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:

\documentclass[12pt]{article}              
\usepackage{setspace}
\doublespacing
\usepackage[backgroundcolor=white,textsize=tiny]{todonotes}
\newcommand{\smalltodo}[2][] 
    {\todo
    {\begin{spacing}{0.5}#2\end{spacing}}} 
\begin{document}
\smalltodo[inline]{testing todonotes here with single spacing}
\end{document}

giving the following error:

Runaway argument?
{\todo  {\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} ?

Best Answer

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:

\makeatletter
\renewcommand{\todo}[2][]{%
    \@todo[caption={#2}, #1]{\begin{spacing}{0.5}#2\end{spacing}}%
} 
\makeatother