4

I have a the following document which uses the book class. For some reason, the page number is, on the first page, at the bottom of the page and centered (article like footer). The next page has the number up and on the left (with the chapter title on the right): book like heading.

Why do I have two different ways to show the page number? I would like to have the normal book class heading (i.e. the page 2 heading) for the whole document.

enter image description here

MWE:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{graphicx} 
\usepackage{lmodern}
\usepackage{xspace}
\title{}
\author{}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}
\usepackage{lipsum}
\begin{document}
%\maketitle
\tableofcontents
\onehalfspacing

\frontmatter 

%\include{fichiers/intro}

\mainmatter

%\include{fichiers/chap1}
%\include{fichiers/chap2}
%\include{fichiers/chap3}
%include{fichiers/chap4}
%include{fichiers/ccl}

\appendix
\backmatter 


\end{document}
0

2 Answers 2

4

This is the default behavior for first pages of chapters.

If you want to change this, simply add the following lines in your preamble (package etoolbox is required):

\patchcmd{\chapter}
  {\thispagestyle{plain}}
  {}
  {}
  {}

MWE:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{xspace}
\title{}
\author{}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}
\usepackage{lipsum}
\usepackage{etoolbox}
\patchcmd{\chapter}
  {\thispagestyle{plain}}
  {}
  {}
  {}

\begin{document}
%\maketitle
\tableofcontents
\onehalfspacing

\frontmatter

%\include{fichiers/intro}

\mainmatter

%\include{fichiers/chap1}
%\include{fichiers/chap2}
%\include{fichiers/chap3}
%include{fichiers/chap4}
%include{fichiers/ccl}

\appendix
\backmatter


\end{document} 

Output:

enter image description here

3

Here is another way, noting that the page style headings is used by the book document class. Add these lines to your preamble:

\makeatletter
\let \ps@plain \ps@headings
\makeatother

Full code:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage{xspace}
\title{}
\author{}
\usepackage[english]{babel}
\usepackage{csquotes}
\usepackage[colorlinks]{hyperref}
\usepackage{lipsum}

\makeatletter
\let \ps@plain \ps@headings
\makeatother
\begin{document}
%\maketitle
\tableofcontents
\onehalfspacing

\frontmatter

%\include{fichiers/intro}

\mainmatter

%\include{fichiers/chap1}
%\include{fichiers/chap2}
%\include{fichiers/chap3}
%include{fichiers/chap4}
%include{fichiers/ccl}

\appendix
\backmatter


\end{document} 
2
  • I would have bet that if I hadn't added this possibility in my answer, you would have done it. :-) Feb 18, 2014 at 12:20
  • @karlkoeller It seemed to me that you left it for me intentionally ;)
    – user11232
    Feb 18, 2014 at 13:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .