本文介绍了tocbibind包的使用方法和效果。该宏包可以自动将参考文献、索引或其他有标题的文档元素插入到目录中,并提供了多种选项进行控制。文章还展示了宏包在TeX套装中的默认自带性质以及使用方法,并配有示例代码和效果图。
宏包在TeX套装中是默认自带的,使用方法简单但效果显著。
tocbibind包它可以自动将参考文献、索引或其他有标题的文档元素插入到目录中。默认情况下,能将目录、图表目录、参考文献和索引的标题添加到目录中,可通过选项控制是否添加。宏包在 TeX 套装都是默认自带的,使用方法很简单,但是可以起到非常大的帮助。
-
-
notbib
、
notindex
、
nottoc
、
notlot
、
notlof
分别用于禁用参考文献、索引、目录本身、表格列表、图片列表的添加。
-
chapter
和
section
用于根据文档类选择章节或节级标题样式。
-
numbib
和
numindex
用于给参考文献和索引标题编号。
-
other
用于自定义标题命令,需配合
tocotherhead
命令使用。
-
效果图(右边未使用该宏包,左边使用宏包后)
代码如下:
\documentclass[fontset=fandol]{ctexart}
\usepackage{amsmath}
\usepackage{tocbibind}
\usepackage[margin=2cm]{geometry}
\newcommand\mytitle{test}
\newcommand\myname{LaTeX Studio}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage[xetex,%
bookmarks=true,%
bookmarksnumbered=true,
bookmarkstype=toc,
bookmarksopen=true,%
pdftitle={\mytitle},%
pdfauthor={\myname},%
pdfsubject={},%
pdfkeywords={},
linkcolor=blue,anchorcolor=blue,urlcolor=blue,
pdfdisplaydoctitle=true,%
pdfstartview={FitH -32768},%
colorlinks=true]{hyperref}
\usepackage{makeidx}
\makeindex
\begin{document}
\pagestyle{empty}
\tableofcontents
\listoftables
\listoffigures
\section{\texttt{tocbibind.sty}宏包示例}
参照 \cite{manual}, \cite{texbook},\cite{1}, \cite{2}
\eqref{test}参照。
\begin{equation}\label{test}
f=x
\end{equation}
\index{公式@数式}
\begin{table}[!ht]
\caption{表格示例}
\centering
\begin{tabular}{|r|c|l|p{5em}|@{\hspace{1cm}}|l|}
\hline
左&居中中&右&固定宽度的单元格&相邻\\
\hline
\end{tabular}
\end{table}
\index{表格示例@leopard}
\begin{figure}[!ht]
\caption{虎}
\centering
\fbox{\rule{3cm}{1cm}}
\end{figure}
\index{tiger@虎}
\begin{thebibliography}{99}
\bibitem[A1]{1} \url{https://www.latexstudio.net}
\bibitem[B2]{2} 第二条参考文献
\bibitem[M]{manual} Leslie Lamport. \newblock \emph{{\LaTeX:} A Document
Preparation System}. \newblock Addison-Wesley, Reading,
Massachusetts, second edition, 1994, ISBN~0-201-52983-1.
\bibitem{texbook} Donald~E. Knuth. \newblock \textit{The \TeX{}book,}
Volume~A of \textit{Computers and Typesetting}, Addison-Wesley,
Reading, Massachusetts, second edition, 1984, ISBN~0-201-13448-9.
\end{thebibliography}
\printindex
\end{document}
全新 LaTeX 知识库,入门资料,免费知识代码:
https://www.latexstudio.net/LearnLaTeX/
精心制作免费视频教程:
https://space.bilibili.com/209746320