Closed Skillmon closed 4 years ago
I don't think that we can change it. I found a number of uses of the counter in other packages. But I added a sentence in the documentation.
@u-fischer thank you very much!
Hi,
This feature of the abspage
counter is even used by the \ChapterStop
macro of zref-example.tex
. Indeed, since the label is written after the \cleardoublepage
, one could believe it will contain the absolute page number of the first page of the chapter that is being started, and then the +1
in \ChapterPages
would be incorrect. But since the end-of-chapter label is written via \zref@wrapper@immediate
, the value of the abspage
counter that is stored in this label is from before the \AtBeginShipout
for the first page of the chapter that is being started; therefore, it holds the absolute number of the last page of the preceding chapter, which is why the computation in \ChapterPages
is correct.
hm, looking at the perpage/zref-abspage clash in issue #18 I realized that in perpage the counter is not zero-based, which means that one gets a different number of page here, depending on if zref-abspage is used or not:
\documentclass[twoside]{article}
%
%\usepackage{zref-abspage}
\usepackage{perpage}
\makeatletter
% this is analogue to how `\cleardoublepage' works, but with `abspage'
\newcommand*\cleartoevenpage
{%
\clearpage
\if@twoside
\ifodd\c@abspage
\hbox{}\newpage
\if@twocolumn
\hbox{}\newpage
\fi
\fi
\fi
}
\makeatother
\begin{document}
x \arabic{abspage}
\cleartoevenpage
x even
\end{document}
What a mess ;-( (The LaTeX count \ReadonlyShipoutCounter
is zero based too, so works similar to the zref-abspage.)
While the label references with the
abspage
module are correct, the counter itself is off by one if one tries to access it directly, that's because it is initialized as0
not as1
as\c@page
would be. If one now wants to create an\cleartoevenpage
macro analogue to\cleardoublepage
but using theabspage
counter, one gets wrong results.If it is impossible to change the behaviour of that counter (because it might be used in documents in some ways), at least the documentation should be adapted to tell people about this off-by-one error.