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.

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}
\hypersetup{colorlinks=false}

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

share|improve this question
2  
if you do not want that, why do you then load hyperref? –  Herbert Feb 3 '11 at 14:06
2  
@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
4  
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

6 Answers 6

up vote 5 down vote accepted

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}
share|improve this answer
    
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.

share|improve this answer
    
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
\documentclass{article}
\usepackage[colorlinks,linkcolor=black]{hyperref}
\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

share|improve this answer
    
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

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).

So, after loading hyperref and natbib:

\makeatletter
\renewcommand\hyper@natanchorstart[1]{}%
\renewcommand\hyper@natanchorend{}%
\renewcommand\hyper@natlinkstart[1]{}%
\renewcommand\hyper@natlinkend{}%
\renewcommand\hyper@natlinkbreak[2]{#1}%
\makeatother
share|improve this answer

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
\let\savedhyperlink\hyper@linkurl
\AtBeginDocument{\let\hyper@linkurl\savedhyperlink}
\makeatother
\begin{document}
\chapter{a}\label{a}
abc\ref{a}

\url{http://www.test.de}
\end{document}
share|improve this answer

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.

share|improve this answer

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.