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
.
\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.preheadhook={}
to\declaretheoremstyle
(or, alternatively, by calling\addtotheorempreheadhook
)?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
\begin{flushleft} … \end{flushleft}
in my macro that's causing the vertical (mis-)alignment. Without it, it already looks quite good.