ho-tex / zref

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

zref-perpage needs to alter \stepcounter as late as possible #11

Open FrankMittelbach opened 3 years ago

FrankMittelbach commented 3 years ago
%FMi needs to be as late as possible ... amstext changes stepcounter for example
\AtBeginDocument{%
\let\ZREF@org@stepcounter\stepcounter
\def\stepcounter#1{%
  \ifcsname @stepcounterhook@#1\endcsname
    \csname @stepcounterhook@#1\endcsname
  \fi
  \ZREF@org@stepcounter{#1}%
}}

Problem would go away if we have the mechanism directly in LaTeX but right now it isn't.

u-fischer commented 3 years ago

Moving behind amstext avoid that the zref hook gets completly lost, but wouldn't solve all problems: the hook code would then be outside the \iffirstchoice@ .. \fi from the amstext definition, and this would break perpage counters inside \text.

There are some open points here. Perhaps one should start by moving the amstext definition into the kernel ...

FrankMittelbach commented 3 years ago

maybe, in any case it is something that needs consolidation betcause right now it simply doesn't work at all if in the wrong order.