4

I'm attempting to use the todonotes package to make margin annotations connected to points in a text. In order to give more space for the annotations, I'd like to be able to increase the line spacing of the main text without increasing the spacing inside the notes. I've used setspace to set the line spacing, but placing an additional \setstretch command inside the \todo command has no effect at all.

\documentclass{article}

\usepackage{todonotes}

\usepackage{setspace}

\setstretch{1.7}

\begin{document}

This is a long text that goes onto two lines. \todo{\setstretch{1.0} This is a longish note about the text.} I'm not sure what else to put here because I need form and not content but form has to have content.

\end{document}

the result of the above code

How can I go about setting line spacing independently inside notes? Have I misunderstood something about setspace, or is there a different package I should be using, or something?

(I've seen the solution to this problem for fixme, but it involves a parameter which todonotes doesn't seem to have.)

3 Answers 3

8

You're missing \selectfont after \setstretch{1}.

In order to avoid having to type in \setstretch{1}\selectfont in every note, you can abuse the size key:

\documentclass{article}

\usepackage{todonotes}

\usepackage{setspace}

\setstretch{1.7}
\presetkeys{todonotes}{size=\setstretch{1}\selectfont}{}

\begin{document}

This is a long text that goes onto two
lines.\todo{This is a longish note about the text.}
I'm not sure what else to put here because I need
form and not content but form has to have content.

\end{document}

enter image description here

4
  • Wonderful, thank you! That solves the problem!
    – Sjiveru
    Commented Jul 18, 2018 at 23:10
  • 1
    If I do this, I get Undefined control sequence. \presetkeys and if I then load xkeyval package, then I get the error Package xkeyval Error: uniquename' undefined in families blx@opt@name'. .... What am I missing? I don't understand the error. xkeyval thinks I am misspelling uniquenames, but I am not spelling uniquenames at all. Should I open a new question about it do you happen to recognize what happened there?
    – thymaro
    Commented Sep 8, 2019 at 16:27
  • @thymaro This has to do with biblatex and appears to be unrelated to the present problem.
    – egreg
    Commented Sep 8, 2019 at 16:37
  • ah, ok, thx. I'll toss out xkeyval and \presetkeys then and leave the todo notes stretched as they are.
    – thymaro
    Commented Sep 8, 2019 at 17:21
0

To allow for single line spacing and so it works with my biblatex, I defined a new command as redefining it is a little more complex.

\newcommand{\note}[1]{\todo[]{\linespread{1}\footnotesize #1 \par}}
0

Another way out (adapted from an answer posted in 9-to-5-Science :


\documentclass{article}

\usepackage[color=blue!10, 
            linecolor=blue!60!gray,
            textsize=footnotesize]
           {todonotes}
\usepackage{setspace}

\setstretch{1.7}

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

\begin{document}

This is a long text that goes onto two lines.
\todo{This is a longish note about the text.}%
I'm not sure what else to put here because I need
form and not content but form has to have content.

\end{document}

Added a pinch of different colour and line-break aesthetics...
producing the following (presumably pleasing) output :

output-image

You must log in to answer this question.

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