# Can't change place of footer and header page numbers [duplicate]

I'm using the command \pagestype{myheadings} to make sure that the page header contains nothing else that the page number.

However, I can't manage to make the page number of the first page of chapter to be displayed up in the page corner.

Here is a sample code of what I'm doing so far:

\documentclass[12pt,a4paper]{book}

\usepackage[T1]{fontenc}
\usepackage[french]{babel}

\title{Test book}
\author{Someone}
\date{\today}

\usepackage{lipsum}

\begin{document}
\sloppy
\maketitle

\chapter{First chapter}
\lipsum[1-100]

\backmatter
\tableofcontents
\end{document}


Best rgards!

• Welcome to TeX.SE. I appreciate that you gave a bit of sample code. For future questions, it would help if you gave a complete sample code. For this one, you've not shown us how you define myheadings, and not shown what package you're using to help you do that. – Teepeemm Jan 15 at 14:50
• Do you want the page number to be in the corner for all pages, or just the first page of the chapter? Have you considered using the KOMA-Script class scrbook? – likethevegetable Jan 15 at 16:15

The book class uses the plain page style for the first page of the chapter. Here is the definition in book.cls:

\newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
----------->>  \thispagestyle{plain}%    <<-----------
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter}


There are at least two ways to change this.

Using the fancyhdr package and redefining the plain style (see pages 12-13 of the documentation).

\usepackage{fancyhdr}
\fancypagestyle{plain}{%
\fancyhf{}%
\renewcommand{\footrulewidth}{0pt}%
}


Via etoolbox:

\usepackage{etoolbox}

\makeatletter