# Using opacity in TikZ causes strange rendering in Acrobat.

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.

-
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 Jan 19 '11 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 Jan 19 '11 at 6:54
@DaveM: So is this solved, then? If so, in the spirit of housekeeping, I'll close as "no longer relevant". –  Loop Space Jan 19 '11 at 9:52
@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 Jan 19 '11 at 17:03
Quite surprising that people with sufficient discrimination to choose TeX and LaTeX are prepared to tolerate the bloatware that is Acrobat... (:-) –  Brent.Longborough Jan 22 '11 at 22:07

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.

-
Do you have any idea why that helps? –  Caramdir Jan 19 '11 at 17:01
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. –  prettygully Jan 19 '11 at 21:30
–  Martin Schröder Dec 15 '11 at 23:20
thanks, you are a hero! –  thias Dec 21 '11 at 8:45
BTW: This one also works for LuaLaTeX. –  daleif 2 days ago

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}
\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.

-

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.

-