![在附录中自动生成定义列表(用户定义定理环境)](https://linux22.com/image/303124/%E5%9C%A8%E9%99%84%E5%BD%95%E4%B8%AD%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E5%AE%9A%E4%B9%89%E5%88%97%E8%A1%A8%EF%BC%88%E7%94%A8%E6%88%B7%E5%AE%9A%E4%B9%89%E5%AE%9A%E7%90%86%E7%8E%AF%E5%A2%83%EF%BC%89.png)
在下面的代码中,我定义了一个定理环境definition
并写了一张图和一个定义:
\documentclass[12pt]{book}
\usepackage[francais, english]{babel}
\usepackage{amsthm}
\begin{document}
\newtheorem{definition}{Definition}
\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
\begin{definition}[title]
body
\end{definition}
% ------------------------------------------
% List of figures
\addcontentsline{toc}{chapter}{\protect\numberline{}List of Figures}
\listoffigures
\cleardoublepage
% ------------------------------------------
% List of Definitions
\chapter*{List of Definitions}
\markboth{List of Definitions}{List of Definitions}
\addcontentsline{toc}{chapter}{\numberline{}List of Definitions}
\makeatletter
\@starttoc{lod}
\makeatother
\end{document}
可以List of Figures
正确生成的见附录:
然而,List of Definitions
是空的:
有人知道如何做才能使定义列表的自动生成起作用吗?
编辑1: @egreg 的解决方案对我来说在单独的文件中运行良好。当我将其适配到我的大型 tex 文件时,我在编译时收到以下消息。有人可以帮忙吗?(抱歉我无法使代码更简单并复制到此处)
答案1
使用thmtools
和tocbibind
\documentclass[12pt]{book}
\usepackage[T1]{fontenc}
\usepackage[french,english]{babel}
\usepackage{amsthm,thmtools}
\usepackage[nottoc]{tocbibind}
\declaretheorem[name=Theorem]{theorem}
\declaretheorem[name=Definition]{definition}
\addto\captionsenglish{%
\renewcommand{\listtheoremname}{List of Definitions}%
}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
\begin{definition}[title]
body
\end{definition}
\begin{theorem}
Body
\end{theorem}
% List of figures
\listoffigures
% List of Definitions
\listoftheorems[ignoreall,show=definition]
\end{document}