How can one make a quick decision what the best "ref" for a thesis in pdflatex
with hyperref
is?
After a few hours reading I do not know more than
ref
is used by everyone who does not know about the other ~ref and works stable\vref
varioref
somehow works together with hyperref makes sometimes trouble with pagebreaks\cref
incleveref
is still in beta(?) (edit: not in beta any more) and does the same like varioref
What are the essential questions that I have to ask myself to find out which method fits best?
Best Answer
You can certainly load both the
varioref
and thecleveref
withhyperref
provided that you load them in the following orderThey all play very nicely together.
The
varioref
andcleveref
weren't around when I did my thesis, but I'm working on a multi-chapter document at the moment in which I'm using both. Here is what I have found to be a good workflow:\cref
and friends (fromcleveref
) in favour of\ref
. This means that, for example, you never have to worry about if you have to capitalizeFigure
orfigure
when referencing afigure
; instead of sayingFigure \ref{fig:myfig}
you just use\cref{fig:myfig}
. Maybe you'll change your mind and end up usingfig.
; in which case you can make the change globally using\crefname
and\Crefname
\vref
and friends (fromvarioref
) to refer to objects 'far away' from the current position in the text; my rule for the moment is to use\vref
when referring to something in a differentsection
. Some might say that this isn't very robust, but if the object you are referring to moves closer,\vref
will still work fine. If you loadcleveref
then\vref
becomes clever too, so you simply write\vref{fig:myfig}
, notFigure \vref{fig:myfig}
The problems you describe with
varioref
occur if you allowhyperlinks
to break, and the reference happens to break across a page that changes the reference from something like 'this page' to 'the next page'. In such a case, you'll have to tweak things manually- if you're using the work flow I've described above and only using\vref
for 'far away' references and\cref
for everything else, then this won't be an issue.Here's a MWE to illustrate some of the features:
EDIT following comments
Quoting the hyperref README,
In fact, as noted by @Mico in Lost labels using intertext with varioref and hyperref, loading the
cleveref
package in addition tovarioref
andhyperref
seems to eliminate a lot of the problems, ascleveref
redefines\vref
and friends to make themclever
.