[Tex/LaTex] Issue with spacing in table of contents

table of contents

I have tried my best to reduce my code to a MWE. I have a thesis document which has separate files. To show the problem I have removed all the text and just included 1 chapter in this MWE. The main file is as below:

\documentclass[12pt]{report}
\renewcommand{\familydefault}{\rmdefault}


\usepackage{harvard}
\usepackage{amssymb}
\usepackage{amsmath}

% TAMU Thesis Packages
\usepackage[latin9]{inputenc}
\usepackage[letterpaper]{geometry}
\geometry{verbose,tmargin=1.25in,bmargin=1.25in,lmargin=1.4in,rmargin=1.15in}
\pagestyle{plain}
\usepackage[doublespacing]{setspace}
\usepackage{tocloft}
\usepackage[rm, tiny,center, compact]{titlesec}
\usepackage{indentfirst}
\usepackage{epstopdf}
\usepackage{graphicx,float,wrapfig}
\usepackage{etoolbox}
\usepackage{tocvsec2}
\usepackage[titletoc]{appendix}
\usepackage{appendix}
\usepackage{tamuconfig}
\usepackage[font=singlespacing]{caption}

\include{defs}

\begin{document}
\renewcommand{\tamumanuscripttitle}{An analysis of bubble plumes in unstratified stagnant water}
\renewcommand{\tamupapertype}{Dissertation}
\renewcommand{\tamufullname}{Chung Kei Chris LAI}
\renewcommand{\tamudegree}{Doctor of Philosophy}
\renewcommand{\tamuchairone}{Scott A. Socolofsky}

\renewcommand{\tamumemberone}{Kuang-An Chang}
\newcommand{\tamumembertwo}{Hamn-Ching Chen}
\newcommand{\tamumemberthree}{Mohsen Pourahmadi}
\renewcommand{\tamudepthead}{Robin Autenrieth}
\renewcommand{\tamugradmonth}{December}
\renewcommand{\tamugradyear}{2015}
\renewcommand{\tamudepartment}{Civil Engineering}


\input{../lists}  

\pagestyle{plain}
\pagenumbering{arabic}
\setcounter{page}{1}

\input{../ch_01}    

\end{document}

The list file is as follows:

\phantomsection
\addcontentsline{toc}{chapter}{TABLE OF CONTENTS}  

\begin{singlespace}
\renewcommand\contentsname{\normalfont} {\centerline{TABLE OF CONTENTS}}


\setlength{\cftaftertoctitleskip}{1em}
\renewcommand{\cftaftertoctitle}{%
\hfill{\normalfont {Page}\par}}

\setlength{\cftbeforechapskip}{0.2cm}
\setlength{\cftbeforesecskip}{-0.4cm}
\setlength{\cftbeforesubsecskip}{-0.45cm}

\tableofcontents

\end{singlespace}

\pagebreak{}

\phantomsection
\addcontentsline{toc}{chapter}{LIST OF FIGURES}  

\renewcommand{\cftloftitlefont}{\center\normalfont\MakeUppercase}

\setlength{\cftbeforeloftitleskip}{-12pt}
\renewcommand{\cftafterloftitleskip}{12pt}

\renewcommand{\cftafterloftitle}{%
\\[4em]\mbox{}\hspace{4pt}FIGURE\hfill{\normalfont Page}\vskip\baselineskip}

\begingroup

\begin{center}
\begin{singlespace}

\setlength{\cftbeforefigskip}{0.6cm}
\setlength{\cftbeforetabskip}{0.4cm} 

\listoffigures

\end{singlespace}
\end{center}

\pagebreak{}

\phantomsection
\addcontentsline{toc}{chapter}{LIST OF TABLES}  

\renewcommand{\cftlottitlefont}{\center\normalfont\MakeUppercase}

\setlength{\cftbeforelottitleskip}{-12pt} 

\renewcommand{\cftafterlottitleskip}{12pt}

\renewcommand{\cftafterlottitle}{%
\\[4em]\mbox{}\hspace{4pt}TABLE\hfill{\normalfont Page}\vskip\baselineskip}

\begin{center}
\begin{singlespace}


\setlength{\cftbeforetabskip}{0.7cm}

\listoftables 

\end{singlespace}
\end{center}
\endgroup
\pagebreak{}  

Chapter 1 is as below-

\chapter{\uppercase{Budget of turbulent kinetic energy in bubble plumes by acoustic Doppler velocimetry (ADV)}}
\label{ch_TKE}

\begin{flushright}
{\it ``Everything is theoretically impossible, until it is done.''} - Robert A. Heinlein
\end{flushright}


\section{Introduction}\label{sec:intro}  

\section{Laboratory experiments}\label{sec:expt1}

\subsection{Set-up} 

\subsection{Velocities measured by an ADV}

\subsection{Some experiences working with the profiling ADV - Vectrino II}    \label{sec:2_3}

\section{Post-processing of raw ADV data}\label{sec:expt2}

\subsection{Doppler noise estimation and noise-reduced estimates of the stress tensor}

\subsection{Decomposition of streamwise velocity w} \label{sec:5_2}

\subsection{Wavelet analysis on streamwise velocity $\tilde{w}$}


\section{Summary and discussions}\label{sec:conclusion} 

\pagebreak{}

The tamuconfig file is as follows:

