From 888dc65f161a0cd3b37febaa1632e7b24c12c7d4 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 21 Feb 2023 20:49:27 +0000 Subject: zref-clever (21feb23) (branch) git-svn-id: svn://tug.org/texlive/branches/branch2022.final@66024 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/zref-clever/zref-clever.dtx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Master/texmf-dist/source') diff --git a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx index 69dbe2af0eb..cee60860c35 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx @@ -165,7 +165,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2023-02-18} {0.3.5} +\ProvidesExplPackage {zref-clever} {2023-02-21} {0.3.6} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -274,15 +274,27 @@ % numeric values. So we store them in \texttt{zc@cntval} and % \texttt{zc@pgval}. For this, we use \cs[no-index]{c@}\meta{counter}, which % contains the counter's numerical value (see `texdoc source2e', section -% `ltcounts.dtx'). +% `ltcounts.dtx'). Also, even if we can't find a valid \cs{@currentcounter}, +% we set the value of 0 to the property, so that it is never empty (the +% property's default is not sufficient to avoid that), because we rely on this +% value being a number and an empty value there will result in ``Missing +% number, treated as zero.'' error. A typical situation where this might +% occur is the user setting a label before \cs{refstepcounter} is called for +% the first time in the document. A user error, no doubt, but we should avoid +% a hard crash. % \begin{macrocode} \zref@newprop { zc@cntval } [0] { - \cs_if_exist:cTF { c@ \l_@@_current_counter_tl } + \bool_lazy_and:nnTF + { ! \tl_if_empty_p:N \l_@@_current_counter_tl } + { \cs_if_exist_p:c { c@ \l_@@_current_counter_tl } } { \int_use:c { c@ \l_@@_current_counter_tl } } { - \cs_if_exist:cT { c@ \@currentcounter } + \bool_lazy_and:nnTF + { ! \tl_if_empty_p:N \@currentcounter } + { \cs_if_exist_p:c { c@ \@currentcounter } } { \int_use:c { c@ \@currentcounter } } + { 0 } } } \zref@addprop \ZREF@mainlist { zc@cntval } -- cgit v1.2.3