[Tex/LaTex] Changing the way figure reference appears in LaTeX

cross-referencing

How can one make LaTeX insert Figure into \ref calls automatically, i.e. instead of writing:

See data in Figure ~\ref{fig:JobInformationDialog}

simply write:

See data in \ref{fig:jobInformationDialog}

and have LaTeX insert Figure [fignum] when it gets compiled?

Best Answer

A very easy way is provided by the prettyref package:

\documentclass{article}
\usepackage{caption}
\usepackage{prettyref}
\newrefformat{fig}{Figure~[\ref{#1}]}

\begin{document}

\begin{center}
  \rule{10cm}{2cm}
  \captionof{figure}{This is my caption}
  \label{fig:first}
\end{center}

Please see \prettyref{fig:first}.
\end{document}

enter image description here

Related Question