![当 \listoffigures 和 \listoftables 由 tocbasic 控制时,保留 \tableofcontents 中的 \listoffigures 和 \listoftables](https://linux22.com/image/442733/%E5%BD%93%20%5Clistoffigures%20%E5%92%8C%20%5Clistoftables%20%E7%94%B1%20tocbasic%20%E6%8E%A7%E5%88%B6%E6%97%B6%EF%BC%8C%E4%BF%9D%E7%95%99%20%5Ctableofcontents%20%E4%B8%AD%E7%9A%84%20%5Clistoffigures%20%E5%92%8C%20%5Clistoftables.png)
当图片列表和表格列表已置于包的控制之下时,如何将它们包含在目录中?通常,可以使用不带选项和 的tocbasic
包来包含这些列表。tocbibind
notlof
notlot
\documentclass{report}
\usepackage[nottoc]{tocbibind}% load before tocbasic
\usepackage{tocbasic}
% reset vertical spacing of LoF and LoT
\renewcommand{\listoffigures}{\listoftoc[\listfigurename]{lof}}
\renewcommand{\listoftables}{\listoftoc[\listtablename]{lot}}
% place LoF and LoT under control of tocbasic
\DeclareTOCStyleEntries{tocline}{figure,table}
% define custom listing
\DeclareNewTOC[%
type=thing,
float,
name=Thing,
listname={List of Things},
counterwithin=chapter,
setup=totoc,% add this list to the Table of Contents
tocentryindent:=figure,
tocentrynumwidth:=figure
]{lop}
% match vertical spacing of LoF and LoT
\usepackage{xpatch}
\makeatletter
\xapptocmd{\@chapter}
{\addtocontents{lop}{\protect\addvspace{10\p@}}}
{}{\PatchFailed}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\listofthings
\chapter{First}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 1} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 1} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 1} \end{thing}
\chapter{Second}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 2} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 2} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 2} \end{thing}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 3} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 3} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 3} \end{thing}
\end{document}
目录页,缺少 LoF 和 LoT:
答案1
您可以在序言中使用\setuptoc{lof}{totoc}
和\setuptoc{lot}{totoc}
将两者添加到目录中:
\documentclass{report}
\usepackage[nottoc]{tocbibind}% load before tocbasic
\usepackage{tocbasic}
% reset vertical spacing of LoF and LoT
\renewcommand{\listoffigures}{\listoftoc[\listfigurename]{lof}}
\renewcommand{\listoftables}{\listoftoc[\listtablename]{lot}}
% place LoF and LoT under control of tocbasic
\DeclareTOCStyleEntries{tocline}{figure,table}
% define custom listing
\DeclareNewTOC[%
type=thing,
float,
name=Thing,
listname={List of Things},
counterwithin=chapter,
setup=totoc,% add this list to the Table of Contents
tocentryindent:=figure,
tocentrynumwidth:=figure
]{lop}
\setuptoc{lof}{totoc}
\setuptoc{lot}{totoc}
% match vertical spacing of LoF and LoT
\usepackage{xpatch}
\makeatletter
\xapptocmd{\@chapter}
{\addtocontents{lop}{\protect\addvspace{10\p@}}}
{}{\PatchFailed}
\makeatother
\begin{document}
\tableofcontents
\listoffigures
\listoftables
\listofthings
\chapter{First}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 1} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 1} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 1} \end{thing}
\chapter{Second}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 2} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 2} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 2} \end{thing}
\begin{figure}[ht] \centering\fbox{Figure}\caption{Figure 3} \end{figure}
\begin{table}[ht] \centering\fbox{Table} \caption{Table 3} \end{table}
\begin{thing}[ht] \centering\fbox{Thing} \caption{Thing 3} \end{thing}
\end{document}