amsbookのtocページの水平方向の間隔

Aug 23 2020

amsbookを使用して、目次の水平方向の間隔を少し調整したいと思います。「第1章」とそのタイトルの間の水平方向のスペースが大きすぎて、セクションとサブセクション、およびそれらの番号とタイトルについても同様です。このスペースを変更する方法。私のMWEで、このサイトで見つけたtocの他の小さな調整を行いました。

\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}
'''

回答

2 egreg Aug 23 2020 at 15:38

を実行すると、\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