[comp.text.tex] LaTeX complex cross reference macro wanted

pmaresch@hawk.ulowell.edu (Pierre Mareschal) (12/19/90)

(La)TeX Gurus,

Given an entry generated in the .aux file by a LaTeX command like:
	\label{ex}
I would like to find a macro (let's call it \pref) that would produce
the following outputs:

	- If the label is on the same page as the reference,
	  it would just use the \ref{ex}:
	  Example:
		Figure~\pref{ex} generates Figure~\ref{ex}
		i.e. Figure 2.1.
	(If the reference is on a left page and the figure on a right page,
	(or vice-versa), it should only produce this simple output too.)

	- If the label is on a different page,
	  it would generate a more complex output:
	  Example:
		Figure~\pref{ex} generates Figure~\ref{ex} (\pageref{ex})
		i.e. Figure 2.1 (page 69).

	Thanks a lot.

:- Pierre Mareschal <pmaresch@hawk.ulowell.edu>