1

I'm trying to have doublespacing in my main text and singlespacing (and footnotesize) in a marginpar. However, if I change the line spacing in the marginpar it seems to shift down. Is there a way to get it to align properly again?

Example:

\documentclass[A4]{article}

\newcommand*{\anchor}[1]{The #1 {\it marginpar} should appear aligned to the very top of this paragraph.}

\newcommand*{\thoreau}{A man is rich in proportion to the number of things he can afford to let alone.}

\newcommand*{\sep}{%
    \vspace{-1em}
    \noindent\makebox[\linewidth]{\rule{\paperwidth}{0.4pt}}
    \vspace{-2.5em}
}

\usepackage{lipsum}
\usepackage{setspace}

\newcommand{\mymarparA}[1]{%
    \marginpar{{\footnotesize #1 (A)\par}}
}

\newcommand{\mymarparB}[1]{%
    \marginpar{{\footnotesize\singlespacing #1 (B)\par}}
}

\newcommand{\mymarparC}[1]{%
    \marginpar{\footnotesize\singlespacing #1 (C)}
}

\begin{document}

\doublespacing

\sep

\anchor{\mymarparA{\thoreau}} \lipsum[2]

\sep

\anchor{\mymarparB{\thoreau}} \lipsum[2]

\sep

\anchor{\mymarparC{\thoreau}} \lipsum[2]

\sep

\end{document}

I have an extra {... \par} in \mymarparA and \mymarparB because I'm actually modifying a different style where I'd have to rewrite some stuff I'd rather not touch to get rid of the need for that. If it can be realigned in the \mymarparB case that would be ideal, but if it only works in the \mymarparC case that'd be a start already and I could potentially rewrite the other stuff to make it work.

Rendering of my example

1

After some time tinkering with various types of boxes, it seems that when line spacing is changed in a parbox or a marginpar, it drops by the height of 0.5 and 1 baselineskip, respectively. (Not sure why in parbox it only drops 0.5\baselineskip, and I've not tested whether this is sensitive to \baselinestretch or font size.)

So, a way to make it align again is to lift everything by 0.5 or 1 baselineskip, depending on situation:

\newcommand{\mymarparB}[1]{%
    \marginpar{{\footnotesize\vspace{-\baselineskip}\singlespacing #1 (B)\par}}
}

\newcommand{\mymarparC}[1]{%
    \marginpar{\footnotesize\vspace{-\baselineskip}\singlespacing #1 (C)}
}

Rendering of the example above

When modifying classicthesis I found I need 1.65\baselineskip, even more mysterious and hacky, but it works.

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.