[NTG-context] \sometxt in staticMPfigure

Hans Hagen pragma at wxs.nl
Tue Sep 26 18:21:05 CEST 2006


Sanjoy Mahajan wrote:
> Hans Hagen wrote:
>   
>> test case:
>>
>> \setupcolors[state=start,textcolor=red]
>> \starttext
>>     red
>>         \color[green]{green
>>             \startMPcode
>>                 label(\sometxt{green\color[blue]{blue}green}, origin) 
>> withcolor red;
>>                 draw fullcircle scaled 1cm xscaled 2;
>>             \stopMPcode
>>         green}
>>     red
>> \stoptext
>>     
>
> The test case works as you say (2006.09.26 beta).  Though I don't
> understand why [Note added later: I now understand, see at the
> end...]: e.g. why the 'green' text in the \sometxt is green.
> Shouldn't the withcolor red trump the \color[green] from ConTeXt?  I
> take your point about the lack of a color stack in metapost and the
> difficulty of getting the metapost and context stacks to interact.
>
> Here's a shorter example of what I'm confused about.
>
> \setupcolors[state=start,textcolor=yellow]
> \starttext
>             \startMPcode
>                 label(\sometxt{?red?}, origin) withcolor red;
>             \stopMPcode
> \stoptext
>
> The label(\sometxt{...}) withcolor red would produce postscript code like
>
>   1 0 0 setrgbcolor
>   <font stuff for ?red?>
>   0 0 0 setrgbcolor
>
> and that would be surrounded by code to set textcolor to yellow.
>
> Oh, I understand now.  The \sometxt{} wraps the ?red? in yellow
> setrgbcolor, since that's seen first by ConTeXt, and *then* it's
> wrapped by metapost in red setrgcolor, so the red is overridden by the
> yellow inside it.
>   
indeed, another option is to replace more of mp's color stuff by context but then we may end up in other problems 

Hans 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list