我怎样才能重现这个漂亮的目录?

我怎样才能重现这个漂亮的目录?

我今天偶然发现了这个目录:

样本目录

我非常喜欢它的结构和简洁性。页码就在条目后面,而不是像通常那样不必要地远离。左侧的章节编号和右侧的标题之间的分隔清楚地将两者区分开来。

我想复制此设计用于一本书,但不知道从哪里开始。你能告诉我如何复制吗?

奖金
您是否知道如何扩展它以列出章节并删除作者?

答案1

漂亮的 toc

使用埃托克

更新启用了目录中的部分(请参阅下面的第一个答案)。此外,它使用\chaptername, \partname (在book类中可用)进行国际化。并且它在页码前使用不可中断的空格。

带有各个部分的漂亮目录

\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}

早期的代码,针对没有章节的目录:

\documentclass{book}
\usepackage{etoc}
\etocsetlevel{authors}{1}
\etocsetlevel{section}{2}
\etocsettocdepth{authors}
\newcommand{\authorstotoc}[1]{\etoctoccontentsline{authors}{#1}}

\newlength{\tocleft}
\setlength{\tocleft}{3cm}

\newlength{\tocsep}
\setlength{\tocsep}{2em}


\etocsetstyle{part}{}{}{{\bfseries\makebox[0pt][r]
                              {Part \etocnumber\hspace{\tocsep}}%
                     \etocname\quad\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]
                               {Chapter \etocnumber\hspace{\tocsep}}}
                             {\ifcase\TEMP
                              \def\TEMP{1}\or\def\TEMP{2}%
                              \makebox[0pt][r]
                                  {\parbox[t]{\dimexpr\tocleft-\tocsep\relax}
                                   {\raggedleft Introductory\\ \strut Chapter}%
                                   \hspace{\tocsep}}\fi
                              }\textbf{\etocname\quad\etocpage}\par
                             \etocifnumbered{}{\vspace{2ex}}}{}

\etocsetstyle{authors}{}{}{\etocname\par\vspace{2ex}}{}

\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}

\chapter{Complex-Systems Design Methodology for Systems-Engineering
  Collaborative Environment}

\authorstotoc{Guido Ridolfi, Erwin Mooij and Sabrina Corpino}

\end{document}

答案2

这不是“如何重现”的答案,但可以给你一些关于如何开始的想法。看看我的目录泛函分析注记。这不是你想要的,但我想你会同意它是非标准的。

以下是来自本地类文件的部分(大部分?)实现此功能的代码:

\renewcommand\l@chapter[2]
  {\vrule width0pt height 16pt depth 4pt
   \normalfont\bfseries#1&\normalfont\bfseries#2\cr}
\renewcommand\l@section[2]{\small#1&\small#2\cr}

\renewcommand\tableofcontents{\par
  \bigskip
  \begingroup\centering
  \renewcommand\numberline[1]{Chapter ##1:\enspace}
  \leavevmode
  \vbox{\baselineskip10pt
    \halign{\hfil##\quad$\cdot$&\quad##\hfil\cr
      \@input{\jobname.toc}}}
  \par\endgroup
  \newwrite\tf@toc
  \immediate\openout\tf@toc\jobname.toc}

稍微解释一下:这是该.toc文件的前两行:

\contentsline {chapter}{\numberline {1}Transfinite induction}{3}
\contentsline {section}{Wellordering}{3}

这些扩展为(假设@是一封信)

\l@chapter{\numberline {1}Transfinite induction}{3}
\l@section{Wellordering}{3}

因此\l@chapter和 friends 是需要调整的宏。在这里,我让它们产生适合进入构造的输出\halign

根据这些想法,您可能能够为您喜欢的布局制作类似的东西。您需要修改命令\chapter以在其对 的调用中包含作者信息\addcontentsline,当然\l@chapter必须能够从其两个参数中挑选出此信息。简单的解决方案:让第一个参数具有形式{chapter title}{author info}并使用辅助宏来区分位。

免责声明:我写这段代码已经好几年了。我对它的理解很可能已经退化了。

相关内容