Let us start with a famous equation:

a^{2} + b^{2} = c^{2}  (1)

Equation (1) has been proven by Pythagoras. And this crossreference was made with \Fref{eq:pythagoras}. Note that I really wrote:

   \Fref{eq:pythagoras} has ...

I did not use:

   Equation~(\Fref{eq:pythagoras}) has ...

See the next page for further features of the fancyref package, I need this page break for demonstration purposes.

The cross-reference works also in the middle of a sentence: Pythagoras has proven equation (1) on the page before. And this cross-reference was made with \fref{eq:pythagoras}. You can see the fancy output from the varioref package.

Oh, you do not like this package and want normal \ref output instead? No problem, just redefine the default format:

   \renewcommand*{\fancyrefdefaultformat}{plain}

Now the cross-reference looks like this: Equation (1). There is also a package option called plain for this purpose.

Oh, you do not like “Equation” and want “Eq.” instead? No problem, just redefine the string:

   \renewcommand*{\Frefeqname}{Eq.}

Eq. (1) and eq. (1) will be the result, respectively. Note that there is no need to redefine \frefeqname to “eq.”. The fancyref package will do this automatically for you. But of course you can use “eqn.” instead, if you really want to.

Oh, you are not using the colon as a delimitor but rather the dash? No problem, just redefine the character:

   \renewcommand*{\fancyrefargdelim}{-}

The new test equation with label eq-trivial will be:

a = a  (2)

The cross-reference \fref{eq-trivial} will give eq. (2) as output, as expected.

All that stuff may be nice, but you are using eqn instead of eq? No problem, just redefine the prefix:

   \fancyrefchangeprefix{\fancyrefeqlabelprefix}{eqn}

We need a new, fantastic test equation with label eqn-fantastic:

b = b  (3)

The cross-reference \fref{eqn-fantastic} will give eq. (3) as output, as expected.

Maybe the spacing between “eq.” and “3” is too generous, let us tighten things a bit, with

   \renewcommand*{\fancyrefdefaultspacing}{%
     \fancyreftightspacing
   }

the spacing looks like eq. (3). If you think this is better, just use the tight option of this package.

Perhaps you want parentheses around the cross-reference? No problem, just redefine the appropriate hook:

   \renewcommand*{\fancyrefhook}[1]{(#1)}

The result from \fref{eq-trivial} is (eq. (2)). In fact this could have been obtained easier, as I provided an package option just for this purpose:

   \usepackage[paren]{fancyref}

Now let us try something really cool. What about introducing a new type of objects, e. g. theorems, with thm prefixed, new strings like “Theorem” added and the cross-reference in huge italics? Also, as you have read in that bargain textbook on typography (“cAN U rEaD It” by John Badmountain), cross-references to theorems should be typeset as footnotes. No problem: First, we need a new prefix:

   \newcommand*{\fancyrefthmlabelprefix}{thm}

Then we declare a new fancyref format called foot:

   \frefformat{foot}{\fancyrefthmlabelprefix}{%
     \unskip\footnote{%
       \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
     }%
   }
   \Frefformat{foot}{\fancyrefthmlabelprefix}{%
     \unskip\footnote{%
       \huge\itshape\Frefthmname\fancyrefdefaultspacing#1#3%
     }%
   }

The strings have to be setup in the preamble of the document, I did this already, because I knew it would be necessary. The code I used was:

   \fancyrefaddcaptions{english}{%
     \newcommand*{\Frefthmname}{Theorem}%
     \newcommand*{\frefthmname}{%
       \MakeLowercase{\Frefthmname}%
     }%
   }%

And finally this is the test theorem: Theorem 1 (Murphy) If something can go wrong, it will go wrong. Now let us try it. \Fref[foot]{thm-murphy} comes out as (^{1}). Oops, the hook is still at work, I will just reset it to its default value:

   \renewcommand*{\fancyrefhook}[1]{#1}

And now?^{2} Gotcha!

1Theorem 1 2Theorem 1