I want to use both regular page numbering (as in 1, 2, 3, etc) and n-m page numbering (1-1, 1-2, 2-1, 2-2, etc) in a document I'm preparing.

This far I've been playing around with custom counters but the obvious answer, using \addtocounter to subtract the page where the current chapter started from \thepage defeats that purpose because I still want regular page numbers.

I can't really post an MWE because it's something I don't really know how to do. On the "pseudo-MWE" below \nmpage is a hypothetic command that outputs the page number in the format <chapter>-<page_of_chapter>, so the 5th page of chapter 2 would be 2-5.

Any ideas on how I could achieve that?

    \markright{\thesection #1}}  


\chapter{Chapter 1}


\chapter{Chapter 2}

Yada yada yada.

  • Which is the main page number, especially which is used for references (\pageref)? – Heiko Oberdiek Nov 30 '12 at 21:38
  • It's \thepage, which I intentionally leave untouched. – Francisco Nov 30 '12 at 21:43

The main page number is \thepage with regular (arabic) numbering. This is also used for page references. Thus we do not need to do anything here.

Additionally the footer should show a page number of the form \thechapter-<arabic page relative to the chapter>. All we need is the page number of the chapter start. Since \chaptermark is already redefined, the definition for \StartChapterPage is put there. A chapter starts a new page, thus we can use \value{page} without resorting to the referencing system. Second advantage of \chaptermark is that it is not called for unnumbered chapters. In order to skip the first pages, \nmpage is defined empty and \printnmpage is defined to do the real work. At the first numbered chapter \nmpage gets the meaning of \printnmpage and the composite page number is shown:

The following definitions are added to the MWE of the question:


And the definition for \chaptermark changes as follows:

  • Wow. Just... wow. I may have learned more about LaTeX in the past minute than in the last week. Thank you, Heiko. – Francisco Nov 30 '12 at 22:26

That can be achieved by creating a new counter that is reset with each chapter, then incrementing it everytime it is used in the headings:



\chapter{The beginning}


\chapter{More Material}


Maybe looking at the memoir class might be a better place. I was using the book class.

  • The \fancypagestyle{plain}{...} trick is described in the manual of fancyhdr – egreg Nov 30 '12 at 20:41
  • My problem is not with fancyhdr - what I need is the page number in the footer to be reset everytime a new chapter begins, to the first page of chapter 2 would be 2-1, not 2-3. – Francisco Nov 30 '12 at 20:46
  • 1
    You could order the page counter to reset. But I wouldn't touch it and rather create a new counter which is reseted every chapter. I don't remember how to do it at this moment, but if no one answers I will look around. – Manuel Nov 30 '12 at 20:53
  • \newcounter{nmpage}[chapter] would do just that. The catch is how to increment it every time page is incremented. – Francisco Nov 30 '12 at 21:10
  • 2
    In the code of @A.Ellet instead of \cfoot{\thechapter--\thepage} you should use \cfoot{\thechapter--\addtocounter{nmpage}{1}\thenmpage}. I think it works. But you should redefine some more commands if you want \pageref and similar to work. I hope someone answers. – Manuel Nov 30 '12 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.