[NTG-context] metafun & \sometxt: should black be "black" or "textcolor"?

Mojca Miklavec mojca.miklavec.lists at gmail.com
Mon Aug 7 11:40:53 CEST 2006

On 8/7/06, Taco Hoekwater wrote:
> Mojca Miklavec wrote:
> >
> > The "real problem" appears in the following figure where the first
> > black is ignored and the second one is not, so it's rather
> > inconsistent:
> It is not really inconsistent, the rule is very simple:
>    all use of "withcolor <black>" upto the first non-zero color
>    is ignored by metapost.

OK, I "give up". I just have to reimplement the terminal to fist store
everything and then write out the black stuff before anything else ;)

> > I can image a "fair solution" to draw "withcolor black" in black and
> > to let the parts with no explicit color and an empty drawoptions()
> > string to use the "default color" (perhaps with gsave/grestore). But
> > I'm not entitled to judge about it.
> Yes, that's what I thought. But I need to patch metapost for
> that, so that solution won't be available in a reliable way
> for quite some time yet.

I realise that and I'll try to implement in an independant way.

> > In any case I'll have to use a solution which will not depend on this
> > behaviour. Is there any chance to get "withcolor somecolor", where
> > "somecolor" is the color set with "textcolor=somecolor"?
> Maybe withcolor \MPcolor{textcolor} ? (I am guessing)

Something that seems to work after some trial-and-error:

But I'm guessing as well. Let's wait for the next bug in the module then ;)

I now used


% \MPextensions, should be specific to \startGNUPLOTgraphic
	if unknown context_gplot: input mp-gnuplot.mp ; fi;
	% overloading
	gp_color_foreground := \MPcolor{textcolor};
	gp_color_lt[-2] := gp_color_foreground;

(because there's probably no way to put \MPcolor{textcolor} to *.mp file)

But now there's a minor problem. I have to initialize
"\setupcolors[textcolor=blue]" *before* loading the gnuplot module,
otherwise it's all black.

In contrast, if I use


    a graphic here will be blue
    a graphic here will be red, but text will still be blue



    a graphic here will be black
    a graphic here will be black, but text will still be blue

I suspect what's going on: as long as textcolor= is undefined,
\@@cltextcolor will expand to black and remain black even if I set
"textcolor=something" later. If it's initialised before loading the
module, it will expand to some color and if I change
"textcolor=someothercolor" later, the color will follow the new

What's the best remedy for it? (And sorry for way too many questions.)


(some files to play with are under http://pub.mojca.org/gnuplot/temp/)

More information about the ntg-context mailing list