I'm using the style files given by my university for my thesis but they are quite old (eethesis document class). In my PDF output, the vertical space before and after the major headings in the table of contents is not consistent.

I want to insert a vertical space between a chapter heading and its first section (Refer to: Related question) but only if the chapter has any sections within. Currently the definitions for l@chapter in eethesis.cls is given below

\vskip 0.75em plus 1pt   % space above chapter line
{\leftskip 2em\relax \rightskip \@tocrmarg \parfillskip -\rightskip
 \parindent 2em\relax\@afterindenttrue
\@tempdima 4em\relax       % width of box holding chapter number
\advance\leftskip \@tempdima \hbox{}\hskip -\leftskip
 \uppercase{#1}\nobreak\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern 
   \@dotsep mu$}\hfill \nobreak \hbox to\@pnumwidth{\hfil\rm #2}\par}
\vskip 0em}  % space below chapter line

and the definition of @chapter in eethe12.sty is

\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
%   \addtocontents{toc}{\protect\vskip{0.75em plus 1pt}} % Add vertical space line
\if@twocolumn                                 % Tests for two-column mode.
 \else \@makechapterhead{\uppercase{#2}}
       \@afterheading                  % Routine called after chapter and
 \fi}                                  % section heading.

Uncommenting the line - Add vertical space line - in the above definition does add a vertical space between the chapter heading and first section but it also increases the space between those chapters that have no sections.

What changes need to be done in order to get consistent spacing before and after all Chapter headings?


Here's a possible solution using a redefinition of \section to test if the space must be added or not (I used the files eethesis.cls and custom_shortcuts.sty found in the link provided); you can adjust the vertical space according to your needs by changing the argument of \addvspace (I chose 10pt for the exampĺe) in the line marked with % change here:


\renewcommand\section{\@startsection {section}{1}{\z@}%
  {-3.5ex \@plus -1ex \@minus -.2ex}%
  {2.3ex \@plus.2ex}%
      \addtocontents{toc}{\protect\addvspace{10pt}}% change here

\title{The Title}
\author{The Author}



\chapter{Test Chapter With Sections}
\section{Test Section One One}
\section{Test Section One Two}
\chapter{Test Chapter Without Sections}
\chapter{Another Test Chapter Without Sections}
\chapter{Another Test Chapter With Sections}
\section{Test Section Three One}
\section{Test Section Three Two}


Your Answer

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

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