8

I have grouped sections nicely below of chapters in ToC, so that there is no space between chapter and following sections, but there is some space between last section and following chapter. All this is done using memoir:

\setlength{\cftbeforesectionskip}{4pt}
\setlength{\cftbeforechapterskip}{16pt}

The problem is that chapter-like entries in the frontmatter (e.g. Foreword, Abstract) will have relatively large vertical space in between. What I would like to have is `grouped´ frontmatter chapter-like entries with 4pt vertical space, and 16pt space between last entry of the group (say, ToC or LoF) and the first chapter. Something like this:

Foreword
Abstract
List of Figures

Chapter 1 Introduction
  1.1 Section title
  1.2 Section title

Chapter 2 Theory
  2.1 Section title
  2.2 Section title

Bibliography
5

Here's one possible solution using the etoolbox package to patch the \chapter command to add some spacing to the ToC; the change is at the point the spacing is required:

\documentclass{memoir}
\usepackage{etoolbox}

\setlength{\cftbeforesectionskip}{4pt}

\begin{document}

\tableofcontents

\chapter*{Foreword}
\addcontentsline{toc}{chapter}{Foreword}
\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}

\pretocmd{\chapter}{\addtocontents{toc}{\addvspace{16pt}}}{}{}

\chapter{Chapter One}
\section{Section One One}
\section{Section One Two}
\section{Section One Three}
\section{Section One Four}

\chapter{Chapter Two}
\section{Section Two One}
\section{Section Two Two}
\section{Section Two Three}

\chapter{Chapter Three}
\section{Section Three One}
\section{Section Three Two}
\section{Section Three Three}
\section{Section Three Four}
\section{Section Three Five}

\end{document}

The resulting ToC:

enter image description here

4

Gonzalo Medina answer is very good for automated behaviour. If you need only to act once or twice for specific cases, you should add manually the space. This is to be used with care, since the general equilibrium of the toc can be altered dramatically.

This is done with

\addtocontents{toc}{\vspace{xpt}}

with x being a positive or negative value, written just before your chapter, section, part etc. entry in the text.

You can also use the \addvspace command, but only for positive values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.