[Tex/LaTex] Line spacing in ToC, LoF, and LoT

spacingtable of contentstocloft

I am currently writing my thesis in Latex and the thesis is supposed to be double spaced, so I have used the \doublespacing command in my latex file.

The problem:

Chapter or Section Titles, Figure Captions, and Table Captions which are long tend to split over multiple lines in the Table of Contents, List of Figures, and List of Tables. Currently, the spacing between all lines in the Table of Contents, List of Figures, and List of Tables, are double spaced. However, the multiple lines of a single entry should be single spaced, and the spacing between different entries should be double spaced.

There were similar problems and solutions elsewhere, but non seem to work satisfactorily for me thus far. Moreover, the other solutions don't seem to work properly with the \documentclass{report}.

I have provided a MWE below to describe the problem.

\documentclass[a4paper,12pt]{report}

\usepackage{setspace}
\usepackage{mwe} % just for dummy images
\doublespacing

\begin{document}

\addcontentsline{toc}{chapter}{Contents}
\tableofcontents 

\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

\chapter{Test Chapter with a very very very very long name which splits over multiple lines}

Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer  

\section{This is a long section title which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}

Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer 

\subsection{Another section title}

\begin{figure}[!htb]
\centering
\includegraphics[width=3cm]{example-image}
\caption{This is a long figure caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}
\end{figure}

\begin{figure}[!htb]
\centering
\includegraphics[width=3cm]{example-image}
\caption{This is a short caption}
\end{figure}

\begin{table}[!htb]
\caption{This is a long table caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}
\centering
\begin{tabular}{ l | r }
\hline
  1 & 2 \\
  7 & 8 \\
\hline
\end{tabular}
\end{table}

\begin{table}[!htb]
\caption{This is a short caption.}
\centering
\begin{tabular}{ l | r }
\hline
  1 & 2 \\
  7 & 8 \\
\hline
\end{tabular}
\end{table}

\end{document}

Best Answer

This may or may not work for you in terms of convenience, because it is not automated. But I try to address both the actual question (about TOC, LOF, & LOT) as well as your comment follow-up about chapter & section titles. In both cases, I use stacks to try to resolve the issue.

First, I don't invoke \doublespacing until after the TOC, LOF, & LOT are printed.

Then, for the TOC, LOF, and LOT, I use the optional argument of \chapter, \section, and \caption to insert a \stackunder{}{} at the end of the optional text, which effectively provides a double spacing to the item below it. That process could be automated if you were willing to redefine those sectioning/captioning commands (which I don't do here).

Note: My answer at multiple spacing in TOC is related to this problem. And there, I show how to automate the process by redefining (in that example) \section.

To deal with the double spacing of headings in the report itself, I set an appropriate long-stacking gap when I go into double spaced mode, and then use left-aligned \Longunderstacks to build single-spaced headings. Note though that for sections and lower-level headings, the stack will be fully indented with respect to the section number, rather than wrapped to the left margin (as seen in section 1.1).

\documentclass[a4paper,12pt]{report}

\usepackage{setspace}
\usepackage{mwe} % just for dummy images
\usepackage[usestackEOL]{stackengine}
\setstackgap{L}{\baselineskip}
\def\stacktype{L}

\begin{document}

\addcontentsline{toc}{chapter}{Contents}
\tableofcontents 

\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\listoftables
\addcontentsline{toc}{chapter}{List of Tables}

\doublespacing
\setstackgap{L}{.6\baselineskip}

\chapter
[Test Chapter with a very very very very long name which \\splits over multiple lines\stackunder{}{}]
{\Longunderstack[l]{Test Chapter with a very very\\ very very long name which \\splits over multiple lines}}

Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer  

\section
[This is a long section title which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text\stackunder{}{}]
{\Longunderstack[l]{This is a long section title which splits\\ across multiple lines. Dummy Text\\ Dummy Text Dummy Text Dummy\\ Text}}

Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer Lorem ipsum dolor sit amet, consectetuer 

\subsection{Another section title}

\begin{figure}[!htb]
\centering
\includegraphics[width=3cm]{example-image}
\caption
[This is a long figure caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text\stackunder{}{}]
{This is a long figure caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}
\end{figure}

\begin{figure}[!htb]
\centering
\includegraphics[width=3cm]{example-image}
\caption{This is a short caption}
\end{figure}

\begin{table}[!htb]
\caption
[This is a long table caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text\stackunder{}{}]
{This is a long table caption which splits across multiple lines. Dummy Text Dummy Text Dummy Text Dummy Text}
\centering
\begin{tabular}{ l | r }
\hline
  1 & 2 \\
  7 & 8 \\
\hline
\end{tabular}
\end{table}

\begin{table}[!htb]
\caption{This is a short caption.}
\centering
\begin{tabular}{ l | r }
\hline
  1 & 2 \\
  7 & 8 \\
\hline
\end{tabular}
\end{table}

\end{document}

enter image description here

enter image description here