LaTeX技巧561:LaTeX如何让每一章带有目录?

转自: http://blog.sina.com.cn/s/blog_5e16f1770102ds8b.html

LaTeX技巧561:LaTeX如何让每一章带有目录?

【问题描述】

当前章节列出该章的所有内容的概要,就是说怎样让每一章能有一个小型的目录?

【解决方案】

解决方案一,需要我们使用一个新的宏包 minitoc,参考其说明文档

这里给一个小例子:

\documentclass{book}

\usepackage{minitoc}

\begin{document}

\dominitoc

\tableofcontents

\chapter{bla}


\minitoc% Creating an actual minitoc

\section{blubb}

\section{foo}

\end{document}

可以产生:

image

更多使用大家可以看看其使用说明文档,这里简单列几个常用的控制命令:

\setcounter{minitocdepth}{1}    % 会在minitoc显示到sections
\setcounter{minitocdepth}{3}    % 会显示到subsubsection。

下面几个命令需要放在导言区

\dominitoc[n]      % 表示去掉minitoc的contents的名字

\dominitoc[c]      % 表示把 "contents"居中

(someone please edit how other parameters should be added: [n][v] or [n, c], even if this is not a good example as as c and n don't go together)

\nomtcrule         % 去掉minitoc的横线
\nomtcpagenumbers  % 把目录的页码部分去掉
\undotted          % 这个是去掉中间的点

解决方案二,如果我们认真研究titletoc宏包,其功能是足以实现这一使用的。参看下面的例子:

\documentclass[oneside]{book}
\usepackage{titletoc}
\usepackage{lipsum}
\begin{document}
\tableofcontents
\chapter{A chapter}
\startcontents[chapters]
\printcontents[chapters]{}{1}{\contentsmargin{1em}}
\section{Section}
\lipsum[1]
\section{Section 2}
\lipsum
\chapter{Second chapter}
\startcontents[chapters]
\printcontents[chapters]{}{1}{\contentsmargin{1em}}
\section{Section}
\lipsum[2]
\section{Another section}
\lipsum
\end{document}

这里不再详述其使用,大家看看看看titletoc的说明文档

演示效果如:

image

选自:

http://tex.stackexchange.com/questions/22899/each-chapter-with-own-contents

http://tex.stackexchange.com/questions/3001/list-sections-of-chapter-at-beginning-of-that-chapter

http://tex.stackexchange.com/questions/5944/minitoc-and-memoir/7877#7877

猜你喜欢

转载自www.cnblogs.com/zhangzujin/p/10229206.html
今日推荐