summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-extref.html
blob: c38d4bf0af91d75286c8155f8204f361385e7664 (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
<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&rsquo;ll often want to
refer to labels in another document of the set; but LaTeX, of its
own accord, doesn&rsquo;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
&ldquo;<code>introduction</code>&rdquo; (likely enough, after all)?  The
package provides a means to transform all the imported labels, so you
don&rsquo;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&rsquo;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
&ldquo;introduction&rdquo; 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>
<dl>
<dt><tt><i>xr.sty</i></tt><dd>Distributed as part of <a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.zip">macros/latex/required/tools</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/required/tools.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/required/tools/">browse</a>)
<dt><tt><i>xr-hyper.sty</i></tt><dd>Distributed with <a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/hyperref.zip">macros/latex/contrib/hyperref</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/hyperref.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/hyperref/">browse</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>