I am looking for a straightforward way to get the absolute page number at the current position. I came across package zref-abspage (the programmer's interface) out of the oberdiek bundle.
Why do I need to define a label myself in order to get the abspage property? Why does the package not do this automatically for me? This is cumbersome, because in order to generate a unique label, I have to define and maintain yet another counter variable.
By contrast, the zref-nextpage module does not have this requirement:
\documentclass{article}
\usepackage{zref-abspage}
\usepackage{zref-nextpage}
\usepackage{ifthen}
\newcount\loopcnt
\makeatletter
\begin{document}
\whiledo{\loopcnt<300}{ %about 7 pages of output
\noindent%
\zref@labelbyprops{mylabel\the\loopcnt}{abspage}%
\zref@extract{mylabel\the\loopcnt}{abspage},
\znextpage\\ % no label required
\advance\loopcnt by 1
}
\end{document}
*.aux. The user command\znextpagedoes exactly this and is therefore, well, not expandible. – AlexG Dec 14 '18 at 10:34