\ProvidesPackage{tamuconfig}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Titlepage Commands
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\tamumanuscripttitle}{Default Title}
\newcommand{\tamupapertype}{DissertationOrThesis}
\newcommand{\tamufullname}{Full Name}
\newcommand{\tamudegree}{Doctor of Philosophy}
\newcommand{\tamuchairone}{Chair Name}
\newcommand{\tamumemberone}{Committee Member1}

\newcommand{\tamudepthead}{Department Head}
\newcommand{\tamugradmonth}{MonthofGraduation}
\newcommand{\tamugradyear}{YearofGraduation}
\newcommand{\tamudepartment}{Department Name}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%   Titlesec Customations 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\titleformat{\chapter}{\centering\normalsize}{\thechapter.}{1em}{}
\titleformat{\section}{\centering\normalsize}{\thesection}{1em}{}
\titleformat{\subsection}{\centering\normalsize\it}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\centering\normalsize\it}{\thesubsubsection}{1em}{}

\setcounter{secnumdepth}{3}

\addtocontents{toc}{\protect\renewcommand{\protect\cftchapleader}
    {\protect\cftdotfill{\cftsecdotsep}}}  % puts leader dots on chapters.


%%%%%%%%  Remove the extra vertical space before chapter titles when using     report class %%%%%%%%%%%
 \makeatletter
\def\ttl@mkchap@i#1#2#3#4#5#6#7{%
\ttl@assign\@tempskipa#3\relax\beforetitleunit
\vspace{\@tempskipa}%<<<<<< REMOVE THE * AFTER \vspace
\global\@afterindenttrue
\ifcase#5 \global\@afterindentfalse\fi
\ttl@assign\@tempskipb#4\relax\aftertitleunit
\ttl@topmode{\@tempskipb}{%
    \ttl@select{#6}{#1}{#2}{#7}}%
\ttl@finmarks  % Outside the box!
\@ifundefined{ttlp@#6}{}{\ttlp@write{#6}}}
\makeatother
%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%  TOC Customations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% Aesthetic spacing redefines that look nicer to me than the defaults.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




%%%  Makes the font in the TOC normal.
\renewcommand\cftsecfont{\normalfont}
\renewcommand\cftsecpagefont{\normalfont}

\renewcommand\cftpartfont{\normalfont}
\renewcommand\cftpartpagefont{\normalfont}


\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}} % adds leader dots for parts
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}} % adds leader dots for chapters

\renewcommand{\cftchapaftersnum}{.} % adds a period after chapter numbers in the toc.


\renewcommand\cftsecafterpnum{\vskip\baselineskip} % These lines allow for long toc titles to be displayed single-spaced within.
\renewcommand\cftsubsecafterpnum{\vskip\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip\baselineskip}
\renewcommand\cftchapafterpnum{\vskip\baselineskip}
\renewcommand\cftpartafterpnum{\vskip\baselineskip}




%%%%%%%%%%%  Makes the appear TOC doublespaced and almost singlespaced for sections.
\setlength\cftparskip{-2pt}
\setlength\cftbeforechapskip{0pt}
\setlength\cftbeforepartskip{0pt}
\setlength\cftbeforesubsecskip{-6pt}
\setlength\cftbeforesubsecskip{-6pt}
\setlength\cftbeforesecskip{-6pt}
%%%%%%%%%%%%%%%%%%%%%


%%%%%  These change spacing in the toc.. Leave for now for tweaking.
%\cftsetindents{chapter}{0in}{.3in}
%\cftsetindents{section}{0.5in}{0in}  %%  adjusts Indents and Numwidths for     tocloft. http://tex.stackexchange.com/questions/50471/question-about-indent-   lengths-in-toc
%\cftsetindents{subsection}{1in}{0in}
%\cftsetindents{subsubsection}{1.5in}{0in}
%\cftsetindents{paragraph}{0.5in}{0.5in}



\preto\figure{%  Removes the extra space added before new chapters
  \ifnum\value{figure}=0\addtocontents{lof}{\vskip-10pt}\fi
}
\preto\table{%  Removes the extra space added before new chapters
  \ifnum\value{table}=0\addtocontents{lot}{\vskip-10pt}\fi
}

\renewcommand{\cftloftitlefont}{\hfill\normalsize\rm\uppercase}
\renewcommand{\cftchappagefont}{\normalsize\rm}  % Makes the chapter page     numbers the default size and font.
\renewcommand{\cftchapfont}{\normalsize\rm}
\renewcommand{\cftchapleader}{\normalsize\rm}

\let\chaptermarkOLD\chaptermark
\renewcommand*\chaptermark[1]{\chaptermarkOLD{#1}\addtocontents{thefigure}   {\protect\addvspace{30pt}}}

The table of contents in the output pdf looks like the attached screenshotenter image description here

I want consistent spacing above and below major headings. Since there is a double space between list of tables and chapter 1 heading, I also want the same spacing between chapter main heading and subheading 1.1. The spacing between subheadings that is 1.1 and 1.2 is fine and doesn't need any changes.

Please help me out.

Best Answer

The tocloft package allows the setting of many spaces and dimensions. In this case it seems you want the space above section (and maybe subsection) lines to be larger. The file posted has the line

\setlength{\cftbefo‌​resecskip}{-0.4cm}

If the dimension -0.4cm is changed to something positive, it would cause the space above toc section lines to be larger. I refer you to the documentation of the tocloft package for other possible customizations.

Related Question