Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

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

share|improve this answer
add comment

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} 
share|improve this answer
    
I would have bet that if I hadn't added this possibility in my answer, you would have done it. :-) –  karlkoeller Feb 18 at 12:20
    
@karlkoeller It seemed to me that you left it for me intentionally ;) –  Harish Kumar Feb 18 at 13:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.