Using ConTeXt and Metapost, it is fairly easy to define spot colors and use them in an image:


  draw unitsquare scaled 10cm;
  fill fullcircle scaled 8cm shifted(5cm,5cm) withcolor \MPcolor{RedSpot};
  setbounds currentpicture to boundingbox currentpicture enlarged 2mm;

The PDF color channels may be separated using GhostScript and then summarized using ImageMagick's montage utility:

gs -dBATCH -dNOPAUSE -sDEVICE=tiffsep -r300 -sOutputFile=separation.tif <output pdf>
montage -label "%f" -density 300 <output pdf> *.*.tif -geometry 600 output.png

NOTE: There is a bug in GhostScript 9.0 -- 9.02 that breaks the tiffsep device by making it unable to load color profiles

The resulting summary shows that the PDF consists of a black frame and a circle that occupies a spot channel:

Color Separation of ConTeXt output

A similar effect can be achieved using XColor and PS-Tricks:

TeXDict begin
/RedSpotCMYK [0 1 1 0] def
/RedSpotSpot (RedSpot) def
/RedSpotDef RedSpotCMYK aload pop RedSpotSpot findcmykcustomcolor def
/XC@RedSpot{RedSpotDef 1.0 setcustomcolor}XCdef



\definecolor{RedSpot}{cmyk}{0 1 1 0}

  \psframe (0,0) (10cm,10cm)
  \pscircle[fillcolor=RedSpot,fillstyle=solid,linestyle=none] (5cm,5cm){4cm}


Compiled with LaTeX and converted to PDF:

latex pstricks_spot
dvips -h tex.pro -h xcolor.pro -h spot_color.pro pstricks_spot
ps2pdf pstricks_spot.ps

This gives a similar color separation:

Color Separation of PSTricks output

However, if I try to swap TikZ for PSTricks in the above process:

TeXDict begin
/RedSpotCMYK [0 1 1 0] def
/RedSpotSpot (RedSpot) def
/RedSpotDef RedSpotCMYK aload pop RedSpotSpot findcmykcustomcolor def
/XC@RedSpot{RedSpotDef 1.0 setcustomcolor}XCdef



\definecolor{RedSpot}{cmyk}{0 1 1 0}

  \draw            (0,0) rectangle (10,10);
  \fill[color=RedSpot] (5,5) circle (4);


NOTE: TikZ 2.10 is broken when combined with the Preview package and dvips

The red circle no longer occupies a separate channel:

Color Separation of TikZ output

Therefore, my question is:

Given that XColor can enable spot colors for PSTricks graphics and TikZ also uses XColor, is it possible to use spot colors in TikZ graphics?

If so, I will be asking a follow-up question about doing so without rendering through Postscript (i.e using pdflatex instead of latex/dvips/ps2pdf)


1 Answer 1


(I'm guessing a lot here.) I think that it is down to the way in which PGF inserts colours in to the output file. To see this, it's worth reviewing the levels in the TikZ/PGF system.

  1. At the top, we have TikZ. This is the frontendlayer and defines the syntax that the user (usually) uses. It's job is to translate user-friendly stuff into a simpler state ready for further processing.
  2. In the middle, we have PGF. This is the basiclayer. This is where all the detail takes place. Here, things are done in a machine/program-friendly way. The full power of TeX is used to do some heavy machinery. All the path decorations and similar are done here. The goal of this layer is to translate what the user wants in to basic path entities.
  3. At the bottom, we have the drivers. These form the systemlayer. Here is where the PGF code is interpreted in to specific instructions. These have to be specific to the planned output type.

So the thing to remember in this is that when you say \fill[color=RedSpot] then that is a TikZ command to set the colour to RedSpot which then gets further interpreted by PGF and then the driver. Chasing definitions through, we find that color=RedSpot calls \pgfsetcolor which calls \pgf@setcolor which calls \pgfsys@color@<model>. This is now a driver level command. Its definition, say for CMYK, is

\def\pgfsys@color@cmyk@stroke#1#2#3#4{\pgfsysprotocol@literal{#1 #2 #3 #4 K}}

from which we can see (and tracing back through the definitions, this gets clearer) that even if we've defined a colour name, it is the CMYK values that get put in the file.

The point is that PGF cannot know that it is possible in PDF to alias colours, because it doesn't know that the final output will be PDF. So it translates the colours to their raw values. And 0 1 1 0 setcmykcolor isn't the spot colour.

A lot of the above is speculation, I'll admit. Here's my evidence for this being the case. If you compile the PSTricks file above and look at the PS, you'll find that the drawing code is:

  tx@Dict begin STP newpath /ArrowA { moveto } def /ArrowB { } def
 0.8 SLW TeXDict begin XC@black end   142.26378 142.26378 113.81102
.5 CLW mul sub 0 360 arc closepath  gsave TeXDict begin XC@RedSpot
end  1. .setopacityalpha  fill  grestore end

But if you compile the TikZ version and look at the PS, you'll find:

 0 1 1 0 setcmykcolor

 141.73404 141.73404 moveto

 255.12128 141.73404 moveto

 255.12128 204.35689 204.35689 255.12128 141.73404 255.12128 curveto

 79.11119 255.12128 28.3468 204.35689 28.3468 141.73404 curveto

 28.3468 79.11119 79.11119 28.3468 141.73404 28.3468 curveto

 204.35689 28.3468 255.12128 79.11119 255.12128 141.73404 curveto


So the RedSpot gets put literally in to the PS from PSTricks but is translated back to 0 1 1 0 internally by PGF first.

The clincher is to do the following. Edit the PS file and replace the 0 1 1 0 setcmykcolor by XC@RedSpot. Then do the gs and montage stuff, and you get:

spot colours from TikZ

which is what you wanted.

However, editing the postscript isn't a great way to do this! Here's what I think you'd have to do to use spot colours in TikZ. I think you'd have to define a new colour model, say spot. You'd then tell PGF that the spot colour model is to be treated specially in that the name of the colour is to be used (or at least XC@<name>). To define a spot colour, you could (I think) use xcolor to define it using one model and then convert it to another. That would ensure that the definition got in to the PS file (which it does already). I don't know how to do all those steps, because it relies on knowing how xcolor works and I don't know much about that. But that's what I would do.

  • Sorry for letting this one sit for so long. Looks like the loss of spot colors is a price PGF pays for multi-driver abstraction. Thanks for the excellent write-up and additional info!
    – Sharpie
    Commented Jan 5, 2012 at 6:03
  • @Sharpie & Andrew Since I am not advanced enough to understand above, I will just put a simple question: I wrote a book in LaTeX that uses two colours, black and bluish one and includes lots of pictures in TikZ. Printing company wants me to provide PDF that uses black and a Pantone colour. Can I do that? I did find the appropriate Pantone colour...
    – Pygmalion
    Commented Oct 28, 2013 at 15:35
  • @Pygmalion I'm afraid that the above represents the absolute limit of what I know how to do. I recommend that you ask a new question about it to see if anyone has any ideas. Commented Oct 28, 2013 at 19:17
  • Andrew Stacey: this would mean creating a duplicate question.
    – Pygmalion
    Commented Oct 28, 2013 at 21:21
  • @Pygmalion No, it would be a follow-up question. This question is finished with as Sharpie has accepted this answer. But, it would seem, Sharpie was more interested in the "why" than the "how". You need the "how" so you can ask a new question, referencing this one, and explaining that you need to actually be able to do this. Commented Oct 29, 2013 at 7:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .