summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2023-02-21 20:49:27 +0000
committerKarl Berry <karl@freefriends.org>2023-02-21 20:49:27 +0000
commit888dc65f161a0cd3b37febaa1632e7b24c12c7d4 (patch)
tree14f46d651a477422534fdb7be87026e09f9eeb88 /Master/texmf-dist/source
parent99c0a9d0e2980f8f05b9354a64f402a8fdca1dd6 (diff)
zref-clever (21feb23) (branch)
git-svn-id: svn://tug.org/texlive/branches/branch2022.final@66024 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 }