\documentclass{mwrep}
%page number on the end of chapter
\makeatletter
\let\ps@closing\ps@plain
\makeatother
%margins
\usepackage{anysize}
\marginsize{3cm}{3cm}{2cm}{2cm}
\usepackage{lipsum}
%mark
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{}\chead{}\rhead{}\lfoot{}\cfoot{}\rfoot{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
%mark
\begin{document}
\chapter{AAAAAAA}
\section{aaaaaaa}
\lipsum
\section{bbbbbbb}
\lipsum
\section{ccccccc}
\lipsum
\chapter{BBBBBBB}
\section{aaaaaaa}
\lipsum
\section{bbbbbbb}
\lipsum
\section{ccccccc}
\lipsum
\chapter{CCCCCCC}
\section{aaaaaaa}
\lipsum
\section{bbbbbbb}
\lipsum
\section{ccccccc}
\lipsum
\end{document}
When you remove code between %mark
s, you get a number on every page.
When I use fancyhdr
, those settings are overwritten and page number is ommited at the beginning and the end of chapter. Is there a way to fix that? I'm only using fancyhdr
to change position of page number.
Best Answer
The
mwrep
class has a very peculiar way of managing page styles, so its interaction withfancyhdr
might be difficult; however this seems to work:We simply redefine the
opening
andclosing
page styles so that they usefancyhdr
way of doing the business.Also remove the code you have regarding
\ps@closing
.A solution without
fancyhdr
might beAll things considered, I prefer the first solution, albeit a bit long, because it lets you customize the page style in case of needs just by using the commands provided by
fancyhdr
rather than going into low level commands such as\@oddfoot
and so on.