[Tex/LaTex] Hyperlink’s bad navigation of sub-figures on click

captionshyperreflinkspositioning

I am using hyperref package to have hyperlinks automatically generated for figures, equations, table of contents, etc… My problem is if I have a big figure consisting of sub-figures and then have a mark somewhere in the text citing one of the sub-figures (example shown below), if I click on the hyperlink generated in pdf, the file navigates to the top of the caption of the sub-figure and not to the top of the sub-figure itself. It only happens with sub-figures. For whole figures, equation and sections/chapters, the file navigates correctly to the top of the figure, equation, etc… It's not the picture type problem as well, I tried different ones.

I don't know if it's meant to be so or there's something wrong that I did.

This is the example code:

\begin{figure}
    \begin{center}
        \subfigure[Sub-figure 1]
            {\label{fig:subfig1}\includegraphics[width=0.45\textwidth]{subfig1}}
        \subfigure[Sub-figure 2]
            {\label{fig:subfig2}\includegraphics[width=0.45\textwidth]{subfig2}}
    \end{center}
    \caption{Two sub-figures}
    \label{fig:sub-figures}
\end{figure}

Lorem ipsum turum bulum \ref{fig:subfig2} culum

Just to make it clear. This is what I would like to see after I click the link from the top edge of the pdf.

------------------------    ------------------------
|                      |    |                      |
|                      |    |                      |
|        PICTURE 1     |    |        PICTURE 2     |
|                      |    |                      |
|                      |    |                      |
------------------------    ------------------------
Figure 1a: Sub-figure 1     Figure 1b: Sub-figure 2

But instead, I'm getting this:

Figure 1a: Sub-figure 1     Figure 1b: Sub-figure 2

Many thanks for help.

Best Answer

A complete code example would be better. For example, the question doesn't show which further packages you're using: perhaps caption, hypcap, subfig, subfigure, ...

I guess you use the subfig package: it's not working well with hyperref, links may point to the subfigure captions instead of to the subfigure.

I recommend to use the subcaption package instead. The author, who wrote also the fine caption package, is aware of the subfig problem and did it better. Use the hypcap option:

\usepackage[hypcap=true]{subcaption}

See the subcaption documentation to learn more.

Btw.: I see you're using the center environment within the figure environment. This produces additional vertical space. I would use \centering after \begin{figure}.