13

I am writing my dissertation. My university requires that the document be double-spaced; I am using the setspace package to do this. However, I must single-space entries of the table of contents that exceed one line in length. What is the best way to do this?

One solution might be to put short titles in the table of contents. However, my university's requirements do not allow this.

Also, from Googling, I have gotten the impression that what I want to do is possible using the tocloft package. However, even after reading the documentation for that package, I'm not sure how.

2 Answers 2

19

Here's a possible solution using the singlespace environment from setspace for the table of contents and tocloft to redefine the \cftXafterpnum commands to add the necessary space after the ToC entries:

\documentclass{article}
\usepackage[doublespacing]{setspace}
\usepackage{tocloft}

\renewcommand\cftsecafterpnum{\vskip\baselineskip}
\renewcommand\cftsubsecafterpnum{\vskip\baselineskip}
\renewcommand\cftsubsubsecafterpnum{\vskip\baselineskip}

\begin{document}

\begin{singlespace}
\tableofcontents
\end{singlespace}

\section{A section with a very long title that spans several lines - even in the ToC}

\subsection{A subsection}

\subsubsection{A subsection}

\end{document}

enter image description here

0
5

An approximate solution is to typeset the ToC as a whole single-spaced -- this may be done by enclosing \tableofcontents in a singlespace environment.

EDIT: To add to the delusion that the ToC is typeset double-spaced, one may fiddle with the definition of internal ToC macros.

\documentclass{article}

\usepackage[doublespacing]{setspace}

\makeatletter

\renewcommand*\l@section[2]{%
  \ifnum \c@tocdepth >\z@
    \addpenalty\@secpenalty
    \addvspace{2.0em \@plus\p@}% Replaced "1.0em" with "2.0em"
    \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}

\renewcommand*\l@subsection{\addvspace{1em}\@dottedtocline{2}{1.5em}{2.3em}}
\renewcommand*\l@subsubsection{\addvspace{1em}\@dottedtocline{3}{3.8em}{3.2em}}

\makeatother

\usepackage{lipsum}

\begin{document}

\begin{singlespace}
\tableofcontents
\end{singlespace}

\section{A section with a very long title that spans several lines - even in the ToC}

\subsection{A subsection}

\lipsum[1]

\end{document}

enter image description here

1
  • How do you make the section singlespaced outside of the table of contents? Jan 30, 2021 at 5:25

You must log in to answer this question.

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