19

I'm trying to add the preface to the contents along with the page on the far right.

I had written it as following:

\chapter*{Preface}

but it does not appear on the contents. If I write it as

\chapter{Preface}

then it would be the first chapter of the book and I don't want this at all...

How can I do that?

Tolaso
  • 193

2 Answers2

29

Add the line

\addcontentsline{toc}{chapter}{Preface}

Just after

\chapter*{Preface}

MWE

\documentclass{book}

\begin{document}
\tableofcontents
\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}
\chapter{First}
\end{document} 

Output

enter image description here

If you want a different alignment like this one

enter image description here

use instead

\addcontentsline{toc}{chapter}{\protect\numberline{}Preface}
karlkoeller
  • 124,410
  • @karlkoeller I personally had to use \protect\numberline{~} to make sure the alignment went through. Thanks for the pointer! – Tom Apr 12 '16 at 12:56
7

I'd modify \frontmatter and \mainmatter to do continuous (arabic) numbering and exploit the fact that chapters are not numbered in the \frontmatter.

\documentclass{book}

\makeatletter
\renewcommand{\frontmatter}{\cleardoublepage\@mainmatterfalse}
\renewcommand{\mainmatter}{\cleardoublepage\@mainmattertrue}
\makeatother

\begin{document}

\frontmatter
\tableofcontents

\chapter{Preface}

A preface

\chapter{Abstract}

An abstract.

\chapter{Introduction}

An introduction.

\mainmatter

\chapter{First}

\end{document}

It's much easier than remembering to add \addcontentsline.

enter image description here

egreg
  • 1,121,712