7

I'm using the changes package for comments. Is it possible to get the comments to be single-spaced, even if the document itself is double-spaced?

MWE:

\documentclass{article}
\usepackage{changes}
\usepackage{lipsum}

\linespread{2}

\begin{document}

\lipsum[1-1][1-3]\comment{I would like this comment to be single-spaced.} \lipsum[1-1][4-6]

\end{document}

Output:

enter image description here

1
  • BTW, \comment is also used by other packages (defined differently). – John Kormylo May 13 '19 at 3:58
5

Quite likely you want all of your margin notes to be single spaced.

\documentclass{article}
\usepackage{changes,etoolbox}

\usepackage{lipsum}

\makeatletter
\preto\@marginparreset{\linespread{1}}
\makeatother

\linespread{2}

\begin{document}

\lipsum[1-1][1-3]\comment{I would like this comment to be single-spaced.}
\lipsum[1-1][4-6]

\end{document}

enter image description here

Explanation: \@marginparreset is the hook that the LaTeX kernel provides for doing initializations before starting to typeset a margin paragraph (internally used by the changes package).

1
4

Using this answer I tried

\documentclass{article}
\usepackage{changes}
\usepackage{lipsum}
\linespread{2}

\begin{document}
\lipsum[1-1][1-3]\renewcommand*{\baselinestretch}{1}\comment{\selectfont  
I would like this comment to be single-spaced.} 
\lipsum[1-1][4-6]

\end{document}

enter image description here

which seems to work. If you decide this is the way to go, then obviously one may make it more automatic and safer by patching this into \comment. You could just look up its definition from changes.sty and redefine it as follows:

\documentclass{article}
\usepackage{changes}
\usepackage{lipsum}
\linespread{2}
\makeatletter
\renewcommand*{\comment}[2][\@empty]{%
\edef\oldbaselinestretch{\baselinestretch}%
\typeout{\oldbaselinestretch}%
\renewcommand*{\baselinestretch}{1}%
\setkeys{Changes@comment}{#1}%
\Changes@output%
{comment}%
{\Changes@comment@id}%
{}%
{}%
{\selectfont #2}%
{\changescommentname}%
{\selectfont #2}%
\renewcommand*{\baselinestretch}{\oldbaselinestretch}%
}
\makeatother
\begin{document}
\lipsum[1-1][1-3]\comment{I would like this comment to be single-spaced.} 
\lipsum[1-1][4-6]

\selectfont
\lipsum[1-1]

\end{document}
2
  • Clever! I was trying to fix \baselineskip, which has to be done before the paragraph starts. I found only one \marginpar in the changes source, but patching it didn't do anything. – John Kormylo May 13 '19 at 4:00
  • @JohnKormylo Thanks! All I did was to look up Ulrike's answer and use the information there. – user121799 May 13 '19 at 4:01

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.