summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extref.html
blob: d6ebe3b02f6f887093ff9627bf3947347cd2966f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<head>
<title>UK TeX FAQ -- question label extref</title>
</head><body>
<h3>Referring to labels in other documents</h3>
<p/>When producing a set of inter-related documents, you&#8217;ll often want to
refer to labels in another document of the set; but LaTeX, of its
own accord, doesn&#8217;t permit this.
<p/>So the package <i>xr</i> was written: if you say
<blockquote>
<pre>
\usepackage{xr}
\externaldocument{volume1}
</pre>
</blockquote><p>
will load all the references from <i>volume1</i> into your present
document.
<p/>But what if the documents both have a section labelled
&#8220;<code>introduction</code>&#8221; (likely enough, after all)?  The
package provides a means to transform all the imported labels, so you
don&#8217;t have to change label names in either document.  For example:
<blockquote>
<pre>
\usepackage{xr}
\externaldocument[V1-]{volume1}
</pre>
</blockquote><p>
loads the references from <i>volume1</i>, but prefixes every one with
the string <code>V1-</code>.  So you would refer to the introduction to volume 1
as:

<blockquote>
<pre>
\usepackage{xr}
\externaldocument[V1-]{volume1}
...
... the introduction to volume1 (\ref{V1-introduction})...
</pre>
</blockquote><p>
To have the facilities of <i>xr</i> working with
<i>hyperref</i>, you need <i>xr-hyper</i>.  For simple
hyper-cross-referencing (i.e., to a local PDF file you&#8217;ve just
compiled), write:
<blockquote>
<pre>
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[V1-]{volume1}
...
... the \nameref{V1-introduction})...
</pre>
</blockquote><p>
and the name reference will appear as an active link to the
&#8220;introduction&#8221; chapter of <i>volume1.pdf</i>.
<p/>To link to a PDF document on the Web, for which you happen to
have the .aux file, write:
<blockquote>
<pre>
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[V1-]{volume1}[http://mybook.com/volume1.pdf]
...
... the \nameref{V1-introduction})...
</pre>

</blockquote><p>
Heiko Oberdiek&#8217;s experimental <i>zref</i> bundle includes a
hyper-crossreferencing mechanism using its <i>zref-xr</i> module.
Usage is closely modelled on <i>xr</i> and <i>xr-hyper</i>; a
trivial example (from a <i>comp.text.tex</i> posting) is
<blockquote>
<pre>
\usepackage{zref-xr,zref-user}
\zexternaldocument*{xr02}
...
\zref{foo}
</pre>
</blockquote><p>
The module provides all the facilities of the older packages, and can
deal both with &#8220;traditional&#8221; LaTeX labels and with
<i>zref</i>&#8217;s style of labels.
<dl>
<dt><tt><i>xr.sty</i></tt><dd>Distributed as part of <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools.zip">macros/latex/required/tools</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/xr.html">catalogue entry</a>
<dt><tt><i>xr-hyper.sty</i></tt><dd>Distributed with <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/hyperref.zip">macros/latex/contrib/hyperref</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/hyperref/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/xr-hyper.html">catalogue entry</a>
<dt><tt><i>zref bundle</i></tt><dd>Distributed as part of
  <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/oberdiek.zip">macros/latex/contrib/oberdiek</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/oberdiek/">browse the directory</a>); <a href="http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/zref.html">catalogue entry</a>
</dl>
<p/>
<p/><p/><p/><p/><p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extref">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=extref</a>
</body>