2

I want to have on the right side of the page a footer "Page 1 of 3". I took this code from another post, but the page number appears both on the right side "Page 2 of 3" and in the centre "2".

How can I fix it?

\documentclass[11pt,a4paper,hidelinks,fleqn]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{amsmath, amssymb}                    
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\chead{\textbf{FE5116}}
\rfoot{Page \thepage\ of \pageref{LastPage}}
\renewcommand{\headrulewidth}{0pt}

\title{Dummy empty page, so that I get the first page with number 2}
\date{}
\begin{document}
\maketitle
\newpage
\section*{Question 1 [25 marks]}
this is a question
\newpage
\section*{Question 1 [25 marks]}
this is a question

\bigskip
%dummy use of math, to center the next line
$$
\text{\textbf{END OF PAPER}}
$$

\end{document}
Fabio
  • 343

1 Answers1

2

You need to actually remove the center part of the footer first, with \cfoot{} or \fancyhf{} (removes both header and footer).

enter image description here

\documentclass[11pt,a4paper,hidelinks,fleqn]{article}
\usepackage[margin=1in]{geometry} 
\usepackage{amsmath, amssymb}                    
\usepackage{lastpage}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{} % clears the header and footer
\fancyhead[C]{\textbf{FE5116}}
\fancyfoot[R]{Page \thepage\ of \pageref{LastPage}}

\renewcommand{\headrulewidth}{0pt}

\title{Dummy empty page, so that I get the first page with number 2}
\date{}
\begin{document}
\maketitle
\newpage
\section*{Question 1 [25 marks]}
this is a question
\newpage
\section*{Question 1 [25 marks]}
this is a question

\bigskip
\begin{center}
\textbf{END OF PAPER}
\end{center}

\end{document}
Torbjørn T.
  • 206,688
  • I think he wants the first page to say "Page 1 of 3". – AML May 02 '18 at 12:08
  • @AML Maybe, but it's not really clear from the question. The obvious thing that's being asked is to remove the page number from the center footer, Fabio will have to clarify if he wants to change the page style of the title page. – Torbjørn T. May 02 '18 at 12:12