![使用特定定理列出所有定理](https://linux22.com/image/348795/%E4%BD%BF%E7%94%A8%E7%89%B9%E5%AE%9A%E5%AE%9A%E7%90%86%E5%88%97%E5%87%BA%E6%89%80%E6%9C%89%E5%AE%9A%E7%90%86.png)
我有一份包含多个语句(我指的是定理/引理/命题环境等)的文档,我想列出给定语句 A 的所有引用 A 的语句,因此如果您愿意的话,可以列出依赖关系列表。这可能吗?
答案1
试试这个,答案取自@Gonzalo 的回复ToC 类似定义列表(使用定理环境)
您可能对使用 thmtools 等的其他解决方案感兴趣。
\documentclass{book}
\usepackage{amsthm}
\usepackage{etoolbox}
\usepackage{xcolor}
\usepackage{framed}
\colorlet{shadecolor}{lightgray!25}
\newtheoremstyle{definitionsty}{3pt}{3pt}{\slshape}{}{\bfseries}{.}{.5em}{\addcontentsline{lod}{section}{#1~\protect\numberline{#2}{#3}}}
\theoremstyle{definitionsty}
\newtheorem{tdefn}{Definition}[chapter]
\newenvironment{defn}
{\begin{shaded}\begin{tdefn}}
{\end{tdefn}\end{shaded}}
\makeatletter
% A command to create the new List of Definitions
\newcommand\listofdefinitions{%
\chapter*{List Of Definitions}\@starttoc{lod}}
% initial definitions to save the chapter info (name and number)
\def\thischaptertitle{}
\def\thischapternumber{}
\newtoggle{noDefs}
\apptocmd{\@chapter}%
{\gdef\thischaptertitle{#1}\gdef\thischapternumber{\thechapter}%
\global\toggletrue{noDefs}}{}{}
% the defn environment does the job: the first time it is used after a \chapter command,
% it writes the information of the chapter to the LoD
\AtBeginDocument{%
\AtBeginEnvironment{defn}{%
\iftoggle{noDefs}{
\addcontentsline{lod}{chapter}{\chaptername~\thischapternumber\hspace{1em}\thischaptertitle}{}
\global\togglefalse{noDefs}
}{}
}%
}
\makeatother
\begin{document}
\listofdefinitions
\chapter{Test Chapter With Definitions}
\begin{defn}[My Hilarious Thing]
Definition 1.2 - Another Super Duper Thingy
Test
\end{defn}
\begin{defn}[A Super Duper Thingy]
Test
\end{defn}
\chapter{Test Chapter Without Definitions}
\chapter{Another Test Chapter With Definitions}
\begin{defn}[Another Super Duper Thingy]
Test
\end{defn}
\begin{defn}
Test
\end{defn}
\end{document}
答案2
类似的方法index
目前还很有限。它将打印定理编号和引用它的其他环境的列表。
\documentclass{article}
\usepackage{amsthm}
\usepackage{imakeidx}
\usepackage{hyperref}
\usepackage[hyperref,user,counter]{zref}
\usepackage{blindtext}
\makeindex[name=theoref,title={List of Theorem References},options=-s theoref.ist]
\begin{filecontents}{theoref.ist}
delim_0 "\n \\dotfill "
page_precedence "nrRAa"
page_compositor "."
\end{filecontents}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}{Lemma}[section]
\makeatletter
\newcommand{\indexref}[2][Theorem]{%
\zref@ifrefundefined{#2}{}{%
\hyperlink{\zref@extract{#2}{anchor}}{\zref@extract{#2}{default}}%
\imki@wrindexentry{theoref}{#1 \csname the\@currenvir\endcsname|hyperlink{\zref@extract{#2}{anchor}}}{\zref@extract{#2}{default}}%
}%
}
\makeatother
\begin{document}
\section{First}
\begin{theorem}{Theorem Number A}
\blindtext[2] \zlabel{theo::A}
\end{theorem}
\begin{theorem}{Theorem Number B}
We will use \indexref{theo::A} and \indexref{theo::C} in order to proof this theorem, as well as \indexref[Lemma]{lem::Llama}!\zlabel{theo::B}
\end{theorem}
\begin{theorem}{Theorem Number C}
We will use \indexref{theo::A}, \indexref{theo::B} in order to proof this theorem!\zlabel{theo::C}
\blindtext[3]
\end{theorem}
\begin{lemma}{Lemma for Llama}
\blindtext\zlabel{lem::Llama}
\end{lemma}
\printindex[theoref]
\end{document}