Frequently Asked Question List for TeX
LaTeX’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 name of things we’ve labelled. The two packages available extend the LaTeX sectioning commands to provide reference by the name of the section.
The titleref
package is a simple extension which provides
the command \titleref
; it is a stand-alone package — don’t use it
in a document in which you also need to use hyperref
.
The byname
package is part of the smartref
bundle
and works well with smartref
, and works (to an extent) with
hyperref
, but the links it defines are not hyperlinks.
The memoir
class incorporates the functionality of
titleref
, but doesn’t work with byname
(though a
search of comp.text.tex
on [groups.google.com] will
find a patch to byname
to remedy the problem).
The hyperref
bundle includes a package nameref
,
which will work standing alone (i.e., without hyperref
: of
course, in this mode its references are not hyperlinked). If you load
hyperref
itself, nameref
is automatically loaded.
Memoir
requires the memhfixc
when running with
hyperref
; following the sequence:
\documentclass[...]{memoir}
...
\usepackage[...]{hyperref}
\usepackage{memhfixc}
nameref
commands may be used in a memoir
document.
Zref
defines a proposed replacement for all of the LaTeX
reference mechanisms, and among other things provides
name-referencing mechanisms:
\usepackage[user,titleref]{zref}
...
\section{hello}\zlabel{sec:one}
The section name is: \ztitleref{sec:one}.
(One might hope that something of this sort would be the “way of the future”, but things move slowly in the LaTeX world: don’t hold your breath.)
Each of titleref
, byname
and nameref
defines a reference command with the same name as the package:
\titleref
, \byname
and \nameref
. The nameref
package also defines a command \byshortnameref
, which uses the
optional “short” title argument to the chapter and section commands.
(Although it comes from the same author, zref
doesn’t
define a short-name variant.)
FAQ ID: Q-nameref
Tags: labels–references