我有以下代码:
\documentclass[12pt]{book}
\usepackage[francais, english]{babel}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
~\cite{cr:sas:12}
% ------------------------------------------
% Bibliography
\addtocontents{toc}{\vskip 4mm}
\addcontentsline{toc}{chapter}{\protect\numberline{}Bibliography}
\bibliographystyle{alpha}
\bibliography{thesis}
% ------------------------------------------
% 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
的如下:
但是,我不知道如何添加Definition
才能List of Definitions
自动生成。有人能帮忙吗?
答案1
例如:
\documentclass[12pt, francais, english]{book}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{tocloft}
\newcommand{\listofdefnitionsname}{List of Definitions}% based on page 13 of tocloft's manual
\newlistof{definition}{defn}{\listofdefnitionsname}
\newcommand{\definition}[2]{%
\refstepcounter{definition}
\par\noindent\textbf{Definition \thedefinition. \textbf{#1:} #2}
\addcontentsline{defn}{definition}{\protect\numberline{\thedefinition}#1}\par}
\begin{document}
\tableofcontents
\chapter{Chapter}
\section{Section}
\begin{figure}
a
\caption{haha}
\end{figure}
~\cite{cr:sas:12}
\definition{This}{This is a definition.}
% ------------------------------------------
% Bibliography
\addtocontents{toc}{\vskip 4mm}
\addcontentsline{toc}{chapter}{\protect\numberline{}\bibname}
\bibliographystyle{alpha}
\bibliography{thesis}
% ------------------------------------------
% List of figures
\addcontentsline{toc}{chapter}{\protect\numberline{}\listfigurename}
\listoffigures
\cleardoublepage
% ------------------------------------------
% List of Definitions
\addcontentsline{toc}{chapter}{\numberline{}\listofdefnitionsname}
\listofdefinition
\end{document}
您没有说明如何添加定义,因此我只是根据示例放入了一个占位符宏tocloft
。显然,您可以修改它以适应需要。