[Tex/LaTex] Changing the baselineskip in marginpar

fontsizeline-spacingmarginpar

I’m adding explanations for definitions in the margin paragraph. I have a macro which looks as follows (simplified):

\newcommand*\define[2]{%
  \marginpar{{\sffamily\footnotesize\textbf{#1}: #2}}}

This works fine, but unfortunately it uses the baseline skip from the main text, which is of course much too large for the footnote-sized font.

So I tried changing the inter-line spacing, but to no avail. These are the two alternatives that I have tried:

  1. Using \fontsize instead of \footnotesize:

    \marginpar{{\sffamily\fontsize{8}{8}\selectfont\textbf{#1}: #2}}
    
  2. Setting \baselineskip:

    \marginpar{{%
      \sffamily\footnotesize%
      \setlength\baselineskip{1ex}%
      \textbf{#1}: #2}}
    

Neither variant works (and I’ve tried other values: the inter-line spacing won’t budge). So here’s my question:

How do I re-assign the baseline skip for margin paragraphs?

Best Answer

Add \par after #2. (No, I don't know why this works.)

EDIT: Or simply omit the additional set of braces in the macro definition.

\documentclass{article}

\newcommand*\defineA[2]{%
  \marginpar{{\sffamily\footnotesize\textbf{#1}: #2}}}

\newcommand*\defineB[2]{%
  \marginpar{{\sffamily\footnotesize\textbf{#1}: #2\par}}}

\newcommand*\defineC[2]{%
  \marginpar{\sffamily\footnotesize\textbf{#1}: #2}}

\usepackage{blindtext}

\begin{document}

Some text.\defineA{foo}{\blindtext} \blindtext

\clearpage

Some text.\defineB{foo}{\blindtext} \blindtext

\clearpage

Some text.\defineC{foo}{\blindtext} \blindtext

\end{document}
Related Question