My code follows:

\input colordvi
\input cmyk-hax


    \foreach \y [evaluate=\y as \yy using #2+1-\y] in {1,...,#2} {%
        \foreach \x in {1,...,\yy} {%
            \shade[shading=ball,ball color=white,#1]
                ({(2*\x-2+\y)*\radius},{sqrt(3)*\y*\radius}) circle (\radius);

%    \drawballs{1}
%    \drawballs[xshift=1.5cm]{2}
%    \drawballs[xshift=4cm]{3}
%    \drawballs[xshift=7cm]{4}
%    \drawballs[xshift=10cm]{5}


This code works well and the output generated successfully. But shaded part shows the mixing color of CMYK combination, but my requirement shade variation should show only B/W. Kindly suggest how can achieve this?

  • 1
    Maybe with \definecolor{testcolor}{gray}{0.9} if I understand your question correctly?
    – Max
    Jul 30, 2018 at 5:55
  • @MaxSnippe Thanks for your quick suggestion, but still the problem exists....
    – MadyYuvi
    Jul 30, 2018 at 6:41
  • What then is exactly your problem?
    – Max
    Jul 30, 2018 at 6:43
  • 1
    Well, @MaxSnippe tried to politely tell you that your question is not as clear as it could (or even should) be. Could you please try to make a more precise version?
    – user121799
    Jul 30, 2018 at 6:44
  • I think this is because pgf gradients do not support CMYK. They get converted to RGB, which messes everything up. Jul 30, 2018 at 13:30

1 Answer 1



tikz now supports grayscale and CMYK shadings since version 3.1.3. So it is only necessary to use \usepackage[gray]{xcolor} (or \usepackage[cmyk]{xcolor}) before loading tikz.

The fundamental problem is that pgf shadings do not support CMYK. So even though you define your testcolor colour in CMYK, it gets converted to RGB in the radial shading in your spheres.

Then when you try to output separations, you find that the RGB gray separates out onto all four plates instead of just the black plate.

This can be solved using a new package, pgf-cmykshadings, which supports CMYK (and grayscale) shadings.

Change the start of your MWE to:

\usepackage[gray]{xcolor}% (could also use \usepackage[cmyk]{xcolor})
\input colordvi
\input cmyk-hax

pgf-cmykshadings will work with all LaTeX engines, so if you don't need cmyk-hax, you could drop it (and colordiv) and use pdflatex, xelatex, or lualatex.

This will result in a PostScript (or PDF) file which only uses the black plate.

  • Thanks for your effort, will check and get back to you, hence I'm in traveling ...
    – MadyYuvi
    Oct 25, 2018 at 13:14

You must log in to answer this question.

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