6

I am using the book.cls and I want that the page number of the first page (only the first page) of every chapter be at the bottom and on the right. And page numbering of the other pages remain intact.

Here is my .tex file: ‎

\documentclass[11pt,a4paper,‎twoside]{book}‎‎
‎\usepackage{lipsum}‎‎‎‎
‎\usepackage{fancybox,‎fancyhdr}‎
‎\pagestyle{fancy}‎
‎\renewcommand{\chaptermark}[1]{%‎
        ‎\markboth{#1}{}}‎
‎\renewcommand{\sectionmark}[1]{%‎
        ‎\markright{\thesection\ #1}}‎
‎\fancyhf{} 
‎\fancyhead[LE]{\small\leftmark‎}‎
‎\fancyhead[RO]{\small\rightmark‎}‎
‎\fancyhead[RE,LO]{\textbf{\thepage}}‎
‎\renewcommand{\headrulewidth}{0pt}‎
‎\renewcommand{\chaptermark}[1]{%‎
‎\markboth{\thechapter\ #1}{}}‎
‎\renewcommand{\sectionmark}[1]{\markright{\thesection\ ‎#1}}‎‎‎
‎\begin{document}‎‎
‎\chapter{Chapter‎ ‎one}‎‎
‎\section{Section‎ ‎one‎‎}‎‎
‎\lipsum[1-‎10‎‎‎]‎‎
‎\end{document}‎‎

How can I do this?

1
  • I think that probably this question would not have been answered if the fancyhdr manual have been carefully read. Commented Oct 21, 2010 at 10:33

2 Answers 2

4

Use the titlesec package's \assignpagestyle to set the page style for \chapter. Something like this.

\usepackage{titlesec}
\newpagestyle{chapterpage}{\setfoot{}{}{\thepage}}
\assignpagestyle\chapter{chapterpage}

Edit: Now that you've added a sample, I know that you're using fancyhdr so the solution is simple:

\fancypagestyle{plain}{
    \fancyhead{}
    \fancyfoot[R]{\textbf{\thepage}}
}
3
  • @TH: Thanks, but your solution doesn't work. In fact, the result is terrible. Because your code typesets "1 Chapter One" in the footer (and also in the header) as well.
    – Malek
    Commented Oct 20, 2010 at 17:55
  • 1
    @Malek: It worked just fine. You neglected to mention what you were actually doing. Now that you've done so, I've edited my answer to provide a simple solution.
    – TH.
    Commented Oct 20, 2010 at 22:04
  • @TH: Thanks very much for your reply. Now it is exactly what I need.
    – Malek
    Commented Oct 21, 2010 at 8:56
3

I assume that you want the first page of evey chapter to have the same layout of the other pages, correct? And probably you are using fancyhdr, isn't it?

If so, maybe this can help you. Otherwise, you can redefine the layout of plain (the style invoked for every \chapter command) pages like this:

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[R]{\thepage} % except the right
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}}

taken from page 8 of fancyhdr user manual.

4
  • "I assume that you want the first page of evey chapter to have the same layout of the other pages, correct?" No! I just want the number of first page of every chapter (only this page) be at the bottom and on the right. Please see my code above.
    – Malek
    Commented Oct 20, 2010 at 17:44
  • I answered your question when there wasn't a line of example code, that's the reason of my assumptions. Again, the answer to your question is in page 8 of the fancyhdr user manual. Probably you should have read the documentation instead of posting the question. Commented Oct 21, 2010 at 10:28
  • I had to push the two last lines (\renewcommand{...}) to before the \fancyfoot to make it work in my case. My intention was to have the first page of a chapter numbered in the center of the bottom footer. However, by default I was getting the header bar without any text on the top of the page. This header was removed by shifting the last two lines to before the \fancyfoot[..]{...}.
    – Diego Dias
    Commented Nov 19, 2017 at 15:03
  • This helped me too. Thank you.
    – Roshni
    Commented Feb 24, 2023 at 14:47

You must log in to answer this question.