Book page numbering for ToC and first pages of chapters

page-numbering

I'm working with the book document class for the first time and I noticed that the page numbering is different for the table of content and the first page of each chapter: instead of being placed on the top of the page, the number is placed on the bottom in these cases.

Why is this the case? I think it is very inconvenient to have to look for the page numbering at a different location in some cases…

So, the second question is: how can I change this? I would like to stick with the default page numbering options but have them consistent for all pages.

This is my minimal example, I am using xelatex in case that is relevant:

\documentclass{book}

\usepackage[british]{babel}
\usepackage{lipsum}

\author{Max}
\title{Test page numbering}

\begin{document}

\frontmatter    
\maketitle

\lipsum

\tableofcontents

\mainmatter 

\chapter{First chapter}
\section{A section}
\lipsum
\section{Another section}
\lipsum[1-10]

\end{document}

Best Answer

As suggested in the comments, you can redefine the plain style that \chapter invokes.

W ithout using additional packages this code will work with 2-sided printing (chapters starting on odd pages, adding a blank page if necessary) or single-sided printing (chapter starting on the next page, odd or even)

See the Chapter 2 page (and the page before) using \documentclass[oneside]{book}

Two side

a

One side

b

\documentclass{book}

%\documentclass[oneside]{book}% try it <<<<<<<<

\makeatletter % added <<<<<<<<<<<<<<
\def\ps@plain{%
    \let\@oddfoot\@empty
    \def\@oddhead{\normalfont\hfil\thepage}}%
\makeatother

\usepackage[british]{babel}
\usepackage{lipsum}

\author{Max}
\title{Test page numbering}

\begin{document}
    
    \frontmatter    
    \maketitle
    
    \lipsum
    
    \tableofcontents
    
    \mainmatter 
    
    \chapter{First chapter}
    \section{A section}
    \lipsum
    \section{Another section}
    \lipsum[1-6]
    \chapter{Second chapter}

\end{document}