Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a pdf image with transparent background that I'll include by using graphicx (\includegraphics). Everything is fine when using pdfLaTeX to build my pdf, but when I switch to XeTeX the image will suddenly have black background instead of being transparent. I have tried to reproduce the problem, and quite strangely some pdf images do not exhibit this problem while some do.

My XeTeX version is 3.1415926-2.4-0.9998, which I believe is the newest. And here's a sample pdf image if any one wishes to test: https://docs.google.com/file/d/0BxDcKKtrknW_MlZMV2lKOE5oMXc/edit

Minimal code:

\documentclass[10pt]{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[h] 
\centering \includegraphics[scale=0.48]{MapReduce_Pipeline.pdf} 
\caption{MapReduce Pipeline.}
\label{fig:MapReduce_Pipeline}
\end{figure}
\end{document} 
share|improve this question
add comment

1 Answer

The PDF file MapReduce_Pipeline.pdf contains the image as JPEG image with a transparency mask. xdvipdfmx, the PDF driver part of XeTeX seems to forget to add the the mask entry. Version 0.7.8 works under TeX Live/Linux, but fails under MiKTeX/Windows.

Since JPEG is not the best format for such kind of drawings with sharp edges, it is better to preserve the vector properties of the image. Perhaps you can find a better PDF export for the drawing in the original program, where the image was generated.

Alternatively you can open the image MapReduce_Pipeline.pdf with evince. There you can store (right click) the image object as PNG file (PNG has transparency feature). Then you can include the PNG image in your XeLaTeX document (the scale factor needs adjusting, or use width=\linewidth or similar).

share|improve this answer
    
Hmm, saving to PNG definitely helps, but why some PDF work while some do not is still a mystery. I've even experienced cases when no image showed up at all. –  yongtw123 Jan 17 '13 at 5:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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