# OS-dependent, bad rendering when embedding transparent images

I'm having a pretty strange problem with embedding a PDF image with some transparency in my Ph.D. thesis. I'm using the memoir document class, and compiling with pdflatex, although I have confirmed that this happens even when not using those two. I've discovered that this problem is operating system dependent. This is pretty serious because I need my thesis rendered correctly on all OS, especially on OS X.

I first create the PDF figure in LaTeX using the tikz package:

\documentclass[border=1cm,tikz]{standalone}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{fadings}

\begin{document}

\begin{tikzpicture}
\draw [-Latex,ultra thick] (0,0) -- ++(45:5);
\draw [-Latex,ultra thick,path fading=south] (2,0) -- ++(45:5);
\end{tikzpicture}

\end{document}


Which looks like this:

The left arrow is just a solid line, while the right arrow is faded towards the tail-end of the arrow. Then, I embed this figure in any simple LaTeX document, such as

\documentclass[letterpaper]{article}
\usepackage{graphicx}

\begin{document}

\begin{figure}[t]
\centering
\includegraphics[scale=1]{tikz-figure}
\caption{My problematic figure.}
\end{figure}

\end{document}


and here's where the problem begins.

### OS X

The PDF figure renders correctly, as above. However, when rendering the final PDF (I tried Skim and Preview), the faded arrow simply does not appear.

### Linux

When rendering on Linux (with Evince) the faded arrow is turned solid and appears in the correct position, just without the fade. This is the case for both the PDF figure and the final PDF document.

### Windows 10

Lastly, on Windows 10 (with Adobe Reader and Sumatra PDF) both the figure and the final document appear as they should, with the right arrow faded.

I tried adding the commonly suggested % \pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>} but that had absolutely no effect. I also tried the pdfx package, but that did not make any difference either.

• This seems to be a problem with the viewer, I'd say. How does it print? Jun 9 '16 at 20:40
• Different PDF viewers are known to have issues with fadings of various kinds. Some of the examples in the TikZ manual don't work for me in Okular, for example. Can you use Adobe Reader on every OS? That might work across the board. (But check Linux, especially, since its version is ancient.)
– cfr
Jun 9 '16 at 20:58
• Try using Adobe Reader on the Mac and see if it renders properly. It may very well be a bug in PDFkit. Preview, Skim and TeXShop all use Apple's PDFkit to render pdf documents. Jun 9 '16 at 21:17
• I opened the final PDF in Chrome and Firefox on both OS X and Linux, and the faded arrow appeared without a hitch. However, I am still confused by this. In OS X, I can view the original PDF figure with the faded arrow just fine. It's only until I embed it in another document does it stop appearing. So it seems that this problem might be at least partially to blame on the PDF viewer. I'm still optimistic it can be fixed in the TeX source. Jun 10 '16 at 1:26
• You could try MuPDF on GNU/Linux. This is the renderer behind SumatraPDF, so it should also show correctly. Furthermore, MuPDF uses subpixel rendering which makes the output look very smooth. It is only lacking a proper GUI on GNU/Linux. Jun 18 '16 at 14:45

## 1 Answer

(I'd like to post this only as comment, but do not have the reputation yet)

I face exactly the same problem with a figure (also a fading arrow): In Adobe Reader and on MacOS, it looks fine. Using Preview (the software) or the space-bar preview from Finder, the arrow is gone completely.

But: My figure was generated using Adobe Illustrator, so I don't think it's a LaTeX/TikZ problem, but pdf-renderer.

The solution I'm using for now is to open the compiled .pdf in Adobe Acrobat and save again with the "optimized pdf" option and transparencies

• medium resolution
• transparency level: 75
• Line Art and Text: 300
• Gradient and Meshes: 150
• Convert all Text to Outlines: False
• Convert all Strokes to Outlines: True
• Clip Complex Regions: True
• Preserve overprint: True

Afterwards, the arrow is visible, but has a tiny halo-outline also around the parts that should be completely transparent. Still better than nothing ...

I'm not sure what Adobe does internally, maybe someone here does. Also, any suggestions for tools that do not require Adobe Acrobat would be great.