summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-nameref.html
blob: 75cc2e990a85df9d8a466f24d939f6ed697dacad (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
<head>
<title>UK TeX FAQ -- question label nameref</title>
</head><body>
<h3>Referring to things by their name</h3>
<p/>LaTeX&rsquo;s labelling mechanism is designed for the impersonal world of
the academic publication, in which everything has a number: an
extension is necessary if we are to record the <em>name</em> of things
we&rsquo;ve labelled.  The two packages available extend the LaTeX
sectioning commands to provide reference by the name of the section.
<p/>The <i>titleref</i> package is a simple extension which provides
the command <code>\</code><code>titleref</code>; it is a stand-alone package &mdash; don&rsquo;t use it
in a document in which you also need to use <i>hyperref</i>.
<p/>The <i>byname</i> package is part of the <i>smartref</i> bundle
and works well with <i>smartref</i>, and works (to an extent) with
<i>hyperref</i>, but the links it defines are not hyperlinks.
<p/>The <i>memoir</i> class incorporates the functionality of
<i>titleref</i>, but doesn&rsquo;t work with <i>byname</i> (though a
search of <i>comp.text.tex</i> on <a href="groups.google.com">groups.google.com</a> will
find a patch to <i>byname</i> to remedy the problem).
<p/>The <i>hyperref</i> bundle includes a package <i>nameref</i>,
which will work standing alone (i.e., without <i>hyperref</i>: of
course, in this mode its references are not hyperlinked).  If you load
<i>hyperref</i> itself, <i>nameref</i> is automatically loaded.
<i>Memoir</i> requires the <i>memhfixc</i> when running with
<i>hyperref</i>; following the sequence:
<blockquote>
<pre>
\documentclass[...]{memoir}
...
\usepackage[...]{hyperref}
\usepackage{memhfixc}
</pre>
</blockquote><p>
<i>nameref</i> commands may be used in a <i>memoir</i> document.
<p/><i>Zref</i> defines a proposed replacement for all of the LaTeX
reference mechanisms, and among other things provides
name-referencing mechanisms:
<blockquote>
<pre>
\usepackage[user,titleref]{zref}
...
\section{hello}\zlabel{sec:one}
The section name is: \ztitleref{sec:one}.
</pre>
</blockquote><p>
(One might hope that something of this sort would be the &ldquo;way of the
future&rdquo;, but things move slowly in the LaTeX world: don&rsquo;t hold
your breath.) 
<p/>Each of <i>titleref</i>, <i>byname</i> and <i>nameref</i>
defines a reference command with the same name as the package:
<code>\</code><code>titleref</code>, <code>\</code><code>byname</code> and <code>\</code><code>nameref</code>. The <i>nameref</i>
package also defines a command <code>\</code><code>byshortnameref</code>, which uses the
optional &lsquo;short&rsquo; title argument to the chapter and section commands.
(Although it comes from the same author, <i>zref</i> <em>doesn&rsquo;t</em>
define a short-name variant.)
<dl>
<dt><tt><i>byname.sty</i></tt><dd>Distributed with <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/smartref.zip">macros/latex/contrib/smartref</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/smartref/">browse the directory</a>)
<dt><tt><i>hyperref.sty</i></tt><dd><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>)
<dt><tt><i>memoir.cls</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/memoir.zip">macros/latex/contrib/memoir</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/memoir/">browse the directory</a>)
<dt><tt><i>nameref.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>)
<dt><tt><i>smartref.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/smartref.zip">macros/latex/contrib/smartref</a> (or <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/smartref/">browse the directory</a>)
<dt><tt><i>titleref.sty</i></tt><dd><a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/misc/titleref.sty">macros/latex/contrib/misc/titleref.sty</a>
<dt><tt><i>zref.sty</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>)
</dl>
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref</a>
</body>