5

Thesis office at my university has this rule regarding TOC -

  • Chapter headings should have double space above and below them
  • Subheadings should be single spaced.

To accomplish this, I have this in my latex source file

\setlength{\cftbeforechapskip}{12pt} % space between whole chapter blocks`
\renewcommand{\cftchapafterpnum}{\vskip 16pt}
% single spaced section and subsection
\renewcommand{\cftsecafterpnum}{\vskip 6pt}
\renewcommand{\cftsubsecafterpnum}{\vskip 6pt}

The problem I have is - because of the first two commands, I have unequal space distribution - something like

ABSTRACT
<28pt> 
DEDICATION
<28pt>
.
.
.
.
CHAPTER 1 TITLE
<28pt>
CHAPTER 2
<16pt>
...SUBHEADING 1
...SUBHEADTING 2
<16pt>
CHAPTER 3
<16pt>
.
.
.

I have used \cftbeforesubsecskip and \cftbeforesecskip also. These introduce spaces everywhere.

What I want is -

ABSTRACT
<16pt>
DEDICATION
<16pt>
.
.
.
<16pt>
CHAPTER 1 TITLE
<16pt>
CHAPTER 2
<16pt>
...SUBHEADING 1
...SUBHEADTING 2
<16pt>
CHAPTER 3
<16pt>
.
.
.

Could someone please tell me how I can get uniform spacing? Thanks a lot. I am clueless about this ... :(

This is what I get -

TOC PAGE

1

REVISED SOLUTION to automate the process and also allow full use of optional argument in \section. This solution modifies the \section definition. If this is the first section of a chapter, a blank line is stacked above the section name in the toc (using the optional argument of the original \section definition). You may have to tweak the actual stack gap (currently set as 18pt).

\documentclass{report}
\usepackage[usestackEOL]{stackengine}
\let\svsection\section
\makeatletter
\renewcommand\section[2][]{%
  \if0\@arabic\c@section%
    \ifx\relax#1\relax\firstsection{#2}\else\firstsection[#1]{#2}\fi%
  \else
    \ifx\relax#1\relax\svsection{#2}\else\svsection[#1]{#2}\fi%
  \fi}
\makeatother
\newcommand\firstsection[2][]{%
  \ifx\relax#1\relax\svsection[\Longstack{\\#2}]{#2}\else
  \svsection[\Longstack{\\#1}]{#2}\fi
}
\setstackgap{L}{18pt}
\begin{document}
\tableofcontents
\chapter{A Chapter}
\section{A Section}
\section[TOC Section Name]{A Section}
\chapter{A Chapter}
\chapter{A Chapter}
\section[TOC Section Name]{A Section}
\end{document}

enter image description here

ORIGINAL SOLUTION:

You may have to tweak the actual stack gap (currently set as 18pt), but using the optional argument for the first section of every chapter will allow you to stack a blank line above that section heading in the toc.

Here, I codify that as \firstsection{}.

\documentclass{report}
\usepackage[usestackEOL]{stackengine}
\newcommand\firstsection[1]{\section[\Longstack{\\#1}]{#1}}
\setstackgap{L}{18pt}
\begin{document}
\tableofcontents
\chapter{A Chapter}
\firstsection{A Section}
\section{A Section}
\chapter{A Chapter}
\chapter{A Chapter}
\firstsection{A Section}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy