diff options
author | Karl Berry <karl@freefriends.org> | 2023-06-14 20:14:56 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2023-06-14 20:14:56 +0000 |
commit | b0f67e19778c30606a0ec495b335739647431937 (patch) | |
tree | 10eed90e0954d39d37e5358435b873167697649b /Master | |
parent | 7e2af6eaaed92aa41c00d6b9e6d3c12c92a821f4 (diff) |
zref-clever (14jun23)
git-svn-id: svn://tug.org/texlive/trunk@67369 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
16 files changed, 280 insertions, 374 deletions
diff --git a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md index 8cbd673f55c..7c02e101a03 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md +++ b/Master/texmf-dist/doc/latex/zref-clever/CHANGELOG.md @@ -1,6 +1,38 @@ # Changelog -## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.3.6...HEAD) +## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.4.0...HEAD) + +## [v0.4.0](https://github.com/gusbrs/zref-clever/compare/v0.3.6...v0.4.0) (2023-06-14) + +### Added +- `labelhook` option, controlling whether to set a `\zlabel` alongside a + standard `\label`. This option uses the kernel's new `label` hook, which + significantly improves and simplifies the task of setting a `\zlabel` in + places where this is not directly supported. The option is enabled by + default, and strongly recommended. It is not expected that this change will + bring backward compatibility problems, `\zlabel`s continue to work just as + before, and the places where a `\label` is required will also continue to + work the same way. The only case I see where you might need to adjust + existing documents is if you already had both `\label`s and `\zlabel`s with + the same names, in which case now you'll have a duplicate `zlabel` and will + indeed have to correct it. Also, you may be interested in taking a look at + the "`\label` or `\zlabel`?" section of the User manual, since the option + opens the possibility of a different approach in label setting in your + documents. + +### Changed +- Given the new `labelhook` option and the fact that it requires both the new + `label` hook and the new hooks with options released in the latest LaTeX + kernel, the kernel version required by `zref-clever` has been bumped to + 2023-06-01. + +### Removed +- Given the new `labelhook` option, the parts of compatibility modules which + provided for setting `\zlabel`s with `\label` in places where the former is + not supported have been removed. These would conflict with the new option, + and the use of the `label` hook for this purpose renders them unnecessary + and is superior in every aspect. Namely, the compatibility modules changed + in this fashion are: `amsmath`, `memoir`, and `listings`. ## [v0.3.6](https://github.com/gusbrs/zref-clever/compare/v0.3.5...v0.3.6) (2023-02-21) 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 87eb00b7d80..f2e55277a18 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-code.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex index ba3a5eaaa23..ec9210dd67c 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-code.tex @@ -22,7 +22,7 @@ % % This work consists of the files zref-clever.dtx, % zref-clever.ins, -% zref-clever.tex, +% zref-clever-doc.tex, % zref-clever-code.tex, % and the files generated from them. % 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 differnew file mode 100644 index 00000000000..46429193c93 --- /dev/null +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.pdf diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex index 138e4e938e1..23645f429e0 100644 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.tex +++ b/Master/texmf-dist/doc/latex/zref-clever/zref-clever-doc.tex @@ -22,7 +22,7 @@ % % This work consists of the files zref-clever.dtx, % zref-clever.ins, -% zref-clever.tex, +% zref-clever-doc.tex, % zref-clever-code.tex, % and the files generated from them. % @@ -331,7 +331,11 @@ Indeed, to use \pkg{zref}, instead of setting a \cs{label} and making a \cs{ref}, one would set a \cs{zlabel} and make \cs{zref}s to it, in pretty much the same way as for the standard system. \pkg{zref-clever} introduces the more featureful \cs{zcref} for making references, but relies on -\pkg{zref}'s \cs{zlabel} for label setting. +\pkg{zref}'s \cs{zlabel} for label setting. \pkg{zref-clever} provides that a +\cs{label} also sets a \cs{zlabel} with the same name using the kernel's +\texttt{label} hook (see the \opt{labelhook} option in \zcref{sec:options}), +so that you can use it too with standard \cs{label}s (see the +\zcref{sec:label-or-zlabel} for discussion). A basic document using \pkg{zref-clever} is shown in \zcref{how:basic} which, despite the small necessary adjustments, should feel very familiar to any @@ -403,7 +407,7 @@ 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 (2021-11-15 or newer) and +\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. @@ -411,7 +415,7 @@ some time. \section{Dependencies} -\pkg{zref-clever} requires \pkg{zref}, and \LaTeX{} kernel 2021-11-15, or +\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 @@ -487,6 +491,49 @@ Sets \meta{label} for referencing with \cs{zref} and, thus, also \cs{zcref}. \cs{label} for \pkg{zref}'s referencing system. +\section{\cs{label} or \cs{zlabel}?} +\zlabel{sec:label-or-zlabel} + +Technically, \pkg{zref}'s referencing system, and thus also \pkg{zref-clever}, +require a label set with \cs{zlabel} to make a reference. However, the +\opt{labelhook} option (see \zcref{sec:options}) leverages the kernel's +\texttt{label} hook to also set a \cs{zlabel} when a standard \cs{label} is +called, so that we can simply use \cs{label}s in our document and refer to +them with either referencing system. Indeed, in some places the use of +\cs{label} this way may be required (see +\zcref{sec:limitations,sec:comp-modules}). That given, which is to be +preferred: use \cs{label} all around or normally use \cs{zlabel} and, +occasionally resort to \cs{label} where required? I guess it depends, but we +can reason the pros and cons of both alternatives. + +Simply using \cs{label} across your document clearly speaks for convenience. +You don't have to worry with the exceptional case where a \cs{zlabel} may not +work or setting it is not possible. You can use either referencing system for +your labels as desired. Your favorite editor may have some facilities to ease +the insertion of labels, but does not support \cs{zlabel}. And so on. The +only disadvantage I can see with this approach is that two labels end up in +the \file{.aux} file which, arguably, may be seen as a redundancy, or waste. + +It is probably fair to consider this redundancy, in most use cases, as a +negligible cost. But you may disagree, or the size of your document or your +requirements may say otherwise, in which case you may prefer the second +approach and use \cs{zlabel} normally, with some occasional \cs{label} where +needed. Known relevant cases where \cs{label} is required are documented in +the manual (see \zcref{sec:how-tos,sec:limitations,sec:comp-modules}), but +some trial and error can easily cover the gap for the remaining cases. They +are also rare cases. So finding out where \cs{label} is required should not +be much of a trouble either. + +I think the first approach does deserve the status of ``recommended'' for +normal use cases and documents. Despite that, note that the examples of this +manual typically use the second approach. There's a historic reason for this, +since most of them were created before the kernel's \texttt{label} hook was +available, so that it was really the only approach. However, I'll keep the +examples this way, notwithstanding this recommendation, because it is also +important to document the limitations of directly using \cs{zlabel}, for those +who may want to use the second approach. + + \section{Options} \zlabel{sec:options} @@ -906,6 +953,19 @@ Its default value is, quite naturally, \cs{@currentcounter}. The default value can be reset by calling the option with no value. Since this option only affects how labels are set, it is not available in \cs{zcref}. +\DescribeOption{\raisebox{.4em}{\dbend}\ labelhook} % +\opt{labelhook} is a boolean option which controls whether \pkg{zref-clever} +uses the kernel's \texttt{label} hook to, whenever a standard \cs{label} is +called, also set a \cs{zlabel} with the same name. The package's default +value is \texttt{true} so that one can use \cs{label}s along the document and +refer to them (also) with \pkg{zref} and \pkg{zref-clever} reference commands. +This value is not only the default, but also a recommended value. Disabling +this option means you are on your own to handle cases where \cs{zlabel} does +not work, which are not many, but can be tricky to deal with where they occur. +Since this option only affects how labels are set, it is not available in +\cs{zcref}. See \zcref{sec:label-or-zlabel} for some discussion of different +labeling approaches this options allows for. + \DescribeOption{nocompat} % Some packages, document classes, or LaTeX features may require specific support to work with \pkg{zref-clever} (see \zcref{sec:limitations}). @@ -1845,14 +1905,19 @@ package in the setup, the same procedure can be used with \cls{memoir}'s \zctask{Make references to \pkg{amsmath} display math environments.} -Given how \pkg{amsmath}'s display math environments work, they need to handle -\cs{label} specially, and this support is quite hard-wired into the -environments, but it is not extended to \cs{zlabel}. \pkg{zref-clever}'s -\opt{amsmath} compatibility module provides that a \cs{label} used inside -these environments set both a regular \cs{label} and a \cs{zlabel}, so that we -can refer to the equations with both referencing systems. Note the use of -\cs{zlabel} for \env{subequations} though. For more details, see the -description of the \opt{amsmath} compatibility module at +\pkg{amsmath}'s display math environments have their contents processed twice, +once for measuring and the second does the final typesetting. Hence, +\pkg{amsmath} needs to handle \cs{label} specially inside these environments, +otherwise we'd have duplicate labels all around, and indeed it does redefine +\cs{label} locally inside them. Alas, the same treatment is not granted to +\cs{zlabel}. Therefore, you must use \cs{label} (not \cs{zlabel}) inside +\pkg{amsmath}'s display math environments, and the \opt{labelhook} option +provides that a \cs{label} sets both a regular \cs{label} and a \cs{zlabel}, +so that we can refer to the equations with both referencing systems. The +following environments are subject to this usage restriction: \env{equation}, +\env{align}, \env{alignat}, \env{flalign}, \env{xalignat}, \env{gather}, +\env{multline}, and their respective starred versions. For more details, see +the description of the \opt{amsmath} compatibility module at \zcref{sec:comp-modules}. \begin{zchowto}[caption={\pkg{amsmath}},label={how:amsmath}] @@ -1870,7 +1935,7 @@ description of the \opt{amsmath} compatibility module at A^{(1)}_l =\begin{cases} n!,&\text{if }l =1\\ 0,&\text{otherwise}.\end{cases} \end{equation*} -\begin{subequations}\zlabel{eq:3} +\begin{subequations}\label{eq:3} \begin{align} A+B&=B+A\\ C&=D+E\label{eq:3b}\\ @@ -1926,14 +1991,13 @@ regardless of what the current counter is. \pkg{listings} package.} Being \env{lstlisting} a verbatim environment, setting labels inside it -requires special treatment. \pkg{zref-clever}'s \opt{listings} compatibility -module provides that a label given to the \opt{label} option gets set with -both a regular \cs{label} and a \cs{zlabel}, so that we can refer to it with -both referencing systems. Setting labels for specific lines of the -environment can be done with \cs{zlabel} directly, subject to the same -escaping as for the standard \cs{label}. For more details, see the -description of the \opt{listings} compatibility module at -\zcref{sec:comp-modules}. +requires special treatment. \pkg{zref-clever}'s \opt{labelhook} option +provides that a label given to the \opt{label} option gets set with both a +regular \cs{label} and a \cs{zlabel}, so that we can refer to it with both +referencing systems. Setting labels for specific lines of the environment can +be done with \cs{zlabel} directly, subject to the same escaping as for the +standard \cs{label}. For more details, see the description of the +\opt{listings} compatibility module at \zcref{sec:comp-modules}. \begin{zchowto}[caption={\pkg{listings}},label={how:listings},escapeinside=`'] \documentclass{article} @@ -2101,7 +2165,50 @@ with the \opt{label type} option. This is \zcref{th:theo} on \zcpageref{th:theo} and it is titled ``\zcref[noname,ref=title]{th:theo}''. \end{mytheo} -\end{document}\end{zchowto} +\end{document} +\end{zchowto} + + +\subsection{\pkg{breqn}} + +\zctask{Make references to \pkg{breqn} math environments.} + +\pkg{breqn}'s math environments \env{dgroup}, \env{dmath}, \env{dseries}, and +\env{darray} offer a \opt{label} option (plus \opt{labelprefix}) for the +purpose of label setting. \pkg{breqn}'s documentation says the following +about the use of \cs{label} inside its environments: \textquote{Use of the + normal \cs{label} command instead of the \opt{label} option works, I think, + most of the time (untested)}. My light testing suggests the same is true +for \cs{zlabel}, which can then be used directly in these environments. +Either way, given the \opt{labelhook} option, we can just use \pkg{breqn}'s +\opt{label} option and be at ease. Also, \pkg{breqn} does not use +\cs{refstepcounter} to increment the equation counters and, as a result, fails +to set \pkg{hyperref} anchors for the equations (thus affecting standard +labels too). You may wish to use the work-around provided by Heiko Oberdiek +at \url{https://tex.stackexchange.com/a/241150}. + +\begin{zchowto}[caption={\pkg{breqn}},label={how:breqn}] +\documentclass{article} +\usepackage{zref-clever} +\usepackage{breqn} +\usepackage{hyperref} +% From https://tex.stackexchange.com/a/241150. +\usepackage{etoolbox} +\makeatletter +\patchcmd\eq@setnumber{\stepcounter}{\refstepcounter}{}{% + \errmessage{Patching \noexpand\eq@setnumber failed}} +\makeatother +\begin{document} +\section{Section 1} +\begin{dmath}[label={eq:1}] + f(x)=\frac{1}{x} \condition{for $x\neq 0$} +\end{dmath} +\begin{dmath}[labelprefix={eq:},label={2}] + H_2^2 = x_1^2 + x_1 x_2 + x_2^2 - q_1 - q_2 +\end{dmath} +\zcref{eq:1, eq:2} +\end{document} +\end{zchowto} \subsection{Ordinal references} @@ -2181,6 +2288,15 @@ verbatim-like environments it depends on how they are defined and whether they provide a proper place or option to do so. But other places may be problematic too, for example, \pkg{amsmath} display math environments also handle \cs{label} specially and the same work is not done for \cs{zlabel}. +Classes and packages may offer label setting by means of arguments or options, +and those usually only cater for the standard referencing system, etc. +Fortunately for us, the \texttt{label} hook introduced by the \LaTeX{} kernel +in the 2023-06-01 release improves the situation considerably. +\pkg{zref-clever} makes use of it with the \opt{labelhook} option, enabled by +default, so that a standard \cs{label} also sets a \cs{zlabel} with the same +name, thus providing a very general and reliable way to deal with these places +where setting a \cs{zlabel} directly is problematic: just set a standard +label. Regarding the second, a correctly set \cs{@currentcounter} is critical for the task of \pkg{zref-clever}: the reference type will depend on that and, @@ -2198,7 +2314,7 @@ which at least allows for some viable work-arounds when the value of to set it, depends on the case. Still, \cs{refstepcounter} is ubiquitous enough a tool that we can count on \cs{@currentcounter} most of the time. -All in all, most things work, but some things don't. And if the later will +All in all, most things work, but some things may not. And if the later will eventually work depends essentially on whether support for \pkg{zref} is provided by the relevant packages and classes or not. Or, failing that, whether \pkg{zref-clever} is able to provide some specific support when a @@ -2260,62 +2376,22 @@ features with support for the following: i) set counter types for counters \texttt{subfigure}, \texttt{subtable}, and \texttt{poemline} (used in the \env{verse} environment); ii) configure resetting behavior (\opt{counterresetby} option) for \texttt{subfigure} and \texttt{subtable} -counters; iii) provide that the \meta{label} arguments to environments -\env{sidecaption} and \env{sidecontcaption} and commands \cs{bitwonumcaption}, -\cs{bionenumcaption}, and \cs{bicaption} \emph{also} set a \cs{zlabel} of the -same name; iv) provide the \pkg{zref} property ``\texttt{subcaption}'' so that +counters; iii) provide the \pkg{zref} property ``\texttt{subcaption}'' so that we can refer to, for example, \texttt{\cs{zcref}[ref=subcaption]\{subcap-1\}} -to emulate the functionality of \cls{memoir}'s \cs{subcaptionref}; v) provide +to emulate the functionality of \cls{memoir}'s \cs{subcaptionref}; iv) provide that \cs{footnote}, \cs{verbfootnote}, \cs{sidefootnote}, and \cs{pagenote} get a proper \opt{currentcounter} set; and v) set counter types for counters -\texttt{sidefootnote} and \texttt{pagenote}. Naturally, the sheer number of -features that required some specific support implies that some gymnastics were -needed here. But the most sensitive changes are: i) a local redefinition of -\cs{label} inside the environments \env{sidecaption} and \env{sidecontcaption} -and the commands \cs{bitwonumcaption}, \cs{bionenumcaption}, and -\cs{bicaption}; and ii) the use of \pkg{ltcmdhooks} command hooks on -\cs{bitwonumcaption}, \cs{bionenumcaption}, \cs{bicaption}, -\cs{@memsubcaption}, \cs{@makefntext}, and \cs{@makesidefntext}. +\texttt{sidefootnote} and \texttt{pagenote}. The most sensitive changes are +the use of \pkg{ltcmdhooks} command hooks on \cs{@memsubcaption}, +\cs{@makefntext}, and \cs{@makesidefntext}. \DescribeOption{amsmath} % -\pkg{amsmath}'s display math environments have their contents processed twice, -once for measuring and the second does the final typesetting. Hence, -\pkg{amsmath} needs to handle \cs{label} specially inside these environments, -otherwise we'd have duplicate labels all around, and indeed it does redefine -\cs{label} locally inside them. Alas, the same treatment is not granted to -\cs{zlabel}. However, \cs{label} is set basically to \emph{store} the value -of the argument inside the environments, and its global meaning is kept in -\cs{ltx@label} which is called at the appropriate time to actually set the -label. So, what \pkg{zref-clever} does is redefine \cs{ltx@label} to set -\texttt{both} a regular \cs{label} and a \cs{zlabel} for the same \meta{label} -(which does not generate a duplicate label problem since the referencing -systems are independent). Therefore, you must use \cs{label} (not -\cs{zlabel}) inside \pkg{amsmath}'s display math environments, and this -compatibility module arranges that you can also refer to that label with -\pkg{zref} and, thus, with \cs{zcref} as well. The following environments are -subject to this usage restriction: \env{equation}, \env{align}, \env{alignat}, -\env{flalign}, \env{xalignat}, \env{gather}, \env{multline}, and their -respective starred versions. In particular, the same is not the case for the -\env{subequations} environment, inside which \cs{zlabel} works as usual (to -refer to the main equation number, that is, right after -\texttt{\cs{begin}\{subequations\}}). See the \zcref{how:amsmath} for an -usage example. The module also ensures proper \opt{currentcounter} values are -in place for the display math environments, for which it uses environment -hooks, and sets the font of equation references to \cs{upshape}, following -\pkg{amsmath}'s \cs{eqref}. Finally, the module also provides a -\texttt{subeq} property, for display math environments used inside the -\env{subequations} environment, which can be used to refer to them directly -with the \opt{ref} option, or to build terse ranges with the \opt{endrange} -option. Note that \pkg{zref-clever} is not the only package to redefine -\cs{ltx@label}, and compatibility problems may arise if this module is used -with such packages or with document classes that do the same. In case of -trouble, you can load \pkg{zref-clever} with option \texttt{nocompat=amsmath} -and either use the standard referencing system's facilities to refer to -\pkg{amsmath}'s equations or check the code documentation for the technique -used for this (which is pretty standard) and adapt it to your case. Given -that any trouble that may arise here is one of the proper ``timing'' of the -redefinition, it should not be particularly complicated to make such -adjustments. +The module ensures proper \opt{currentcounter} values are in place for the +display math environments, for which it uses environment hooks. The module +also provides a \texttt{subeq} property, for display math environments used +inside the \env{subequations} environment, which can be used to refer to them +directly with the \opt{ref} option, or to build terse ranges with the +\opt{endrange} option. \DescribeOption{mathtools} % \pkg{mathtools} has a feature to show the numbers only for those equations @@ -2330,33 +2406,14 @@ side. \DescribeOption{breqn} % This compatibility module only sets proper \opt{currentcounter} values for the environments \env{dgroup}, \env{dmath}, \env{dseries}, and \env{darray}, and -uses environment hooks for the purpose. Note that these environments offer a -\opt{label} option for label setting, but implements it in a way that is -somewhat tricky to grab for our purposes, so we don't do it. However, -\pkg{breqn}'s documentation says the following about the use of \cs{label} -inside its environments: \textquote{Use of the normal \cs{label} command - instead of the \opt{label} option works, I think, most of the time - (untested)}. My light testing suggests the same is true for \cs{zlabel}, -which can then be used directly in these environments. But the ``second -class'' status for this use is the one granted by \pkg{breqn}, there's not -much we can do here. If you have any trouble with this, you may wish to check -\zcref{wkrnd:breqn}. +uses environment hooks for the purpose. See the \zcref{how:breqn} for an +usage example. \DescribeOption{listings} % -Being \env{lstlisting}s environments what they are, one cannot simply place a -label inside them without special treatment. \pkg{listings} arranges to this -by providing a \opt{label} option for setting a label for the whole -environment, and a properly escaped label command inside the environment can -be used to refer to the line number. While the later can also be used to set -a \cs{zlabel} to make line number references, the \opt{label} option is -catered to the standard labels exclusively. Hence, this compatibility module -uses the same label name -- which luckily and atypically is stored in a -variable -- and sets a \cs{zlabel} as well. This is done by using -\pkg{listings}' \texttt{PreInit} hook, se we don't have to redefine or tamper -with anything for the purpose. Besides this, the module also sets appropriate -\opt{countertype}, \opt{counterresetby} and \opt{currentcounter} values for -the \pkg{listings}' counters: \texttt{lstlisting} and \texttt{lstnumber}. See -the \zcref{how:listings} for an usage example. +The module sets appropriate \opt{countertype}, \opt{counterresetby} and +\opt{currentcounter} values for the \pkg{listings}' counters: +\texttt{lstlisting} and \texttt{lstnumber}. See the \zcref{how:listings} for +an usage example. \DescribeOption{enumitem} % \LaTeX{}'s \env{enumerate} environment requires some special treatment from @@ -2407,54 +2464,6 @@ sort, but from \pkg{zref-clever}'s perspective, their status is ``not supported''. -\subsection*{\pkg{breqn}} - -As mentioned in \opt{breqn}'s compatibility module (\zcref{sec:comp-modules}), -\pkg{breqn}'s math environments \env{dgroup}, \env{dmath}, \env{dseries}, and -\env{darray} offer a \opt{label} option (plus \opt{labelprefix}) for the -purpose of label setting. Setting a \cs{zlabel} alongside with a regular -\cs{label} based on that option requires redefining some of \pkg{breqn} -internals. Also, \pkg{breqn} does not use \cs{refstepcounter} to increment -the equation counters and, as a result, fails to set \pkg{hyperref} anchors -for the equations (thus affecting standard labels too). The example below -also provides to that.\footnote{The later work-around thanks to Heiko - Oberdiek, at \url{https://tex.stackexchange.com/a/241150}.} - - -\begin{zcworkaround}[caption={\pkg{breqn}},label={wkrnd:breqn}] -\documentclass{article} -\usepackage{zref-clever} -\usepackage{breqn} -\makeatletter -\define@key{breqn}{label}{% - \edef\next@label{% - \noexpand\label{\next@label@pre#1}% - \noexpand\zlabel{\next@label@pre#1}}% - \let\next@label@pre\@empty} -\makeatother -\usepackage{hyperref} -\usepackage{etoolbox} -\makeatletter -\patchcmd\eq@setnumber{\stepcounter}{\refstepcounter}{}{% - \errmessage{Patching \noexpand\eq@setnumber failed}} -\makeatother -\begin{document} -\section{Section 1} -\begin{dmath}[label={eq:1}] - f(x)=\frac{1}{x} \condition{for $x\neq 0$} -\end{dmath} -\begin{dmath}[labelprefix={eq:},label={2}] - H_2^2 = x_1^2 + x_1 x_2 + x_2^2 - q_1 - q_2 -\end{dmath} -\zcref{eq:1, eq:2} -\end{document} -\end{zcworkaround} - -Of course, you can always adapt things to your needs and, e.g., make the -\opt{label} option set just \cs{zlabel} instead of both labels, or create a -separate \opt{zlabel} option. - - \subsection*{\cls{beamer}} \cls{beamer} does some really atypical things with regard to cross-references. @@ -2536,16 +2545,13 @@ A couple of caveats though. First, there's probably still some work to be done there in defining and setting reference types for \cls{beamer} specific document objects, e.g. overlays. But it can be done by the standard user interface of \pkg{zref-clever}. Second, since \cls{beamer}'s anchoring system -does not provide for uniqueness of anchors as \pkg{hyperref} does, the -procedure used by \pkg{zref-clever} in its \opt{amsmath} compatibility module -of setting both \cs{label} and \cs{zlabel} in \pkg{amsmath}'s display math -environments will result in duplicate anchors for labels set in them, with -corresponding \pkg{hyperref} warnings of ``destination with the same -identifier has been already used, duplicate ignored''. The warning is -actually harmless in this case, since both labels are set in the same place, -and thus have identical anchors. But, if it bothers you enough, you can look -at the \opt{amsmath} compatibility module in the code documentation, and -adjust things so that it sets only a \cs{zlabel}. +does not provide for uniqueness of anchors as \pkg{hyperref} does, if you +(need to) use \cs{label} to set both \cs{label} and \cs{zlabel}, relying on +the \opt{labelhook} option, this will result in duplicate anchors for labels +set in them, with corresponding \pkg{hyperref} warnings of ``destination with +the same identifier has been already used, duplicate ignored''. The warning +is actually harmless in this case, since both labels are set in the same +place, and thus have identical anchors, it is nevertheless there. \section{Acknowledgments} @@ -2589,6 +2595,7 @@ were generously provided by (in chronological order): % 2022-01-12: https://chat.stackexchange.com/transcript/message/60129233#60129233 % 2022-04-09: https://github.com/latex3/hyperref/issues/229#issuecomment-1093870142 % 2023-01-02: https://tex.stackexchange.com/q/670399 (comments) + % 2023-06-01: https://github.com/latex3/latex2e/pull/956 Phelype Oleinik, % 2021-08-20: https://tex.stackexchange.com/q/611370 (comments) % 2021-09-09: https://tex.stackexchange.com/a/614704 @@ -2596,6 +2603,7 @@ were generously provided by (in chronological order): % 2021-10-21: https://github.com/latex3/latex2e/pull/699 % 2022-01-12: https://tex.stackexchange.com/questions/629946/#comment1571118_629946 % 2022-01-11: https://tex.stackexchange.com/questions/633341/#comment1579825_633347 + % 2023-06-01: https://github.com/latex3/latex2e/pull/1020 Enrico Gregorio, % 2021-08-20: https://tex.stackexchange.com/a/611385 % 2021-08-20: https://tex.stackexchange.com/q/611370/#comment1529282_611385 @@ -2637,9 +2645,11 @@ were generously provided by (in chronological order): % and following discussion. Thomas F. Sturm, % 2023-02-09: https://github.com/T-F-S/tcolorbox/issues/206 + % 2023-05-12: https://github.com/T-F-S/tcolorbox/issues/230 and Yukai Chou. % 'muzimuzhi' % 2023-02-18: https://github.com/gusbrs/zref-clever/pull/14 % 2023-02-18: https://github.com/gusbrs/zref-clever/pull/15 + % 2023-05-11: https://github.com/T-F-S/tcolorbox/issues/230 The package's language files have been provided or improved thanks to: Denis Bitouzé (French), diff --git a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf b/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf Binary files differdeleted file mode 100644 index 4a4bfb147fb..00000000000 --- a/Master/texmf-dist/doc/latex/zref-clever/zref-clever.pdf +++ /dev/null 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 cee60860c35..fff75c1b447 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.dtx @@ -22,7 +22,7 @@ % % This work consists of the files zref-clever.dtx, % zref-clever.ins, -% zref-clever.tex, +% zref-clever-doc.tex, % zref-clever-code.tex, % and the files generated from them. % @@ -131,12 +131,11 @@ % % Taking a stance on backward compatibility of the package. During initial % development, we have used freely recent features of the kernel (albeit -% refraining from \pkg{l3candidates}, even though I'd have loved to have used -% \cs{bool_case_true:}\dots{}). We presume \pkg{xparse} (which made to the -% kernel in the 2020-10-01 release), and \pkg{expl3} as well (which made to -% the kernel in the 2020-02-02 release). We also just use UTF-8 for the +% refraining from \pkg{l3candidates}). We presume \pkg{xparse} (which made to +% the kernel in the 2020-10-01 release), and \pkg{expl3} as well (which made +% to the kernel in the 2020-02-02 release). We also just use UTF-8 for the % language files (which became the default input encoding in the 2018-04-01 -% release). Finally, a couple of changes came with the 2021-11-15 kernel +% release). Also, a couple of changes came with the 2021-11-15 kernel % release, which are important here. First, a fix was made to the new hook % management system (\pkg{ltcmdhooks}), with implications to the hook we add % to \cs{appendix} (by \contributor{Phelype Oleinik} at @@ -144,18 +143,23 @@ % \url{https://github.com/latex3/latex2e/pull/699}). Second, the support for % \cs{@currentcounter} has been improved, including \cs{footnote} and % \pkg{amsmath} (by \contributor{Frank Mittelbach} and \contributor{Ulrike -% Fischer} at \url{https://github.com/latex3/latex2e/issues/687}). Hence, -% since we would not be able to go much backwards without special handling -% anyway, we make the cut at the 2021-11-15 kernel release. +% Fischer} at \url{https://github.com/latex3/latex2e/issues/687}). Finally, +% and critically, the new \texttt{label} hook introduced in the 2023-06-01 +% 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. % % \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} -\IfFormatAtLeastTF{2021-11-15} +\IfFormatAtLeastTF{2023-06-01} {} {% \PackageError{zref-clever}{LaTeX kernel too old} {% - 'zref-clever' requires a LaTeX kernel 2021-11-15 or newer.% + 'zref-clever' requires a LaTeX kernel 2023-06-01 or newer.% \MessageBreak Loading will abort!% }% \endinput @@ -165,7 +169,7 @@ % % Identify the package. % \begin{macrocode} -\ProvidesExplPackage {zref-clever} {2023-02-21} {0.3.6} +\ProvidesExplPackage {zref-clever} {2023-06-14} {0.4.0} {Clever LaTeX cross-references based on zref} % \end{macrocode} % @@ -3927,6 +3931,36 @@ % \end{macrocode} % % +% \subsubsection*{\opt{labelhook} option} +% +% \begin{macrocode} +\bool_new:N \l_@@_labelhook_bool +\keys_define:nn { zref-clever/label } + { + labelhook .bool_set:N = \l_@@_labelhook_bool , + labelhook .initial:n = true , + labelhook .default:n = true , + } +% \end{macrocode} +% +% We \emph{must} use the lower level \cs{zref@label} in this context, and +% hence also handle protection with \cs{zref@wrapper@babel}, because +% \cs{zlabel} makes itself no-op when \cs{label} is equal to \cs{ltx@gobble}, +% and that's precisely the case inside the \pkg{amsmath}'s \env{multline} +% environment (and possibly elsewhere?). See +% \url{https://tex.stackexchange.com/a/402297} and +% \url{https://github.com/ho-tex/zref/issues/4}. +% +% \begin{macrocode} +\AddToHookWithArguments { label } + { + \bool_if:NT \l_@@_labelhook_bool + { \zref@wrapper@babel \zref@label {#1} } + } +% \end{macrocode} +% +% +% % \subsubsection*{\opt{nocompat} option} % % @@ -4007,8 +4041,8 @@ % % This is a set of options related to reference typesetting which receive % equal treatment and, hence, are handled in batch. Since we are dealing with -% options to be passed to \cs{zcref} or to \cs{zcsetup} or at load time, only -% ``not necessarily type-specific'' options are pertinent here. +% options to be passed to \cs{zcref} or to \cs{zcsetup}, only ``not +% necessarily type-specific'' options are pertinent here. % % % \begin{macrocode} @@ -7774,39 +7808,10 @@ % related features, mostly dealing with captions, subfloats, and notes. Some % of them are implemented in ways which make difficult the use of \pkg{zref}, % particularly \cs{zlabel}, short of redefining the whole stuff ourselves. -% Hopefully, these features are specialized enough to make \pkg{zref-clever} -% useful enough with \cls{memoir} without much friction, but unless some -% support is added upstream, it is difficult not to be a little intrusive -% here. +% Fortunately, however, the kernel's new \texttt{label} hook, and the +% \opt{labelhook} option, make things somewhat easier. % % \begin{enumerate} -% \item Caption functionality which receives \meta{label} as optional -% argument, namely: -% \begin{enumerate} -% \item The \env{sidecaption} and \env{sidecontcaption} environments. These -% environments \emph{store} the label in an internal macro, -% \cs{m@mscaplabel}, at the begin environment code (more precisely in -% \cs[replace=false]{@@sidecaption}), but both the call to -% \cs{refstepcounter} and the expansion of \cs{m@mscaplabel} take place at -% \cs{endsidecaption}. For this reason, hooks are not particularly -% helpful, and there is not any easy way to grab the \meta{label} argument -% to start with. I can see two ways to deal with these environments, none -% of which I really like. First, map through \cs{m@mscaplabel} until -% \cs{label} is found, then grab the next token which is the \meta{label}. -% This can be used to set a \cs{zlabel} either with a kernel environment -% hook, or with \cs{@mem@scap@afterhook} (the former requires running -% \cs{refstepcounter} on our own, since the \texttt{env/.../end} hook -% comes before this is done by \cs{endsidecaption}). Second, locally -% redefine \cs{label} to set both labels inside the environments. -% \item The bilingual caption commands: \cs{bitwonumcaption}, -% \cs{bionenumcaption}, and \cs{bicaption}. These commands do not support -% setting the label in their arguments (the labels do get set, but they -% end up included in the \texttt{title} property of the label too). So we -% do the same for them as for \env{sidecaption}, just taking care of -% grouping, since we can't count on the convenience of the environment -% hook (luckily for us, they are scoped themselves, so we can add an extra -% group there). -% \end{enumerate} % \item The \cs{subcaptionref} command, which makes a reference to the % subcaption without the number of the main caption (e.g. ``(b)'', instead % of ``2.3(b)''), for labels set inside the \meta{subtitle} argument of the @@ -7860,36 +7865,6 @@ } , } % \end{macrocode} -% Support for caption \cls{memoir} features that require that \meta{label} be -% supplied as an optional argument. -% \begin{macrocode} - \cs_new_protected:Npn \@@_memoir_both_labels: - { - \cs_set_eq:NN \@@_memoir_orig_label:n \label - \cs_set:Npn \@@_memoir_label_and_zlabel:n ##1 - { - \@@_memoir_orig_label:n {##1} - \zlabel{##1} - } - \cs_set_eq:NN \label \@@_memoir_label_and_zlabel:n - } - \AddToHook { env / sidecaption / begin } - { \@@_memoir_both_labels: } - \AddToHook { env / sidecontcaption / begin } - { \@@_memoir_both_labels: } - \AddToHook{ cmd / bitwonumcaption / before } - { \group_begin: \@@_memoir_both_labels: } - \AddToHook{ cmd / bitwonumcaption / after } - { \group_end: } - \AddToHook{ cmd / bionenumcaption / before } - { \group_begin: \@@_memoir_both_labels: } - \AddToHook{ cmd / bionenumcaption / after } - { \group_end: } - \AddToHook{ cmd / bicaption / before } - { \group_begin: \@@_memoir_both_labels: } - \AddToHook{ cmd / bicaption / after } - { \group_end: } -% \end{macrocode} % Support for \texttt{subcaption} reference. % \begin{macrocode} \zref@newprop { subcaption } @@ -7930,7 +7905,8 @@ % % \subsection{\opt{amsmath}} % -% About this, see \url{https://tex.stackexchange.com/a/402297}. +% About this, see \url{https://tex.stackexchange.com/a/402297} and +% \url{https://github.com/ho-tex/zref/issues/4}. % % \begin{macrocode} \@@_compat_module:nn { amsmath } @@ -7938,69 +7914,6 @@ \@@_if_package_loaded:nT { amsmath } { % \end{macrocode} -% First, we define a function for label setting inside \pkg{amsmath} math -% environments, we want it to set both \cs{zlabel} and \cs{label}. We may -% ``get a ride'', but not steal the place altogether. This makes for -% potentially redundant labels, but seems a good compromise. We \emph{must} -% use the lower level \cs{zref@label} in this context, and hence also handle -% protection with \cs{zref@wrapper@babel}, because \cs{zlabel} makes itself -% no-op when \cs{label} is equal to \cs{ltx@gobble}, and that's precisely the -% case inside the \env{multline} environment (and, damn!, I took a beating of -% this detail\dots{}). See also \url{https://github.com/ho-tex/zref/issues/4} -% and \url{https://github.com/latex3/latex2e/issues/272}. -% \begin{macrocode} - \cs_set_nopar:Npn \@@_ltxlabel:n #1 - { - \@@_orig_ltxlabel:n {#1} - \zref@wrapper@babel \zref@label {#1} - } -% \end{macrocode} -% Then we must store the original value of \cs{ltx@label}, which is the macro -% actually responsible for setting the labels inside \pkg{amsmath}'s math -% environments. And, after that, redefine it to be \cs{@@_ltxlabel:n} -% instead. We must handle \pkg{hyperref} here, which comes very late in the -% preamble, and which loads \pkg{nameref} at \texttt{begindocument} (though -% this has changed recently 2022-05-16, see -% \url{https://github.com/latex3/hyperref/commit/a011ba9308a1b047dc151796de557da0bb22abaa}), -% which in turn, lets \cs{ltx@label} be \cs{label}. This has to come after -% \pkg{nameref}. Other classes packages also redefine \cs{ltx@label}, which -% may cause some trouble. A \texttt{grep} on \texttt{texmf-dist} returns hits -% for: \file{thm-restate.sty}, \file{smartref.sty}, \file{jmlrbook.cls}, -% \file{cleveref.sty}, \file{cryptocode.sty}, \file{nameref.sty}, -% \file{easyeqn.sty}, \file{empheq.sty}, \file{ntheorem.sty}, -% \file{nccmath.sty}, \file{nwejm.cls}, \file{nwejmart.cls}, -% \file{aguplus.sty}, \file{aguplus.cls}, \file{agupp.sty}, -% \file{amsmath.hyp}, \file{amsmath.sty} (surprise!), \file{amsmath.4ht}, -% \file{nameref.4ht}, \file{frenchle.sty}, \file{french.sty}, plus -% corresponding documentations and different versions of the same packages. -% That's not too many, but not ``just a few'' either. The critical ones are -% explicitly handled here (\pkg{amsmath} itself, and \pkg{nameref}). A number -% of those I'm really not acquainted with. For \pkg{cleveref}, in particular, -% this procedure is not compatible with it. If we happen to come later than -% it and override its definition, this may be a substantial problem for -% \pkg{cleveref}, since it will find the label, but it won't contain the data -% it is expecting. However, this should normally not occur, if the user has -% followed the documented recommendation for \pkg{cleveref} to load it last, -% or at least very late, and besides I don't see much of an use case for using -% both \pkg{cleveref} and \pkg{zref-clever} together. I have documented in -% the user manual that this module may cause potential issues, and how to work -% around them. And I have made an upstream feature request for a hook, so -% that this could be made more cleanly at -% \url{https://github.com/latex3/hyperref/issues/212}. -% \begin{macrocode} - \@@_if_package_loaded:nTF { hyperref } - { - \AddToHook { package / nameref / after } - { - \cs_new_eq:NN \@@_orig_ltxlabel:n \ltx@label - \cs_set_eq:NN \ltx@label \@@_ltxlabel:n - } - } - { - \cs_new_eq:NN \@@_orig_ltxlabel:n \ltx@label - \cs_set_eq:NN \ltx@label \@@_ltxlabel:n - } -% \end{macrocode} % The \env{subequations} environment uses \texttt{parentequation} and % \texttt{equation} as counters, but only the later is subject to % \cs{refstepcounter}. What happens is: at the start, \texttt{equation} is @@ -8145,11 +8058,7 @@ % From the \pkg{breqn} documentation: \textquote{Use of the normal \cs{label} % command instead of the \opt{label} option works, I think, most of the time % (untested)}. Indeed, light testing suggests it does work for \cs{zlabel} -% just as well. However, if it happens not to work, there was no easy -% alternative handle I could find. In particular, it does not seem viable to -% leverage the \opt{label=} option without hacking the package internals, even -% if the case of doing so would not be specially tricky, just ``not very -% civil''. +% just as well. % % \begin{macrocode} \@@_compat_module:nn { breqn } @@ -8223,19 +8132,6 @@ counterresetby = { lstnumber = lstlisting } , } % \end{macrocode} -% Set (also) a \cs{zlabel} with the label received in the \texttt{label=} -% option from the \texttt{lstlisting} environment. The \emph{only} place to -% set this label is the \texttt{PreInit} hook. This hook, comes right after -% \cs{lst@MakeCaption} in \cs{lst@Init}, which runs \cs{refstepcounter} on -% \texttt{lstlisting}, so we must come after it. Also \pkg{listings} itself -% sets \cs{@currentlabel} to \cs{thelstnumber} in the \texttt{Init} hook, -% which comes right after the \texttt{PreInit} one in \cs{lst@Init}. Since, -% if we add to \texttt{Init} here, we go to the end of it, we'd be seeing the -% wrong \cs{@currentlabel} at that point. -% \begin{macrocode} - \lst@AddToHook { PreInit } - { \tl_if_empty:NF \lst@label { \zlabel { \lst@label } } } -% \end{macrocode} % Set \texttt{currentcounter} to \texttt{lstnumber} in the \texttt{Init} hook, % since \pkg{listings} itself sets \cs{@currentlabel} to \cs{thelstnumber} % here. Note that \pkg{listings} \emph{does use} \cs{refstepcounter} on diff --git a/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins b/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins index d4f77dcf36f..668d25788fe 100644 --- a/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins +++ b/Master/texmf-dist/source/latex/zref-clever/zref-clever.ins @@ -22,7 +22,7 @@ % % This work consists of the files zref-clever.dtx, % zref-clever.ins, -% zref-clever.tex, +% zref-clever-doc.tex, % zref-clever-code.tex, % and the files generated from them. % @@ -68,7 +68,7 @@ This work is "maintained" (as per LPPL maintenance status) by This work consists of the files zref-clever.dtx, zref-clever.ins, - zref-clever.tex, + zref-clever-doc.tex, zref-clever-code.tex, and the files generated from them. diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang index ae2a864c6c6..9450f15d3f8 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-dutch.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang index 14699ba9ae7..bc1b922448a 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-english.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang index a9cda98af35..78c49a248e1 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-french.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang index 25b78c6e300..b123a2c504e 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-german.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-italian.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-italian.lang index 31a8d2f45d4..d6f26294028 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-italian.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-italian.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang index 09f67bee0ea..c1499a3b926 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-portuguese.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% diff --git a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang index ded02c97936..3a8d8d067c2 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever-spanish.lang @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% 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 6f8fd74d957..1b999f94088 100644 --- a/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty +++ b/Master/texmf-dist/tex/latex/zref-clever/zref-clever.sty @@ -26,7 +26,7 @@ %% %% This work consists of the files zref-clever.dtx, %% zref-clever.ins, -%% zref-clever.tex, +%% zref-clever-doc.tex, %% zref-clever-code.tex, %% and the files generated from them. %% @@ -42,18 +42,19 @@ %% %% ----------------------------------------------------------------------- %% +\NeedsTeXFormat{LaTeX2e} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} -\IfFormatAtLeastTF{2021-11-15} +\IfFormatAtLeastTF{2023-06-01} {} {% \PackageError{zref-clever}{LaTeX kernel too old} {% - 'zref-clever' requires a LaTeX kernel 2021-11-15 or newer.% + 'zref-clever' requires a LaTeX kernel 2023-06-01 or newer.% \MessageBreak Loading will abort!% }% \endinput }% -\ProvidesExplPackage {zref-clever} {2023-02-21} {0.3.6} +\ProvidesExplPackage {zref-clever} {2023-06-14} {0.4.0} {Clever LaTeX cross-references based on zref} \RequirePackage { zref-base } \RequirePackage { zref-user } @@ -2452,6 +2453,18 @@ currentcounter .default:n = \@currentcounter , currentcounter .initial:n = \@currentcounter , } +\bool_new:N \l__zrefclever_labelhook_bool +\keys_define:nn { zref-clever/label } + { + labelhook .bool_set:N = \l__zrefclever_labelhook_bool , + labelhook .initial:n = true , + labelhook .default:n = true , + } +\AddToHookWithArguments { label } + { + \bool_if:NT \l__zrefclever_labelhook_bool + { \zref@wrapper@babel \zref@label {#1} } + } \bool_new:N \g__zrefclever_nocompat_bool \seq_new:N \g__zrefclever_nocompat_modules_seq \keys_define:nn { zref-clever/reference } @@ -5447,32 +5460,6 @@ subtable = table , } , } - \cs_new_protected:Npn \__zrefclever_memoir_both_labels: - { - \cs_set_eq:NN \__zrefclever_memoir_orig_label:n \label - \cs_set:Npn \__zrefclever_memoir_label_and_zlabel:n ##1 - { - \__zrefclever_memoir_orig_label:n {##1} - \zlabel{##1} - } - \cs_set_eq:NN \label \__zrefclever_memoir_label_and_zlabel:n - } - \AddToHook { env / sidecaption / begin } - { \__zrefclever_memoir_both_labels: } - \AddToHook { env / sidecontcaption / begin } - { \__zrefclever_memoir_both_labels: } - \AddToHook{ cmd / bitwonumcaption / before } - { \group_begin: \__zrefclever_memoir_both_labels: } - \AddToHook{ cmd / bitwonumcaption / after } - { \group_end: } - \AddToHook{ cmd / bionenumcaption / before } - { \group_begin: \__zrefclever_memoir_both_labels: } - \AddToHook{ cmd / bionenumcaption / after } - { \group_end: } - \AddToHook{ cmd / bicaption / before } - { \group_begin: \__zrefclever_memoir_both_labels: } - \AddToHook{ cmd / bicaption / after } - { \group_end: } \zref@newprop { subcaption } { \cs_if_exist_use:c { @@thesub \@captype } } \AddToHook{ cmd / @memsubcaption / before } @@ -5505,23 +5492,6 @@ { \__zrefclever_if_package_loaded:nT { amsmath } { - \cs_set_nopar:Npn \__zrefclever_ltxlabel:n #1 - { - \__zrefclever_orig_ltxlabel:n {#1} - \zref@wrapper@babel \zref@label {#1} - } - \__zrefclever_if_package_loaded:nTF { hyperref } - { - \AddToHook { package / nameref / after } - { - \cs_new_eq:NN \__zrefclever_orig_ltxlabel:n \ltx@label - \cs_set_eq:NN \ltx@label \__zrefclever_ltxlabel:n - } - } - { - \cs_new_eq:NN \__zrefclever_orig_ltxlabel:n \ltx@label - \cs_set_eq:NN \ltx@label \__zrefclever_ltxlabel:n - } \bool_new:N \l__zrefclever_amsmath_subequations_bool \AddToHook { env / subequations / begin } { @@ -5656,8 +5626,6 @@ } , counterresetby = { lstnumber = lstlisting } , } - \lst@AddToHook { PreInit } - { \tl_if_empty:NF \lst@label { \zlabel { \lst@label } } } \lst@AddToHook { Init } { \__zrefclever_zcsetup:n { currentcounter = lstnumber } } \msg_info:nnn { zref-clever } { compat-package } { listings } |