我是 Latex 新手,在使用 tocloft 包生成方程列表时遇到问题,希望得到帮助。我希望列表像 \listoftables \listoffigures 函数那样显示。我使用 article 文档类和 tocloft 包来生成新列表。
\newcommand{\listequationsname}{List of Equations}
\newlistof{myequations}{equ}{\listequationsname}
\newcommand{\myequations}[1]{%
\addcontentsline{equ}{figure}{\protect\numberline{\theequation}#1}\par}
\setlength{\cftmyequationsnumwidth}{2.5em}`
%followed by :
\section*{List of Illustrations}
\addcontentsline{toc}{section}{List of Illustrations}
\listoffigures
\addcontentsline{toc}{subsection}{List of Figures}
\listoftables
\addcontentsline{toc}{subsection}{List of Tables}
\listofmyequations
\addcontentsline{toc}{subsection}{List of Equations}`
答案1
tocbasic
以下是使用alternative 的建议tocloft
。
\documentclass{article}
\usepackage{blindtext}% dummy text
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\counterwithin{equation}{section}
\usepackage{tocbasic}
\usepackage{scrbase}
\renewcommand*{\tableofcontents}{\listoftoc[{\contentsname}]{toc}}
\renewcommand*{\listoffigures}{\listoftoc[{\listfigurename}]{lof}}
\renewcommand*{\listoftables}{\listoftoc[{\listtablename}]{lot}}
\DeclareNewTOC[
type=myequation,
name=Equation,
listname={List of Equations},
tocentrynumwidth=2.3em,% like figures and tables
tocentryindent=1.5em,% like figures and tables
]{equ}
\newcommand{\myequations}[1]{%
\addxcontentsline{equ}{myequation}[\theequation]{#1}}
\setuptoc{lof}{leveldown,totoc}
\setuptoc{lot}{leveldown,totoc}
\setuptoc{equ}{leveldown,totoc}
\begin{document}
\tableofcontents
\section*{List of Illustrations}
\addcontentsline{toc}{section}{List of Illustrations}
\listoffigures
\listoftables
\listofmyequations
\section{A Section}
\blindtext
\begin{table}[htb]
\centering\huge Table
\caption{First table}
\end{table}
\Blindtext
\begin{table}[htb]
\centering\centering\huge Table
\caption{Second table}
\end{table}
\blindtext
\begin{equation}
a^2+b^2=c^2
\myequations{A first equation}
\end{equation}
\section{A second section}
\Blindtext
\begin{table}[htb]
\centering\centering\huge Table
\caption{Third table}
\end{table}
\Blindtext
\begin{equation}
h=pq
\myequations{A second equation}
\end{equation}
\end{document}
结果: