summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-02-21 20:48:08 +0000
committerKarl Berry <karl@freefriends.org>2023-02-21 20:48:08 +0000
commitdb79b729227f816dfd7946b8a9bb2ee7cd674211 (patch)
treeb45a43bec498670b331328a17543cfa1efe7f1c5 /Master/texmf-dist/source
parent57ff3e334b48fdf6e3adf756a20f36358738d203 (diff)
zref-clever (21feb23)
git-svn-id: svn://tug.org/texlive/trunk@66021 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx20
1 files changed, 16 insertions, 4 deletions
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 }