以下代码创建了一个脚注,问题是在生成的 pdf 文件中单击脚注引用1
不会跳转到1
页面底部的脚注定义,而是跳转到 pdf 文件的开头。但如果我删除“\usepackage{setspace}”行,一切正常。为什么会这样,如何让它按我预期的方式工作?提前致谢。
\documentclass[11pt]{article}
\usepackage{hyperref}
\tolerance=1000
\usepackage{setspace}
\title{temp}
\hypersetup{
colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=blue,%
urlcolor=black
}
\begin{document}
\maketitle
\tableofcontents
\section{Section 1}
\label{sec-1}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Section 2}
\label{sec-2}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Section 3}
\label{sec-3}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Test footnotes}
\label{sec-4}
This text has a footnote \footnote{See section \ref{sec-1}}
\end{document}
答案1
该软件包setspace
修改了的标准定义,\footnote
以便在脚注文本中使用单倍行距。还hyperref
进行了修改\footnote
以制作超链接。
然而,hyperref
它通常对于为完成其工作而必须重新定义的命令的定义(有很多)是不可知的:它只是采用当前定义并对其进行一些调整以添加超链接。
setspace
如果在 之后加载包hyperref
,前者的修改将覆盖后者的修改。因此正确的做法是先加载setspace
,然后hyperref
。
有一些包需要加载后 hyperref
,你会发现一个大列表哪些包应该在 hyperref 之后加载而不是之前加载?并且setspace
没有出现在那里。
\documentclass[11pt]{article}
\usepackage{setspace}
\usepackage{hyperref}
\hypersetup{
colorlinks,%
citecolor=black,%
filecolor=black,%
linkcolor=blue,%
urlcolor=black
}
%\tolerance=1000 %%% Are you really sure?
\title{temp}
\begin{document}
\maketitle
\tableofcontents
\section{Section 1}
\label{sec-1}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Section 2}
\label{sec-2}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Section 3}
\label{sec-3}
TeX is a computer program for typesetting documents, created by Donald Knuth. It
takes a suitably prepared computer file and converts it to a form which may be
printed on many kinds of printers, including dot-matrix printers, laser printers
and high-resolution typesetting machines. LaTeX is a set of macros for TeX that
aims at reducing the user's task to the sole role of writing the content, LaTeX
taking care of all the formatting process. A number of well-established
publishers now use TeX or LaTeX to typeset books and mathematical journals. It
is also well appreciated by users caring about typography, consistent
formatting, efficient collaborative writing and open formats.
\section{Test footnotes}
\label{sec-4}
This text has a footnote \footnote{See section \ref{sec-1}}
\end{document}
顺便问一下,你真的确定吗\tolerance=1000
?这是一个相当大的值,你可能会得到很宽的单词间距。最好这样做
\usepackage{microtype}
(前加载中hyperref
)。