summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty')
-rw-r--r--Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty64
1 files changed, 31 insertions, 33 deletions
diff --git a/Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty b/Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty
index b7871a4336b..6235a941b2b 100644
--- a/Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty
+++ b/Master/texmf-dist/tex/latex/hyperref/xr-hyper.sty
@@ -16,18 +16,14 @@
%% which must be somewhere on TeX's input path.
%% Some packages (eg hyperref) really need to know the location of the
%% final document rather than the aux file. By default this is assumed
-%% to be `document.dvi'. A package may redefine the command \XR@ext to
-%% change this default extension (eg some of the hyperref backends
-%% define this to be `document.pdf'). However sometimes the final
+%% to be `document.pdf'. A package may redefine the command \XR@ext to
+%% change this default extension. However sometimes the final
%% document may be in a position unrelated to the aux file, or the
%% browser may not be able to find files at an arbitrary point in
%% TeX's input path, so the new final optional argument allows a full
%% URL to the final document to be specified.
%%
-%% \externaldocument{file}[http://here.xxx.edu/this/path/to/file.dvi]
-%%
-%% Unless a package redefines \XR@addfile, the optional URL argument
-%% will be ignored.
+%% \externaldocument{file}[http://here.xxx.edu/this/path/to/file.pdf]
%%
%% Version beta2 also added another improvement unrelated
%% to the hyperref support. Olivier Michel pointed out that
@@ -61,7 +57,7 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{xr-hyper}
- [2023-04-22 v7.00x eXternal References (DPC)]
+ [2023-05-16 v7.00y eXternal References (DPC)]
\def\externaldocument{\@testopt\XR@cite{}}
\let\externalcitedocument\externaldocument
@@ -77,6 +73,7 @@
\else
\let\XR@bibcite\bibcite
\fi
+ \def\XR@useURL{}%
\def\XR@URL{#4}%
\filename@parse{#3}%
\XR@next#3.aux\relax\\}}
@@ -92,6 +89,19 @@
\long\def\@secondofthree#1#2#3{#2}
\long\def\@thirdofthree #1#2#3{#3}
+% 2023-05-13 we need to handle \newlabel's with two arguments differently
+% to \newlabel's with five argument. For this we make use of
+% XR@addURL:
+\def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}
+\def\XR@@dURL#1#2#3#4#5\\{%
+ {#1}{#2}%
+ \if!#4!%
+ {#3}{#4}{}% new perhaps this could use \XR@URL too?
+ \else
+ {#3}{#4}{\XR@useURL}%
+ \fi
+ }%
+
\def\XR@explist{\expandafter\XR@next\XR@list\\}
\def\XR@loop#1{%
\openin\@inputcheck#1\relax
@@ -100,18 +110,18 @@
\expandafter\XR@aux
\else
\PackageInfo{xr}{IMPORTING LABELS FROM #1}%
+ \let\XR@testnewlabel\XR@testnewlabel@aux
\expandafter\XR@read\fi}
\def\XR@read{%
\read\@inputcheck to\XR@line
\expandafter\XR@test\XR@line...\XR@}
% 2019 update to match xr
-% 2020 don't extend r@-arguments if hyperref has been detected in the source
-% newlabel has already the right number of arguments
-\def\XR@HYPcompargs{{}{}{}}
\long\def\XR@test#1#2#3#4\XR@{%
\let\XR@tempa\@gobblethree
+% we set the file name only if the target has actually destinations.
+% for this we test if hyperref has been used.
\ifx#1\HyperFirstAtBeginDocument
- \def\XR@HYPcompargs{}%
+ \let\XR@useURL\XR@URL
\fi
\ifx#1\newlabel
\let\XR@tempa\@firstofthree
@@ -121,32 +131,16 @@
\let\XR@tempa\@thirdofthree
\fi\fi\fi
\XR@tempa
- {\expandafter\protected@xdef\csname r@\XR@prefix#2\endcsname{\XR@addURL{#3}\XR@HYPcompargs}}%
+ {%
+ \expandafter\protected@xdef\csname r@\XR@prefix#2\endcsname{\XR@addURL{#3}}%
+ }%
{\expandafter\bibcite\expandafter{\XR@prefix#2}{#3}}%
{\edef\XR@list{\XR@list\filename@area#2\relax}}%
\ifeof\@inputcheck\expandafter\XR@aux
\else\expandafter\XR@read\fi}
-\providecommand*{\XR@addURL}[1]{#1}
-% The above definition doesn't actually use the URL, hyperref 6 could
-% make a definition like so to put the URL in the fifth field of its
-% ref structure.
-
-\@ifpackageloaded{hyperref}{%
- \PackageWarningNoLine{xr-hyper}{Load package `hyperref' after `xr-hyper'}%
-}{}
-%\def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}
-
-%\def\XR@@dURL#1#2#3#4#5\\{%
-% {#1}{#2}%
-% \if!#4!%
-% \else
-% {#3}{#4}{\XR@URL}%
-% \fi
-%}
-
-\providecommand\XR@ext{dvi}
+\providecommand\XR@ext{pdf}
\endinput
%%
@@ -169,4 +163,8 @@
%% 2020-05-14 v7.00e
%% add additional braces to \r@ only if hyperref is not detected in the aux
%% of the source document (https://github.com/latex3/hyperref/issues/118)
-%%
+%%
+%% 2023-05-15 v.7.00z
+%% unified and simplified the brace handling: all defined references have now
+%% five brace groups. Together with the planed change in LaTeX 2023-06-01 this
+%% will improve the combination of hyperref/non-hyperref documents.