ho-tex / zref

zref packages for LaTeX
LaTeX Project Public License v1.3c
6 stars 2 forks source link

zref-abspos should add the pagevalue property to savepos #1

Closed u-fischer closed 4 years ago

u-fischer commented 7 years ago

The (undocumented) zref-abspos modul in zref allows to get length relative to the page layout. For twoside layout it needs the page number to decide if it is on an odd page. But zrefsavepos doesn't save the pagevalue property, only abspage and so some commands of zref-abspos fall back to \c@page which can be wrong at page breaks. I suggest to add \zref@addprop{savepos}{pagevalue} to the modul. An example to demonstrate the problem:

\documentclass{book} %twoside layout for different values
\usepackage{zref-savepos,zref-abspos}
\newcounter{mparnum}
\renewcommand*{\themparnum}{a:\arabic{mparnum}}
\makeatletter

\def\testabspos{%
 \stepcounter{mparnum}\zsavepos{\themparnum}% 
 \textbf{\the\numexpr\ZREF@abspos@body@x@left{\themparnum}}}

%\zref@addprop{savepos}{pagevalue} %if used correct value
\makeatother

\begin{document}
\testabspos blblbl

\vspace{42\baselineskip}

\testabspos blblbl\\
\testabspos blblbl\\
\testabspos blblbl\\
\testabspos blblbl <-- wrong value

\testabspos blblbl\\
\testabspos blblbl
\end{document}
u-fischer commented 4 years ago

The fix has been uploaded to ctan.