2

How can I add extra space between two specfied sections in the TOC?

i.e. I want to add space only at the arrow:

Is this even possible in a simple way?

Here's a minimal example:

\documentclass{article}
\makeatother
\begin{document}
\tableofcontents

\section{Sec 1}
\section{Sec 2} % I want space between section 2 and 3 in the table of contents
\section{Sec 3}
\section{Sec 4}
\section{Sec 5}

\end{document}

(I am also using the classicthesis template if that makes a difference)

Thanks in advance.

4
  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    May 26, 2014 at 10:56
  • In your MWE you are using article and not classicthesis ;-) Happened that accidentally?
    – user31729
    May 26, 2014 at 11:07
  • No, but I assume the solution would be the same? I just want to edit the TOC.
    – user52452
    May 26, 2014 at 11:20
  • \section{Sec 2} \addtocontents{toc}{\vspace{1cm}} \section{Sec 3} and compile twice.
    – user4686
    May 27, 2014 at 14:36

2 Answers 2

1

In this case, I used the optional argument of \section, to make the toc entry have a blank line stacked under it. The only thing you need to pay attention to is that if the entry is long enough to wrap in the toc, just stack under the last word of the entry, rather than under the whole entry.

\documentclass{article}
\usepackage{stackengine}
\begin{document}
\def\stacktype{L}
\tableofcontents

\section{Sec 1}
\section[\stackunder{Sec 2}{}]{Sec 2} % I want space between section 2 and 3 in the table of contents
\section{Sec 3}
\section{Sec 4}
\section{Sec 5}

\end{document}

enter image description here

0

This is an attempt using patchcmd from etoolbox with a conditional check whether chapter 3 and section 2 is reached. Note: to increase space bwteen 1 and 2, one needs to use the last section number, i.e., 2 in this demonstration. Need compile twice for the proper redering.

\patchcmd{\section}{\bfseries}%
{\ifnum\value{chapter}=3 \ifnum\value{section}=2 % Adjust parameters for various output.
\addtocontents{toc}{\protect\addvspace{20pt}}    % adjust 20pt to suit one's need.
\else
\addtocontents{toc}{\protect\addvspace{0pt}}
\fi
\fi}
{}{}

enter image description here

Code

\documentclass{book}
\usepackage{etoolbox}


\patchcmd{\section}{\bfseries}%
{\ifnum\value{chapter}=3 \ifnum\value{section}=2
\addtocontents{toc}{\protect\addvspace{20pt}}   % adjust 20pt to suit one's need.
\else
\addtocontents{toc}{\protect\addvspace{0pt}}
\fi
\fi}
{}{}

\begin{document}
\tableofcontents

\chapter{A chapter}
\section{A section}
\section{A section} 

\chapter{A chapter}

\chapter{A chapter}
\section{A section}
\section{A section} % I want space between section 2 and 3 
\section{A section}
\section{A section}

\chapter{A chapter}
\section{A section}
\subsection{A subsection}  
\subsection{A subsection}

\chapter{A chapter}

\end{document}

You must log in to answer this question.

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