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.

I want to remove vertical space between two chapters in table of contents. I can remove the vertical space between chapter and a section by using

\usepackage[titles,subfigure]{tocloft}
\renewcommand\cftchapafterpnum{\vskip -2pt}

But i dont know how to remove the spaces between two chapters. Please help me to figure it out.

share|improve this question
1  
Have you tried adjusting \cftbeforechapskip? Maybe try \setlength{cftbeforechapskip}{0pt}. Also it would be easier to help you if you could provide an MWE next time. –  Max Jan 3 '13 at 15:08
add comment

1 Answer

This removes the space between 2 chapters only when they are just next to each other.

\documentclass{book}

\usepackage[titles]{tocloft}

\makeatletter
\newskip\old@cftbeforechapskip
\old@cftbeforechapskip\cftbeforechapskip
\let\old@l@chapter\l@chapter
\let\old@l@section\l@section
\def\l@chapter#1#2{\old@l@chapter{#1}{#2}\cftbeforechapskip3pt}% set your value here
\def\l@section#1#2{\old@l@section{#1}{#2}\cftbeforechapskip\old@cftbeforechapskip}
\makeatother

\begin{document}

\tableofcontents

\chapter{AAA}
\section{sss}

\chapter{BBB}
\section{ttt}

\chapter{CCC}

\chapter{DDD}

\end{document}

If you want to remove all the vertical spaces, you simply say the following instead of the long code in preamble:

\setlength{\cftbeforechapskip}{0pt}
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.