# Change indent in standard table of content (not tocloft)

I know that the indenting size of chapter, section and subsection can be changed in tocloft package using \cftsetindents. I am using a Latex template and I shouldn't use tocloft or any other TOC packages. So my question is how can I control those indents in the standard TOC? it's okay if I need to modify the cls files, etc but I don't know what are the settings to be changed.

\documentclass[singlespace,tocchapterhead,a4paper,openright,twoside]{MyThesisEnglish}
\usepackage{paralist}
\usepackage{natbib}
\usepackage[figuresright]{rotating}
\usepackage{lscape}
\usepackage[caption=false]{subfig}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{calc}
\usepackage{mathrsfs}
\usepackage{stmaryrd}
\usepackage{eucal}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{epstopdf}
\usepackage{epsfig}
\usepackage{setspace}
\usepackage{color}
\usepackage{epstopdf}
\usepackage{dsfont}
\usepackage{algorithmic}
\usepackage{textcomp}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{url}
\usepackage{tipa}
\usepackage{array}
\citestyle{unsrt}
\usepackage[top=25mm, bottom=25mm, left=40mm, right=25mm]{geometry}

\begin{document}
\pagenumbering{roman}

\include{Title}

\include{Dedication}

\include{Abstract}

\include{ABSTRACT2}

\include{Acknow}

\include{Approval}

\include{Declaration}

\makeatletter
\renewcommand{\@dotsep}{10000}
\makeatother

\tableofcontents
\listoftables
\listoffigures
\newpage
\include{abbrev}

\mainmatter
\singlespace

\include{Chapter1}
\include{Chapter2}
\include{Chapter3}
\include{Chapter4}
\include{Chapter5}
\include{Chapter6}

\begin{singlespace}
\bibliography{bibfile}
\bibliographystyle{ai}
\end{singlespace}

\newpage
\appendix
\include{AppendixA}
\include{AppendixB}

\include{biodata}                                                %
\include{listofpublications}                                    %
\end{document}


Update: I increased the indention for chapter titles using \setlength\@tempdima{5.5em} but still couldn't find the way to increase the indention of sections and subsections. https://imgur.com/a/3lUcG

\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\setcounter{secnumdepth}{3}%
\setcounter{tocdepth}{2} %
\vskip .1cm \@plus \p@ %{the v-distance between the headings in the contents}
\setlength\@tempdima{5.5em}% %{the distance between the number of the chapter and its title}
\begingroup
\parindent\z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode
\hskip  -\leftskip
% CCW: The following 3 lines add dots to the chapter TOC listings
\leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}

• Welcome to TeX SX! Unrelated: epsfig is totally obsolete (for more than twenty years) and should be replaced with \includegraphics. Is there any reason not to use a toc package? You load geometry, which certainly modifies the general layout. Jan 9, 2018 at 19:59
• You're loading epstopdf twice, by the way
– user31729
Jan 9, 2018 at 19:59
• @Bernard Thanks for your reminder about theepsfig package. Other toc packages change the appearance of the table of content and I don't have time to change them back to the original design. I just need to increase the indents. Jan 9, 2018 at 20:09
• The chapter (for example) TOC entry is formatted by \l@chapter, so search MyThesisEnglish.cls for \l@chapter an modify accordingly. Often these use \@dottedtocline where the indentation is the second argument. Jan 9, 2018 at 21:35
• And you probably don't need to load epstopdf at all unless you're using a really old version of TeX.
– cfr
Jan 10, 2018 at 0:47

The ToC entries for \chapters, \sections and \subsections are handled by \l@chapter, \l@section and \l@subsection, respectively. Here are the definitions of each (from report.cls):

\newcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\hskip -\leftskip
#1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
\penalty\@highpenalty
\endgroup
\fi}
\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}


Within \l@chapter, the length \@tempdima specifies the box width that holds the chapter number. The default definition, as you can see above, is 1.5em. You can change this using the following

\usepackage{etoolbox}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\l@chapter}{1.5em}{5.5em}{}{}
\makeatother


to increase the box width to 5.5em, say.

Note how \l@section's definition also uses 1.5em as the first length parameter, followed by 2.3em. The first length is the indentation, while the second length is the width of the box containing the section number. The first length in \l@subsection is 3.8em (or 1.5em + 2.3em) and puts its number in a box of width 3.2em. So it seems the indentation of the sub-level is the sum of the indentation of its parent level and the parent's box width. With this is mind, \l@subsubsection should have an indentation of 7em (3.8em + 3.2em):

\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}


Look at that!

You can change the \section and \subsection indentation to now coincide with your 5.5em \l@chapter number-box width using

\makeatletter
\patchcmd{\l@section}{5.5em}{2.3em}{}{}% Since \l@chapter uses 5.5em for \@tempdima
\patchcmd{\l@subsection}{7.8em}{3.2em}{}{}% Since \l@section uses 5.5em + 2.3em
\makeatletter

• Thanks, this works well. \patchcmd{\l@chapter}{1.5em}{5.5em}{}{} \patchcmd{\l@section}{1.5em}{5.5em}{}{} \patchcmd{\l@subsection}{3.8em}{7.8em}{}{} The only problem is that the chapter titles are long and when line breaks there is double-space gap between the first line and the second line of the chapter title. How to remove the extra space? Jan 10, 2018 at 9:53
• @R.Toward: That may be related to your use of \addtocontents{toc}{\addvspace{.5cm}} before including every chapter. Perhaps try \addtocontents{toc}{\par\addvspace{.5cm}} (can't test it since I don't have your \documentclass or chapters).
• Adding \par or removing the {\addvspace{.5cm}} doesn't affect the result. I have uploaded the cls file here. textuploader.com/dmdg6 Jan 10, 2018 at 16:55