LaTeX hyperref link goes to wrong page

Posted by ecto on Stack Overflow See other posts from Stack Overflow or by ecto
Published on 2010-04-30T15:37:57Z Indexed on 2010/04/30 17:07 UTC
Read the original article Hit count: 423

Filed under:
|

I am trying to create a reference to a float that doesn't use a caption. If I include \label{foo} within the float and reference it using \pageref{foo}, the correct page number is displayed in my pdf document but the hyperlink created by the hyperref package links to a different page (the first page of the section). If I include a caption before the label in the float, the hyperref link goes to the correct page.

Is there a way to get the hyperref link to work correctly without including a caption in the float? Or else is there a way to suppress the display of a caption so I can include one without it being shown?

Below is a minimal example. If I process it using pdflatex, I get three pages. The "figure" is shown on the second page, and the third page says "See figure on page 2." But the hyperlink on the '2' says "Go to page 1", and if I click it it takes me to page 1.

If I put an empty \caption{} before the \label{foo}, then the hyperlink works correctly, but I don't want to show a caption for my float.

\documentclass[11pt]{memoir}

\usepackage{hyperref}

\begin{document}

some text \clearpage

\begin{figure} a figure \label{foo} \end{figure}

more text \clearpage

See figure on page \pageref{foo}.

\end{document}

© Stack Overflow or respective owner

Related posts about latex

Related posts about hyperref