[Tex/LaTex] Change linespacing within marginnote

line-spacingmarginnote

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}

enter image description here

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
enter image description here

Best Answer

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

enter image description here

\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}
Related Question