I construct an article with three kinds of pagenumber style.

- fist part: \pagenumbering{Roman}

- Sencond part: \pagenumbering{arabic}

- third part: \pagenumbering{Alpha}


How can I get the sum of pages of each part? For example, there are 3 pages in the first part with pagenumber style Roman, and 5 pages in the second part with pagenumber style arabic. The answer to this question will be used in the Q2.


In the foot of every page in each part, I'd like typeset the page number like this: Page\ \thepage\ of\ \totalpages{Roman}(or arabic, Alpha for related part). I know @abspage@last, but it just give a total page number of an whole article. So is it possible to make a macro like \totalpages{Roman/arabic/Alpha...} to achieve this? No other packages preferred.




part 1:
\cfoot{Page\ \thepage\ of\ \totalpages{Roman}}
part 2:
\cfoot{Page\ \thepage\ of\ \totalpages{arabic}}
part 3: \pagenumbering{Alpha}
\cfoot{Page\ \thepage\ of\ \totalpages{Alpha}}
  • Would that be "Page I of X" or "Page I of 10"? Commented Sep 18, 2022 at 13:14
  • Both are all right and preferred.
    – lyl
    Commented Sep 18, 2022 at 13:48

1 Answer 1


EDIT: I have added an alternative solution (currently commented out) that gives Page A of 4 instead of Page A of D. It needs some hackery, using LaTeX internals, however.

Here is a solution with an extra macro \changepagenumbering. This remembers the last page number of the previous chunk and puts it in a label. It also does a\newpage, because changing page numbers mid-page doesn't make sense. Maybe it also works without this \newpage. I then use \pageref to pick up this number in \totalpages. You will need at least one extra LaTeX run to get the numbers correct.


% Start a new page numbering scheme. Remember the number of pages of the
% previous scheme and start a new page (changing page numbering mid-page
% doesn't make sense)

% If you want the number of pages in decimal use this instead of the above:

% \newcommand\mypagecount{\arabic{page}}
% \makeatletter
% \newcommand\mylabel[1]{\@bsphack
%   \protected@write\@auxout{\let\mypagecount\relax}%
%          {\string\newlabel{#1}{{\@currentlabel}{\mypagecount}}}%
%   \@esphack}
% \makeatother
% \newcommand\previousnumbering{}
% \newcommand\changepagenumbering[1]{%
%   \mylabel{last-pagenumber-of-\previousnumbering}%
%   \newpage
%   \renewcommand\previousnumbering{#1}%
%   \pagenumbering{#1}%
% }
% \newcommand\totalpages[1]{\pageref{last-pagenumber-of-#1}}

\cfoot{Page\ \thepage\ of\ \totalpages{Roman}}
\section{part 1}


\cfoot{Page\ \thepage\ of\ \totalpages{arabic}}
\section{part 2}


\cfoot{Page\ \thepage\ of\ \totalpages{Alph}}
\section{part 3}


% end with a dummy one

enter image description here

  • Would you kindly provide also a solution for ` Page I of 10`?
    – lyl
    Commented Sep 20, 2022 at 2:20
  • That probably would require another package. Is that a problem? Commented Sep 20, 2022 at 7:52
  • I prefer a solution non other packages. Or is it possible to get the absolute number of a middle page in article when there are two or more page number styles in it?
    – lyl
    Commented Sep 20, 2022 at 8:02
  • 1
    Modern LaTeX has a counter totalpages, which is the total number of pages that has yet been output. It can be printed with \thetotalpages. However, when you are constructing the footer the current page has not yet been output, so it hasn't been counted yet. So on page 4, the counter is 3. You could use this to do the calculation, totalpages - the value at the end of the previous section. But notice: the calculated number must be put is a \label-like structure, written to the aux-file because it must be used before it has been calculated. Commented Sep 20, 2022 at 8:35
  • I have added an alternative solution that gives decimal numbers. Commented Sep 20, 2022 at 8:46

You must log in to answer this question.

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