How do you change fancy page numbering style after specific point in report

fancyhdrheader-footerpage-numbering

I'm writing a report in which I want to have separate numbering styles before and after the introduction. For the executive summary and toc I want to have no page numbering, and following this (up to the introduction) I want to have lowercase roman numeral numbering in the bottom right corner, for example just 'iv'. For the introduction onwards I want arabic numbering in the style 'Page X of X' in the bottom right corner.

enter image description here

I've got the correct styling for the latter sections, however the method I've used to do this also applies this style to the front matter (e.g. 'Page ii of 2').

enter image description here

I'm unsure how to redefine the \rfoot style after a particular section or how to overwrite the numbering format on particular pages, but retain the fancy page styling.

Below is a MWE of my report.

\documentclass[a4paper,draft, 12pt]{report}

\usepackage[top=2cm,left=2cm,right=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}

\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}

\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{fancy}
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\makeatother

\begin{document}

\chapter*{Executive Summary}
\thispagestyle{empty}

Some text

\tableofcontents
\thispagestyle{empty}

\chapter*{Glossary}
\pagenumbering{roman}

\chapter*{List of abbreviations}

\listoffigures

\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}

\pagenumbering{arabic}

Some text

\chapter{First Chapter}

Some text

\end{document}

Best Answer

The best way is to define different page styles for the different parts. For the Executive summary you can use \pagestyle{empty} as you apparently don't want any headers or footers there. For the two other parts I defined two page styles frontmatter and mainmatter, that contains the footer definitions. I also put the \pagenumbering command there to keep everything together.

Please note that usually it is important to give a \newpage, \clearpage or \cleardoublepage (whatever is appropriate) before the \pagestyle command, otherwise the previous page might be affected.

If you want to add headers, it is best to do that inside the \fancypagestyle commands too.

And, by the way, I generally advise against the use of the old-fashioned commands like \rfoot. It is usually better to use \fancyfoot etc, especially if you want to differentiate between even and odd pages.

\documentclass[a4paper,draft, 12pt]{report}

\usepackage[top=2cm,left=2cm,right=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{lastpage}
\pagestyle{fancy}
\fancyhf{}
\fancypagestyle{frontmatter}{
  \pagenumbering{roman}
  \rfoot{\thepage}
}
\fancypagestyle{mainmatter}{
  \pagenumbering{arabic}
  \rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
}

\makeatletter
\renewcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \thispagestyle{fancy}
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\makeatother

\begin{document}
\pagestyle{empty}
\chapter*{Executive Summary}
\thispagestyle{empty}

Some text

\clearpage
\pagestyle{frontmatter}
\tableofcontents
\thispagestyle{empty}

\chapter*{Glossary}

\chapter*{List of abbreviations}

\listoffigures

\clearpage
\pagestyle{mainmatter}
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}


Some text

\chapter{First Chapter}

Some text

\end{document}