# Change linespacing within marginnote

I am trying to change the linespacing within a marginnote such that it is different from the main document. I have tried all approaches described in Temporarily increase line spacing and Aligning margin note with line spacing different from main text, but none of them worked. Any ideas?

\documentclass{article}

\usepackage{setspace}
\usepackage{marginnote}
\begin{document}

\setstretch{1.25}

\renewcommand{\a}{One Two Three Four Five }

\newcommand{\newdef}[2][0]{\marginnote{{\setstretch{0.8}\emph{#2}}}[#1\baselineskip]}

\a\a\a\a\a\a\a\a\a\a\newdef{spanning multiple lines}
\a\a\a\a\a\a\a\a\a\a

\end{document}


Using

\newcommand{\newdef}[2][0]{\marginnote{{\setstretch{0.6}\emph{#2}\endgraf}}[#1\baselineskip]}

\a\a\a\a\a\a\a\a\a\a\newdef{spanning multiple lines; in this case even more than tree}
\a\a\a\a\a\a\a\a\a\a


I get

• the image in your edit (for which you show no source) is expected behaviour if you specify a baselineskip that is not large enough to fit in the letters, note the descender on the p. Why do you want to reduce baselineskip so much without reducing the font size? – David Carlisle Feb 19 '15 at 18:45

Delete a spurious {} group that is reverting the change before the end of the note:

\documentclass{article}

\usepackage{setspace}
\usepackage{marginnote}
\begin{document}

\setstretch{1.25}

\renewcommand{\a}{One Two Three Four Five }

\newcommand{\newdef}[2][0]{\marginnote{\setstretch{0.8}\emph{#2}}[#1\baselineskip]}

\a\a\a\a\a\a\a\a\a\a\newdef{spanning multiple lines}
\a\a\a\a\a\a\a\a\a\a

\end{document}

• Unfortunately, this did not help. The result is the same as in my updated question. – Florian Feb 19 '15 at 18:34
• @Florian in the original question the linespacing did not change and you asked how to change it for example by 0.8. this answers that exactly. If that is not what you want edit your question to state in words what you do want. – David Carlisle Feb 19 '15 at 18:37
• The problem is not about the linespacing value in itself, but about the fact that starting from the third line the linespacing seems not to be respected. I can understand that this was not clear. – Florian Feb 19 '15 at 18:39
• @Florian then make an example that has three lines, and ask about that (whatever that issue is it is unrelated to the original problem where the linespacing was not changed at all) – David Carlisle Feb 19 '15 at 18:41
• @Florian if you set text of the same size on a baseline reduced to 80% then there is no room for the larger letters so even spacing is impossible, that is unrelated to \marginpar – David Carlisle Feb 19 '15 at 18:43

Here I put it in a \parbox.

\documentclass{article}

\usepackage{setspace}
\usepackage{marginnote}
\begin{document}

\setstretch{1.25}

\renewcommand{\a}{One Two Three Four Five }

\newcommand{\newdef}[1]{\marginnote{\setstretch{.6}\parbox[t]{\marginparwidth}{\emph{#1}}}}

\a\a\a\a\a\a\a\a\a\a on this line\newdef{spanning multiple lines we can try this}
\a\a\a\a\a\a\a\a\a\a

\end{document}


• This is weird. While this solution seems to work for three lines, it does not work for four: i.imgur.com/Qm87gyC.png – Florian Feb 19 '15 at 18:43
• @Florian the number of lines is unrelated to your problem, it is just the position of ascenders and descenders in the text that you use. – David Carlisle Feb 19 '15 at 18:46
• I see, thank you. I was not aware that there is an interdependence between the linespacing and the font size. At least I would have expected that the lines 'overlay' equally. – Florian Feb 19 '15 at 18:50
• @Florian If you reduce the baselineskip by 0.8 you are specifying a 10pt font on a 9.6pt baseline, Tex can no maintain an even spacing given such a requirement. – David Carlisle Feb 19 '15 at 18:50
• @Mappi Use \raggedright, as in \newcommand{\newdef}[1]{\marginnote{\setstretch{.6}\parbox[t]{\marginparwidth}{\raggedright\emph{#1}}}}  – Steven B. Segletes Mar 7 at 14:43