1

I'm using the memoir class, and I'd like to add a shaded background to my sidenotes. My solution, however, doesn't work: the baseline of the sidenote text and the body text no longer align, as illustrated by my MWE:

\documentclass{memoir}
\usepackage{xcolor}
\definecolor{shadecolor}{gray}{0.9}

\begin{document}
Lorem
\sidepar[\textit{Note.}]{}
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris.

Lorem
\sidepar[\begin{snugshade} \textit{Note.} \end{snugshade}]{}
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris.

\end{document}

enter image description here

I understand that there may be solutions provided by other packages, but I'd also like to understand why the position of the note shifts.

  • What about \sidepar[\colorbox{shadecolor}{\textit{Note.}}]{}? – Werner Aug 27 '18 at 23:20
  • @Werner Well, that was easy! What a nice, simple solution. Thanks. – Derek Aug 27 '18 at 23:26
1

If you just want a coloured box inside your \sidepar, then you can use \colorbox{shadecolor}{<stuff>}:

enter image description here

\documentclass{memoir}

\usepackage{xcolor}
\definecolor{shadecolor}{gray}{0.9}

\begin{document}
Lorem
\sidepar[\textit{Note.}]{}
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris.

Lorem
\sidepar[\begin{snugshade} \textit{Note.} \end{snugshade}]{}
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris.

Lorem
\sidepar[\colorbox{shadecolor}{\textit{Note.}}]{}
ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum
gravida mauris.

\end{document}

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.