diff options
author | Karl Berry <karl@freefriends.org> | 2023-06-19 20:21:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-06-19 20:21:27 +0000 |
commit | 2140579f064a0fce2295b1d822da067df613d950 (patch) | |
tree | 2ef225b3ca644daa720c89884cd27a8af1279bc7 /Master | |
parent | 0c010e5f38d5fcd48a4d4a70d1483f2180afe687 (diff) |
zref-clever (19jun23)
git-svn-id: svn://tug.org/texlive/trunk@67411 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md | 10 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf | bin | 1273255 -> 1275753 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf | bin | 346306 -> 346246 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex | 24 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx | 59 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty | 21 |
6 files changed, 69 insertions, 45 deletions
diff --git a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md index 7c02e101a03..0298bbd36ac 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md @@ -1,6 +1,14 @@ # 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@pgfmt` property. ## [v0.4.0](https://github.com/gusbrs/zref-clever/compare/v0.3.6...v0.4.0) (2023-06-14) diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf Binary files differindex f2e55277a18..f87257bca40 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf Binary files differindex 46429193c93..18256a8c361 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex index 23645f429e0..65235075ba3 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex @@ -66,6 +66,10 @@ \NewDocumentCommand\username{m}{`\texttt{#1}'} +\makeatletter +\newcommand{\zcrequiredkernelversion}{\zc@required@kernel@version} +\makeatother + \setlength{\marginparsep}{2\labelsep} \definecolor{reffmtbox}{gray}{0.15} @@ -407,19 +411,17 @@ available at \zcref{sec:how-tos}. 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. - -\section{Dependencies} +\subsection{Dependencies} -\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. +\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. \section{User interface} 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 fff75c1b447..044e23adbda 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx @@ -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@required@kernel@version}{2023-06-01} \NeedsTeXFormat{LaTeX2e} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} -\IfFormatAtLeastTF{2023-06-01} +\IfFormatAtLeastTF{\zc@required@kernel@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@required@kernel@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@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@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@newprop}*\{zc@pgfmt\}}. -% -% \begin{macrocode} -\tl_new:N \g_@@_page_format_tl +% used by \pkg{cleveref}, is simple and smart: store with the label what +% \cs{thepage} would return, if the counter \cs{c@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@newprop}*\{zc@pgfmt\}}), so that the label comes after the +% counter, and we can get the correct value of the counter. +% +% \begin{macrocode} +\int_new:N \g_@@_page_format_int +\tl_new:N \g_@@_prev_page_format_tl \AddToHook { shipout / before } { - \group_begin: - \int_set:Nn \c@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@newprop* { zc@pgfmt } { \g_@@_page_format_tl } +\zref@newprop* { zc@pgfmt } { \int_use:N \g_@@_page_format_int } \zref@addprop \ZREF@mainlist { zc@pgfmt } % \end{macrocode} % diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty index 1b999f94088..1529ee915a6 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty @@ -42,19 +42,20 @@ %% %% ----------------------------------------------------------------------- %% +\newcommand{\zc@required@kernel@version}{2023-06-01} \NeedsTeXFormat{LaTeX2e} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} -\IfFormatAtLeastTF{2023-06-01} +\IfFormatAtLeastTF{\zc@required@kernel@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@required@kernel@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@addprop \ZREF@mainlist { zc@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@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@newprop* { zc@pgfmt } { \g__zrefclever_page_format_tl } +\zref@newprop* { zc@pgfmt } { \int_use:N \g__zrefclever_page_format_int } \zref@addprop \ZREF@mainlist { zc@pgfmt } \prg_new_conditional:Npnn \__zrefclever_if_package_loaded:n #1 { T , F , TF } { \IfPackageLoadedTF {#1} { \prg_return_true: } { \prg_return_false: } } |