# Where will a theorem be used?

I have once seen a book (Graph Theory by Reinhard Diestel) where the author flags his theorems by adding on the left/right of the page the reference number of later theorems where said theorem will be applied. A truly bidirectional cross-reference!

I assume this is done automatically, but how? I have never seen a package for this.

Here is a screenshot:

-
Welcome to TeX.sx! Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. – Kurt Mar 11 '13 at 0:28
I'm not aware of a package that does it for you. Have you thought of asking the author. – Marc van Dongen Mar 11 '13 at 4:54
See tex.stackexchange.com/q/37918/15925 and tex.stackexchange.com/q/14981/15925 for implementations of related types of back referencing. – Andrew Swann Mar 11 '13 at 8:11
@Delio If you have found a solution, would you like to share it here? – egreg Apr 21 '13 at 22:28
This feature clearly deserves a package. – TonioElGringo Apr 27 '13 at 13:01

## Update 2

In this update I eliminated the blemish that there is another environment refprop to use when a reference is needed. Now, you can use the originary theorem environment (prop) as \begin{prop}[<specification>][<label>] (see the code below). The solution has to be triggered by \RefthmPatch{<list of your thm-envs>}

\documentclass{book}
\usepackage[margin=3cm,marginparwidth=2cm]{geometry}
\usepackage{lipsum}
\usepackage{marginnote}
\usepackage{etoolbox}
\usepackage{twoopt}
\usepackage{amsthm}
\newtheorem{prop}{Proposition}[section]
% \newtheorem{thm}{Theorem}[section]
% \newtheorem{lem}{Lemma}[section]

\makeatletter
\newcommand{\do@patch@refthm}[1]{%
\expandafter\let\csname svd@#1\expandafter\endcsname\csname #1\endcsname
\expandafter\renewcommandtwoopt\csname #1\endcsname[2][][]{%
\csname svd@#1\endcsname[##1]
\if\relax\detokenize{##2}\relax\else
\marginnote{\centering\normalfont\lbrack\ref{##2}\rbrack}\fi}}
\def\@patch@refthm@list{}
\newcommand{\RefthmPatch}[1]{\gdef\@patch@refthm@list{#1}}
\AtBeginDocument{%
\let\do=\do@patch@refthm
\expandafter\docsvlist\expandafter{\@patch@refthm@list}}
\makeatother

\RefthmPatch{prop}
%If you use more theorems:
%\RefthmPatch{thm,prop,lem}

\begin{document}
%%%%%%%%%%%%%%%%%%%%
\makeatletter
\c@chapter=1
\c@section=9
\c@prop=2
\makeatother
%%%%%%%%%%%%%%%%%%%%
\mbox{}
\clearpage
\lipsum[1-4]
\begin{prop}[][somethm:1]
Together with $\emptyset$ the cuts in $G$ from a subspace $\mathcal{C}^*$ of $\mathcal{E}(G)$. This space is generated by cuts of the form $E(v)$.
\end{prop}
\lipsum[5-8]
...
%%%%%%%%%%%%%%%%%%%%
\makeatletter
\c@chapter=4
\c@section=6
\c@prop=2
\makeatother
%%%%%%%%%%%%%%%%%%%%
\begin{prop}\label{somethm:1}
A Theorem in which a certain theorem is used.
\end{prop}
\end{document}


## Update 1

I slightly modified my previous approach. Now the solution does, what it is supposed to:

\documentclass{book}
\usepackage[margin=3cm,marginparwidth=2cm]{geometry}
\usepackage{lipsum}
\usepackage{marginnote}
\usepackage{amsthm}

\newtheorem{prop}{Proposition}[section]

\newenvironment{refprop}[1]
{\begin{prop}\marginnote{\centering\normalfont\lbrack\ref{#1}\rbrack}}
{\end{prop}}

\begin{document}
%%%%%%%%%%%%%%%%%%%%
\makeatletter
\c@chapter=1
\c@section=9
\c@prop=2
\makeatother
%%%%%%%%%%%%%%%%%%%%
\mbox{}
\clearpage
\lipsum[1-4]
\begin{refprop}{somethm:1}
Together with $\emptyset$ the cuts in $G$ from a subspace $\mathcal{C}^*$ of $\mathcal{E}(G)$. This space is generated by cuts of the form $E(v)$.
\end{refprop}
\lipsum[5-8]
...
%%%%%%%%%%%%%%%%%%%%
\makeatletter
\c@chapter=4
\c@section=6
\c@prop=2
\makeatother
%%%%%%%%%%%%%%%%%%%%
\begin{prop}\label{somethm:1}
A Theorem in which a certain theorem is used.
\end{prop}
\end{document}


### Remark

The next step would be to apply this to a given set of theorem environments. For that task a wrapper could be written. But this is not the scope of the answer.

## Original Solution

Allthough the \vskip is disturbing me a little, because it is arbitrary, this could work:

\reversemarginpar

\newenvironment{refthm}[1]
{\marginpar[\centering\vskip3mm\lbrack\ref{#1}\rbrack]{}\begin{somethmenv}}
{\end{somethmenv}}

\begin{refthm}{somethm:1}
A theorem which will be applied in a later theorem with the label somethm:1.
\end{refthm}

...

\begin{someotherthmenv}\label{somethm:1}
A Theorem in which a certain theorem is used.
\end{someotherthmenv}

-