So I am attempting to begin early on my thesis, and I am running into some strange TeX problems. I am using 12pt font - important for the spacing commands below. When formatting the ToC we are required to allow double spacing between each major heading (like chapters) but constrain the subheadings within each major heading to single spacing. This results in the following ToC scheme:

    Chapter xxx

Chapter xxx

Section xxx
Section xxx
Subsection xxx

Chapter xxx

Section xxx
Section xxx

Chapter xxx


Is there a nice way to produce this style of output? So far the closest I have come is by playing with settings in tocloft. This code comes close but it is not quite what I want:

    \setlength\cftbeforechapskip{0pt}
\setlength\cftbeforesecskip{-6pt}
\setlength\cftbeforesubsecskip{-6pt}

\renewcommand{\cftchapafterpnum}{\vskip 12pt}
\renewcommand{\cftsecafterpnum}{\vskip 6pt}
\renewcommand{\cftsubsecafterpnum}{\vskip 6pt}


As you can see it will only produce a half space separation between the major headings and the block of subheadings with a full space between each major heading. Any suggestion would be greatly appreciated! Thanks!

You can do this without packages:

\documentclass[12pt]{book}

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalfont\Large\bfseries%
\ifnum\value{section}=1\relax
}

\makeatother

\begin{document}

\tableofcontents
\chapter{Test chapter}
\section{Test section}
\subsection{Test subsection}
\section{Test section}
\chapter{Test chapter}
\chapter{Test chapter}
\section{Test section}
\subsection{Test subsection}
\subsection{Test subsection}
\chapter{Test chapter}
\section{Test section}
\section{Test section}
\subsection{Test subsection}
\subsection{Test subsection}

\end{document}


• Worked like a charm! Thank you for your quick response! :) To make this comment legit: do have any suggestions for materials I could read to brush up on how you arrived at your answer? – chowno Sep 2 '13 at 21:11
• @chowno You're welcome! In this case, you need some familiarity with the code used in book.cls, in particular with \@startsection; the file book.cls itself and the document source2e.pdf (the commented source for the LaTeX kernel) can be possible sources. – Gonzalo Medina Sep 3 '13 at 2:59
• @GonzaloMedina I tried to run the code you suggested above. I then commented the code from \makeatletter to \makeatother and generated the pdf again. I couldn't see much of a difference in the 2 outputs.. Could u please explain the purpose of the code from \makeatletter to \makeatother? – Shray Sharan Jul 30 '15 at 16:41
• @ShraySharan That code changes the vertical spacing in the ToC (table of contents) between the entry for the first section on a chapter and that chapter entry. You should see the difference in the ToC even with the 12pt I used in the \vspace*; use 120pt instead and you'll see the effect. – Gonzalo Medina Jul 30 '15 at 17:50
• @GonzaloMedina I used your suggestion to edit my TOC. This has made my TOC look great, but all my first level subheadings in the entire document align to the left because of this. If I dont add the above code, the 1st level subheadings look okay but TOC does not look as required. Please let me know if I should post a separate question for this – Shray Sharan Aug 10 '15 at 14:22