我曾经看过一本书(Reinhard Diestel 的《图论》),作者在书页的左侧/右侧标记了后面将应用该定理的定理的参考编号。真正的双向交叉引用!
我认为这是自动完成的,但是如何完成呢?我从未见过这样的包。
以下是屏幕截图:
答案1
更新 2
refprop
在此更新中,我消除了需要引用时需要使用另一个环境的缺陷。现在,您可以使用原始定理环境( prop
)作为\begin{prop}[<specification>][<label>]
(参见下面的代码)。解决方案必须由触发\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}
更新 1
我稍微修改了之前的方法。现在的解决方案可以做到:
\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}
评论
下一步是将其应用于给定的一组定理环境。对于该任务,可以编写包装器。但这不是答案的范围。
原始解决方案
尽管这\vskip
有点困扰我,因为它是任意的,但这可能会起作用:
\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}
答案2
这是我的“廉价 Diestel”答案,因为我的解决方案只是将所有边距文本放在右侧,而不是检查页面是否应该放在左侧/右侧。对我来说,这已经足够好了,因为我不会打印出我的文档。
我的诀窍是简单地使用marginpar
。关键的代码行是:
\newcommand{\margin}[1]{\marginpar{\flushright \textcolor{blue}{\small{#1}}}}
。
最小工作示例:
\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}
输出结果如下:
请注意,您还需要该hyperref
包来使引用也可点击。
我尽可能地模仿 Diestel,因此如果一切设置正确,方括号中的参考文献应该是可点击的,并引导您找到正确的定理,就像正常引用一样。
当然,您可以在\newcommand{\margin}[1]{\marginpar{\flushright \textcolor{blue}{\small{#1}}}}
命令中更改颜色、大小或字体系列。
不幸的是,我无法自动完成此操作。