summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/tools/xr.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/tools/xr.sty')
-rw-r--r--Master/texmf-dist/tex/latex/tools/xr.sty62
1 files changed, 48 insertions, 14 deletions
diff --git a/Master/texmf-dist/tex/latex/tools/xr.sty b/Master/texmf-dist/tex/latex/tools/xr.sty
index ece5e0df2d0..9e3f16cd92b 100644
--- a/Master/texmf-dist/tex/latex/tools/xr.sty
+++ b/Master/texmf-dist/tex/latex/tools/xr.sty
@@ -13,7 +13,7 @@
%% (but please observe conditions on bug reports sent to that address!)
%%
%%
-%% Copyright (C) 1993-2023
+%% Copyright (C) 1993-2024
%% The LaTeX Project and any individual authors listed elsewhere
%% in this file.
%%
@@ -35,17 +35,40 @@
%% The list of all files belonging to the LaTeX `Tools Bundle' is
%% given in the file `manifest.txt'.
%%
-%% File: xr.dtx Copyright (C) 1993-2019 David Carlisle
+%% File: xr.dtx Copyright (C) 1993-2024 David Carlisle
\NeedsTeXFormat{LaTeX2e}
+\DeclareRelease{v5}{2023-07-04}{xr-2023-07-04.sty}
+\DeclareCurrentRelease{}{2024-04-10}
\ProvidesPackage{xr}
- [2023-07-04 v5.06 eXternal References (DPC)]
-\def\externaldocument{\@ifnextchar[\XR@{\XR@[]}}
+ [2024-04-10 v6.00 eXternal References (DPC)]
+\def\externaldocument{\@testopt\XR@cite{}}
\let\externalcitedocument\externaldocument
-\def\XR@[#1]#2{{%
+\def\XR@cite[#1]{\@testopt{\XR@[#1]}{}}
+\def\XR@[#1][#2]#3{\@testopt{\XR@@{#1}{#2}{#3}}{#3.\XR@ext}}
+\def\XR@@nocite{nocite}
+\long\def\@gobblefour #1#2#3#4{}
+\long\def\@firstoffour #1#2#3#4{#1}
+\long\def\@secondoffour#1#2#3#4{#2}
+\long\def\@thirdoffour #1#2#3#4{#3}
+\long\def\@fourthoffour #1#2#3#4{#4}
+\def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}
+\def\XR@@dURL#1#2#3#4#5\\{%
+ \unexpanded{{#1}{#2}{#3}{#4}}{\XR@URL}%
+ }%
+\providecommand\XR@ext{pdf}
+\def\XR@@#1#2#3[#4]{{%
\makeatletter
\def\XR@prefix{#1}%
- \set@curr@file{#2}%
- \expandafter\XR@next\@curr@file.aux\relax\\}}
+ \def\XR@nocite{#2}%
+ \ifx\XR@nocite\XR@@nocite
+ \let\XR@bibcite\vadjust
+ \else
+ \let\XR@bibcite\bibcite
+ \fi
+ \def\XR@URL{#4}%
+ \set@curr@file{#3}%
+ \filename@parse\@curr@file
+ \XR@next\@curr@file.aux\relax\\}}
\def\XR@next#1\relax#2\\{%
\edef\XR@list{#2}%
\XR@loop{#1}}
@@ -64,15 +87,26 @@
\read\@inputcheck to\XR@line
\expandafter\XR@test\XR@line...\XR@}
\long\def\XR@test#1#2#3#4\XR@{%
- \let\XR@tempa\@gobbletwo
+ \let\XR@tempa\@gobblefour
\ifx#1\newlabel
- \let\XR@tempa\@firstoftwo
- \else\ifx#1\bibcite
- \let\XR@tempa\@firstoftwo
+ \let\XR@tempa\@firstoffour
+ \else\ifx#1\XR@bibcite
+ \let\XR@tempa\@secondoffour
\else\ifx#1\@input
- \let\XR@tempa\@secondoftwo
- \fi\fi\fi
- \XR@tempa{#1{\XR@prefix#2}{#3}}{\edef\XR@list{\XR@list#2\relax}}%
+ \let\XR@tempa\@thirdoffour
+ \else\ifx#1\new@label@record
+ \let\XR@tempa\@fourthoffour
+ \fi\fi\fi\fi
+ \XR@tempa
+ {%
+ \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}}%
+ {%
+ \edef\next{\noexpand\new@label@record{\XR@prefix#2}{\unexpanded{#3}{xr-url}{\XR@URL}}}%
+ \next
+ }
\ifeof\@inputcheck\expandafter\XR@aux
\else\expandafter\XR@read\fi}
\endinput