1

I am preparing the table of contents for my thesis via the titletoc package. Specifically, I have a long chapter title that continues through multiple lines which are double spaced. However, I need them to be single spaced. For the rest of the table of contents, i.e., spacing between different chapter titles must be double spaced. Is there a specific way through which I can do this in the titletoc package?

A Sample Table of Contents

Attached is the code that I am using:

\documentclass{report}

\usepackage[indentafter]{titlesec} 
\usepackage{titletoc}
\usepackage{setspace}
\usepackage{lipsum}

\renewcommand{\chaptername}{CHAPTER}

\setcounter{tocdepth}{0} %% changes toc entry appearance
\newcommand{\setupname}[1][\chaptername]{
    \titlecontents{chapter}[0pt]{\vspace{1ex}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}[]
}

\titleformat{\chapter}[hang]{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
    \begin{spacing}{1.75}
        \renewcommand*\contentsname{TABLE OF CONTENTS}
        \tableofcontents
        \cleardoublepage
        \setupname
        \chapter{INTRODUCTION}
        \lipsum
        
        \section{Problem Statement and Organization}
        \lipsum
        
        \section{Detailed Investigations}
        \lipsum

        \chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}
        \lipsum
                
        \section{Problem Statement and Organization}
        \lipsum
        
        \section{Detailed Investigations}
        \lipsum
        
        \chapter{CONCLUSION}
        \lipsum
        
    \end{spacing}
\end{document}
3
  • Hello Vikram, could you provide a MWE? Commented Jun 23, 2021 at 7:39
  • Hi @DrecksHippy, I have included the code that I am using. Thank you for your help. Commented Jun 23, 2021 at 16:18
  • the MWE would be more helpfull if you removed the unnecessary lines ;) But is it an option for you, to put the \tableofcontents command outside the spacing environment and then change the \vspace{1ex} in your \setupname command to \vspace{1.75\baselineskip}? Commented Jun 25, 2021 at 9:35

2 Answers 2

0

As suggested in my comment to the question, you can put the \tableofcontents outside the spacing environmont to prevent more linespacing in the first place. Then to get back the additional space between to entries in the toc, add some space in the 3rd parameter of the \titlecontents command, that is the code that's put before every toc entry:

documentclass[12pt]{report}

\usepackage{setspace}
\usepackage[indentafter]{titlesec}
\usepackage{titletoc}
\setcounter{tocdepth}{0}
\renewcommand{\chaptername}{CHAPTER}

\newcommand{\setupname}[1][\chaptername]{ % set \vspace to 1.75\baselineskip
    \titlecontents{chapter}[0pt]{\vspace{1.75\baselineskip}}{#1~\thecontentslabel:\quad}{}{\mdseries\titlerule*[0.75em]{.}\contentspage}
}

\titleformat{\chapter}[hang]{\mdseries\large}{\chaptertitlename\ \thechapter:}{1em}{\centering}
\begin{document}
    \renewcommand*\contentsname{TABLE OF CONTENTS}
    \tableofcontents
    \begin{spacing}{1.75}
        \cleardoublepage
        \pagenumbering{arabic}
        \setupname
        \chapter{INTRODUCTION}\label{chap:intro}
        
        \chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}\label{chap:intro}
        
        \chapter{REFERENCES}
        
    \end{spacing}
    
\end{document}

enter image description here

0

I wouldn't enclose the whole document in a \spacing environment: just issue \setstretch{1.75} in the document preamble. You can set \singlespacing in the code for the \titlecontents.

\documentclass{report}

\usepackage[indentafter]{titlesec} 
\usepackage{titletoc}
\usepackage{setspace}
\usepackage{lipsum}

\renewcommand{\chaptername}{CHAPTER}
\renewcommand*\contentsname{TABLE OF CONTENTS}

\titleformat{\chapter}[hang]
  {\mdseries\large}
  {\chaptertitlename\ \thechapter:}
  {1em}
  {\centering}
\titlecontents{chapter}
  [0pt]
  {\vspace{1ex}\singlespacing}
  {\chaptername~\thecontentslabel:\quad}
  {}
  {\mdseries\titlerule*[0.75em]{.}\contentspage}


\setcounter{tocdepth}{0} %% changes toc entry appearance

\setstretch{1.75}

\begin{document}

\tableofcontents

\cleardoublepage

\chapter{INTRODUCTION}
\lipsum

\section{Problem Statement and Organization}
\lipsum

\section{Detailed Investigations}
\lipsum

\chapter{I AM A VERY LONG CHAPTER, BUT I NEED TO BE SINGLE SPACED USING THE TITLETOC PACKAGE}
\lipsum

\section{Problem Statement and Organization}
\lipsum

\section{Detailed Investigations}
\lipsum

\chapter{CONCLUSION}
\lipsum

\end{document}

enter image description here

You must log in to answer this question.

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