Skip to content

Commit

Permalink
make unique counter more robust against includeonly, see issue #10
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer committed Mar 8, 2022
1 parent d40fbdf commit ab686b7
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions zref.dtx
Original file line number Diff line number Diff line change
Expand Up @@ -2907,13 +2907,13 @@ the height difference of the two baselines is
% \begin{macro}{\zref@require@unique}
% Generate the counter |zref@unique| if the counter does not
% already exist.
% change 2022-08-03: The counter is no longer removed from the reset,
% so that the behaviour with includeonly is improved, see issue
% https://github.com/ho-tex/zref/issues/10
% \begin{macrocode}
\ZREF@Robust\def\zref@require@unique{%
\@ifundefined{c@zref@unique}{%
\begingroup
\let\@addtoreset\ltx@gobbletwo
\newcounter{zref@unique}%
\endgroup
% \end{macrocode}
% \end{macro}
%
Expand All @@ -2928,6 +2928,15 @@ the height difference of the two baselines is
}
% \end{macrocode}
% \end{macro}
% To improve the behaviour if include/includeonly is used, we round the
% counter up at every include, see https://github.com/ho-tex/zref/issues/10
%
% \begin{macrocode}
\AddToHook
{include/after}
{\setcounter{zref@unique}
{\csname fp_to_int:n\endcsname{ceil(\c@zref@unique +100,-2)}}}
% \end{macrocode}
%
% \subsubsection{Utilities}
%
Expand Down

0 comments on commit ab686b7

Please sign in to comment.