LaTeX/目錄和圖列表
外觀
< LaTeX
基本 LaTeX 提供了根據標題或題注自動生成目錄 (ToC, \tableofcontents) 和表/圖列表 (LoT, \listoftables/LoF, \listoffigures) 的方法。 要排版目錄 (或 LoT/LoF),LaTeX 需要輔助檔案;這意味著每次 ToC 更新至少需要兩次 LaTeX 執行。
\documentclass{article}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\listoffigures
\section{Wombat}
\blindtext
\section{Alpaca}
\blindtext
\begin{figure}
\caption{This is a caption for a non-existing image}
\end{figure}
\section*{Not in ToC}
\end{document}
對於文章類,這些列表在內部是無編號的節。對於標準報告和書籍類,它們是無編號的章;每個都從新頁開始。
預設情況下,無編號的章和節不會出現在目錄中。 如何使它們顯示。
目錄有深度。預設情況下,目錄中存在三個分節級別。 你可以指定 到哪個級別 ToC 應該顯示詳細資訊。 \setcounter{tocdepth}{<number>}
分節命令以及 \caption 提供一個可選引數,可以接受不同的標題。 通常,這是用於為 ToC 或 LoF/LoT 提供較短的題注。
\documentclass{article}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\listoffigures
\section[Alpaca]{Wombat}
\blindtext
\begin{figure}
\caption[This is the LoF entry]{This is a caption for a non-existing image}
\end{figure}
\end{document}

etoc 包可以讓你獲得單個章節的目錄。 以下是一個小例子。

\documentclass{book}
\usepackage{etoc}
\usepackage{blindtext}
\begin{document}
\tableofcontents
\etocsettocstyle{\subsection*{This Chapter contains:}}{\noindent\rule{\linewidth}{.4pt}}
\chapter{Extinct Species}
\localtableofcontents
\section{Mammals}
\subsection{Big-eared hopping mouse}
\subsection{Jamaican rice rat}
\subsection{White-footed rabbit-rat}
\section{Butterflies}
\subsection{Nymphalidae}
\subsection{Lycaenidae}
\subsection{Uraniidae}
\end{document}
如果你想自定義你的目錄,你可以從標準類的一些包中選擇。 然而,memoir 和 KOMA-script 具有內建的自定義方法,使用包會破壞這些類的功能。
LaTeX 為目錄中的條目使用定義的空間,這意味著長的章節或節號有時會與標題重疊。 一個簡單的解決方案是透過在序言中新增 \renewcommand{\numberline}[1]{#1~} 來覆蓋它。 不過,使用專門用於 ToC 自定義的包可能更好。

