# [texhax] referencing figures, prepend word "Fig"

Tue Apr 8 21:29:29 CEST 2008

Dear tex hackers,

When I started writing I was unsure of whether to use the word "figure",
"diagram", "fig" or whatever, so I decided to defer that decision until
later. Throughout the text all references are given as \ref{fig:foobar},
or \ref{tab:atable} and so forth.

Now, I want to automatically prepend the word "Fig" or "Table" to each
reference depending on the three characters that appear before the colon.

Such that

In \ref{fig:dataflow1654} you can see ...

Becomes

In Fig 1.2 you can see ...

and likewise for table references of the form \ref{tab:table345} which
would become

In Table 1.7 a summary is given ...

Is it possible to redefine \ref to do this?

Gratefully in anticipation of any help,

Andy

--
Use the source