1

I would like to add additional space between some selected ToC entries. I can achieve this by adding \bigskip in the title. While this produces the required output it also produces an error (associated with the hyperref package - see below).

So it seems there must be a more correct way of doing this.

What I want to achieve: What I want to achieve

MWE:

\documentclass{book}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{hyperref}
\begin{document}
\addcontentsline{toc}{chapter}{Summary\bigskip}

\addcontentsline{toc}{chapter}{Table of contents}
\tableofcontents 

\addcontentsline{toc}{chapter}{List of figures}
\listoffigures 

\addcontentsline{toc}{chapter}{List of tables\bigskip}
\listoftables 

\mainmatter
\chapter{Chapter 1}
\section{Section}
\end{document}  

This produces the following error:

Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\@ifnextchar'

Token not allowed in a PDF string (PDFDocEncoding):(hyperref) removing `\bigskipamount'

0

1 Answer 1

1

Add the space separately using

\addtocontents{toc}{\protect\bigskip}

Your sample code:

enter image description here

\documentclass{book}

\usepackage[utf8]{inputenc} 
\usepackage[T1]{fontenc} 
\usepackage{hyperref}
\begin{document}
\frontmatter % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\cleardoublepage % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\addcontentsline{toc}{chapter}{Summary}
\addtocontents{toc}{\protect\bigskip} % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

\cleardoublepage % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\addcontentsline{toc}{chapter}{Table of contents}
\addtocontents{toc}{\vspace{-2ex}} % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\tableofcontents 

\cleardoublepage % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\addcontentsline{toc}{chapter}{List of figures}
\addtocontents{toc}{\vspace{-2ex}} % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\listoffigures 

\cleardoublepage % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\addcontentsline{toc}{chapter}{List of tables}
\addtocontents{toc}{\protect\bigskip} % <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
\listoftables 

\mainmatter
\chapter{Chapter 1}
\section{Section}
\end{document}  
6
  • Great, so simple! Looking at it, it would be great to reduce the space between the ToC, LoF and LoT entries (for example to the same space as between section entries which is not shown in the MWE).
    – Low
    Nov 28, 2016 at 16:38
  • Should I add a new question for this/add this to my original question?
    – Low
    Nov 28, 2016 at 16:38
  • @Low You can also add negative space using \addtocontents{toc}{\vspace{-10pt}} or something like that.
    – gernot
    Nov 28, 2016 at 16:51
  • @Low I have updated my answer. Note that you have to add \cleardoublepage to make sure that the page references are correct. Without it, the \tableofcontents etc commands will start a new (double) page, but toc will contain the page number where the \addtocontents command was.
    – gernot
    Nov 28, 2016 at 16:59
  • @Low Moreover, you have to add the command \frontmatter, otherwise you will have doubled page numbers, since \mainmatter resets page numbering. If you don't like roman numerals for the front matter, you have to make sure that page numbering continues for the main sections.
    – gernot
    Nov 28, 2016 at 17:04

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