texlive[67411] Master/texmf-dist: zref-clever (19jun23)

commits+karl at tug.org commits+karl at tug.org
Mon Jun 19 22:21:27 CEST 2023


Revision: 67411
          http://tug.org/svn/texlive?view=revision&revision=67411
Author:   karl
Date:     2023-06-19 22:21:27 +0200 (Mon, 19 Jun 2023)
Log Message:
-----------
zref-clever (19jun23)

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-doc.pdf
    trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex
    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-06-19 20:21:17 UTC (rev 67410)
+++ trunk/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md	2023-06-19 20:21:27 UTC (rev 67411)
@@ -1,7 +1,15 @@
 # Changelog
 
-## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.4.0...HEAD)
+## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.4.1...HEAD)
 
+## [v0.4.1](https://github.com/gusbrs/zref-clever/compare/v0.4.0...v0.4.1) (2023-06-19)
+
+### Changed
+- Improved Dependencies section in User manual.
+
+### Fixed
+- Use safer method to define the `zc at pgfmt` property.
+
 ## [v0.4.0](https://github.com/gusbrs/zref-clever/compare/v0.3.6...v0.4.0) (2023-06-14)
 
 ### Added

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-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex	2023-06-19 20:21:17 UTC (rev 67410)
+++ trunk/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex	2023-06-19 20:21:27 UTC (rev 67411)
@@ -66,6 +66,10 @@
 
 \NewDocumentCommand\username{m}{`\texttt{#1}'}
 
+\makeatletter
+\newcommand{\zcrequiredkernelversion}{\zc at required@kernel at version}
+\makeatother
+
 \setlength{\marginparsep}{2\labelsep}
 
 \definecolor{reffmtbox}{gray}{0.15}
@@ -407,21 +411,19 @@
 The package does not accept load-time options, package options must be set
 using \cs{zcsetup} (see \zcref{sec:user-interface}).
 
-\pkg{zref-clever} requires a recent \LaTeX{} kernel (2023-06-01 or newer) and
-the packages \pkg{zref}, including some of its modules, and \pkg{ifdraft}.  It
-also requires UTF-8 input encoding, which has been the kernel's default for
-some time.
 
+\subsection{Dependencies}
 
-\section{Dependencies}
+\pkg{zref-clever} requires \pkg{zref}, particularly its \pkg{zref-base},
+\pkg{zref-user} and \pkg{zref-abspage} modules, and the \LaTeX{} kernel
+\zcrequiredkernelversion{}, or newer.  It requires UTF-8 input encoding, which
+has been the kernel's default for some time.  It also needs \pkg{ifdraft}.
+Some packages are leveraged by \pkg{zref-clever} if they are present, but are
+not loaded by default or required by it, namely: \pkg{hyperref},
+\pkg{zref-check}, and \pkg{zref}'s \pkg{zref-hyperref} and \pkg{zref-xr}
+modules.
 
-\pkg{zref-clever} requires \pkg{zref}, and \LaTeX{} kernel 2023-06-01, or
-newer.  It also needs \pkg{ifdraft}.  Some packages are leveraged by
-\pkg{zref-clever} if they are present, but are not loaded by default or
-required by it, namely: \pkg{hyperref}, \pkg{zref-check}, and \pkg{zref}'s
-\pkg{zref-titleref}, \pkg{zref-hyperref}, and \pkg{zref-xr} modules.
 
-
 \section{User interface}
 \zlabel{sec:user-interface}
 

Modified: trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx	2023-06-19 20:21:17 UTC (rev 67410)
+++ trunk/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx	2023-06-19 20:21:27 UTC (rev 67411)
@@ -148,18 +148,18 @@
 % release, alongside the corresponding new hooks with arguments, just
 % simplifies and improves label setting so much, by allowing \cs{zlabel} to be
 % set with \cs{label}, that it is definitely a must for \pkg{zref-clever}, so
-% we require that too.  Hence we make the cut at the 2023-06-01 kernel
-% release.
+% we require that too.  Hence we make the cut at this latter kernel release.
 %
 %    \begin{macrocode}
+\newcommand{\zc at required@kernel at version}{2023-06-01}
 \NeedsTeXFormat{LaTeX2e}
 \providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
-\IfFormatAtLeastTF{2023-06-01}
+\IfFormatAtLeastTF{\zc at required@kernel at version}
   {}
   {%
     \PackageError{zref-clever}{LaTeX kernel too old}
       {%
-        'zref-clever' requires a LaTeX kernel 2023-06-01 or newer.%
+        'zref-clever' requires a LaTeX kernel \zc at required@kernel at version\space or newer.%
         \MessageBreak Loading will abort!%
       }%
     \endinput
@@ -169,7 +169,7 @@
 %
 % Identify the package.
 %    \begin{macrocode}
-\ProvidesExplPackage {zref-clever} {2023-06-14} {0.4.0}
+\ProvidesExplPackage {zref-clever} {2023-06-19} {0.4.1}
   {Clever LaTeX cross-references based on zref}
 %    \end{macrocode}
 %
@@ -471,28 +471,39 @@
 % \cs{thepage} to retrieve such information is bound to go wrong: we don't
 % know, and can't know, what is within that macro, and that's the business of
 % the user, or of the documentclass, or of the loaded packages.  The technique
-% used by \pkg{cleveref}, which we borrow here, is simple and smart: store
-% with the label what \cs{thepage} would return, if the counter \cs{c at page}
-% was ``\(1\)''.  That does not allow us to \emph{sort} the references,
-% luckily however, we have \texttt{abspage} which solves this problem.  But we
-% can decide whether two labels can be compressed into a range or not based on
-% this format: if they are identical, we can compress them, otherwise, we
-% can't.  To do so, we locally set \cs{c at page} to ``1'', thus avoiding any
-% global spillovers of this trick.  Since this operation is not expandable we
-% cannot run it directly from the property definition.  Hence, we use a
-% shipout hook, and set \cs{g_@@_page_format_tl}, which can then be retrieved
-% by the starred definition of \texttt{\cs{zref at newprop}*\{zc at pgfmt\}}.
+% used by \pkg{cleveref}, is simple and smart: store with the label what
+% \cs{thepage} would return, if the counter \cs{c at page} was ``\(1\)''.  That
+% would not allow us to \emph{sort} the references, luckily however, we have
+% \texttt{abspage} which solves this problem.  But we can decide whether two
+% labels can be compressed into a range or not based on this format: if they
+% are identical, we can compress them, otherwise, we can't.  However,
+% \texttt{x} expanding \cs{thepage} can lead to errors for some \pkg{babel}
+% packages which redefine \cs{roman} containing non-expandable material (see
+% \url{https://chat.stackexchange.com/transcript/message/63810027#63810027},
+% \url{https://chat.stackexchange.com/transcript/message/63810318#63810318},
+% \url{https://chat.stackexchange.com/transcript/message/63810720#63810720}
+% and discussion).  So I went for something a little different.  As mentioned,
+% we want to know if \cs{thepage} is the same for different labels, or if it
+% has changed.  We can thus test this directly, by comparing \cs{thepage} with
+% a stored value of it, \cs{g_@@_prev_page_format_tl}, and stepping a counter
+% every time they differ.  Of course, this cannot be done at label setting
+% time, since it is not expandable.  But we can do that comparison before
+% shipout and then define the label property as starred
+% (\texttt{\cs{zref at newprop}*\{zc at pgfmt\}}), so that the label comes after the
+% counter, and we can get the correct value of the counter.
 %
 %    \begin{macrocode}
-\tl_new:N \g_@@_page_format_tl
+\int_new:N \g_@@_page_format_int
+\tl_new:N \g_@@_prev_page_format_tl
 \AddToHook { shipout / before }
   {
-    \group_begin:
-    \int_set:Nn \c at page { 1 }
-    \tl_gset:Nx \g_@@_page_format_tl { \thepage }
-    \group_end:
+    \tl_if_eq:NNF \g_@@_prev_page_format_tl \thepage
+      {
+        \int_gincr:N \g_@@_page_format_int
+        \tl_gset_eq:NN \g_@@_prev_page_format_tl \thepage
+      }
   }
-\zref at newprop* { zc at pgfmt } { \g_@@_page_format_tl }
+\zref at newprop* { zc at pgfmt } { \int_use:N \g_@@_page_format_int }
 \zref at addprop \ZREF at mainlist { zc at pgfmt }
 %    \end{macrocode}
 %

Modified: trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty	2023-06-19 20:21:17 UTC (rev 67410)
+++ trunk/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty	2023-06-19 20:21:27 UTC (rev 67411)
@@ -42,19 +42,20 @@
 %% 
 %% -----------------------------------------------------------------------
 %% 
+\newcommand{\zc at required@kernel at version}{2023-06-01}
 \NeedsTeXFormat{LaTeX2e}
 \providecommand\IfFormatAtLeastTF{\@ifl at t@r\fmtversion}
-\IfFormatAtLeastTF{2023-06-01}
+\IfFormatAtLeastTF{\zc at required@kernel at version}
   {}
   {%
     \PackageError{zref-clever}{LaTeX kernel too old}
       {%
-        'zref-clever' requires a LaTeX kernel 2023-06-01 or newer.%
+        'zref-clever' requires a LaTeX kernel \zc at required@kernel at version\space or newer.%
         \MessageBreak Loading will abort!%
       }%
     \endinput
   }%
-\ProvidesExplPackage {zref-clever} {2023-06-14} {0.4.0}
+\ProvidesExplPackage {zref-clever} {2023-06-19} {0.4.1}
   {Clever LaTeX cross-references based on zref}
 \RequirePackage { zref-base }
 \RequirePackage { zref-user }
@@ -146,15 +147,17 @@
       \l__zrefclever_current_counter_tl
   }
 \zref at addprop \ZREF at mainlist { zc at enclval }
-\tl_new:N \g__zrefclever_page_format_tl
+\int_new:N \g__zrefclever_page_format_int
+\tl_new:N \g__zrefclever_prev_page_format_tl
 \AddToHook { shipout / before }
   {
-    \group_begin:
-    \int_set:Nn \c at page { 1 }
-    \tl_gset:Nx \g__zrefclever_page_format_tl { \thepage }
-    \group_end:
+    \tl_if_eq:NNF \g__zrefclever_prev_page_format_tl \thepage
+      {
+        \int_gincr:N \g__zrefclever_page_format_int
+        \tl_gset_eq:NN \g__zrefclever_prev_page_format_tl \thepage
+      }
   }
-\zref at newprop* { zc at pgfmt } { \g__zrefclever_page_format_tl }
+\zref at newprop* { zc at pgfmt } { \int_use:N \g__zrefclever_page_format_int }
 \zref at addprop \ZREF at mainlist { zc at pgfmt }
 \prg_new_conditional:Npnn \__zrefclever_if_package_loaded:n #1 { T , F , TF }
   { \IfPackageLoadedTF {#1} { \prg_return_true: } { \prg_return_false: } }



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