将第二卷的目录包含在第一卷中,反之亦然

将第二卷的目录包含在第一卷中,反之亦然

我正在准备一本将分成两卷印刷的书,我想在目录中显示两卷的全部内容,可以分成两个单独的目录(第 I 卷索引/第 II 卷索引),也可以作为一个目录,其中卷号变成未编号的部分,其中包含该书的章节和部分。

我四处寻找,但找不到答案。我正在使用回忆录,看看它是否有任何不同。

答案1

这应该可行。假设另一个卷已命名volumetwo且文件volumetwo.toc已存在。

\makeatletter
\def\tableofcontentsfrom#1#2{
\section*{#2\@mkboth{\MakeUppercase#2}{\MakeUppercase#2}}%
\begingroup\makeatletter%
  \@input{#1.toc}%
\endgroup%
}
\makeatother

\tableofcontentsfrom{volumetwo}{Contents of Volume 2}

\tablofcontents(它是原始和宏的修改\@starttoc。)

自动化版本,两个卷均带有一个较长的目录(我只是没有根据书籍/报告/文章类别自动选择顶级)

\makeatletter
\def\gentoc#1{
\section*{#1\@mkboth{\MakeUppercase#1}{\MakeUppercase#1}}%
\begingroup\makeatletter%
 \let\l@toplevel\l@part%    use for BOOK class
% \let\l@toplevel\l@chapter% use for REPORT class
% \let\l@toplevel\l@section% use for ARTICLE class
\let\l@part\l@chapter%
\let\l@chapter\l@section%
\let\l@section\l@subsection%
\let\l@subsection\l@subsubsection%
}
\def\endgentoc{%
\endgroup%
}
\def\gentocfile#1#2{\l@toplevel{#1}{0}\@input{#2.toc}}
\makeatother

...

\begin{gentoc}{Complete Table of Contents}
\gentocfile{First volume}{volumeone}
\gentocfile{Second volume}{volumetwo}
\end{gentoc}

相关内容