I need to use separate page numbering in appendices while keeping the main numbering. I.e., when the page is in appendix, the header must be like "Appendix 1. Page X of XXX" where XXX is the number of pages in appendix. And in the footer the numbering must be uniform from the first page of the document to the end. How can I do it?

  • You need to create a new counter and increment it in the header or using the everypage package. You can print the last counter value using \ref{lastpage} (for example) and use \AtEndDocument{\addtocounter{mypage}{-1}\refstepcounter{mypage}\label{lastpage}} Commented Dec 23, 2016 at 14:05
  • Please explain. I don't know TeX/LaTeX so good.
    – user121687
    Commented Dec 23, 2016 at 15:15
  • I suppose you want me to create an MWE for you as well. Sigh! Commented Dec 23, 2016 at 16:55

1 Answer 1


From your description I assume you are using oneside.

Note, since not every page has a header, I increment mypage using everypage, which runs after the page is complete but before the header is added. Also, \AtEndDocument runs before the last everypage.

\usepackage{lipsum}% MWE only

\AddEverypageHook{\stepcounter{mypage}}% before header

\makeatletter% create \pagestyle{appemdix}
    \def\@oddhead{{\slshape\rightmark}\hfil Page \themypage{} of \ref{lastpage}}%

\chapter{Yada yada yada}
\clearpage% push out last page before appendix

You must log in to answer this question.