1

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).

Linkas
  • 145
  • 2
    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 –  Jan 26 '15 at 17:29
  • 2
    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 –  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
  • @GonzaloMedina This works! – Linkas Jan 26 '15 at 18:18
  • Usually people want to achieve exactly that behaviour ;-) Where did you get the class? If you are required to use this, you might be required to have those pages completely blank. – Johannes_B Jan 26 '15 at 20:37
  • This class is a part of unofficial document. I realized that my document must have page number on every page. – Linkas Jan 26 '15 at 20:48

1 Answers1

4

Add the following lines

\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.

karlkoeller
  • 124,410