Time for action – introducing variable references
We will use the varioref
commands, \vref
and \vpageref
, to achieve enhanced reference texts:
Open our current example. Add the package
varioref
to your preamble:\usepackage{varioref}
Edit the content of the second chapter:
\emph{amsmath}, on position \ref{item:amsmath} of the top list in section~\vref{sec:packages}, is indispensable to high-quality mathematical typesetting in \LaTeX. \emph{amssymb}, on position \ref{item:amssymb}, provides a huge amount of math symbols. See also the footnote \vpageref{fn:project}.
Typeset twice and look at the result:
What just happened?
The command \vref
checked the distance to the referenced section. As it's on the facing page, that is, on the preceding page in a two-sided layout, it wrote "1.2 on the facing page". Similar for \vpageref
, it refers to "the preceding page".
\vref{name}
acts in the following way:
If the reference and
\label{name}
are on the same page, it behaves exactly like\ref
. The page number...