2

I would like to make a small horizontal spacing adjustment in the table of contents using amsbook. I find the horizontal space between "Chapter 1" and its title too large and similarly for sections and subsections and their numbers and titles. How to modify this space. In my MWE I made some other small adjustments of toc which I found on this site.

\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
  • @egreg Thank you! Exactly what I needed! Thank you!
    – wdacda
    Aug 24, 2020 at 7:53

1 Answer 1

2

You can get a normal interword space instead of the \quad inserted by amsbook by doing

\patchcmd{\tocchapter}{\quad}{ }{}{}
\patchcmd{\tocsection}{\quad}{ }{}{}
\patchcmd{\tocsubsection}{\quad}{ }{}{}

enter image description here

You can also experiment with

\patchcmd{\tocchapter}{\quad}{\enspace}{}{}
\patchcmd{\tocsection}{\quad}{\enspace}{}{}
\patchcmd{\tocsubsection}{\quad}{\enspace}{}{}

or \hspace{<whatever you like>} instead of \enspace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.