Download Untitled
Transcript
Cross-Referencing
Combing cleveref and varioref
As cleveref fully supports varioref, you may use both to get the most out of them.
cleveref redefines the commands of varioref to use \cref internally. So, you could
use the good page referencing features of varioref together with the clever naming
automatism!
Just load varioref before cleveref:
\usepackage{varioref}
\usepackage{cleveref}
Now, you may use \vref, \cref, \ref, or the other commands—whichever seems
appropriate.
Referring to labels in other documents
If you write several related documents that refer to each other, you might want to
use references to labels of another document. The package with the short name
xr (standing for eXternal References) implements it. First load the package:
\usepackage{xr}
If you need to refer to sections or environments in an external document called, say,
doc.tex, insert this command into your preamble:
\externaldocument{doc}
This enables you to additionally refer to anything that has been given a label in doc.tex.
You may do this for several documents. If you need to avoid conflicts when an external
document uses the same \label like the main document, declare a prefix using the optional
argument of \externaldocument:
\externaldocument[D-]{doc}
This way, all references from doc.tex would be prefixed by D- and you could write
\ref{D-name} to refer to name in doc.tex. Instead of D- you may choose any prefix
that transforms your labels such that they become unique.
Have a go hero – turning references into hyperlinks
PDF documents offer bookmarks and hyperlink capabilities. How about exploiting that
ourselves? There's an outstanding package offering hyperlink support; it's called hyperref.
Try it: load hyperref right before cleveref. This order is important for the references to
work. Even without any options or commands, your document will be hyperlinked as much
as possible:
[ 162 ]