0

I need some urgent help with my dissertation formatting for the TOC which I am just not able to figure out and have a submission deadline to get my PhD.

I have manually created the TOC (I had to), and need to make the following changes in it:

  1. Triple space from title for List of Figures
  2. Have double space between each entry EXCEPT multi-line titles.
  3. Indent second line if title has two lines or more.

I have tried everything and looked everywhere, but just can't figure this out. I would SERIOUSLY appreciate any help with this asap.

I am attaching the TeX code. I work on Overleaf.

\documentclass[12pt]{article}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{geometry}
\usepackage{setspace}
\usepackage{endnotes}
\usepackage{sectsty}
\usepackage{indentfirst}
\usepackage{graphicx} % Allows including images
\usepackage{footmisc}
\usepackage{etoolbox}
\setlength{\footnotesep}{\baselineskip} %use 1.67\baselineskip for a double space
\usepackage[utf8]{inputenc}
\pagenumbering{roman}

\setcounter{MaxMatrixCols}{10}


\baselineskip = 21pt
\renewcommand
\baselinestretch{1.5}
\newtheorem{defn}{Definition}
\geometry{left=1in,right=1in,top=1in,bottom=1in}
\doublespacing
\makeatletter
\def\@biblabel#1{\hspace*{-\labelsep}}
\makeatother

\renewcommand{\contentsname}
    {\centering \normalsize CONTENTS}


\newcommand{\addsection}[3]{\addtocontents{toc}{\protect\contentsline{section}{\protect\numberline{#1}#2}{#3}}}
\newcommand{\addsubsection}[3]{\addtocontents{toc}{\protect\contentsline{subsection}{\protect\numberline{#1}#2}{#3}}}
\newcommand{\addsubsubsection}[3]{\addtocontents{toc}{\protect\contentsline{subsubsection}{\protect\numberline{#1}#2}{#3}}}


\begin{document}

\setcounter{page}{7}


% Construct contents
\addsection{}{LIST OF FIGURES}{viii}
\addsection{}{LIST OF TABLES}{ix}

\addsection{}{CHAPTERS}{}

\addsection{1}{IT'S A MATCH! OR IS IT? A LAB EXPERIMENT ON MENTORSHIP}{1}
\addsubsection{1.1}{Introduction}{1}
\addsubsection{1.2}{The Mentorship Experiment: Experiment Design}{7}
\addsubsection{1.3}{Treatments}{14}
\addsubsection{1.4}{Implementation}{17}
\addsubsection{1.5}{Experimental Results}{18}
\addsubsection{1.6}{Conclusion}{26}


\addsection{2}{ GENDER DIFFERENCES IN TOP LEADERSHIP ROLES: DOES WORKER BACKLASH MATTER?}{45}
\addsubsection{2.1}{Introduction}{45}
\addsubsection{2.2}{The Leadership Experiment: Experiment Design}{51}
\addsubsection{2.3}{Treatments}{54}
\addsubsection{2.4}{Implementation}{57}
\addsubsection{2.5}{Experimental Results}{58}
\addsubsubsection{2.5.1}{Gender differences in the decision to be manager}{59}
\addsubsubsection{2.5.2}{Gender differences in managers' decision-making}{62}
\addsubsubsection{2.5.3}{Gender differences in leadership style}{67}
\addsubsubsection{2.5.4}{Gender differences in the extent of received worker backlash}{68}
\addsubsection{2.6}{Conclusion}{70}

\addsection{3}{DEGREES OF EQUALITY: WHY ARE THERE FEWER WOMEN IN UNDERGRADUATE ECONOMICS?}{82}
\addsubsection{3.1}{Introduction}{82}
\addsubsection{3.2}{Literature Review}{83}
\addsubsection{3.3}{Experiment Design}{89}
\addsubsection{3.4}{Empirical Strategy}{91}
\addsubsection{3.5}{Implementation}{92}
\addsubsection{3.6}{Results}{93}
\addsubsection{3.7}{Strategy for the full scale study}{95}
\addsubsection{3.8}{Conclusion}{97}
    
\addsection{}{APPENDIX}{106}
\addsection{}{BIBLIOGRAPHY}{128}


\tableofcontents

\end{document}
2
  • 1
    You can use \addtocontents{toc}{\vskip2\baselineskip} in between your \addsection commands.
    – Lupino
    Commented Jul 24, 2020 at 11:10
  • Thank you so much!! This worked perfectly in inserting a Triple space from title for List of Figures! Any suggestions on how to have a single space for multi-line titles, with the second line indented as well? Thank you, thank you!!! Commented Jul 24, 2020 at 13:09

1 Answer 1

0

Any suggestions on how to have a single space for multi-line titles, with the second line indented as well?

In article.cls, \l@section is defined as follows:

\newcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}

So basically what you need to do is to modify this. In your preamble you should add

\makeatletter
\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{1.0em \@plus\p@}%
    \setlength\@tempdima{1.5em}%
    \begingroup
      \setstretch{1}%
      \hangindent\@tempdima
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
    \endgroup
  \fi}
\makeatother

Where \setstretch{1} is a command for a single space and \hangindent\@tempdima is a command for an indent of the second line.

Result: Result


As for subsection, there is a similar solution:

\makeatletter
\renewcommand*\l@subsection[2]{%
  \ifnum 2>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\@tempdima\baselineskip
    \setstretch{1}%
    \advance\@tempdima-\baselineskip
    \setlength{\parskip}{\@tempdima}%
    \hangindent1.5em\relax
    \leftskip 1.5em\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent 1.5em\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima 2.3em\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#1}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}%
     \par}%
  \fi}
\makeatother

In this solution,

    \@tempdima\baselineskip
    \setstretch{1}%
    \advance\@tempdima-\baselineskip
    \setlength{\parskip}{\@tempdima}%
    \hangindent1.5em\relax

is the added part to the definition of \l@subsection in article.cls and latex.ltx.

Result: enter image description here


Just in case, this is for subsubsection.

\makeatletter
\renewcommand*\l@subsubsection[2]{%
  \ifnum 3>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\@tempdima\baselineskip
    \setstretch{1}%
    \advance\@tempdima-\baselineskip
    \setlength{\parskip}{\@tempdima}%
    \hangindent1.5em\relax
    \leftskip 3.8em\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent 3.8em\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima 3.2em\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#1}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #2}%
     \par}%
  \fi}
\makeatother
7
  • The multi-line title is still double spaced. I can't figure out how to single space it. And the second line of the multi-line title needs to start with a paragraph indent Commented Jul 24, 2020 at 15:03
  • I saw your point. I have edited my answer: is this answering your question?
    – domperor
    Commented Jul 24, 2020 at 15:36
  • It works perfectly!!!! Thank you so much!! I see the logic. One last question: If I had to do the same with multi-line titles in the subsection, how should I modify your preamble code? Commented Jul 24, 2020 at 15:46
  • I am happy to hear that worked. I have edited my answer and have written about the subsection.
    – domperor
    Commented Jul 24, 2020 at 16:13
  • Have just written about subsubsection as well, just in case.
    – domperor
    Commented Jul 24, 2020 at 16:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .