# TOC customization in amsbook

I am transcribing an old book in LaTeX, trying to preserve the style.

I found the amsbook class to be the perfect solution for me. I produce chapters with \chapter{Thermodynamic Systems} and I get something like "Chapter I - Thermodynamic Systems". When I create the TOC, the word "Chapter" is repeated for each entry, but I want it as a heading for all chapters, and then print only the chapter number.

This is what I get:

Preface.................................................................iii

Introduction.........................................................vii

Chapter I. Thermodynamic Systems.......................1

1. The state of a system......................................1

Chapter II. The First Law of Thermodynamics.........2

(actually, without points) and so on...

This is instead the original layout:

........................................................................Page Preface.................................................................iii

Introduction.........................................................vii

Chapter

I. Thermodynamic Systems....................................1

1. The state of a system......................................1

II. The First Law of Thermodynamics......................2

(sorry for the poor reproduction, you have to imagine that "Chapter", "I" and "II" are vertically aligned.)

Is there also a way to write the word "Page" at the top of the pages numbers and to get the dots, like the original book?

I searched all around the web, but all the packages I found that allow to modify the TOC are incompatible with the amsbook class.

I DO NOT want to remove the word "Chapter" in the actual chapter name, I want to remove it only in the TOC.

Here is an axample of the document:

\documentclass[10pt,twoside,titlepage,reqno]{amsbook}
\usepackage[a5paper]{geometry}
\geometry{papersize={5.375in,8.500in}}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[%hypertex,
unicode=true,
plainpages = false,
pdfpagelabels,
bookmarks=true,
bookmarksnumbered=true,
bookmarksopen=true,
backref=false,
urlcolor  = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures
]{hyperref}
\hypersetup{
pdftitle={Thermodynamics},
pdfauthor={Enrico Fermi},
pdfsubject={Unabridged, unaltered republication of 1937 edition.}
}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lettrine}
\usepackage{type1cm}
\renewcommand{\LettrineTextFont}{\MakeUppercase}
\renewcommand{\thechapter}{\Roman{chapter}}
\usepackage{chngcntr}
\counterwithout{section}{chapter}

\author{\scshape{Enrico Fermi}}
\title{\Huge \MakeUppercase{Thermodynamics}}

\makeindex

\begin{document}

\frontmatter

\maketitle

\makeatletter
\makeatother

\chapter*{Preface}
\lettrine{T}{his} book originated in a course of lectures held at Columbia University,
New York, during the summer session of 1936.

Blablabla...

\begin{flushright}
\textsc{E. Fermi}
\end{flushright}

\tableofcontents

\chapter*{Introduction}
\lettrine{T}{hermodynamics} is mainly concerned with the transformations
of heat into mechanical work and the opposite transformations of mechanical work into heat.

Blablabla...

\mainmatter

\chapter{Thermodynamic Systems}\index{Thermodynamical systems}
\section{The state of a system and its transformations}\index{Thermodynamical state of a system}
The state of a system in mechanics is completely specified at a
given instant of time if the position and velocity of each mass
point of the system are given. For a system composed of a
number $N$ of mass-points, this requires the knowledge of
$6N$ variables.

Blablabla...

\subsection*{A system composed of a chemically defined homogeneous fluid}
\index{Chemically homogeneous systems}\index{Chemically homogeneous fluid}
We can make the following measurements on such a
system: the temperature $t$, the volume $V$, and the pressure $p$.

Blablabla...

\chapter{The First Law of Thermodynamics}
\section{The statement of the first law of thermodynarnics}
Some text...

\chapter{The Second Law of Thermodynamics}\label{chap:2ndLawOfThermo}

\printindex

\end{document}


Thanks in advance for the help!

To remove the word "Chapter" from the chapters lines (see this answer of egreg) and to add the dots to every line you can write the following lines in the preamble:

