26

I have a problem using opacity in TikZ. Whenever I use it somewhere in a picture, I get weird side-effects: colors in (some) other parts of the documents are changed apparently randomly and it makes the text look semi-bold and somewhat blurry.

I only see this effect in Acrobat. Other pdf viewers I tried display the document correctly.

13
  • Have you checked with other pdf readers (eg. evince instead of acrobat)? Usually they are the problem (see tex.stackexchange.com/questions/141/… and tex.stackexchange.com/questions/1915/tikz-strange-color-change). Otherwise, could you please post or link to an example.
    – Caramdir
    Commented Jan 19, 2011 at 6:29
  • Now I'm feeling pretty stupid :-( I should have tried another reader earlier and saved myself some aggravation. Acrobat is the culprit - it doesn't seem well-suited to Linux (has a tendency to crash my OS) but it seems to be the only browser that handles DLJS stuff when I use the acrotex package. Thanks very much!
    – DaveM
    Commented Jan 19, 2011 at 6:54
  • @DaveM: So is this solved, then? If so, in the spirit of housekeeping, I'll close as "no longer relevant". Commented Jan 19, 2011 at 9:52
  • 1
    @Andrew: This this question now has a real solution, I'd rather close similar questions as duplicates of this (maybe after some rewriting of this question to make it more general).
    – Caramdir
    Commented Jan 19, 2011 at 17:03
  • 1
    Quite surprising that people with sufficient discrimination to choose TeX and LaTeX are prepared to tolerate the bloatware that is Acrobat... (:-) Commented Jan 22, 2011 at 22:07

3 Answers 3

29

Try inserting:

\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>} 

into your preamble. I had a problem with some colours being way too bright in acrobat reader (but not in other pdf viewers) when using opacity < 1 and this fixed it for me.

3
  • It has something to do with rendering of the alpha channel & a deficiency in acrobat reader; sorry, my technical knowledge is not up to a better explanation. If you google the code, you'll find that there are quite a few sources discussing the beamer/transparency/acroread problem & offering this fix. Commented Jan 19, 2011 at 21:30
  • 1
  • 1
    BTW: This one also works for LuaLaTeX.
    – daleif
    Commented Jul 30, 2015 at 12:42
6

I had this exact same problem. The solution posted by prettygully only works with pdfTeX / pdfLaTeX. If you use XeTeX / XeLaTeX you can put this modified version in your preamble instead:

\usepackage{everypage}
\AddEverypageHook{%
  \makeatletter%
  \special{pdf: put @thispage <</Group << /S /Transparency /I true /CS /DeviceRGB>> >>}%
  \makeatother%
}%

This was inspired by is-there-a-way-to-rotate-all-pages-in-xelatex and inkscape-pdf-includegraphics-xelatex-changed-colors.

4

If you are using pdflatex, inserting

\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}

in the preamble indeed works.

However, if you use latex > dvips > ps2pdf, this workaround will not work, since the pdf page attributes are ignored by latex. The issue is also described in the ghostscript manual:

ps2pdf currently has only very limited support for PDF 1.4. It writes out the blend mode, constant alpha, and text knockout graphics state parameters, and it handles images with soft masks, but it does not handle transparency groups, or soft masks in the graphics state.

Interestingly, the solution is as simple as using ps2pdf13. This way, you create a PDF v1.3 compliant pdf file which seems to work as expected. So far, we did not notice any side effects.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .