4

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}
  • 1
    Welcome to TeX.SE! You can get some ideas in here: tex.stackexchange.com/q/56546. Do you really need doublespacing between the entries of toc, lof, lot? I would not touch this and set the \doublespacing behind \addcontentsline{toc}{chapter}{List of Tables}. Don't you think, the double spaced titles look strange? – LaRiFaRi Jun 23 '14 at 10:33
  • 2
    Hi @LaRiFaRi, unfortunately the requirement is to double space between different entries but single space within each entry in the ToC, LoF, and LoT. Additionally, I am also trying to change the line spacing of all chapter titles, section titles, and subsection titles which occupy multiple lines to be single spaced in the body of the thesis. Since this is another problem, related to spacing of titles as they appear in the body of the thesis, I left it out of the above question. – Zorro Jun 23 '14 at 22:02
3

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

1

I faced similar issues and could not find an elegant solution online. Eventually, I could hack some lines in the code and found a workaround which worked for my dissertation submission.

In Preamble:

\usepackage{tocloft}               % For table of contents formatting
\usepackage{setspace}              % For spacing

%% Table of contents formatting
\renewcommand{\cftchapdotsep}{\cftdotsep}   % Give chapters dots too
\renewcommand{\cftchapfont}{\normalfont}    % Change to normal font 
\renewcommand{\cftchapleader}{\normalfont\cftdotfill{\cftchapdotsep}}
\renewcommand{\cftchappagefont}{\normalfont}
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\cfttoctitlefont}{\normalfont\hfill}
\renewcommand{\cftaftertoctitle}{\hfill}
\renewcommand\cftchapafterpnum{\vskip 5pt} % for spacing after each entry
\renewcommand\cftsecafterpnum{\vskip 5pt} % for spacing after each entry
\renewcommand\cftsubsecafterpnum{\vskip 5pt} % for spacing after each entry
\renewcommand\cftsubsubsecafterpnum{\vskip 5pt} % for spacing after each entry
\setlength{\cftbeforetoctitleskip}{0in}

% List of figures formatting
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\cftloftitlefont}{\normalfont\hfill}
\renewcommand{\cftafterloftitle}{\hfill}
\setlength{\cftbeforeloftitleskip}{0in}
\setlength\cftbeforefigskip{\cftbeforechapskip} % for spacing after each entry

% List of tables formatting
\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\cftlottitlefont}{\normalfont\hfill}
\renewcommand{\cftafterlottitle}{\hfill}
\setlength{\cftbeforelottitleskip}{0in}
\setlength\cftbeforetabskip{\cftbeforechapskip} % for spacing after each entry

In the document:

% Generate the table of contents and end it with a new page
\begin{singlespace}
  \tableofcontents{\normalsize}
  \newpage
% Generate a list of figures, making sure to include a table of 
% contents line for the list.
  \addcontentsline{toc}{chapter}{LIST OF TABLES}
  \listoftables
  \newpage
  \addcontentsline{toc}{chapter}{LIST OF FIGURES}
  \listoffigures
\end{singlespace}
\newpage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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