[latex3-commits] [latex3/latex2e] latexlab/rcb-review: remove dependency from nameref (0f276899)

github at latex-project.org github at latex-project.org
Fri Jul 28 12:57:43 CEST 2023


Repository : https://github.com/latex3/latex2e
On branch  : latexlab/rcb-review
Link       : https://github.com/latex3/latex2e/commit/0f276899572c527f4ee1e7ff004a982c55398593

>---------------------------------------------------------------

commit 0f276899572c527f4ee1e7ff004a982c55398593
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Fri Jul 28 12:57:43 2023 +0200

    remove dependency from nameref


>---------------------------------------------------------------

0f276899572c527f4ee1e7ff004a982c55398593
 required/latex-lab/latex-lab-footnotes.dtx | 28 +++++++++-------------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/required/latex-lab/latex-lab-footnotes.dtx b/required/latex-lab/latex-lab-footnotes.dtx
index e29cfc90..ed5e8e45 100644
--- a/required/latex-lab/latex-lab-footnotes.dtx
+++ b/required/latex-lab/latex-lab-footnotes.dtx
@@ -622,7 +622,7 @@
 % above, as it contains a reference command it can't be used to match a note, also \cs{footref} can
 % be used after the note has already been set. \cs{footref} disables therefore the automatic detection.
 %
-% Instead the \cs{label} command is (currently with the help of a hook from the \texttt{nameref} package)
+% Instead the \cs{label} command is 
 % extended in the \cs{footnotetext} command to also store the structure number and \cs{footref} retrieves this
 % number to setup the reference and the link.
 %
@@ -716,8 +716,6 @@
 %
 % \item tagging destroys footnotes directly following the text with pdflatex.
 %
-% \item there is a dependency on nameref as it provides the hook in \cs{label}
-% used by the \cs{footref} code.
 %
 % \item there is a dependency to etoolbox as we patch \cs{\@iiiminipage}
 %
@@ -905,7 +903,6 @@
 % \subsection{Variants}
 %
 %    \begin{macrocode}
-\cs_generate_variant:Nn \ref_label:nn { Vn }
 \cs_generate_variant:Nn \ref_value:nn { Vn }
 \cs_generate_variant:Nn \prop_gput:Nnn {cxn}
 \cs_generate_variant:Nn \hook_gput_code:nnn{nne}
@@ -1725,35 +1722,28 @@
 % For \cs{footref} and (perhaps later for labeled footnotes)
 % we must extend the label system.
 % Beside the normal values we also need the structure number of the note.
-% We use the \pkg{nameref} hook until latex provides a hook for its label.
+% We use the inbuild label hook
 % At first we define a suitable attribute, it uses as value the structure
 % number of the note as stored in \cs{l__fnote_currentstruct_tl}
 %    \begin{macrocode}
 \ref_attribute_gset:nnnn {fnote/struct}{1}{now}{\l_@@_currentstruct_tl}
 %    \end{macrocode}
 %
-% We add a hook to the \pkg{nameref} hook. By default it does nothing
-% \begin{macro}{\@@_label_hook:}
+% We add a hook to the label hook. By default it does nothing
+% \begin{macro}{\@@_label_hook:n}
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_label_hook: {}
-\AddToHook{begindocument/before}
-  {
-    \RequirePackage{nameref}
-    \g at addto@macro\label at hook
-      {
-        \@@_label_hook:
-      }
-  }
+\cs_new_protected:Npn \@@_label_hook:n #1 {}
+\AddToHookWithArguments{label}{ \@@_label_hook:n{#1}}
 %    \end{macrocode}
 % \end{macro}
 % Inside a footnotetext we change the hook to store the structure number too.
-% nameref provides the name of label in \cs{label at name}.
+% The name of label is provided as argument in the label hook.
 %    \begin{macrocode}
 \AddToHook{fntext/begin}
  {
-   \cs_set_protected:Npn \@@_label_hook:
+   \cs_set_protected:Npn \@@_label_hook:n #1
     {
-      \ref_label:Vn \label at name {fnote/struct}
+      \ref_label:nn {#1} {fnote/struct}
     }
  }
 %    \end{macrocode}





More information about the latex3-commits mailing list.