我知道,可以使用来更改和的缩进大小chapter
。我正在使用 Latex 模板,不应该使用或任何其他 TOC 包。所以我的问题是如何控制标准 TOC 中的这些缩进?如果我需要修改 cls 文件等,那就没问题了,但我不知道要更改哪些设置。section
subsection
tocloft
\cftsetindents
tocloft
\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}
\addcontentsline{toc}{chapter}{\textbf{DEDICATIONS}}
\include{Dedication}
\addcontentsline{toc}{chapter}{\textbf{ABSTRACT}}
\include{Abstract}
\addcontentsline{toc}{chapter}{\textbf{\textit{ABSTRACT2}}}
\include{ABSTRACT2}
\addcontentsline{toc}{chapter}{\textbf{ACKNOWLEDGEMENTS}}
\include{Acknow}
\addcontentsline{toc}{chapter}{\textbf{APPROVAL}}
\include{Approval}
\addcontentsline{toc}{chapter}{\textbf{DECLARATION}}
\include{Declaration}
\makeatletter
\renewcommand{\@dotsep}{10000}
\makeatother
\tableofcontents
\listoftables
\listoffigures
\newpage
\addcontentsline{toc}{chapter}{\textbf{LIST OF ABBREVIATIONS}}
\include{abbrev}
\mainmatter
\singlespace
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter1}
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter2}
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter3}
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter4}
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter5}
\addtocontents{toc}{\addvspace{.5cm}}
\include{Chapter6}
\addcontentsline{toc}{chapter}{\textbf{REFERENCES/Bibliography}}
\begin{singlespace}
\bibliography{bibfile}
\bibliographystyle{ai}
\end{singlespace}
\newpage
\addcontentsline{toc}{chapter}{\textbf{APPENDICES}}
\appendix
\include{AppendixA}
\include{AppendixB}
\addcontentsline{toc}{chapter}{\textbf{BIODATA OF STUDENT}}
\include{biodata} %
\addcontentsline{toc}{chapter}{\textbf{LIST OF PUBLICATIONS}}
\include{listofpublications} %
\end{document}
更新:我增加了章节标题的缩进,\setlength\@tempdima{5.5em}
但仍然找不到增加章节和小节缩进的方法。https://imgur.com/a/3lUcG
\renewcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\setcounter{secnumdepth}{3}%
\setcounter{tocdepth}{2} %
\addpenalty{-\@highpenalty}%
\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
\advance \leftskip \@tempdima
\hskip -\leftskip
\etchapterheadstyle{#1}\nobreak
% 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}
答案1
\chapter
s、\section
s 和s的 ToC 条目分别由、和\subsection
处理。以下是每个条目的定义(来自\l@chapter
\l@section
\l@subsection
report.cls
):
\newcommand*\l@chapter[2]{%
\ifnum \c@tocdepth >\m@ne
\addpenalty{-\@highpenalty}%
\vskip 1.0em \@plus\p@
\setlength\@tempdima{1.5em}%
\begingroup
\parindent \z@ \rightskip \@pnumwidth
\parfillskip -\@pnumwidth
\leavevmode \bfseries
\advance\leftskip\@tempdima
\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}}
在 中\l@chapter
,长度\@tempdima
指定容纳章节号的框宽度。如上所示,默认定义是1.5em
。您可以使用以下命令更改此设置
\usepackage{etoolbox}
\makeatletter
% \patchcmd{<cmd>}{<search>}{<replace>}{<success>}{<failure>}
\patchcmd{\l@chapter}{1.5em}{5.5em}{}{}
\makeatother
例如,将框宽度增加到5.5em
。
注意\l@section
的定义也使用1.5em
作为第一个长度参数,后跟2.3em
。第一个长度是缩进,而第二个长度是包含部分编号的框的宽度。第一个长度为\l@subsection
(3.8em
或1.5em
+ 2.3em
),并将其编号放在宽度为 的框中3.2em
。因此,子级别的缩进似乎是其父级别的缩进和父级框宽度的总和。考虑到这一点,应该有一个( + )\l@subsubsection
的缩进:7em
3.8em
3.2em
\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
看那个!
您可以使用以下方法将缩进更改\section
为与数字框宽度\subsection
一致5.5em
\l@chapter
\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