# Pagestyle plain. No page number on last page of chapter

I am using plain pagestyle. Last page of every chapter doesn't have page number. This is my master page:

\documentclass[a4paper,onecolumn,oneside,11pt,wide,floatssmall]{mwrep}
\usepackage{bookman}
\usepackage{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\pagestyle{plain}

\usepackage[sort, compress]{cite}

\usepackage{pgfplots}
\usepackage[pdftex, bookmarks=false]{hyperref}

\begin{document}

\pagenumbering{roman}
\renewcommand{\baselinestretch}{1.0}
\raggedbottom
\input {title}

\tableofcontents

\newpage
\pagenumbering{arabic}
\setcounter{page}{1}

\input {chap_a}
\input {chap_b}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Files: chap_a, chap_b contains text. Chapter chap_a and chap_b are two A4 pages long. Second page of chap_a doesn't have page number. chap_a.tex and chap_b.tex files are identical:

\chapter {WSS}
\label{chap:wss}
\section{WSS}
aa bb ...
aa bb

\subsection{BBAA}
bb aa ...
bb aa

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:

How can I put page number on these pages?

Hint: When I change pagestyle: pagestyle{headings} instead of pagestyle{plain} I have page numbers on every page in header except first page in every chapter, which doesn't have page number in footer (I read that it should have).

• Welcome to TeX.SX! What's inside of chap_a.tex etc? \pagenumbering{arabic} sets the page number to 1 usually, it's not necessary to use \setcounter{page}{1} explicitly – user31729 Jan 26 '15 at 17:29
• The class redefines \cleardoublepage so that if it needs to make an empty page to get the next chapter open on the right it uses the blank page style rather than the default one. that seems to be a major aim of the class but \makeatletter\let\ps@blank\ps@plain\makeatother probably changes it. – David Carlisle Jan 26 '15 at 17:30
• hyperref should be the last package to be loaded, in most cases – user31729 Jan 26 '15 at 17:30
• @David Carlisle - I put this line before \begin{document} and it doesn't work. Still no page number. – Linkas Jan 26 '15 at 17:46
• Add this to the preamble: \usepackage{etoolbox} \pretocmd{\chapter}{\thispagestyle{plain}}{}{} – Gonzalo Medina Jan 26 '15 at 18:14

\makeatletter
\def\ps@plain{%
\let\@mkboth\@gobbletwo
\let\ps@normal\hf@plain
\let\ps@opening\hf@plain
\let\ps@closing\hf@plain
\let\ps@blank\hf@empty
\ps@normal}
\makeatother

just before

\pagestyle{plain}

and the problem is solved.