# How to avoid link higlighting when using package hyperref?

I'd like to include some http links in my document. So i Included the hyperref package so that i can use the command \url{}

Microsoft Surface\footnote{\url{http://www.microsoft.com/surface}}


This works, but the problem is, that all the links in my document (also the ones created with \ref{} or \cite{} are highlighted. I want to avoid that. So i added:

\usepackage{hyperref}


But nothing changed. How can I avoid that all links are highlighted? I only want to enable URLs and nothing else.

-
if you do not want that, why do you then load hyperref? –  Herbert Feb 3 '11 at 14:06
@Herbert: Because i want to link microsoft.com but not highlight that and not highlight any other link in my document. –  RoflcoptrException Feb 3 '11 at 14:09
You could try using the url package instead, or a have a look at the answers on this related question. –  Juan A. Navarro Feb 3 '11 at 14:09

Only load the url package it also provides \url but will not render an hyperlink. Note that most PDF viewer do this now automatically anyway.

If your really need hyperref for something else try to:

1. Load the option with the package: \usepackage[colorlinks=false]{hyperref}

2. Create a hyperref.cfg file in the same directory as your TeX file and put the \hypersetup{colorlinks=false} in there.

Certain options of hyperref must be given very early and can't be changed afterwards. The colorlinks option might be one of them.

Supplement:

I just tested this under my TeXLive 2010 installation. With colorlinks=false I get the usual colored frame around the hypertext. You might want to activate colors and set them to black:

\usepackage[colorlinks=true,urlcolor=black]{hyperref}

-
Thanks. That solved the problem. –  RoflcoptrException Feb 3 '11 at 14:16
The option colorlinks=false should still give you boxes around the url (and \cites etc.) –  Carsten Thiel Feb 3 '11 at 14:23
@Carsten: Thanks, I already added that to my answer. –  Martin Scharrer Feb 3 '11 at 14:36

Since hyperref version 2011/02/05 v6.82a, the option hidelinks has been available, which suppresses the highlighting of links.

-
With \usepackage[colorlinks=true,urlcolor=black]{hyperref} the TOC links become red, while with \usepackage[hidelinks]{hyperref} everything renders perfectly. This is the way to go :) –  Riccardo Nov 19 '12 at 11:41

You can also used the style facilities of the url package.

\def\UrlFont{\small\sffamily\color{yourcolor}}


with

colorlinks = False


in hypersetup. I think it is easier. I did this for a beamer package where hyperref is loaded by default.

-

For natbib cites, you just need to intercept the hooks between hyperref and natbib. Similar changes can be done for refs (look in hyperref.sty).

\makeatletter
\renewcommand\hyper@natanchorstart[1]{}%
\renewcommand\hyper@natanchorend{}%
\makeatother

-

If you want only to print urls you can use the url package. If you want to have active links for the urls you could try this. It should disable all hyperref features (including bookmarks) with the exception of links behind urls:

\documentclass{book}
\usepackage[draft]{hyperref}
\makeatletter
\makeatother
\begin{document}
\chapter{a}\label{a}
abc\ref{a}

\url{http://www.test.de}
\end{document}

-
\documentclass{article}
\begin{document}

Microsoft Surface\footnote{\url{http://www.microsoft.com/surface}}

\end{document}


if you want the links. Replace \usepackage{url} instead of hyperref, will print URLs in typewriter. NEarly all pdf viewer convert it by default into a link.

Herbert

-
Unfortunately, I find that the url package still has a bug relating to underscores in URLs. –  user4417 Aug 11 '11 at 11:53
no it has no bug, otherwise show the opposite! –  Herbert Aug 11 '11 at 12:11
Ok, it is probably not a bug in the url package, and rather the pdf viewer. I find that clicking such a link containing an underscore, in a pdf document, using Adobe Reader X 10.1.0 will follow a truncated URL. e.g. http://www.under_score.com -> http://www.under –  user4417 Aug 11 '11 at 15:12