UK TeX FAQ -- question label nameref

### Referring to things by their name

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.)

`byname.sty`
  Distributed with macros/latex/contrib/smartref (or browse the directory)
`hyperref.sty`
  macros/latex/contrib/hyperref (or browse the directory)
`memoir.cls`
  macros/latex/contrib/memoir (or browse the directory)
`nameref.sty`
  Distributed with macros/latex/contrib/hyperref (or browse the directory)
`smartref.sty`
  macros/latex/contrib/smartref (or browse the directory)
`titleref.sty`
  macros/latex/contrib/misc/titleref.sty
`zref.sty`
  Distributed as part of macros/latex/contrib/oberdiek (or browse the directory)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=nameref