
我想使用 amsbook 在目錄中進行小的水平間距調整。我發現「第一章」與其標題之間的水平空間太大,對於章節和小節及其編號和標題也是如此。如何修改這個空間。在我的 MWE 中,我對目錄做了一些其他的小調整,我在這個網站上找到了這些調整。
\documentclass[12pt]{amsbook}
\usepackage{etoolbox}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
% Uppercase 'CHAPTER' label in toc
\patchcmd{\tocchapter}{#1}{\MakeUppercase{#1}}{}{}
\makeatletter
% dots leading to the page number in toc
\renewcommand\@pnumwidth{1em}
\patchcmd{\@tocline}
{\hfil}
{\leaders\hbox{\,.\,}\hfil}
{}{}
% modify spacing in toc
\def\l@chapter{\@tocline{3}{5pt plus1pt}{0pc}{0pt}{}}
\def\l@section{\@tocline{2}{1pt plus1pt}{1.5pc}{0pt}{}}
\def\l@subsection{\@tocline{1}{1pt plus1pt}{4.5pc}{0pt}{}}
\makeatother
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\begin{document}
\frontmatter
\title{My Book}
\author{Me}
% \date{}
\maketitle
\tableofcontents
\mainmatter
\chapter{Preliminaries}
\section{Section One}
\subsection{Subsection One}
\section{Section Two}
\subsection{Subsection One}
\subsection{Subsection Two}
\chapter{Results}
\section{Section One}
\subsection{Subsection One}
\subsection{Subsection Two}
\section{Section Two}
\subsection{Subsection One}
\subsection{Subsection Two}
\end{document}
'''
答案1
您可以透過執行以下操作來獲得正常的字間空間而不是\quad
插入的空間amsbook
\patchcmd{\tocchapter}{\quad}{ }{}{}
\patchcmd{\tocsection}{\quad}{ }{}{}
\patchcmd{\tocsubsection}{\quad}{ }{}{}
您也可以嘗試
\patchcmd{\tocchapter}{\quad}{\enspace}{}{}
\patchcmd{\tocsection}{\quad}{\enspace}{}{}
\patchcmd{\tocsubsection}{\quad}{\enspace}{}{}
或\hspace{<whatever you like>}
代替\enspace
.