Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The following code created a footnote, the problem is that in the produced pdf file clicking footnote reference 1 doesn't jump to footnote definition1 in bottom of the page, instead, it jumps to the beginning of the pdf file. But if I remove the "\usepackage{setspace}" line everything works. Why is this and how to make it work as I expected? Thanks in advance.

\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}
share|improve this question
1  
Welcome to TeX.SX! Did you try loading hyperref after setspace? –  egreg Jul 6 at 19:52
    
    
Hi egrep, Thank you very much, and yes loading hyperref after setspace addresses the issue. I'm going to read the link you provided. This was my first post at Tex.SX and I'm impressed by how fast my question gets correctly answered. –  York Jul 6 at 20:12

1 Answer 1

up vote 5 down vote accepted

The package setspace modifies the standard definition of \footnote so that single spacing is used in the footnote texts. Also hyperref modifies \footnote so as to make the hyperlinks.

However, hyperref is generally agnostic about the definition of the commands it has to redefine for doing its job (there are many): it just takes the current definition and massages it a bit for adding the hyperlinks.

If you load the package setspace after hyperref, the modification made by the former overrides the change made by the latter. So the correct way is first loading setspace and then hyperref.

There are some packages that should be loaded after hyperref, you find a big list at Which packages should be loaded after hyperref instead of before? and setspace doesn't appear there.

\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}

By the way, are you really sure about \tolerance=1000? It's quite a large value and you'll risk getting wide interword spaces. It's better to do

\usepackage{microtype}

(before loading hyperref).

share|improve this answer
2  
Package setspace is an item in the section "Package Compatibility" of hyperref's README: Package order is \usepackage{setspace} before \usepackage{hyperref} as egreg has answered in more detail. –  Heiko Oberdiek Jul 6 at 20:33
    
Sorry egrep about the \tolerance=1000 thing. It was a leftover that I should have deleted. –  York Jul 6 at 22:59
    
@York I have nothing to do with egrep, although I've written a package that uses regular expressions. ;-) –  egreg Jul 6 at 23:02
    
@egreg: What package is that, a LaTeX package? I'm pretty new to LaTeX, do you have really book/site to recommend? –  York Jul 6 at 23:34
    
@York It's called regexpatch, for modifying definitions of commands. You can try Nicola Talbot's “LaTeX for Complete Novices” –  egreg Jul 6 at 23:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.