1126

I know that I can use hyperref to make cross-references and hyperlinks clickable. That makes the clickable areas outlined in fluorescent green, however. How can I make the green boxes go away?

Vebjorn Ljosa
  • 22,437
  • 17
  • 43
  • 32
  • 40
    Seeing what an important and popular question this is, I suggest choosing @meep.meep's answer as the accepted answer because it does exactly the same as Jukka's (which is nonetheless correct), but in a much more elegant way. Many new and unexperienced users will come across this question so it's worth thinking about it. – doncherry Aug 30 '11 at 16:28
  • 3
    And what if I want to keep them even for printing? How can i do that, please? – Perlnika May 26 '13 at 18:06
  • 3
    Some PDF viewers like qpdfview show boxes around links. So disable this first or make sure with other viewers that these boxes are actually in the PDF before you try to remove them. – Frank Breitling Mar 20 '17 at 15:32
  • 1
    In particular in qpdfview deselect the setting: Edit->Settings->Grapics->General->Decorate links – Harald Jul 12 '18 at 15:30
  • @Harald This settings does not seem to have any effect (even after restarting qpdfviewer). Links to references (green) and to figures & tables table of content (both red) and external links (cyan) all remain marked in in the program. (Though I if I view the same PDF in e.g. chromium then there are no color markings.) – zrajm Jun 18 '20 at 16:07

8 Answers8

1079

With \usepackage[hidelinks]{hyperref} you get active links in \textcolor (usually black) without a box around them.

Johannes_B
  • 24,235
  • 10
  • 93
  • 248
meep.meep
  • 16,905
  • 97
    I think there is no need for using \usepackage[hidelinks]{hyperref}. This problem may be fixed by just adding [hidelinks] as a global option to the \documentclass declaration (for instance: \documentclass[hidelinks,12pt]{report}). I read this in the quick help of MiKTeX 2.9. –  Apr 10 '12 at 01:50
  • 106
    @AhmedNaji: This is because global options, specified with the document class, will be passed down to the packages. However, I'm not aware of any package other than hyperref that knows an option hidelinks, so imho it isn't really helpful to move the option to the document class. An example where it does make sense to specify such an option globally (i.e. with the document class) is the option draft, which will influence e.g. graphicx and hyperref, or perhaps a language option like ngerman. – doncherry May 19 '12 at 23:41
  • 8
    What if other packages refer to hidelinks, that you may not want to disable? – Nicholas Hamilton Dec 20 '12 at 09:02
  • 5
    The suggested solution causes an "option clash" if you use the classicthesis package. In that case the comment of @user13436 solves the issue. – Emanuele Paolini Sep 19 '17 at 08:09
  • 8
    \usepackage[hidelinks]{hyperref} doesn't work. my code here and here – alhelal Oct 03 '17 at 05:53
  • 2
    \usepackage[hidelinks]{hyperref} works for me. – George Colpitts Jan 05 '19 at 23:16
  • 1
    This doesn't work for me, but what user13436 suggests in his comment does. Thank you, @user13436. – Arnaud Mortier Mar 30 '19 at 23:39
  • 1
    You should really use \PassOptionsToPackage{hidelinks}{hyperref} -- this will avoid any clashes with packages that also load hyperref. – NeoH4x0r May 15 '23 at 23:07
462

I use something like

\usepackage{xcolor}
\hypersetup{
    colorlinks,
    linkcolor={red!50!black},
    citecolor={blue!50!black},
    urlcolor={blue!80!black}
}

This gets rid of the ugly color boxes, but uses dark colored fonts which still make it clear that they are clickable.

Juan A. Navarro
  • 62,139
  • 32
  • 140
  • 169
  • 139
    I really think something like this should be the default rather than the neon boxed links. – einpoklum Nov 26 '11 at 21:32
  • 17
    The use of dark colours here is also important: brighter colours, like the defaults, usually come out too pale when printing. – Peter LeFanu Lumsdaine Dec 03 '12 at 01:17
  • 4
    @einpoklum, at the time the "hypertext" was popularized not long ago, the idea was to highlight it as much as possible, just because it was new. Remember that hyperlinks in web pages used to be highlighted and underlined in bright blue. – alfC Sep 09 '15 at 18:49
  • 14
    @alfC: But not boxed in bright green... :-) – einpoklum Sep 09 '15 at 18:59
  • 7
    @alfC By default, they still are in most browsers. – JAB Feb 01 '16 at 18:05
  • 1
    If I do this as a sign of hyperlink in the document, does it affect on printed page result? I mean when it is printed into hard copy (real document), the hyperlink text colour will be same as you see in pdf version (soft copy). – meisyal Dec 08 '16 at 04:49
  • 1
    @ShokatsuRyō depends on your printer, but the answer is usually yes. – Juan A. Navarro Dec 08 '16 at 08:44
  • Thanks, @JuanA.Navarro. I thought It just affected on soft copy only. – meisyal Dec 08 '16 at 09:05
  • sorry I tried to 'remove' your vote, just came here again and wanted to upvote (again) :). Thank you! – Ciprian Tomoiagă Dec 22 '16 at 01:11
  • 2
    You are a man of good taste. Exactly what was I looking for---this turned my literature review into something of modest design. I also appreciate you covering all of the bases: linkcolor, citecolor, and urlcolor. Moreover, this has the additional benefit of masking BibLaTeX's mistake of coloring a quotation mark in an MLA 8 citation with a dark color choice. –  Apr 20 '18 at 05:49
  • I don't know how it was before but currently you can use linkcolor, citecolor. urlcolor and others like hyperref option. – juanuni Nov 14 '21 at 23:32
  • 4
    It's possible to hack the colors so that the printer shows them in black, but they show up in color on the PDF viewer; https://tex.stackexchange.com/questions/230752/can-i-have-hyperlinks-a-different-color-for-printing ; also, see this latest development for improvements! https://tex.stackexchange.com/questions/4425/is-there-a-way-to-have-coloured-hyperref-hyperlinks-in-the-pdf-but-have-them-pr/364143#364143 – Joe Corneli Feb 27 '22 at 23:31
  • It says ! LaTeX Error: Undefined colorblue!80!black'.` – Ynjxsjmh Feb 06 '23 at 01:10
  • @Ynjxsjmh did you also include \usepackage{xcolor}? – Juan A. Navarro Feb 11 '23 at 08:09
  • @JuanA.Navarro Thanks, that helps. I remember I have noticed the xcolor package and included it in my document, but still got the error. Strangely, I couldn't reproduce undefined color error any more this time. – Ynjxsjmh Feb 11 '23 at 09:54
  • Simple and beautiful! – Mohith Nagaraju Nov 12 '23 at 09:36
