1 %% xr package (beta release)
3 %% Copyright (C) 1993-1997 David Carlisle
5 %% This is a modified version of the xr package from the Standard LaTeX
6 %% tools distribution. It has some internal changes to cooperate with
7 %% the hyperref package, and one new user level argument, also mainly of
9 %% If no problems are reported the version in the tools distribution
10 %% will be updated to match this at the next LaTeX release.
12 %% \externaldocument[prefix]{document}[URL]
14 %% The `document' referred to by the main argument is the file
16 %% which must be somewhere on TeX's input path.
17 %% Some packages (eg hyperref) really need to know the location of the
18 %% final document rather than the aux file. By default this is assumed
19 %% to be `document.dvi'. A package may redefine the command \XR@ext to
20 %% change this default extension (eg some of the hyperref backends
21 %% define this to be `document.pdf'). However sometimes the final
22 %% document may be in a position unrelated to the aux file, or the
23 %% browser may not be able to find files at an arbitrary point in
24 %% TeX's input path, so the new final optional argument allows a full
25 %% URL to the final document to be specified.
27 %% \externaldocument{file}[http://here.xxx.edu/this/path/to/file.dvi]
29 %% Unless a package redefines \XR@addfile, the optional URL argument
32 %% This version (beta2) also has another improvement unrelated
33 %% to the hyperref support. Olivier Michel pointed out that
34 %% if the aux file was not on texinputs you could not always go
35 %% \externaldocument{/some/path/to/file}
36 %% specifically that worked if file.aux was a `simple' document with
37 %% one aux file, but if \include had been used, the `sub' aux files
38 %% would not be found by xr in the remote directory.
39 %% This version calls \filename@parse to get the directory name of the
40 %% remote directory, which is then explicitly prepended to the names of
41 %% any included aux files.
45 %% 1997/10/06 v6.00beta2
47 %% 1999/09/01 v6.00beta3
48 %% Definitions of \XR@addURL corrected (Heiko Oberdiek).
50 %% 2000/03/22 v6.00beta4
51 %% \xdef changed to \protected@xdef.
53 \NeedsTeXFormat{LaTeX2e}
54 \ProvidesPackage{xr-hyper}
55 [2000/03/22 v6.00beta4 eXternal References (DPC)]
57 \def\externaldocument{\@testopt\XR@{}}
58 \def\XR@[#1]#2{\@testopt{\XR@@{#1}{#2}}{#2.\XR@ext}}
65 \XR@next#2.aux\relax\\}}
66 \def\XR@next#1\relax#2\\{%
70 \ifx\XR@list\@empty\else\expandafter\XR@explist\fi}
72 \def\XR@explist{\expandafter\XR@next\XR@list\\}
75 \openin\@inputcheck#1\relax
77 \PackageWarning{xr}{^^JNo file #1^^JLABELS NOT IMPORTED.^^J}%
80 \PackageInfo{xr}{IMPORTING LABELS FROM #1}%
81 \expandafter\XR@read\fi}
83 \read\@inputcheck to\XR@line
84 \expandafter\XR@test\XR@line...\XR@}
85 \long\def\XR@test#1#2#3#4\XR@{%
87 \expandafter\protected@xdef\csname r@\XR@prefix#2\endcsname
90 \edef\XR@list{\XR@list\filename@area#2\relax}%
92 \ifeof\@inputcheck\expandafter\XR@aux
93 \else\expandafter\XR@read\fi}
95 \providecommand*{\XR@addURL}[1]{#1}
96 % The above definition doesn't actually use the URL, hyperref 6 could
97 % make a definition like so to put the URL in the fifth field of its
100 \@ifpackageloaded{hyperref}{%
101 \PackageWarningNoLine{xr-hyper}{Load package `hyperref' after `xr-hyper'}%
104 %\def\XR@addURL#1{\XR@@dURL#1{}{}{}{}\\}
106 %\def\XR@@dURL#1#2#3#4#5\\{%
114 \providecommand\XR@ext{dvi}
118 %% End of file `xr.sty'.