Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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}. –  Christian Hupfer May 26 at 10:56
1  
Thanks you. I've added the example. –  user52452 May 26 at 11:04
    
In your MWE you are using article and not classicthesis ;-) Happened that accidentally? –  Christian Hupfer May 26 at 11:07
    
No, but I assume the solution would be the same? I just want to edit the TOC. –  user52452 May 26 at 11:20
    
\section{Sec 2} \addtocontents{toc}{\vspace{1cm}} \section{Sec 3} and compile twice. –  jfbu May 27 at 14:36
add comment

2 Answers 2

up vote 2 down vote accepted

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

share|improve this answer
add comment

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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