# Different page numbering in appendices while keeping main numbering

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}} – John Kormylo Dec 23 '16 at 14:05
• Please explain. I don't know TeX/LaTeX so good. – user121687 Dec 23 '16 at 15:15
• I suppose you want me to create an MWE for you as well. Sigh! – John Kormylo Dec 23 '16 at 16:55

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.

\documentclass[oneside]{book}
\usepackage{lipsum}% MWE only
\usepackage{everypage}

\newcounter{mypage}

\makeatletter% create \pagestyle{appemdix}
\def\ps@appendix{%
\def\@oddfoot{\hfil\thepage\hfil}%
\let\@evenfoot=\@oddfoot
\let\@mkboth\markboth
}
\makeatother

\begin{document}