Make links in LaTeX documents print in black and white

Here is a neat little hack to help optimize LaTeX documents for screen and print. I want links within LaTeX-generated pdf’s to be obvious when viewing on screen (“brick red” is my preference), but I want them to disappear when printed.

Yesterday, I found out the hyperref package has a neat option1 which precisely accomplishes this. Specify the ocgcolorlinks option in your hyperref stack as follows:

usepackage[ocgcolorlinks]{hyperref}

Once you have done this, you can style your links any way you like (color, highlight, underline/box, etc.)—as soon as you print, all of these decorations disappear and the printed output is in perfect black. Screen vs. print:

Latex color linksLatex bw links

  1. The hyperref manual on CTAN warns us: this is an experimental feature! Apparently it sometimes breaks links that cross multiple lines—not such a huge deal to me since almost all of my links are numerical citations.