修改ToC Backmatter進入距離

修改ToC Backmatter進入距離

我使用類別創建了一個簡單的文檔,memoir如下所示:

\documentclass[12pt,a5paper]{memoir}

\renewcommand\thepart{\arabic{part}}
% modify ToC part
\renewcommand{\cftpartaftersnum}{.}
\renewcommand{\cftpartfont}{\normalsize\bfseries}
\renewcommand{\cftpartpagefont}{\normalsize\bfseries}
\setlength{\cftbeforepartskip}{16pt}
\setlength{\cftpartnumwidth}{2.5em}
% modify ToC chapter
\renewcommand{\cftchapteraftersnum}{.}
\renewcommand{\cftchapterfont}{\normalsize}
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapterpagefont}{\normalsize}
\setlength{\cftbeforechapterskip}{2pt}
\setlength{\cftchapternumwidth}{2.5em}


\begin{document}
\frontmatter
\tableofcontents
\mainmatter

\part{Part One}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\part{Part Two}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\backmatter
\pagestyle{plain}
\chapter[About Writer]{About Writer}

\end{document}

我的結果

如何About Writer在目錄中的最後一章和最後一章之間添加更多空間(例如 16pt)(如Part One和之間的空間Part Two)?謝謝。

更新:兩者卡爾科勒的約翰內斯_B 的如果我使用的話,答案效果很好\chapter[About Writer]{About Writer}。但是當我使用\include{aboutwriter}(如@barbara-beeton提及),他們沒有工作。

\documentclass[12pt,a5paper]{memoir}

\renewcommand\thepart{\arabic{part}}
% modify ToC part
\renewcommand{\cftpartaftersnum}{.}
\renewcommand{\cftpartfont}{\normalsize\bfseries}
\renewcommand{\cftpartpagefont}{\normalsize\bfseries}
\setlength{\cftbeforepartskip}{16pt}
\setlength{\cftpartnumwidth}{2.5em}
% modify ToC chapter
\renewcommand{\cftchapteraftersnum}{.}
\renewcommand{\cftchapterfont}{\normalsize}
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapterpagefont}{\normalsize}
\setlength{\cftbeforechapterskip}{2pt}
\setlength{\cftchapternumwidth}{2.5em}

% Karlkoeller said:
\usepackage{etoolbox}
\appto{\backmatter}{\addtocontents{toc}{\protect\addvspace{16pt}}}{}{}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter

\part{Part One}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\part{Part Two}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\backmatter
\pagestyle{plain}
% \chapter[About Writer]{About Writer}

% Johannes_B said:
% \addtocontents{toc}{\protect\vspace{16pt}}

\include{aboutwriter} % Include external file

\end{document}

答案1

加載包etoolbox並發布

\preto{\backmatter}{\addtocontents{toc}{\protect\addvspace{16pt}}}

這樣,當您發佈時,就會在目錄中新增跳過\backmatter16pt

微量元素:

\documentclass[12pt,a5paper]{memoir}

\renewcommand\thepart{\arabic{part}}
% modify ToC part
\renewcommand{\cftpartaftersnum}{.}
\renewcommand{\cftpartfont}{\normalsize\bfseries}
\renewcommand{\cftpartpagefont}{\normalsize\bfseries}
\setlength{\cftbeforepartskip}{16pt}
\setlength{\cftpartnumwidth}{2.5em}
% modify ToC chapter
\renewcommand{\cftchapteraftersnum}{.}
\renewcommand{\cftchapterfont}{\normalsize}
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapterpagefont}{\normalsize}
\setlength{\cftbeforechapterskip}{2pt}
\setlength{\cftchapternumwidth}{2.5em}

\usepackage{etoolbox}
\preto{\backmatter}{\addtocontents{toc}{\protect\addvspace{16pt}}}


\begin{document}
\frontmatter
\tableofcontents
\mainmatter

\part{Part One}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\part{Part Two}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\backmatter
\pagestyle{plain}
\chapter[About Writer]{About Writer}

\end{document} 

輸出:

在此輸入影像描述

答案2

前面部分中的空格來自\part並且更容易,我認為在這裡使用相同的機製而不是簡單地依賴空格會導致更容易理解的目錄。

在此輸入影像描述

\documentclass[12pt,a5paper]{memoir}

\renewcommand\thepart{\arabic{part}}
% modify ToC part
\renewcommand{\cftpartaftersnum}{.}
\renewcommand{\cftpartfont}{\normalsize\bfseries}
\renewcommand{\cftpartpagefont}{\normalsize\bfseries}
\setlength{\cftbeforepartskip}{16pt}
\setlength{\cftpartnumwidth}{2.5em}
% modify ToC chapter
\renewcommand{\cftchapteraftersnum}{.}
\renewcommand{\cftchapterfont}{\normalsize}
\renewcommand{\cftchapterleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapterpagefont}{\normalsize}
\setlength{\cftbeforechapterskip}{2pt}
\setlength{\cftchapternumwidth}{2.5em}


\begin{document}
\frontmatter
\tableofcontents
\mainmatter

\part{Part One}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}

\part{Part Two}
\chapter[Chapter Title]{Chapter Title}
\chapter[Chapter Title]{Chapter Title}
%\chapter[Chapter Title]{Chapter Title}

\backmatter
\part{The Appendix Bits}
\pagestyle{plain}
\chapter[About Writer]{About Writer}

\end{document}

相關內容