I am using article
class and tocloft
package.
Does anyone know how to put a space (for example of size "22pt") between a ToC section entry and only the first subsection entry in every section.
When I use \setlength\cftbeforesubsecskip{22pt}
this puts a space before every subsection entry. I don't want extra space between subsection entires. I only want a space between the section entry and 1st subsection entry (in every section).
What would be useful is a command that changes the space after a section entry, not before. This way I could set the space after a section entry but as far as I know something like \cftAFTERsecskip
does not exist.
Does anyone have a suggestion? Thank you!
\documentclass[12pt]{article}
\usepackage{tocloft}
\setlength\cftparskip{0pt}
\setlength\cftbeforesecskip{0pt}
\setlength\cftbeforesubsecskip{22pt}
\setlength\cftaftertoctitleskip{44pt}
\begin{document}
\tableofcontents
\section{Test section one}
\subsection{test section one one}
\subsection{test section one two}
\section{Test section two}
\subsection{test section two one}
\subsection{test section two two}
\clearpage
\section{Test section three}
\subsection{test section three one}
\subsection{test section three two}
\end{document}
Best Answer
One option would be to redefine
\subsection
as implemented inarticle.cls
. In the redefinition you test for the value of thesubsection
counter; if the value is greater then one, do nothing; if it's equal to one, add the space to the ToC:Patching the
\subsection
command with the help of\patchcmd
from theetoolbox
package simplifies the code: