[Tex/LaTex] position the page number of whole document to the bottom right

header-footerpage-numbering

I am using Easy thesis template to write my thesis. In the Thesis.cls file it is written like \def\baseclass{book} which I guess it uses book class as the basic one.

I use single sided page.

I have \frontmatter, \mainmatter and \backmatter.

The \frontmatter handles those sections below in roman style and I indicated the positions of the pages numbers in current document:

TITLE page - no page number
DECLARATION - position top right
ABSTRACT (2 pages) - [1st page no page number, 2nd page top right]
ABSTRACT (In Malay language) (2 pages)  - [1st page no page number, 2nd page top right]
ACKNOWLEDGMENTS (2 pages)  -[1st-page bottom center, 2nd and following pages top right]
CONTENTS (4 pages) -[same as above]
LIST OF FIGURES (4 pages) -[same as above]
LIST OF TABLES (2 pages) -[same as above]
LIST OF ABBREVIATIONS (2 pages) -[same as above]
LIST OF SYMBOLS (3 pages) -[same as above]

and the \mainmatter handle

Chapter1  - [1st-page bottom center, 2nd and following pages top right]
Chapter2 -[same as above-]
Chapter3 -[same as above-]
Chapter4 -[same as above-]
Chapter5 -[same as above-]
Chapter6 -[same as above-]
Chapter7 -[same as above-]

finally the \backmatter handles

REFERENCES  - [1st-page bottom center, 2nd and following pages top right]
APENDIX  - [1st-page bottom center, 2nd and following pages top right]
List of Scientific Contributions (3 pages) -[all pages top right]

In the Thesis.cls file, I can see the code for the page setting as below:

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\year}
%\usepackage{setspace}
\RequirePackage{setspace}
\onehalfspacing
\setlength{\parindent}{15pt} % VJ-originally 0pt
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}
\setmarginsrb           { 1.5in}  % left margin
                        { 0.6in}  % top margin
                        { 1.0in}  % right margin
                        { 0.8in}  % bottom margin
                        {  20pt}  % head height
                        {0.25in}  % head sep
                        {   9pt}  % foot height
                        { 0.3in}  % foot sep
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}

By the way, what I want is as below (including the tile pages):

\fronmatter  - [roman style at bottom right]
\mainmatter - [arabic style at bottom right]
\backmatter - [arabic style at bottom right]

Is there any way to do that? I browsed around but none is helping me.

note: I am using fancyhdr package too.

Best Answer

This should work for you: Pages starting a chapter are using the pagestyle plain, at least in the book class, so you need to redefine this style in order to have it consistent. Also, as an aside, the O and E in \fancyfoot[RO,RE]{} are odd and even, respectively, and not needed as you are printing single sided.

\documentclass{book}

\usepackage{fancyhdr}

\fancypagestyle{mystyle}{
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyfoot[R]{\thepage}
}

%Renew plain style for chapter pages
\fancypagestyle{plain}{
\fancyhf{}
\renewcommand\headrulewidth{0pt}
\fancyfoot[R]{\thepage}
}

\title{This is a Thesis}
\author{Me}

\begin{document}


\frontmatter
\pagestyle{empty}

\maketitle


\tableofcontents

\pagestyle{mystyle}
\chapter{Abstract}

\chapter{Bla}


\mainmatter
\chapter{C3}


\section{S1}
\section{S2}

\chapter{C4}


\section{S1}
\section{S2}

\end{document}