0

I'm writing a math paper where I would like to give literature references next to theorems using marginnote or marginpar. Unfortunately, I can't seem to get them positioned in the right way (i.e. aligned with the title Theorem x.y) – no matter where I place my macro \mathreferences. Moreover, currently that macro also inserts where it is placed an additional new paragraph that I would like to get rid of without having to always comment out the blank line manually (without the macro, there is no new paragraph). How can I fix this? Any help would be much appreciated!

Here's an MWE:

\documentclass[12pt,a4paper]{memoir}

\usepackage{fontspec}
\usepackage{xunicode}
\usepackage{mathtools}
\usepackage{unicode-math}


\usepackage{amsthm}
\usepackage{thmtools}

\newcounter{mathcounter}
\numberwithin{mathcounter}{chapter}

\declaretheoremstyle[
  spaceabove=2em,
  spacebelow=2em,
  postheadspace=1em,
  headfont=\upshape\bfseries,
  notefont=\mdseries,
  notebraces={(}{)},
  bodyfont=\itshape,
]{mytheoremstyle}

\declaretheorem[
  name={Theorem},
  style=mytheoremstyle,
  numberlike=mathcounter
]{theorem}


\usepackage{xcolor}
\usepackage{marginnote}

\newcommand{\mathreferences}[1]{%
  \marginnote{%
    \footnotesize%
    \normalfont% no italic font, if we're using this inside a theorem
    \color{gray}
    \begin{flushleft}%
    % References: %
    #1%
    \end{flushleft}%
  }%
}


\usepackage{lipsum}
\begin{document}

\chapter{The chapter}
\section{The section}


\begin{theorem}
  \mathreferences{Give some references here}
  \label{foo}

  Let $(M^n, g)$ be a smooth Riemannian manifold, $Σ^{n-1} ⊂ M$ be a
  two-sided embedded hypersurface, possibly with boundary. Let $N$ be
  the – up to a sign unique – normal vector field of $Σ$. Then […]
\end{theorem}

\end{document}

UPDATE: Following the comments, I played around some more and have settled with the following definition of \mathreferences for the time being:

\renewcommand*{\raggedleftmarginnote}{\raggedrightmarginnote}

\newcommand{\mathreferences}[1]{%
  \marginnote{%
    \footnotesize%
    \normalfont% no italic font, if we're using this inside a theorem
    \color{gray}%
    #1%
  }%
}

Redefining \raggedleftmarginnote will always align content of the notes to the left, no matter whether they get displayed on the left or right margin in a double-sided document. (I previously used \begin{flushleft} …\end{flushleft} for this but, unfortunately, this is messing up the vertical positioning.

Unfortunately, I haven't been able to fix the issue with the blank lines, so I have resorted to always commenting out any blank lines following \mathreferences.

11
  • You are probably best of extending thmtools such that you can use \begin{theorem}[balu-note=....], though currently I do not know how to implement this. When adding it inside the body it is very tricky to get the placement right of the side note. If on the otherhand we can have it run a, say, \marginnote as a part of typesetting the header, then we are done.
    – daleif
    Feb 18, 2020 at 12:53
  • @daleif: Thank you for your comment! Can this possibly be done by passing a preheadhook={} to \declaretheoremstyle (or, alternatively, by calling \addtotheorempreheadhook)?
    – balu
    Feb 18, 2020 at 12:56
  • Since you probably don't want to have a list in the margin all the time, it probably needs to be a combination of adding a hook and then have it use data given by a key
    – daleif
    Feb 18, 2020 at 13:55
  • 1
    This adds a dlf=... key, but still causes a line break after the header \makeatletter \thmt@define@thmuse@key{dlf}{\addtotheorempostheadhook[local]{\marginnote{\llap{\rule{\paperwidth}{0.4pt}}test: {#1}}}} \makeatother
    – daleif
    Feb 18, 2020 at 14:13
  • Thank you, this looks actually quite good! Also, having played around with your solution for a bit I noticed that it's actually the \begin{flushleft} … \end{flushleft} in my macro that's causing the vertical (mis-)alignment. Without it, it already looks quite good.
    – balu
    Feb 18, 2020 at 15:49

0

You must log in to answer this question.

Browse other questions tagged .