I would like to have an easy way to reference a label and if that label is not on the current page then its page should be printed in the reference like "See example 2.3 (p.4)". I tried the varioref and the cleveref packages but their text output using \vref or \cref is too verbose for me. I couldn't find anything in the documentation to just print (p.4) instead. Or is there another alternative?

  • Why couldn't you "find anything in the documentation"? Where did you look? Section 3 "Customization" of varioref.pdf has all the details. – Frank Mittelbach Aug 28 '13 at 19:20
  • I saw that but couldn't figure out that this section with its non-existing examples is what I'm looking for. – user764754 Aug 28 '13 at 20:37

If you are using babel you can change the printed reference with package varioref as shown in the following MWE for German language.

\documentclass[ngerman]{scrartcl}% article


\addto{\extrasngerman}{% addto only with babel  <===============


\section{Abschnitt 1}

Und der erste Verweis auf Abschnitt~\vref{sec:Test}. %  <===============


Und der Verweis auf Abschnitt~\vref{sec:Test}.       %  <===============


The macro \addto{\extrasngerman} adds the new meanings for language ngerman. If you use another language change ngerman to your language.

Change (Seite~\pageref{#1}) to that you need, for example (p.~\pageref{#1}).


The KOMA-Script macro \newcaptionname{ngerman}{...} is not able to handle a third argument (for \pageref{#1}) so you can't use it here.

  • Perfect. One thing that is strange is that i get errors like "Extra \else." when I keep using cleveref. – user764754 Aug 28 '13 at 0:03
  • @user764754 errors might be due to the order you load packages (or not all of them up-to-date): hyperref, babel and cleveref all overwrite some of the varioref definitions. – Frank Mittelbach Aug 28 '13 at 19:18

If you use varioref all the fixed texts are in easily changable macros, for example the package has

    \def\reftextfaraway#1{on page~\pageref{#1}}%

so you can have


and similarly for any other texts it produces.

  • Thanks! What worked for me was \addto\extrasngerman{\renewcommand{\reftextfaraway}[1]{(p.\pageref{#1})}} – user764754 Aug 27 '13 at 23:19
  • 1
    @user764754 this is needed because Babel is used. All of that is documented in varioref.pdf (section 3). – Frank Mittelbach Aug 28 '13 at 19:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.