I am trying to generate a header/footer layout per the following:
Frontmatter - roman page numbers in footer, right aligned, no header
Mainmatter - arabic page numbers in footer, chapter name and number in header, all right aligned
Backmatter - arabic page numbers in footer, no header, right aligned
Using the below code, I am almost there - except the page numbers are not right aligned in \pagestyle{plain}
\documentclass[11pt,a4paper]{report}
\usepackage{fancyhdr}
\usepackage{lipsum}
%Fancyhdr settings
\lhead{}
\chead{}
\lfoot{}
\cfoot{}
\rfoot{\thepage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
\fancyhead[R]{\chaptername\ \thechapter\ --\ \leftmark}
\fancyhead[L]{}
\renewcommand{\headrulewidth}{0pt}
\begin{document}
\chapter*{Abstract}
\pagestyle{plain}
\pagenumbering{roman}
\lipsum{}
\chapter{Introduction}
\pagestyle{fancy}
\pagenumbering{arabic}
\lipsum{}
\chapter*{Appendix}
\pagestyle{plain}
\lipsum{}
\end{document}
When I redefine the plain
pagestyle footer to be right aligned using
\fancypagestyle{plain}{%
\fancyhf{}% clear all header and footer fields
\rfoot{\thepage}%
}
The header in the fancy
pagestyle is no longer displayed.
I've tried a few workarounds, to no avail. The line \renewcommand{\chaptermark}[1]{\markboth{#1}{#1}}
also appears to have some handling issues when used inside a page style redefinition (i.e. \fancypagestyle{plain}{%
) or if inserted after \begin{document}
Any help would be much appreciated