108

Is it possible to make a reference to the page where a figure is rendered?

I would like to write something like

see figure~\ref{figure-xyz} on page NN

where NN will automatically be maintained by LaTeX. The figure that prompted my question is almost a page so it may be floated further in the doc.

I suppose it's possible, after all the figure-to-page mapping is generated by \listoffigures.

lockstep
  • 250,273

3 Answers3

144
see figure~\ref{figure-xyz} on page~\pageref{figure-xyz}

Also see the varioref package which lets you write see figure~\vref{figure-xyz} which will automatically add the "on page NN" iff the figure is not on the current page.

Lev Bishop
  • 45,462
34

Just use \pageref{}, so in your case:

see figure \ref{figure-xyz} on page \pageref{figure-xyz}
Vivi
  • 26,953
  • 31
  • 77
  • 79
  • 23
    Please do not omit the ~. Without it, it could happen, that figure is placed at the end of the line and the number \ref{} at the beginning of the next line. ~ inserts an unbreakable space so that the number can't be divided from figure which is good typography. Same for ~\cite etc. – Mensch Sep 04 '12 at 23:31
  • @Mensch I wish I had known that before! – Andrea May 12 '21 at 09:37
5

A quite complete solution for page references at package cleveref (Cleveref documentation). You don't have to write "page" or "pages" when cross-referencing, neither "figure" or "figures" (!).

if you want a page reference, use \cpageref (and don’t write “page” in front), if you want a page range, use \cpagerefrange, and if you want to refer to multiple pages, simply throw all your comma separated labels into a single \cpageref.

In your case, I would use \cpageref{} for the page and \cref{} for the figure itself, for example,

%At preamble
\usepackage{cleveref}

%...

see \cref{figure-xyz} on \cpageref{figure-xyz}

By the way, as an extra plus, you do not have to mind the ~ between Figure and \ref. All these issues are managed by the package =)