ToCを2つの部分に分割する方法

ToCを2つの部分に分割する方法

私のテキスト (クラス) の章は、report理想的には、第 1 部と第 2 部の 2 つの主要なグループに分かれています。テキスト内で、各パートの最初の章が表示される直前に、次のような独立したページを作成しました。

\clearpage
\thispagestyle{empty}
\null\vspace{\stretch{1}}
\begin{center}
{\Huge FIRST/SECOND PART}\\
\par\vspace{0.7cm}\noindent
{\Large\textit{First/Second Part Description}}
\end{center}
\vspace{\stretch{2}}\null

目次内でテキストを 2 つの部分に分割することを反映するには、目次内の第 1 部/第 2 部の最初の章の直前に「第 1 部/第 2 部 // 第 1 部/第 2 部」の説明」を中央揃え (太字でも可) で表示し、ページ番号は表示せずに、hyperrefそのページへのパスを表示する (簡単なら、必須ではありません) ようにします。

どうすればそれが実現できるのか全く分かりませんが、どんな助けでもいただければ幸いです。

答え1

これは、パート区切りに関するコード フラグメント (なぜ使用しないのですか\part?) を使用し、関連するページへのハイパーターゲットと、そのページにリンクする中央揃えの ToC 行を追加します。

\documentclass{report}

\usepackage{blindtext}

\newcounter{dummypart}

\usepackage{hyperref}

\makeatletter
\newcommand{\partdivider}[2]{%
  \clearpage
  \thispagestyle{empty}
  \null\vspace{\stretch{1}}
  \begin{center}
    {\Huge #1}

    \vspace{0.7cm}\noindent
    {%
      \refstepcounter{dummypart}%
      \label{dummypart:\thedummypart}%
      \hypertarget{dummypart:\thedummypart}{\Large\textit{#2}}%
    }
  \end{center}
  %Need \protect to prevent breaking of commands during write process to the .aux file!
  \addtocontents{toc}{\protect\centering\protect\hyperlink{dummypart:\thedummypart}{\textit{#2}}\protect\par}
  \vspace{\stretch{2}}\null%
}
\makeatother


\begin{document}
\tableofcontents


\partdivider{First Part}{The Fellowship Of The Ring}

\chapter{Foo}


\partdivider{Second Part}{The Two Towers}

\chapter{Foobar}




\partdivider{Third Part}{The Return Of The King}

\chapter{Other Foobar}


\end{document}

ここに画像の説明を入力してください

関連情報