I have a LaTeX document with a figure and references to it:
\\begin{figure}
...
\\caption{...}
\\label{fig:1}
\\end{figure}
\\ref{fig:1}
I use
To previous comment:
\usepackage{hyperref}
\usepackage{caption}
is slightly better than \usepackage[all]{hypcap}
because when you use e.g. figure
without captions there won't be a compilation problem. The caption package by default sets option
hypcap=true
anchoring hyperlinks to the beginning of an environment.