6

I am trying to use the mnote package to write margin notes that I can conveniently hide with a single command (package option). Unfortunately, the notes have very odd (and wrong?) spacing when it comes to mathematical formulae and quantities with units (from the siunitx package).

Here is a MWE showcasing the issues:

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage[mnwidth=\marginparwidth,
sidenotes]{mnotes}

\usepackage{siunitx}

\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{beramono}
\usepackage{newpxtext}

\begin{document}

This paragraph is a test for the \texttt{mnote} package,\MNOTE{This is a note. Formulae displayed with \texttt{mnote} look rather odd: \[\int_a^b f(x)\,dx = F(b) - F(a).\] The spacing looks off in formulae such as $E=mc^2$ as well as numbers \SI{10}{\angstrom}.} which does not seem to play well with mathematical formulae:
\[
    \int_a^b f(x)\,dx = F(b) - F(a).
\]
$E = mc^2$ is an equation with the expected spacing. \textit{$E = mc^2$ is an equation within italic text}. \SI{10}{\angstrom} also has the expected spacing.

\end{document}

MWE

Is there a way to get the correct spacing (the same as in the main text) in margin notes created with mnote?

1 Answer 1

7

This has nothing to do with mnote other than the fact that it uses \tiny font size.

The “problem” is in the Euler fonts, that by precise choice use quite wide sidebearings in smaller sizes.

\documentclass[a4paper]{book}

\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{newpxtext}

\begin{document}

\[
    \int_a^b f(x)\,dx = F(b) - F(a).
\]

\tiny
\[
    \int_a^b f(x)\,dx = F(b) - F(a).
\]

\end{document}

enter image description here

You get a slightly better output with \scriptsize.

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage[
  mnwidth=\marginparwidth,
  sidenotes
]{mnotes}

\usepackage{siunitx}

\usepackage[euler-digits,euler-hat-accent]{eulervm}
\usepackage{beramono}
\usepackage{newpxtext}

\renewcommand{\MNFONT}{\scriptsize}

\begin{document}

This paragraph is a test for the \texttt{mnote} package,%
\MNOTE{This is a note. Formulae displayed with \texttt{mnote} 
  look rather odd: \[\int_a^b f(x)\,dx = F(b) - F(a).\] The 
  spacing looks off in formulae such as $E=mc^2$ as well as numbers \SI{1}{\nano\meter}.}
which does not seem to play well with mathematical formulae:
\[
    \int_a^b f(x)\,dx = F(b) - F(a).
\]
$E = mc^2$ is an equation with the expected spacing. 
\textit{$E = mc^2$ is an equation within italic text}. \SI{1}{\nano\meter} 
also has the expected spacing.

\end{document}

I fixed the \angstrom deprecated unit.

enter image description here

Alternatively, define a suitable math version in which the fonts are scaled from the 10pt size. I also added mode=text to siunitx in order to get Palatino for units.

\documentclass[a4paper]{book}

\usepackage{lipsum}
\usepackage[
  mnwidth=\marginparwidth,
  sidenotes
]{mnotes}

\usepackage[mode=text]{siunitx}

\usepackage[euler-digits,euler-hat-accent,small]{eulervm}
\usepackage{beramono}
\usepackage{newpxtext}

\DeclareFontFamily{U}{scaledzeur}{\skewchar \font =127}
\DeclareFontShape{U}{scaledzeur}{m}{n}{<-> zeurm10}{}
\DeclareFontFamily{U}{scaledzeus}{\skewchar \font =176}
\DeclareFontShape{U}{scaledzeus}{m}{n}{<-> zeusm10}{}
\DeclareMathVersion{scaledeuler}{}
\SetSymbolFont{letters}{scaledeuler}{U}{scaledzeur}{m}{n}
\SetSymbolFont{symbols}{scaledeuler}{U}{scaledzeus}{m}{n}


\renewcommand{\MNFONT}{\tiny\mathversion{scaledeuler}}

\begin{document}

This paragraph is a test for the \texttt{mnote} package,%
\MNOTE{This is a note. Formulae displayed with \texttt{mnote} 
  look rather odd: \[\int_a^b f(x)\,dx = F(b) - F(a).\] The 
  spacing looks off in formulae such as $E=mc^2$ as well as numbers \SI{1}{\nano\meter}.}
which does not seem to play well with mathematical formulae:
\[
    \int_a^b f(x)\,dx = F(b) - F(a).
\]
$E = mc^2$ is an equation with the expected spacing. 
\textit{$E = mc^2$ is an equation within italic text}. \SI{1}{\nano\meter} 
also has the expected spacing.

\end{document}

enter image description here

1
  • Thank you for the fantastic and detailed answer!
    – Pinco
    Sep 28 at 12:57

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.