This is my "budget Diestel" answer, because my solution simply puts all the margin text to the right, instead of checking if the page is meant to be on the left/right side. For me, this works well enough because I don't print out my documents.
My trick is to simply use marginpar
. The critical line of code is:
\newcommand{\margin}[1]{\marginpar{\flushright \textcolor{blue}{\small{#1}}}}
.
Minimal working example:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm}
\usepackage[]{geometry}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\usepackage[colorlinks=true,
linkcolor=blue,
citecolor=blue,
allcolors=blue]{hyperref}
\newcommand{\margin}[1]{\marginpar{\flushright \textcolor{blue}{\small{#1}}}}
\begin{document}
\begin{theorem}[Hall's] \label{theorem1}
Let $G = (A, B)$ be a bipartite graph.
Then $G$ has a matching \margin{bipartite} if and only if
$|N_G(S)| \geq |S|$ for all $S \subseteq A$ \margin{$N_G(S)$}.
\end{theorem}
\begin{theorem}[Tutte's] \label{theorem2}
Let $G$ be a graph.
Then $G$ has a matching if and only if $q(G-S) \leq |S|$
for all $S \subseteq V(G)$. \margin{$q$, [\ref{theorem3}]}
\end{theorem}
This is a strengthening of Theorem \ref{theorem1}.
\begin{theorem}[Gallai-Edmonds] \label{theorem3}
Every \margin{[\ref{theorem2}]} graph $G$ contains
$S \subseteq V(G)$ with the following two properties:
\begin{enumerate}
\item $S$ is matchable to $G-S$, \margin{matchable}
\item Every component of $G-S$ is
factor critical. \margin{factor
critical}
\end{enumerate}
Given $S$ satisfying the following two properties,
$G$ contains a $1$-factor if and only if
$|S| = |\mathcal{C}_{G-S}|$. \margin{$\mathcal{C}_{G-S}$}
\end{theorem}
\end{document}
Which produces the following output:
Note that you need the hyperref
package to make the references clickable as well.
I've tried to imitate Diestel as much as possible, so if everything is set up properly, the references in the square brackets should be clickable and direct you to the correct theorem, much like how normal referencing should.
Of course, you can change the colour, size, or font family in the \newcommand{\margin}[1]{\marginpar{\flushright \textcolor{blue}{\small{#1}}}}
command.
Unfortunately, I wasn't able to do this automatically.