5

I created a simple document using memoir class as follows:

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

My result

How can I add more space (say 16pt) between About Writer and the last chapter in ToC (like those between Part One and Part Two)? Thanks.

UPDATE: Both Karlkoeller's and Johannes_B's answers worked fine if I used \chapter[About Writer]{About Writer}. But when I used \include{aboutwriter} (as @barbara-beeton mentioned), they didn't work.

\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}
11
  • 1
    Hi and welcome, have a look at table of contents: adding a vertical space
    – Johannes_B
    Feb 17, 2015 at 17:22
  • @Johannes_B: I added \addtocontents{toc}{\protect\vspace{16pt}}. It didn't work. Thanks.
    – guest_5758
    Feb 17, 2015 at 17:34
  • Sure it does, @karlkoeller is doing exactly the same below.
    – Johannes_B
    Feb 17, 2015 at 17:37
  • @Johannes_B: I've double checked but adding \addtocontents{toc}{\protect\vspace{16pt}} (or even greater number) seems doesn't work for me. I'm pretty new to LaTeX. I might have made mistakes. Thanks.
    – guest_5758
    Feb 17, 2015 at 17:49
  • the suggested \addtocontents should work in the example as shown in the question. but if in the real situation you are using \include{aboutwriter}, the \addtocontents will be delayed until after the included file has been processed. not very useful, but a (poorly) documented side effect of \include. the \appto{backmatter} method provided by @karlkoeller gets around that "gotcha". Feb 17, 2015 at 18:14

2 Answers 2

10

Load the package etoolbox and issue

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

In this way, when you issue \backmatter a 16pt skip is added in the ToC.

MWE:

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

Output:

enter image description here

1
  • @guest_5758 you're welcome. Feb 17, 2015 at 17:41
2

The space in the earlier parts comes from \part and it is easier, and I think leads to a more simply understood table of contents to use the same mechanism here rather than simply rely on space.

enter image description here

\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}
1
  • Thanks :) The problem is now fixed by adding \usepackage{etoolbox} and \preto{\backmatter}{\addtocontents{toc}{\protect\addvspace{16pt}}}{}{} as mentioned above. Thanks a lot.
    – guest_5758
    Feb 18, 2015 at 4:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .