Since the first page of a chapter is handled differently than others, and is actually typeset using the plain
page style via
\thispagestyle{plain}
at a call to \chapter
, one can modify the plain
page style and additionally use fancyhdr
to create a separate page style (fancy
) for the rest of the non-first-chapter-pages.
\documentclass{book}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\newcounter{chappage}[chapter]% chappage is slave to chapter
\renewcommand{\thechappage}{\stepcounter{chappage}\arabic{chappage}}
\usepackage{fancyhdr}% http://ctan.org/pkg/fancyhdr
\fancypagestyle{plain}{% 'plain' page style (used for first page of chapter)
\fancyhf{}% clear all header and footer fields
\renewcommand{\headrulewidth}{0pt}% no header rule
\renewcommand{\footrulewidth}{0.4pt}% footer rule
\fancyhead[LE,RO]{\thechapter-\thechappage}%
\fancyfoot[C]{\thepage}
}
% Regular 'fancy' page style
\fancyhf{}% clear all header and footer fields
\fancyhead[LE,RO]{\thechapter-\thechappage}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0.4pt}% header rule
\renewcommand{\footrulewidth}{0.4pt}% footer rule
\pagestyle{fancy}% Set page style to 'fancy'
\begin{document}
\chapter{First chapter}\lipsum[1-15]
\chapter{Second chapter}\lipsum[1-15]
\chapter{Third chapter}\lipsum[1-15]
\chapter{Last chapter}\lipsum[1-15]
\end{document}
Note that I've added a footer rule on the first chapter page, which can be removed. Also, no marks are added to the inner pages of the chapters, but this can also be added. Since there was no requirement in the original post, it's been kept simple here.
The advantage with this approach is that you are able to modify what you want displayed in the header/footer on the first chapter page separately from that of the other pages, since the chapter first page is usually typeset differently and may require a different look.
Note that modification of the plain
page style will also impact how all the other \chapter
-like first pages look. For example, \tableofcontents
, which typesets as a \chapter*
by default, will also have this. If this is unwanted, a little more work is required.