# Hyperref and the float package

There is an issue when using the hyperref package, which provides links and bookmarks, together with the float package, which implements changes in float placement in the document.

Loading both has the side effect of making all links generated by hyperref lead to the first page of the document, instead of the appropriate page. The following MWE reproduces the issue:

\documentclass{article}

\usepackage{lipsum}

\usepackage[pdftex,
bookmarks=true,
pagebackref=true]{hyperref}
\usepackage{bookmark}

\usepackage{float}
\restylefloat{figure}
\restylefloat{table}

\begin{document}

\lipsum[20-27]

\begin{figure}
\centering
A figure.
\caption{Figure caption}
\label{label}
\end{figure}

\lipsum[3-8]

\lipsum[17]

\end{document}


In this example, the label reference leads to the first page, and not to the page where the figure actually is.

I haven't found any mentions to this in either the hyperref or the float documentations.

• Loading the float package before hyperref, as suggested in the answer, also seems to eliminate "pdfTeX warning (ext4): destination with the same identifier ... has been already used, duplicate ignored" type errors. – GregH Aug 20 at 14:51

The solution to this issue is to load the float package before hyperref, issuing commands that affect floats after loading hyperref:

(...)
\usepackage{float}

\usepackage[pdftex,
bookmarks=true,

I'm not sure about why this behavior occurs, but I can assume that there is some command redefinition in float that breaks links generated by hyperref.
• This is wrong, too. To get correct results in all aspects, the order should be: Load float, load hyperref, use \newfloat resp. \restylefloat. See also hyperref README and tex.ac.uk/cgi-bin/texfaq2html?label=hyperdupdest – Axel Sommerfeldt Sep 25 '13 at 7:32