通常定制章节样式或者目录样式,采用的包最多的是titlesec和titletoc宏包,最近,又有了一个新的包etoc,其定制性上更进一步,推荐大家阅读其说明,试用试用!
例如下面这一目录样式:
用etoc宏包定制的代码如下:
\documentclass{book}
\usepackage{etoc}
\etocsetlevel{authors}{1}
\etocsetlevel{section}{2}
\etocsetlevel{subsection}{3}
\etocsettocdepth{section}
\newcommand{\authorstotoc}[1]{\etoctoccontentsline{authors}{#1}}
\newlength{\tocleft}
\setlength{\tocleft}{3cm}
\newlength{\tocsep}
\setlength{\tocsep}{2em}
\etocsetstyle{part}{}{}{{\bfseries\makebox[0pt][r]
{\partname\ \etocnumber\hspace{\tocsep}}%
\etocname\kern1em\relax\etocpage\par}\vspace{3ex}}{}
% to avoid possible line breaks between chapter (or part) name and page number
% replace \quad by \kern1em\relax
\etocsetstyle{chapter}{}{}{\etocifnumbered
{\makebox[0pt][r]
{\chaptername\ \etocnumber\hspace{\tocsep}}}
{\ifcase\TEMP
\def\TEMP{1}\or\def\TEMP{2}%
\makebox[0pt][r]
{\parbox[t]{\dimexpr\tocleft-\tocsep\relax}
{\raggedleft Introductory\\ \strut \chaptername}%
\hspace{\tocsep}}\fi
}\textbf{\etocname\kern1em\relax\etocpage}\par
\etocifnumbered{}{\vspace{2ex}}}{}
\etocsetstyle{authors}{}{}{\etocname\par\vspace{1ex}}{\vspace{2ex}}
\etocsetstyle{section}{}{}{\makebox[0pt][r]{\etocnumber\hspace{\tocsep}}%
\etocname\kern1em\etocpage\par}{}
\etocsettocstyle {\noindent\sffamily{\LARGE \contentsname}\par
\thispagestyle{empty}%
\noindent\rule{\dimexpr\tocleft-\tocsep}{1pt}\par\vspace{3ex}%
\leftskip\tocleft\parindent0pt\def\TEMP{0}}{}
\begin{document}
\frontmatter
\tableofcontents
\chapter{Preface}
\mainmatter
\chapter*{A Few Words About Systems Engineering}
\addcontentsline{toc}{chapter}{A Few Words About Systems Engineering}
\part{Systems Engineering Practice}
\chapter{Methodology for an integrated Definition of a System and its
Subsystems: The Case-Study of an Airplane and its Subsystems}
\authorstotoc{Sergio Chiesa, Marco Fioriti and Nicole Viola}
\section{This is a section}
\section{This is another section}
\chapter{Complex-Systems Design Methodology for Systems-Engineering
Collaborative Environment}
\authorstotoc{Guido Ridolfi, Erwin Mooij and Sabrina Corpino}
\section{Another section}
\section{One more section}
\chapter*{A Few Words About Systems Engineering}
\addcontentsline{toc}{chapter}{A Few Words About Systems Engineering}
\section*{An unnumbered section}
\addcontentsline{toc}{section}{An unnumbered section}
\end{document}效果图如下:

选自:http://tex.stackexchange.com/questions/178510/how-can-i-reproduce-this-beautiful-table-of-contents


发表评论 取消回复