[Tex/LaTex] Editing the toc page with amsbook document class

amsbooktable of contents

enter image description here

I'd like to change 'Contents' to say 'TABLE OF CONTENTS' in all capital letters. I would like for them to read as 'CHAPTER 1.' instead of just 'Chapter 1.'

Also, excuse me for being too needy, I'd like to have dots running from the chapter title to the page number.

I know I'm asking for a lot, but I've been covering 0 ground trying to find references on this stuff. I'm currently using the amsbook document class. I've tried to include tocloft, but the package wouldn't even let me run \tableofcontents, which leads me to believe that there is a conflict somehow.

Thanks in advance!

Best Answer

Three simple patches:

\documentclass{amsbook}
\usepackage{etoolbox}

% 'Table of contents' instead of 'Contents'
\renewcommand{\contentsname}{Table of contents}
% Use the next line if you want capital letters
%\renewcommand{\contentsname}{\MakeUppercase{Table of contents}}

% Uppercase 'CHAPTER' label in toc
\patchcmd{\tocchapter}{#1}{\MakeUppercase{#1}}{}{}

% Leader dots in toc
\makeatletter
%\renewcommand\@pnumwidth{1em} % <-- depending on the total number of pages
\patchcmd{\@tocline}
  {\hfil}
  {\leaders\hbox{\,.\,}\hfil}
  {}{}
\makeatother

\begin{document}

\frontmatter

\tableofcontents

\mainmatter

\chapter{Introduction}

\chapter{Seminorms and the Minkowski functional}

\chapter{Convex polytopes}
\section{Convex}
\section{Polytopes}

\end{document}

The normal value of \@pnumwidth is 1.6em; reduce it as shown if you have less than 100 pages (or adjust the size to suit); in the first picture the default value is used, in the second one 1em is used.

\@pnumwidth at 1.6em

enter image description here

\@pnumwidth at 1em

enter image description here

Related Question