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


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


Many thanks for help.

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}.

• Thank you. The package is indeed very useful and solves the problem. – ld_pvl Nov 27 '10 at 3:58

Not taking away from Stefan's answer (for which he should gain full credit), here's the code you need:

\documentclass{article}

\usepackage{lipsum}     % filler text

\usepackage{graphicx}
\usepackage[hypcap=true]{caption}
\usepackage[hypcap=true,list=true]{subcaption}
\usepackage{hyperref}

\begin{document}
\tableofcontents
\listoffigures
\section{Section One}
\lipsum[1]

\begin{figure}[h]
\begin{subfigure}[b]{.5\linewidth}
\centering
\includegraphics[width=0.9\textwidth]{test}
\caption{Sub-figure 1}
\label{fig:subfig1}
\end{subfigure}%
\begin{subfigure}[b]{.5\linewidth}
\centering
\includegraphics[width=0.9\textwidth]{test}
\caption{Sub-figure 2}
\label{fig:subfig2}
\end{subfigure}
\caption{Two sub-figures}
\label{fig:sub-figures}
\end{figure}

\lipsum[1]
Lorem ipsum \ref{fig:subfig1} turum bulum \ref{fig:subfig2} culum \ref{fig:sub-figures}.
\end{document}