\makeatletter
\renewcommand\tocchapter[3]{%
}
\renewcommand{\tocsection}[3]{%
}
\makeatother


Moreover, to insert the line with "Chapter" in the TOC, you can add the line

\addtocontents{toc}{\protect\contentsline{chapter}{Chapter}{}{}}


just after the \mainmatter and, to have a line with the word "Page" right-aligned at the beginning of the TOC, add this

\addtocontents{toc}{\protect\contentsline{chapter}{}{\textsc{\small Page}}{}}


just after the \frontmatter.

In other words, the following MWE:

\documentclass[10pt,twoside,titlepage,reqno]{amsbook}
\usepackage[a5paper]{geometry}
\geometry{papersize={5.375in,8.500in}}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[%hypertex,
unicode=true,
plainpages = false,
pdfpagelabels,
bookmarks=true,
bookmarksnumbered=true,
bookmarksopen=true,
backref=false,
urlcolor  = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures
]{hyperref}
\hypersetup{
pdftitle={Thermodynamics},
pdfauthor={Enrico Fermi},
pdfsubject={Unabridged, unaltered republication of 1937 edition.}
}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{lettrine}
\usepackage{type1cm}
\renewcommand{\LettrineTextFont}{\MakeUppercase}
\renewcommand{\thechapter}{\Roman{chapter}}
\usepackage{chngcntr}
\counterwithout{section}{chapter}

\author{\scshape{Enrico Fermi}}
\title{\Huge \MakeUppercase{Thermodynamics}}

\makeindex

\makeatletter
\renewcommand\tocchapter[3]{%
}
\renewcommand{\tocsection}[3]{%
}
\makeatother

\begin{document}

\frontmatter

\maketitle

\makeatletter
\makeatother

\chapter*{Preface}
\lettrine{T}{his} book originated in a course of lectures held at Columbia University,
New York, during the summer session of 1936.

Blablabla...

\begin{flushright}
\textsc{E. Fermi}
\end{flushright}

\tableofcontents

\chapter*{Introduction}
\lettrine{T}{hermodynamics} is mainly concerned with the transformations
of heat into mechanical work and the opposite transformations of mechanical work into heat.

Blablabla...

\mainmatter

\chapter{Thermodynamic Systems}\index{Thermodynamical systems}
\section{The state of a system and its transformations}\index{Thermodynamical state of a system}
The state of a system in mechanics is completely specified at a
given instant of time if the position and velocity of each mass
point of the system are given. For a system composed of a
number $N$ of mass-points, this requires the knowledge of
$6N$ variables.

Blablabla...

\subsection*{A system composed of a chemically defined homogeneous fluid}
\index{Chemically homogeneous systems}\index{Chemically homogeneous fluid}
We can make the following measurements on such a
system: the temperature $t$, the volume $V$, and the pressure $p$.

Blablabla...

\chapter{The First Law of Thermodynamics}
\section{The statement of the first law of thermodynarnics}
Some text...

\chapter{The Second Law of Thermodynamics}\label{chap:2ndLawOfThermo}

\printindex

\end{document}


gives the result:

• Thank you so much @karlkoeller, this is what I was looking for! – Matteo Aug 4 '13 at 20:03
• @user1255231 PS: Do you also want a line with "Page" right-aligned at the beginning of the TOC? – karlkoeller Aug 4 '13 at 20:05
• @user1255231 I modified the answer for accomplishing all your requests. – karlkoeller Aug 4 '13 at 20:42

Here's a modification based on karlkoeller's answer:

\makeatletter
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\rightskip\@pnumwidth plus4em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima #6\nobreak\relax
\dotfill\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
\nobreak
\endgroup
\fi}
\makeatother


and use

\addtocontents{toc}{
\protect\raggedright
\protect\dotfill\textsc{Page}}


as well as

\addtocontents{toc}{
\protect\raggedright
\protect\vspace{8pt plus1pt}
\protect Chapter}


Result: