本文已加入专栏文章目录,归入「进阶使用」文章系列。
titletoc
宏包提供了定制目录列表样式的功能,本文主要讨论其中的「创建子目录」功能。
标准目录的子目录
LaTeX 的典型目录通过 tableofcontents
输出,一个文档里最多使用一次。在实践中,长文档有包含多个「目录」的需求:
- 精简目录,常出现在完整目录之前。精简目录只包含一到两级章节标题,篇幅短,完整目录包含更多章节层次。
- 子目录,常出现在各章开头,仅包含当前章下的次级标题。例如
Chapter 2 Title
<start of partial toc>
2.1 Section title ....... page 10
2.1.1 Subsection title .... page 11
2.1.2 Subsection title .... page 12
2.2 Section title ....... page 15
... ...
<end of partial toc>
<start of chapter contents>
... ...
titletoc
提供了生成子目录的命令 startcontents
和 printcontents
:
documentclass{
article}
usepackage{
lipsum}
usepackage{
titletoc}
begin{
document}
% ta