I am trying to make a few subtle changes to the default table of contents in document{report}.
- I need the table of contents entries to adhere to the global \doublespacing, except for when an entry exceeds one line. In this case, I need it to wrap ~3/4 of the way through the page, and for the second line to be single-spaced relative to the first.
- I need it to do this for both chapter entries as well as section and subsection entries.
Here's a short compilable example of what I'm trying to do:
\documentclass{report}
\usepackage{setspace}
% Global double spacing
\doublespacing
\begin{document}
\cleardoublepage
\makeatletter
{
\renewcommand{\@pnumwidth}{2em}
\renewcommand{\@tocrmarg}{2em}
\renewcommand*{\l@chapter}[2]{%
\addpenalty{-\@highpenalty}%
\vskip 1.0em
\setlength\@tempdima{1.5em}
\begingroup
\parindent \z@
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip\@tempdima
\hskip -\leftskip
\hangindent=0.75\linewidth
\hangafter=1
\doublespacing
\setstretch{1.0}
{\bfseries #1}\nobreak
\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill
\nobreak #2\par
\endgroup
}
\renewcommand*{\l@section}[2]{%
\addpenalty{\@secpenalty}%
\begingroup
\parindent \z@
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip 2.3em
\hangindent=0.75\linewidth
\hangafter=1
\doublespacing
\setstretch{1.0}
#1\nobreak
\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill
\nobreak #2\par
\endgroup
}
\renewcommand*{\l@subsection}[2]{%
\addpenalty{\@secpenalty}%
\begingroup
\parindent \z@
\rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\advance\leftskip 3.8em
\hangindent=0.75\linewidth
\hangafter=1
\doublespacing
\setstretch{1.0}
#1\nobreak
\leaders\hbox{$\m@th \mkern \@dotsep mu.\mkern \@dotsep mu$}\hfill
\nobreak #2\par
\endgroup
}
\renewcommand{\contentsname}{\MakeUppercase{TABLE OF CONTENTS}}
\tableofcontents
}
\makeatother
\chapter{A Very Long Chapter Title That Will Definitely Require Wrapping To The Second Line in the Table of Contents}
\section{An Example Section Title That Is Long Enough to Wrap and Test This Case}
\subsection{A Subsection Title That Also Wraps to Check Multi-line Behavior}
\chapter{Another Chapter}
\section{Short Section}
\end{document}
Any and all help is greatly appreciated, as I've been banging my head against this wall for quite some time.
Thank you!


setspaceand about (vertical) spacing, I've added these two tags.