TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a document with colored hyperlinks, using the options of the hyperref package. I also have lots of tikz-figures that use various shades of gray and occasionally some colors.

The way my document is right now looks very nice on screen but not so great when I print it on a monochrome printer. I tried using xcolor's \selectcolormodel{gray} but then all the colors are printed as shades of grey. This is ok for figures but not acceptable for the text.

Is there a way to change the color of the text (and only that) to black when printing the document? The figures should stay as they are (colored/shaded).

If this is not possible, is there a way to turn all the figures in grayscale and all the text to black?

Are things like these possible or do I have to maintain 2 diferrent versions of my document (i.e. one for on-screen reading and the other one for printing)?

I am using XeLaTeX if it is of any importance.

some text


and a figure with shades of grey


share|improve this question

marked as duplicate by Papiro, Maarten Dhondt, Svend Tveskæg, Zarko, Romain Picot Dec 28 '15 at 16:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

If the colored text is coming just from hyperlinks, it's a matter of saying \hypersetup{colorlinks=false}, I believe. – egreg Jul 8 '11 at 10:23
Nice picture. Is it done with TikZ? – N.N. Jul 8 '11 at 10:28
Do your really need colored links? You can switch to a colored border around links to make them stand out (see egreg's first comment). This border is then not printed. – Martin Scharrer Jul 8 '11 at 12:48
@Martin, thank you for your suggestion. No I don't really need them. I just prefer them. I find the colored boxes rather distracting. And if there are lots of references close together sometimes they fall on each other. I think that my question is rather specific though. Even something like It cannot be done + a reference is a perfectly acceptable answer. If nothing comes up, I will ask on comp.text.tex. – pmav99 Jul 9 '11 at 20:03



Needs a pdf version 1.5 and links can not be broken across lines.

share|improve this answer
thank you. Unfortunately it is not good enough. Links are still colored, and the links that cannot be broken are very inconvenient too. Causes lots of overfull hboxes. By the way, ocgcolorlinks is an undocumented option? I can't find any reference at hyperref's doc. – pmav99 Jul 8 '11 at 12:05
it needs the pdftex or (for xelatex) the dvipdfm driver – Herbert Jul 8 '11 at 12:42
@pmav99: See e.g. tug.org/applications/hyperref/ftp/README. "Experimental option ocgcolorlink. The idea are colored links, when viewed, but printed without colors. This [..] uses Optional Content Groups, a feature introduced in PDF 1.5. Main disadvantage: Links cannot be broken across lines. PDF reference 1.7: 4.10.2 "Making Graphical Content Optional": Graphics state operations, such as setting the color, ..., are still applied. Therefore the link text is put in a box and set twice, with and without color." Exactly what I thought. – Martin Scharrer Jul 8 '11 at 12:51
@Herbert, could this be adapted to have a \textogcolor{blue}{blargh} command? and/or a \occgcolor{blue} command. – Mariano Suárez-Alvarez Sep 4 '15 at 7:38
@MarianoSuárez-Alvarez: I suppose yes, but I never tried it. – Herbert Sep 5 '15 at 7:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.