I do have this short file
\documentclass%[colorlinks=true]
{memoir}
\usepackage[pdftex]{hyperref}
\begin{document}
%\chapter{first}
Here goes the figure.
\begin{figure}[!h]
\label{fig:MyFigure}
this is the figure itself
\caption{The figure caption}
\end{figure}
Next part of text.
Refer to Fig \ref{fig:MyFigure} on page \pageref{fig:MyFigure}.
\listoffigures
\end{document}
The result shows up like this:
Next part of text. Refer to Fig on page 1.
I.e. the Fig number is missing. When I uncomment [colorlinks=true], some very narrow rectangle is visible after Fig, so I guess somehow \ref{} generates nothing. At the same time, \pageref{} seems to work OK. Also, \listoffigures "sees" the figure. After uncommenting \chapter{first}, the compilation is OK. (The same effect also on ShareLaTeX, so it is not a TeX configuration problem.)
Also, I do have figure number "1.1", and in the reference I see "1". when having more than one figure, the figure sequence number is OK, but in the reference I see some increasing number, with 3-4 step size; at the same time the hyperref jump seems to take to the right place.
Do I miss something, or it is a bug?
\label{fig:MyFigure}after\caption{}. – Sigur Jan 03 '15 at 14:34\labelrelies on a\refstepcounter{countername}to be done before. In your case, the\captiondoes the\refstepcounter{figure}for you and you have to put\labelaccordingly after\caption– Jan 03 '15 at 15:20\caption{MyCaption}\label{fig:MyFigure}, i.e. outside – Jan 03 '15 at 15:36hypcappackage. – Werner Jan 03 '15 at 15:51hypcappackage, and there's nothing in the linked duplicate that mentions it. maybe add a mention there. – barbara beeton Jan 03 '15 at 19:34