I want to get the real page number. If I use \thepage
, I get problems, when I change the pagenumbering. For pagenumbering gobble
, it disappears, if I change from arabic
to roman
, it resets the counter. There must be actually some internal counter like \p@count
(I made that up). What is it?
The following example should show 13 on the last page.
\documentclass[a5paper, 11pt]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\begin{document}
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
\pagenumbering{gobble}
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
\pagenumbering{arabic}
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
Seite \thepage
\newpage
\end{document}
Best Answer
The package
xassoccnt
provides a mean to force a stepping of an associated counter each time a driver counter is stepped as well -- the driver counter ispage
here.This has an advantage over the
totcount
orlastpage
packages, since the associated counterrealpage
(any name will do, butsection
etc. is unwise, of course ;-)) is not reset (unless explicitly done so with\setcounter
) -- As such, it counts the total absolute values of pages.So even in case of
\pagenumbering
commands, this does not have an effect on therealpage
counter.Please note that
page
is an unrealiable counter in some sense!A version with
\NewTotalDocumentCounter
(needsxassoccnt
v.1.2. and above)