There is \ref{} and \pageref{}. But I want mixed behaviour. I would like to have something like "XXX (page.YYY)" in text, where XXX is what \ref{} usually produce (chapter/section/etc number), while YYY is page number. How to do it?

  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Feb 15, 2015 at 18:04
  • 3
    Think about how this should work if the \ref points to something on the same page...
    – Werner
    Feb 15, 2015 at 18:08

2 Answers 2


create a new command like \fullref


And call


That is a MWE which doesn't test page. I suggest, as @Mico said, to use https://www.ctan.org/pkg/varioref. The author of the package has thought to you :-)

  • Thanks! I need to learn basic macro processing in TeX :)
    – Drop Drop
    Feb 15, 2015 at 18:07
  • 1
    Possibly better with p.~\pageref{#1}
    – egreg
    Feb 15, 2015 at 18:10
  • that is LaTeX, not tex. You will find easily on internet the basic of \newcommand. Here, we have a command with only one argument. We send it (#1) to other commands.
    – Maïeul
    Feb 15, 2015 at 18:10
  • inded, egreg you are true
    – Maïeul
    Feb 15, 2015 at 18:11
  • or \cpageref{#1} with cleveref
    – user31729
    Feb 15, 2015 at 18:11

I suggest you look into the varioref package and its \vref macro. The macro has the following properties:

  • if the item being cross-referenced happens to be located on the same page, it behaves like the plain \ref macro, i.e., nothing is appended;

  • if the item is located on the immediately previous or following page, it appends "on the preceding page" or "on the following page", as appropriate, to the cross-reference;

  • if the item is located somewhere else in the document, the string "on page " is appended to the cross-reference.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .