为什么我的所有脚注都超链接到标题页?

为什么我的所有脚注都超链接到标题页?

问题

我有各种脚注,它们从文本超链接到各自页面的底部。当我点击超链接(在正文中)时,它们总是会带我到文档的第一页。我还有footnotebackref一个将超链接放在脚注将引导读者返回到正文,并附上这些链接以供参考。

编辑 MWE

经过大量删除,我设法将文档缩减为以下几行。有人可能会说我找到了问题所在,因为删除后\usepackage[hang, flushmargin]{footmisc}问题就解决了,但我仍然希望脚注不缩进。

\documentclass{article}

\usepackage[usenames,dvipsnames]{color}
\usepackage[colorlinks=true]{hyperref}

\usepackage[hang, flushmargin]{footmisc}         %Problem line.
\usepackage{footnotebackref}

\begin{document}
\tableofcontents            
\newpage                
\section{Section}
This is some text\footnote{This is a footnote.}.
\end{document}

答案1

在对该问题的评论中,我引用了footmisc手册:

hyperref软件包的目标是从脚注标记到相应的脚注正文建立超链接;这自然会给 带来麻烦footmisc,不幸的是,目前还没有已知的补救措施。如果您使用footmisc,请hyperref通过将其加载为来抑制 的超脚注: \usepackage[hyperfootnotes=false,...]{hyperref}建议对这两个软件包之间的交互进行进一步的研究,但尚未安排。

因此,事情可能不会按照人们希望的方式进行,这是可以预料的。但是,MWE 中的问题可以通过更改包加载顺序轻松解决:

\documentclass{article}

\usepackage[hang, flushmargin]{footmisc}
\usepackage[colorlinks=true]{hyperref}
\usepackage{footnotebackref}

\begin{document}
\tableofcontents            
\newpage                
\section{Section}
This is some text\footnote{This is a footnote.}.

\newpage\null% to see that the hyperlink works
\end{document}

答案2

我想给巴西用户留个小贴士,有些文档必须使用区域标准包abntex2cite。我希望这个小贴士也能帮助解决其他问题hyperref

该包hyperref应该是最后加载的包,但情况并非总是如此,如下所述:hyperref哪些包应该在之后而不是之前加载?

该包abntex2cite是这些例外之一,必须在之后加载hyperref

问题是:如果你hyperref在 之后加载abntex2cite.bbl文件将会出现错误,并且引用将无法正确写入。而引用是使用 的 (主要) 原因abntex2cite。因此hyperref必须在 之前abntex2cite

但这会导致另一个问题。脚注链接将指向第一页。要解决此问题,必须setspace在“hyperref”之前加载包。

MWE 如下:

\documentclass{article}
\usepackage{setspace} % Always before hyperref -- Enable correct footnote link
\usepackage{hyperref}
\usepackage[alf]{abntex2cite}   % Normas ABNT - After hyperref
\begin{document}
First Page.

With the package setspace before hyperref, the footnotes work properly.

Without the package setspace or if it is loaded after hyperref, the footnotes don't work properly.

\clearpage
This is the first footnote\footnote{Text 1.}.

\clearpage
This is the second footnote\footnote{Text 2.}.

\end{document}

答案3

对于使用 apacite、babel 和 hyperef 包的人来说,这可能会有效。

我首先加载了所有其他包,然后是 hyperref、babel、apacite。

% Load the rest of your packages here then use the order
    \usepackage[pdftex,bookmarks=true,colorlinks]{hyperref}
    \usepackage[latin1]{inputenc}
    \usepackage[english,spanish]{babel}
    \usepackage{apacite} 
\begin{document}

相关内容