[metapost] Problem with colors

Taco Hoekwater taco at elvenkind.com
Sun Aug 8 15:43:10 CEST 2010

On 08/08/2010 03:12 PM, Steve Checkoway wrote:
> % Written by metapost version 1.208
> begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
> string _n[];
> vardef _s(expr _t,_f,_m,_x,_y)(text _c)=
>    addto _p also _t infont _f scaled _m shifted (_x,_y) _c; enddef;
> _n0="cmr10";
> _s("X",_n0,1.00000,0.0000,0.0000, withcolor cmyk(0,0,1,0)
> );
> setbounds _p to (0,0.0000)--(7.4720,0.0000)--
>   (7.4720,6.8078)--(0,6.8078)--cycle;
> _p endgroup
> mpxbreak
> It looks like that should be withcmykcolor (0,0,1,0).

Or it could be withcolor (0,0,1,0), the problem was that
the macro 'cmyk' is undefined.

> Someone offlist suggested that I try \usepackage[usenames,dvipsnames]

There is also a dvipsnam.mp (part of mfpic) which defines the
macro cmyk, or you could add this definition somewhere in your
mp input file (but before the label, of course):

   vardef cmyk (expr c, m, y, k) = (c, m, y, k)  enddef;

Best wishes,

More information about the metapost mailing list