4

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}
moewe
  • 175,683
AlexG
  • 54,894
  • 1
    Why the package does something is imho a rather senseless question. If you think a feature is missing add an issue to the issue tracker. – Ulrike Fischer Dec 14 '18 at 10:08
  • @Ulrike Could be an option, indeed. – AlexG Dec 14 '18 at 10:13
  • I guess the reason is expandibility. A command for extracting the abs. page number without passing it a label would not be expandible, because it would have to define a unique label internally and write it to *.aux. The user command \znextpage does exactly this and is therefore, well, not expandible. – AlexG Dec 14 '18 at 10:34

0 Answers0