LaTeX
Introduction
References
For handling references there are several packages with different functionality:
| Package | Commands | Notes |
|---|---|---|
hyperref |
\autoref{} |
+ Automatically adds the name of the cross-reference type |
cleveref |
||
fancyref |
+ Automatically adds the name of the cross-reference type - Requires sticking to naming convention. |
|
varioref |
\vref{} \vpageref{} |
Takes into account the page of the reference |
zref |
Complete reimplementation of LaTeX reference system |
The package cleveref is one of the most advanced ones. But a major problem is to get it running with automated labelling of formulas as cleveref doesn’t work together with the showonlyrefs=true option of package mathtools.
An alternative is the usage of the package autonum which on the other hand doesn’t work with biblatex…
Info
The only thing that seems to work is the usage of zref.
zref
zrefitself is more or less only the base package that can be used by package authors- Using
zref-clever(GitHub) one has all the functionality that is needed (as far as I can tell)- Working in combination with
hyperref - Working in combination with
mathtoolsand the\mathtoolsset{showonlyrefs,showmanualtags}options
- Working in combination with
- Usage:
- You can still use
\label{}(could also use\zlabel{}but AFAIK no advantage, also refer to section 6 inzref-cleverdocumentation) - Referencing:
\zcref<*>[<options>]{<labels>}:- Reference to
<labels>given as comma separated list - If
hyperrefis enabled references will be hyperlinked (also seezref-cleveroptions) - Starred version does not form links
- Options are mostly local forms of the global package options
- Reference to
\zcpageref<*>[<options>]{<labels>}:- Page reference
- Same as
\zcrefwith optionref=page
- You can still use
- Minimal working example (from StackExchange):
\documentclass[10pt]{article} \usepackage{zref-clever} \usepackage{mathtools} \mathtoolsset{showonlyrefs,showmanualtags} \usepackage{hyperref} \begin{document} \begin{equation} referenced \label{eq:a} \end{equation} \begin{align} referenced too \label{eq:b} \end{align} \begin{equation} unreferenced \end{equation} Consider \zcref{eq:a, eq:b}. They are referenced. \end{document}