
我的文本(類)的章節report
理想地分為兩個主要組:第一部分和第二部分。在文字內部,在顯示每個部分的第一章之前,我建立了一個單獨的頁面,如下所示:
\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
我希望透過將「第一/第二部分//第一/第二部分」說明」在第一/第二部分的第一章之前居中顯示(可能是粗體),將文字分為兩部分,反映在目錄中目錄中的一部分,不顯示頁碼,但可能帶有hyperref
該頁面的連結(如果這很簡單,則不是必需的)。
我不知道如何實現這一目標,任何幫助將不勝感激!
答案1
這使用了有關部分分隔符號的程式碼片段(為什麼不使用\part
?),並將超級目標添加到相關頁面以及連結到該頁面的居中目錄行。
\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}