chappg.sty: number pages by chapter

Basic operation of the package is to redefine \thepage to be
\thechapter-\arabic{page}, and to cause the page number to be reset
(to 1) at the start of each chapter.  So the pages of chapter 3 will
be numbered 3-1, 3-2, ..., and the pages of appendix B will be
numbered B-1, B-2, ...

The package assumes the environment of the standard report or book
classes (or classes derived from them by inclusion or copying).

The package's effect is achieved by defining a new \pagenumbering
style `bychapter', and using it.  The package changes \pagenumbering
to take an optional argument, which is the `prefix' to the page
number.  Ordinarily, this will be the chapter number, but a user may
care to say (for example):

  \chapter*{Preface}
  \pagenumbering[Preface]{bychapter}

in her document somewhere, and the pages of the preface will be
numbered Preface-1, Preface-2, ...

The separator between the chapter and page numbers (hyphen above, but
I can imagine people wanting it to be an en-dash) is \chappgsep, which
en-dash-lovers may redefine (after loading the package); for example:

  \renewcommand{\chappgsep}{--}%

Havoc is wreaked with this structure in the LaTeX \frontmatter and
\mainmatter commands (which both explicitly use \pagenumbering and
therefore destroy the changed definition of \thepage

My design decision was to assume that \frontmatter is indeed to be in
\pagenumbering{roman}, and to restore the chapter-numbering in
\mainmatter.  Chapters in the frontmatter can not be numbered `by'
their chapters, since the chapters don't actually have numbers.  If
the author wishes to have some special treatment of part of the
frontmatter, the analogue of the above is

  \chapter{Preface}
  \pagenumbering[Preface]{bychapter}

The conception breaks down again in \backmatter; again, the \chapter
commands don't number the chapters, so that the pages will all be
numbered as if they were `within' the last real chapter.  Therefore,
if by-chapter page numbering is still enabled while in the backmatter,
and the user hasn't issued a new \pagenumbering[prefix]{bychapter}
since the \backmatter command, the package rewrites the prefix as
{\bf??}, and produces a warning at the end of the document.

