I want to have two sets of page numbers (P and p) in my document. The first one (P) is global, the second one (p) resets to 1 at some predefined points.

So, the document will look like,


P1/5 p1/3


P2/5 p2/3


P3/5 p3/3

Text. In this page the page number (p, second one) is reset.

P4/5 p1/2


P5/5 p2/2

To get the total page count a label in the last page or the lastpage package (http://www.ctan.org/pkg/lastpage) can help me. And that is not the subject of this question.

The problem is with the second counter. I can use chappg (http://www.ctan.org/pkg/chappg) with noauto option. But I loose the global page counter P. Moreover, the (sub) total number of pages in that group has to be manually set.

I understand that if I write a set of macros with a new counter (my@local@page), reset it at my predefined points, label the last page in a group (label names will have to be distinct), perhaps I can achieve my goal. But that requires at least half a day. Which I do not have at this moment.

I was wondering if you can suggest something readily usable.

  • What defines this group of sub-pages? Is it a chapter? A section? Also, what \documentclass are you using? Do you have any package restrictions?
    – Werner
    Nov 13, 2012 at 3:59
  • This is actually a list where I need to reset the page number for a new group. These points are known to me (i.e. I can manually issue a command there, but nothing automatic). These are not chapters or sections or anything like that. \documentclass is article. No package restrictions.
    – Masroor
    Nov 13, 2012 at 4:17
  • Is a \newpage or \clearpage issued before the command that changes the page numbering? If so, it would make things much easier.
    – yo'
    Nov 13, 2012 at 6:53
  • Yes, \clearpage is always issued the changes in page numbering.
    – Masroor
    Nov 13, 2012 at 7:44
  • If you are ready to compile separately the separately-numbered page groups, the pdfpage package might help you.
    – T. Verron
    Nov 13, 2012 at 7:45

1 Answer 1


Here's a possible setup. I use fancyhdr for typesetting the two page numbers and also for stepping the secondary counter. The macro \resetpageaux does a \clearpage, sets a label and sets the secondary counter to zero. At the end of the document we set also the last label.




  P \thepage/\zpageref{LastPage} -- p \thepageaux/\ref{\currentauxref}%

\usepackage{kantlipsum} % just for mock text








enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .