[pdftex] Problem with colors in included PDF file

Piet van Oostrum piet at cs.uu.nl
Wed Jun 11 15:44:30 CEST 2003

I have found a problem when including a PDF graphic in a LaTeX document. 
The colors of the included figure are sometimes wrong.

For example in the following file:


I have put the picture online at http://www.cs.uu.nl/~piet/try.pdf because
I am not sure if attachments are welcome on this list.

The picture contains two black rectangles and a red rectangle. However, in
the resulting pdf file that you get from pdflatex, one of the black boxes
is green. 

I think this occurs because pdftex isn't aware that the first box which is
black, has a different color than is current at the moment the figure is
inserted. It apparently assumes that black is the current color, so no
color change is necessary. When the third box has to be placed it knows,
however, that the current color is red, so it resets the color to black.

I don't think the problem is in the included pdf file, as I have
constructed it in different ways: from xfig with PDF export, with xfig an
dia with EPS export and epstopdf, and all give the same result. In the EPS
file both black boxes have an explicit black color selection. I don't have
a program to produce a readable dump of the PDF file (it is compressed) so
I can't check it there.

The problem can of course be solved with
\textcolor{black}{\includegraphics{try}} but this shouldn't be necessary,
I think.
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van.Oostrum at hccnet.nl

More information about the pdftex mailing list