[latex3-commits] [git/LaTeX3-latex3-hyperref] cleanup-patches: really move \Ref code (bef0c65)
Ulrike Fischer
fischer at troubleshooting-tex.de
Mon Apr 11 00:07:59 CEST 2022
Repository : https://github.com/latex3/hyperref
On branch : cleanup-patches
Link : https://github.com/latex3/hyperref/commit/bef0c658b957ac63c994e2cf4f9ebce2ff2d5e60
>---------------------------------------------------------------
commit bef0c658b957ac63c994e2cf4f9ebce2ff2d5e60
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Mon Apr 11 00:07:59 2022 +0200
really move \Ref code
>---------------------------------------------------------------
bef0c658b957ac63c994e2cf4f9ebce2ff2d5e60
hyperref.dtx | 25 ++++++------
nameref.dtx | 127 ++++++-----------------------------------------------------
2 files changed, 25 insertions(+), 127 deletions(-)
diff --git a/hyperref.dtx b/hyperref.dtx
index 10b497f..2860d34 100644
--- a/hyperref.dtx
+++ b/hyperref.dtx
@@ -12536,21 +12536,20 @@
\def\@namerefstar#1{%
\HyRef at StarSetRef{#1}\@thirdoffive
}
-
+\def\@Refstar#1{%
+ \HyRef at StarSetRef{#1}\HyRef at MakeUppercaseFirstOfFive
+}%
+\def\HyRef at MakeUppercaseFirstOfFive#1#2#3#4#5{%
+ \MakeUppercase#1%
+}%
+\DeclareRobustCommand*{\Ref}{%
+ \@ifstar\@Refstar\HyRef at Ref
+}%
+\def\HyRef at Ref#1{%
+ \hyperref[{#1}]{\Ref*{#1}}%
+}%
\Hy at AtBeginDocument{%
\@ifpackageloaded{varioref}{%
- \def\@Refstar#1{%
- \HyRef at StarSetRef{#1}\HyRef at MakeUppercaseFirstOfFive
- }%
- \def\HyRef at MakeUppercaseFirstOfFive#1#2#3#4#5{%
- \MakeUppercase#1%
- }%
- \DeclareRobustCommand*{\Ref}{%
- \@ifstar\@Refstar\HyRef at Ref
- }%
- \def\HyRef at Ref#1{%
- \hyperref[{#1}]{\Ref*{#1}}%
- }%
% \end{macrocode}
% Test if we are running new 2019 varioref or old one:
% \begin{macrocode}
diff --git a/nameref.dtx b/nameref.dtx
index c97b62d..a084aab 100644
--- a/nameref.dtx
+++ b/nameref.dtx
@@ -659,9 +659,19 @@
\DeclareRobustCommand{\pageref}{\T at pageref}%
% \end{macrocode}
% \end{macro}
-% \begin{macrocode}
+% \begin{macro}{\Ref}
+% \begin{macrocode}
+ \def\T at Ref#1{%
+ \NR at setref{#1}\NR at MakeUppercaseFirstOfFive{#1}%
+ }%
+ \def\NR at MakeUppercaseFirstOfFive#1#2#3#4#5{%
+ \MakeUppercase#1%
+ }%
+ \DeclareRobustCommand*{\Ref}{%
+ \@ifstar\T at Ref\T at Ref}%
}
% \end{macrocode}
+% \end{macro}
%
% \subsection{Usage and frontend}
% Access the (third) name part with |\nameref|;
@@ -690,23 +700,12 @@
% \end{macrocode}
% \end{macro}
% \begin{macrocode}
-%\@ifclassloaded{memoir}{%
-% \ltx at IfUndefined{@mem at titlerefnolink}\ltx at secondoftwo{%
-% \ltx at IfUndefined{@mem at titleref}\ltx at secondoftwo\ltx at firstoftwo
-% }%
-%}\ltx at secondoftwo
-%{%
-% \DeclareRobustCommand*{\nameref}{%
-% \@ifstar\@mem at titlerefnolink\@mem at titleref
-% }%
-%}{%
% \end{macrocode}
% \begin{macro}{\nameref}
% \begin{macrocode}
\DeclareRobustCommand*{\nameref}{%
\@ifstar\T at nameref\T at nameref
}%
-%}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\Nameref}
@@ -760,101 +759,11 @@
\AtBeginDocument{%
\ifx\csname @@vpageref\endcsname\relax
\else
-%FMi
% \end{macrocode}
-% Test if we are using the new varioref ...
+% This requires a varioref newer than 2019-09-12
% \begin{macrocode}
- \ifdefined\vp at gerefstar
\let\NR@@vpageref\@@vpageref
-% \end{macrocode}
-% if not then old patching code
-% \begin{macrocode}
- \else
- \def\NR@@vpageref#1[#2]#3{%
- \leavevmode\unskip
- \global\advance\c at vrcnt\@ne
- \@ifundefined{r@\the\c at vrcnt @vr}%
- {\@namedef{r@\the\c at vrcnt @vr}{{??}{??}{}{}{}}}{}%
- \edef\@tempa{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@\the\c at vrcnt @vr\endcsname
- }%
- \@ifundefined{r@\the\c at vrcnt @xvr}%
- {\@namedef{r@\the\c at vrcnt @xvr}{{??}{??}{}{}{}}}{}%
- \edef\@tempb{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@\the\c at vrcnt @xvr\endcsname
- }%
- {%
- \let\@currentlabel\@empty
- \expandafter\label\expandafter{\the\c at vrcnt @xvr}%
- }%
- \ifx\@tempa\@tempb
- \else
- \vref at err{%
- \noexpand\vref at page boundary %
- \@tempb-\@tempa\space (may loop)%
- }%
- \fi
- \@ifundefined{r@#3}{\@namedef{r@#3}{{??}{??}{}{}{}}}{}%
- \edef\thevpagerefnum{%
- \expandafter\expandafter\expandafter
- \@secondoffive\csname r@#3\endcsname
- }%
- \ifx\vref at space\@undefined
- \space
- \else
- \vref at space
- \fi
- \ifx\@tempa\thevpagerefnum
- #1%
- \else
- #2%
- \is at pos@number\thevpagerefnum{%
- \is at pos@number\@tempa{%
- \@tempcnta\@tempa
- \advance\@tempcnta\@ne
- }{%
- \@tempcnta\maxdimen
- }%
- \ifnum \thevpagerefnum =\@tempcnta
- \ifodd\@tempcnta
- \if at twoside
- \reftextfaceafter
- \else
- \reftextafter
- \fi
- \else
- \reftextafter
- \fi
- \else
- \advance\@tempcnta-2 %
- \ifnum \thevpagerefnum =\@tempcnta
- \ifodd\@tempcnta
- \reftextbefore
- \else
- \if at twoside
- \reftextfacebefore
- \else
- \reftextbefore
- \fi
- \fi
- \else
- \reftextfaraway{#3}%
- \fi
- \fi
- }{%
- \reftextfaraway{#3}%
- }%
- \fi
- {%
- \let\@currentlabel\@empty
- \expandafter\label\expandafter{\the\c at vrcnt @vr}%
- }%
- }%
- \fi
-%FM - end mod
- \def\@@vpageref#1[#2]#3{%
+ \def\@@vpageref#1[#2]#3{%
\begingroup
\csname @safe at activestrue\endcsname
\edef\x{#3}%
@@ -874,16 +783,6 @@
\fi
}
% \end{macrocode}
-% \begin{macrocode}
-\def\T at Ref#1{%
- \NR at setref{#1}\NR at MakeUppercaseFirstOfFive{#1}%
- }%
-\def\NR at MakeUppercaseFirstOfFive#1#2#3#4#5{%
- \MakeUppercase#1%
- }%
-\DeclareRobustCommand*{\Ref}{%
- \@ifstar\T at Ref\T at Ref}%
-% \end{macrocode}
%
% \subsection{Support for package \xpackage{listings}}
%
More information about the latex3-commits
mailing list.