[Tikzdevice-bugs] Context and tikz?

Charlie Sharpsteen chuck at sharpsteen.net
Fri Apr 15 22:41:35 CEST 2011


I just found your post on R-Help:


http://r.789695.n4.nabble.com/R-plots-pdf-does-not-allow-spotcolors-td3446696.html#none

Which definitely puts what you are trying to achieve with colors into
context. I played around with context a little bit, and there is some good
and bad news.

The bad news first: It appears TikZ won't work with ConTeXt colors, at least
not with spot colors. There are a couple of reasons for this:


   - It appears that at a low level, the TikZ color engine only works with
   RGB and Grayscale colors.


   - For the new version of ConTeXt, MK IV, there is no code in that links
   ConTeXt's "\definecolor" command to TikZ's color model, which means
   "\pgfutil at definecolor{name}{rgb}{values}" must be used.

This means TikZ graphics can be made just fine in ConTeXt, but I could not
find a way to link an RGB value to a spot color.  So, at this moment it
doesn't look like TikZ is a viable way to produce PDF files that have
correctly set spot color information.


Now, for the good news.  ConTeXt has it's own graphics library called
METAPOST for which there is better support for ConTeXt color definitions.
For example, the following METAPOST graphic uses a CMYK color that is linked
to a PANTONE definition:


\runMPgraphicstrue

\definecolor
  [PantoneThreeZeroEight]
  [c=1,m=.05,y=0,k=.47]

\definespotcolor
  [DarkBlue]
  [PantoneThreeZeroEight]
  [p=1,e=PANTONE 308 CV]

\setupcolors[spot=yes,state=start,overprint=yes]

\starttext
\startMPpage
  fill unitsquare scaled 1cm withcolor \MPcolor{DarkBlue};
  fill unitsquare shifted (0.5,0.5)
    scaled 1cm withcolor transparent(1,0.5,red);
\stopMPpage
\stoptext


The output PDF contains PANTONE 308 CV as a spot color channel that contains
the first square definition. Now, the syntax of METAPOST is similar enough
to TikZ that it may be possible to modify the tikzDevice to output METAPOST
code instead of TikZ code.  This may not take much effort if you were
willing to skip support for more exotic features like polypath construction
and raster images (which wouldn't conform to Spot Colors anyway). In fact,
I've always thought about adding support for other TeX graphics libraries as
a possible post-1.0 direction for the tikzDevice.

-Charlie


More information about the Tikzdevice-bugs mailing list