204

Well, I see there are a lot of answers already, and they work, however I thought I'd give more detail:

As above, you can use

\usepackage[hidelinks]{hyperref}

or

\hypersetup{hidelinks}

However, if your problem is with the ugly green boarder there are very nice ways to remove that, without making it unclear what is a hyperlink.

I like

\hypersetup{
  colorlinks   = true, %Colours links instead of ugly boxes
  urlcolor     = blue, %Colour for external hyperlinks
  linkcolor    = blue, %Colour of internal links
  citecolor   = red %Colour of citations
}

That should be pretty self-explanatory, since I've commented everything so I can keep track of it.

There is also

\hypersetup{frenchlinks=true}

Which replaces the colour with small caps. No idea why it is French, or why small caps, but it is also an option.

There, I felt this helps complete the above answers; Yes, you can remove the box by hiding all the links, but there are other choices out there.

Matheod
  • 450
  • 3
  • 14
Canageek
  • 17,935
  • 7
    This is a real solution, otherwise how is the reader supposed to distinguish clickable links from plain text? Thank you – neurino Jan 09 '13 at 23:06
  • You are very welcome. – Canageek Jan 10 '13 at 17:10
  • @Canageek, I used your suggestion and it worked perfectly, but it changed also all text color from black (dark) to grey. How can I control this problem? I mean, what should I do to have the black (dark) color in the text? – Gilson Aug 20 '14 at 02:33
  • @Gilson I've not had that problem, at least, not that I've noticed. Could you make a new question with a MWE so I can test it out? Tag me in the comment please. – Canageek Aug 20 '14 at 18:31
  • @Canageek I've just done it in link – Gilson Aug 20 '14 at 19:57
  • What if I want to make the links bold instead of changing its color? – skan Jan 15 '21 at 16:35
  • @skan I don't know that one off the top of my head, why don't you make that a question and I'm sure you'll get an answer quite quickly. – Canageek Jan 15 '21 at 22:06
128
\hypersetup{
    colorlinks=false,
    pdfborder={0 0 0},
}

Edit: Fortunately, this is no longer needed. Since 2011-02-05 (hyperref version 6.82a), you can use the hidelinks option to achieve the same result; see this answer.

Jukka Suomela
  • 20,795
  • 13
  • 74
  • 91
  • 7
    Besides \hypersetup you may provides those settings as options when loading the hyperref package. – Stefan Kottwitz Aug 02 '10 at 17:03
  • 6
    Although I find them helpful- otherwise some people wouldn't know that clicking on a reference will take them to a bibliography entry. They don't show up in the printed copies. – Sharpie Aug 02 '10 at 17:26
  • 3
    I agree with Sharpie. It's better to change the borders and/or colours to something more pleasing but still visible (see Juan's answer), than to get rid of them entirely. – ShreevatsaR Aug 11 '10 at 21:24
  • 7
    I personally use \ifpdf\usepackage[pdftex,pdfborderstyle={/S/U/W 1},hyperfootnotes=false]{hyperref}\fi. This gets rid of the box by making links underlined instead. You can then use the linkcolor option to make the colours more palatable to humans. – kahen Dec 02 '10 at 14:39
  • 2
    Congrats! The fact that your answer was un-accepted got you the first Populist badge ever awarded here, this is quite a funny turn. Referring to the more up-to-date answer is really good style though, kudos for that! – doncherry Sep 08 '11 at 17:15
22

You can also use \usepackage[colorlinks=true, urlcolor=blue, pdfborder={0 0 0}]{hyperref}.

Can add any options of your choice, in order to only have urls without color or anything, use only pdfborder={0 0 0} option

Torbjørn T.
  • 206,688
user32319
  • 221
15

If you are using a modern release of LyX, then these options can be set in Document -> Settings -> PDF Properties -> Hyperlinks -> No frames around links.

Arnab
  • 167
  • 1
  • 2
14

As Canageek mentions, there are already a bunch of answers here, but there's another option that I developed in answer to another question, which you can see here: it refines the experimental "ocgcolorlinks" option so that the text is highlighted on screen and not in print, but avoids the boxing that caused weird line-wrapping of the current ocgcolorlinks implementation.

Ben Lerner
  • 7,082
  • 1
    Thank you for your idea of implementing line-breakable ocgcolorlinks! It is the basis for further refinement made in the ocgx2 package, allowing for ocg colour links that also wrap around page breaks and which can be nested. Also the empty-link issue could be solved. See here . – AlexG Apr 13 '17 at 10:49
13

For the sake of completion, if you use qpdfview, check that the option Decorate links is unselected (Edit -> Settings). I spent quite some time finding this was the actual problem!

enter image description here

luchonacho
  • 4,161
  • 3
    Thanks! I was about to debug the hyperref package as none of the above work to hide the decoration around links and refs. – scrutari Mar 21 '19 at 17:15