[pdftex] Rule color madness

Andreas Matthias amat at kabsi.at
Wed Apr 9 20:44:37 CEST 2003

G. D. Brettschneider wrote:

> Well, it's not so important for me, so I didn't check
> the archives to see whether or not this has been discussed
> before, but I'm a bit surprised by this little file returning
> two lines in different colors instead of the same (with
> pdfTeX 1.00b):
>   \pdfliteral {0 1 1 0 k}% switch color to red (CMYB)

This just sets the non-stroking color. You forgot to set
the stroking color as well.

>   \hrule height 1pt      % draws black line

PDF Code:

0 0.498 m
468 0.498 l

This line is drawn in non-stroking color, which is still black.
You need a \pdfliteral {0 1 1 0 K} to draw it in red.

>   \vskip 1pt
>   \hrule height 1.01pt   % draws red line

PDF Code:

0 0 468 1.006 re

This rectangle is drawn in stroking color, which is red.

Although it seems that you are drawing two line, a look into
the PDF Code shows that you are drawing one line and one
rectangle. Therefore you have to set the stroking and the
non-stroking color. This is a real pitfall. You can investigate
this with \pdfcompresslevel=0.


More information about the pdftex mailing list