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

发布于 2024-09-29 16:29:25 字数 226 浏览 1 评论 0原文

我有一个 LaTeX 文档,其中包含一个图形和对其的引用:

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

\ref{fig:1}

我使用 hyperref 包来获取生成的 PDF 中的超链接。 但是,图形的链接会导航到标题,而图形本身则不在视图中。如何让它导航到图形的开头而不将标题移动到顶部?

I have a LaTeX document with a figure and references to it:

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

\ref{fig:1}

I use the hyperref package to get hyperlinks in the resulting PDF.
However the link to the figure navigates to the caption leaving the figure itself out of the view. How can I make it navigate to the start of the figure instead without moving the caption to the top?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雪落纷纷 2024-10-06 16:29:25

在序言中添加此内容

\usepackage{hyperref}
\usepackage[all]{hypcap}    %for going to the top of an image when a figure reference is clicked

确保在导入 hyperref 包后写入 \usepackage[all]{hypcap}

Add this in your preamble

\usepackage{hyperref}
\usepackage[all]{hypcap}    %for going to the top of an image when a figure reference is clicked

Make sure that the \usepackage[all]{hypcap} is written after the hyperref package is imported.

过潦 2024-10-06 16:29:25

对于之前的评论:

\usepackage{hyperref}
\usepackage{caption}

\usepackage[all]{hypcap} 稍好,因为当您使用不带标题的 figure 时,不会出现编译问题。默认情况下,标题包将选项锚定

hypcap=true

超链接设置为环境的开头。

To previous comment:

\usepackage{hyperref}
\usepackage{caption}

is slightly better than \usepackage[all]{hypcap} because when you use e.g. figure without captions there won't be a compilation problem. The caption package by default sets option

hypcap=true

anchoring hyperlinks to the beginning of an environment.

不必了 2024-10-06 16:29:25
\usepackage{hyperref}
\usepackage{caption}

使用它比 \usepackage[all]{hypcap} 更好。

\usepackage{hyperref}
\usepackage{caption}

Using this is a better idea than \usepackage[all]{hypcap}.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文