# \ref, make figure/table reference automatically toggle between “above” or “below”

Is it possible to automatically include a reference to the position of a labeled object (Table, Figure) in text? By this I mean the following:

Say I have labeled a figure in chapter 1:

\label{fig:one}


Then I refer to it in text by using:

See Figure~\ref{fig:one}


Which produces "See Figure 1.1" as desired. I'd like to be able to have it produce: "See Figure 1.1, above" or "See Figure 1.1, below", automatically detecting whether to produce "above" or "below" depending on whether the figure will be placed above that position on the final page.

-
Consider using the varioref package, which has facilities just for that purpose. –  egreg Sep 28 '11 at 10:10
awesome, thank you! –  tim riffe Sep 28 '11 at 10:32

The varioref package is intended just for similar things. Its command \vref adds suitable words to the number, depending on the context. For example, in twosided printing, it might resolve a reference see Figure~\vref{x} to
The varioref package is indeed the way to go IMHO, but I made the experience that some people (like Ph.D. supervisors) are not used to such things and tend to dislike it. A simple "see Figure N.M" does it mot of the time. –  Martin Scharrer Sep 28 '11 at 11:18