2

I have the chapters of my text (report class) ideally divided in two main groups: FIRST PART and SECOND PART. Inside the text, right before the first chapter of each part is displayed, I created an isolated page like this:

\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

I would like to have this division of the text in two parts reflected inside the ToC by having "FIRST/SECOND PART // First/Second Part" Description" appear centered (and maybe bold) right before the first chapter of the first/second part in the ToC, without the page number displayed but maybe with an hyperref to that page (if that's easy, it's not essential).

I have no clue on how to achieve that and any help would be much appreciated!

1 Answers1

2

This uses the code fragment about the part dividers (why not using \part?) and adds a hypertarget to the relevant page and a centered ToC line which links to the page.

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

enter image description here