I'm using the following command to embed images in my LaTeX document (which is then rendered as PDF)
\newcommand{\img}[4]{
\begin{figure}[!hbt]
\centering
\vspace{1ex}
\includegraphics[width=#2]{images/#1}
\caption[#4]{\label{img.#1} #3}
\vspace{1ex}
\end{figure}
}
When creating a href to an image, the viewer jumps to the image caption instead of the top of the image. How do I change my \img
command so it still puts the caption below the image but links to it jump to the image itself?
Best Answer
caption
. The default setting ishypcap=true
.caption
, you can load the packagehypcap
. It is important that the package is loaded afterhyperref
. You can loadhypcap
with the optionall
. In this casehypcap
has an influence on all float environments. You can limit it to figures by setting the optionfigure
.