texlive[66021] Master/texmf-dist: zref-clever (21feb23)

commits+karl at tug.org commits+karl at tug.org
Tue Feb 21 21:48:09 CET 2023


Revision: 66021
          http://tug.org/svn/texlive?view=revision&revision=66021
Author:   karl
Date:     2023-02-21 21:48:08 +0100 (Tue, 21 Feb 2023)
Log Message:
-----------
zref-clever (21feb23)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md
    trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf
    trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf
    trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx
    trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty

Modified: trunk/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md	2023-02-21 20:47:51 UTC (rev 66020)
+++ trunk/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md	2023-02-21 20:48:08 UTC (rev 66021)
@@ -1,7 +1,13 @@
 # Changelog
 
-## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.3.5...HEAD)
+## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.3.6...HEAD)
 
+## [v0.3.6](https://github.com/gusbrs/zref-clever/compare/v0.3.5...v0.3.6) (2023-02-21)
+
+### Fixed
+- Avoid "Missing number, treated as zero" error for labels set before first
+  call to `\refstepcounter`.
+
 ## [v0.3.5](https://github.com/gusbrs/zref-clever/compare/v0.3.4...v0.3.5) (2023-02-18)
 
 ### Fixed

Modified: trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx	2023-02-21 20:47:51 UTC (rev 66020)
+++ trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx	2023-02-21 20:48:08 UTC (rev 66021)
@@ -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 at cntval} and
 % \texttt{zc at 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 at newprop { zc at 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 at addprop \ZREF at mainlist { zc at cntval }

Modified: trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty	2023-02-21 20:47:51 UTC (rev 66020)
+++ trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty	2023-02-21 20:48:08 UTC (rev 66021)
@@ -53,7 +53,7 @@
       }%
     \endinput
   }%
-\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}
 \RequirePackage { zref-base }
 \RequirePackage { zref-user }
@@ -88,11 +88,16 @@
 \zref at addprop \ZREF at mainlist { zc at type }
 \zref at newprop { zc at cntval } [0]
   {
-    \cs_if_exist:cTF { c@ \l__zrefclever_current_counter_tl }
+    \bool_lazy_and:nnTF
+      { ! \tl_if_empty_p:N \l__zrefclever_current_counter_tl }
+      { \cs_if_exist_p:c { c@ \l__zrefclever_current_counter_tl } }
       { \int_use:c { c@ \l__zrefclever_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 at addprop \ZREF at mainlist { zc at cntval }



More information about the tex-live-commits mailing list.