Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

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

share|improve this answer
    
This works perfectly. Thanks! –  Andrew Uzzell Mar 28 '12 at 13:32
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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