[Tex/LaTex] How to do custom page numbering

page-numbering

I would like to have page numbers set in a non-default style. (I will have several chapters A, B, C, … and I would like the pages in Chapter A numbered A-1, A-2, … and then the pages in Chapter B numbers B-1, B-2, etc.)

Questions:
(1) Is there a package that supports such numbering?
(2) Alternately (and probably more useful, since I will need to cobble several documents together but it is not that many pages altogether), is there a way to manually set the text written on the foot of a page?

PS: No, this is not by choice. This page numbering is mandated.

Best Answer

You need to redefine the representation for the chapter counter (to use Alphabetic characters), the representation for the page numbers (to include the chapter counter), and make sure that the page counter will reset when the chapter counter is stepped. A little example:

\documentclass{book}
\usepackage{etoolbox}
\usepackage{lipsum}

\renewcommand\thechapter{\Alph{chapter}}% change chapter counter to Alphabetic
\renewcommand\thepage{\thechapter--\arabic{page}}% change page counter (Chapter--page)
\makeatletter
\patchcmd{\@chapter}{\chaptermark{#1}}{\chaptermark{#1}\refstepcounter{page}}{}{}
\@addtoreset{page}{chapter}% resets the page counter when chapter counter is stepped
\makeatother

\begin{document}

\chapter{Test chapter one}
\lipsum[1-8]
\chapter{Test chapter two}
\lipsum[1-8]

\end{document}