在使用hyperref时,如何使超链接导航到LaTeX中图形的顶部?

在使用hyperref时,如何使超链接导航到LaTeX中图形的顶部?,latex,viewport,captions,figures,Latex,Viewport,Captions,Figures,我有一个LaTeX文档,其中有一个图和参考: \begin{figure} ... \caption{...} \label{fig:1} \end{figure} \ref{fig:1} 我使用hyperref包在生成的PDF中获取超链接。 但是,指向地物的链接会导航到标题,而将地物本身排除在视图之外。我如何让它导航到图的开头而不将标题移到顶部?将此添加到序言中 \usepackage{hyperref} \usepackage[all]{hypcap} %for going to

我有一个LaTeX文档,其中有一个图和参考:

\begin{figure}
...
\caption{...}
\label{fig:1}
\end{figure}

\ref{fig:1}
我使用hyperref包在生成的PDF中获取超链接。
但是,指向地物的链接会导航到标题,而将地物本身排除在视图之外。我如何让它导航到图的开头而不将标题移到顶部?

将此添加到序言中

\usepackage{hyperref}
\usepackage[all]{hypcap}    %for going to the top of an image when a figure reference is clicked
确保在导入hyperref包后写入\usepackage[all]{hypcap}

\usepackage{hyperref}
\usepackage{caption}
使用此选项比\usepackage[all]{hypcap}更好。

前面的评论:

\usepackage{hyperref}
\usepackage{caption}
略优于
\usepackage[all]{hypcap}
,因为当您使用例如
而没有标题时,不会出现编译问题。默认情况下,标题包设置选项

hypcap=true

将超链接锚定到环境的开头。

谢谢您的回答。您能详细说明为什么更好吗?如果出于某种原因您不能使用caption软件包,您可以使用
\capstartfalse