Hyperref 没有跳转到适当的位置

Hyperref 没有跳转到适当的位置

可能重复:
href 到图像标签 - 如何跳转到图像而不是图像下方的标题?

似乎指向图片的链接会将光标带到图片标签,而标签位于页面顶部。这使得读者必须向上滚动才能看到图片。此外,脚注会将我带到上一页,或者有时会让我停留在同一页,但 PDF 会转到同一页的全页视图。我做错了什么?

MWE 代码:

\documentclass[12pt]{article}

\usepackage{float}
\usepackage{verbatim}
\usepackage[margin=1in]{geometry} 
\usepackage{graphicx}            
\usepackage{amsmath}              
\usepackage{amsfonts}              
\usepackage{amsthm}                
\usepackage{harvard}
\usepackage{setspace}
\usepackage{fullpage}
\usepackage{threeparttable}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{hyperref}
\usepackage[titletoc,toc,page]{appendix}
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{conj}[thm]{Conjecture}



\begin{document}
\nocite{*}

\title{Hpperref not working}

\author{N00b}

\maketitle
\newpage
\section{Main}

It appears that the links to the figures, like here for Figure ~\ref{fig:mweref}, take   the cursor to the figure label, where the Label is at the top of the page. This makes the reader have to scroll up to see the figure. Also, the footnotes, like this one \footnote{containing really useful stuff}, takes me either to the previous page or when I remove the newpage command after my title, it takes me  to the pdf with the full page view of the same page. What am I doing wrong? Thanks. 
\begin{figure}[H]
\centering
\includegraphics[scale=0.55]{mweref}
\caption{mweref}\label{fig:mweref}
\end{figure}
\end{document}

此 PDF 文件是我的 TeXnicCenter 正在生成的输出。

答案1

对于第一个问题,您可以使用hypcap包裹:

\usepackage{hyperref}
\usepackage[all]{hypcap}

来自包装文档:

此包尝试使用 来解决问题hyperref,即链接到标题下方的浮点而不是浮点的开头。因此,此包将任务分为两部分,使用\capstart或 自动在浮点开头设置链接,其余部分在\caption命令中设置。

对于第二个问题,众所周知,hyperref对脚注的支持很容易被破坏,正如 hyperref 手册中的以下引述所示:

将脚注标记变成脚注文本的超链接。容易损坏...

但是,您的最小示例不允许我重现您提到的问题。也许您可以考虑停用脚注的超链接?

\usepackage[hyperfootnotes=false]{hyperref}

您还可以尝试以下答案中给出的一些建议表格中的 hyperref + 表格 + 脚注错误

答案2

这个问题可以通过以下方式解决hypcap包,加载为

\usepackage[all]{hypcap}        % needed to help hyperlinks direct correctly;

请注意,这是需要加载的少数包之一hyperref。还有一些其他的,详见哪些包应该在 hyperref 之后加载而不是之前加载?

请注意,我已将您的代码精简为 MWE - 许多包在复制问题时都是不必要的。

\documentclass[12pt]{article}

\usepackage{float}
\usepackage[margin=1in]{geometry} 
\usepackage[demo]{graphicx}            
\usepackage{hyperref}
\usepackage[all]{hypcap}        % needed to help hyperlinks direct correctly;

\begin{document}
\nocite{*}

\title{Hpperref not working}

\author{N00b}

\maketitle
\newpage
\section{Main}
 It appears that the links to the figures, like here for Figure ~\ref{fig:mweref}, take   the cursor to the figure label, where the Label is at the top of the page. This makes the reader have to scroll up to see the figure. Also, the footnotes, like this one \footnote{containing really useful stuff}, takes me either to the previous page or when I remove the newpage command after my title, it takes me  to the pdf with the full page view of the same page. What am I doing wrong? Thanks. 
 \begin{figure}[H]
\centering
\includegraphics[scale=0.55]{mweref}
\caption{mweref}\label{fig:mweref}
\end{figure}
\end{document}

相关内容