5

I'm using \hyperref and encountering two problems. First: footnote links are not active; second: I cannot seem to change the color of links or to go from colored links to links with borders.

Below is an example (using colored links, not borders):

\documentclass[11pt]{article}
\usepackage{setspace}
\usepackage{amssymb, natbib}
\usepackage[tbtags]{amsmath}
\usepackage{rotating}
\usepackage{ctable}
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{caption}
\usepackage{comment}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage[margin=1.1in]{geometry}

 \usepackage[pdftex, pdftitle={}, pdfauthor={}, colorlinks=true, urlcolor=green, linkcolor=green, citecolor=green, raiselinks=false, hyperfootnotes=true]{hyperref}

Any help would be greatly appreciated!


Sorry, here is, what I think, is a MWE.

\documentclass[11pt]{article}
\usepackage{setspace}
\usepackage{amssymb, natbib}
\usepackage[tbtags]{amsmath}
\usepackage{rotating}
\usepackage{ctable}
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{caption}
\usepackage{comment}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage[margin=1.1in]{geometry}

 \usepackage[pdftex, pdftitle={Mongolia games paper}, pdfauthor={Daniel Rubenson, Peter Loewen \& Richard Sawyer}, colorlinks=true, urlcolor=green, linkcolor=green, citecolor=green, raiselinks=false, hyperfootnotes=true]{hyperref}

\usepackage{hypernat}

\newcommand{\revertstretch}{\setstretch{1.3}}
\revertstretch

% THEOREM Environments ---------------------------------------------------
 \newtheorem{thm}{Theorem}%[subsection]
 \newtheorem{cor}[thm]{Corollary}
 \newtheorem{lem}[thm]{Lemma}
 \newtheorem{thma}{Theorem}%[subsection]
 \newtheorem{lema}[thm]{Lemma}
 \newtheorem{prop}[thm]{Proposition}
% \theoremcontact{definition}
 \newtheorem{defn}[thm]{Definition}
% \theoremcontact{remark}
 \newtheorem{rem}[thm]{Remark}
 \newtheorem{hypo}{Hypothesis}
% \numberwithin{equation}{subsection} % MATH ------------------------------------------------------------------- %
\DeclareMathOperator{\IM}{Im} % \DeclareMathOperator{\ess}{ess}
 \newcommand{\eps}{\varepsilon}
 \newcommand{\fn}{\footnote}
 \newcommand{\To}{\longrightarrow}
 \newcommand{\h}{\mathcal{H}}
 \newcommand{\s}{\mathcal{S}}
 \newcommand{\A}{\mathcal{A}}
 \newcommand{\J}{\mathcal{J}}
 \newcommand{\M}{\mathcal{M}}
 \newcommand{\W}{\mathcal{W}}
 \newcommand{\X}{\mathcal{X}}
 \newcommand{\BOP}{\mathbf{B}}
 \newcommand{\BH}{\mathbf{B}(\mathcal{H})}
 \newcommand{\KH}{\mathcal{K}(\mathcal{H})}
 \newcommand{\Real}{\mathbb{R}}
 \newcommand{\Complex}{\mathbb{C}}
 \newcommand{\Field}{\mathbb{F}}
 \newcommand{\RPlus}{\Real^{+}}
 \newcommand{\Polar}{\mathcal{P}_{\s}}
 \newcommand{\Poly}{\mathcal{P}(E)}
 \newcommand{\EssD}{\mathcal{D}}
 \newcommand{\Lom}{\mathcal{L}}
 \newcommand{\States}{\mathcal{T}}
 \newcommand{\abs}[1]{\left\vert#1\right\vert}
 \newcommand{\set}[1]{\left\{#1\right\}}
 \newcommand{\seq}[1]{\left<#1\right>}
 \newcommand{\norm}[1]{\left\Vert#1\right\Vert}
 \newcommand{\essnorm}[1]{\norm{#1}_{\ess}}
%%% ----------------------------------------------------------------------
\newenvironment{changemargin}[2]{%
 \begin{list}{}{%
  \setlength{\topsep}{0pt}%
  \setlength{\leftmargin}{#1}%
  \setlength{\rightmargin}{#2}%
  \setlength{\listparindent}{\parindent}%
  \setlength{\itemindent}{\parindent}%
  \setlength{\parsep}{\parskip}%
 }%
\item[]}{\end{list}}






\title{title}
\author{author}
\date{\today}
\begin{document}
\pagenumbering{roman}
\maketitle
\singlespace
\begin{abstract}
\noindent Abstract
\end{abstract}

\clearpage
\doublespace
\pagenumbering{arabic}

\section{Introduction}

\href{a_link}{a link}

An example.\footnote{An example.}

\end{document}
7
  • Your code works for me. Links are green and work. And when I change colorlinks from true to false, the links become red boxes. Your problem seems to lie elsewhere, please give us more and more precise info (see MWE link by Claudio).
    – Christian
    Apr 23, 2012 at 14:07
  • 1
    It is better to not show just part of your code, but a minimum working example Apr 23, 2012 at 14:10
  • Sorry, here is, what I think, is a MWE.
    – Daniel
    Apr 23, 2012 at 15:31
  • 2
    Are you sure you can't leave out a single package or definition and still see the behaviour you describe?
    – Christian
    Apr 23, 2012 at 15:37
  • 1
    hyperref is known to have problems going along with packages that do something related to footnotes.
    – egreg
    Apr 23, 2012 at 16:44

1 Answer 1

1

The color of hyperlinks produced using \href is controlled by the filecolor key, so you can say

\usepackage[
  pdftitle={Mongolia games paper}, 
  pdfauthor={Daniel Rubenson, Peter Loewen \& Richard Sawyer}, 
  colorlinks=true, 
  urlcolor=green, 
  linkcolor=green, 
  citecolor=green, 
  filecolor=green, 
  raiselinks=false, 
  hyperfootnotes=true]{hyperref}

but apparently you want all the hyperlinks to be the same color; in this case, it is better to use allcolors:

\usepackage[
  pdftitle={Mongolia games paper}, 
  pdfauthor={Daniel Rubenson, Peter Loewen \& Richard Sawyer}, 
  colorlinks=true, 
  allcolors=green, 
  raiselinks=false, 
  hyperfootnotes=true]{hyperref}

A complete example incorporating some of your code (i changed the value of paperheight just for the example):

\documentclass[11pt]{article}
\usepackage{setspace}
\usepackage{amssymb, natbib}
\usepackage[tbtags]{amsmath}
\usepackage{rotating}
\usepackage{ctable}
\usepackage{sectsty}
\usepackage{fancyhdr}
\usepackage{caption}
\usepackage{comment}
\usepackage{appendix}
\usepackage{verbatim}
\usepackage[margin=1.1in,
paperheight=8cm% just for the example
]{geometry}

\usepackage[
  pdftitle={Mongolia games paper}, 
  pdfauthor={Daniel Rubenson, Peter Loewen \& Richard Sawyer}, 
  colorlinks=true, 
  urlcolor=green, 
  linkcolor=green, 
  citecolor=green, 
  filecolor=green, 
  raiselinks=false, 
  hyperfootnotes=true]{hyperref}

\usepackage{hypernat}

\newcommand{\revertstretch}{\setstretch{1.3}}
\revertstretch

\begin{document}

\href{a_link}{a link}

An example.\footnote{An example.}

\end{document}

enter image description here

Regarding the issue with footnote hyperlink, it is a well known fact that hyperref might not cooperate well with footnotes; here's a little note about the hyperfootnotes option, taken from hyperref's documentation:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .