[NTG-context] \sometxt in staticMPfigure
Hans Hagen
pragma at wxs.nl
Tue Sep 26 11:57:20 CEST 2006
Sanjoy Mahajan wrote:
> With the new beta, this stress test for \sometxt works fine:
>
> ====================================================
> \setupcolors[state=start]
> \starttext
> \startstaticMPfigure{fig}
> label(\sometxt{he\color[blue]{ab}lo}, origin) withcolor red;
> draw fullcircle scaled 1cm xscaled 2;
> \stopstaticMPfigure
>
> \usestaticMPfigure[fig]
>
> xyz
> \stoptext
> ====================================================
>
> Well, it comes out in red, then blue, but the last two letters ('lo')
> are in black, I guess because pdftex doesn't have a color stack. But
> that's not what I was meaning to test. I just wanted to test \sometxt
> and it looks good.
>
this is tricky; context has a color stack, but the text and mp stuff
work independently (in mp there is no symmetry in color handling); i can
imagine a different handling of mp colors, but this will slow down
things (comes down to pushing and popping colors on the context color
stack and such)
in this situation, i think that the best we can do is to revert to the
current color, so i patched things a bit:
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
> But, the following now doesn't work (I'm pretty sure it would have
> worked with 2006.08.08 because I've been using the boxes macros alot):
>
> ================= dc2.tex [my crazy naming scheme] ===================
> \starttext
>
> \startMPinclusions
> input boxes
> \stopMPinclusions
>
> \startstaticMPfigure{fig}
> boxit.h(btex h etex);
> drawboxed(h);
> \stopstaticMPfigure
>
> \usestaticMPfigure[fig]
>
> xyz
>
> \stoptext
> ====================================================
>
> It produces
>
> This is MetaPost, Version 0.901 (Web2C 7.5.3)
> (/home/sanjoy/texmf/web2c/natural.tcx)
> (texexec-mpgraph.mp
> >> boxit.h
> ! Isolated expression.
> <to be read again>
> (
> l.150 boxit.h(
> btex h etex
> ?
>
> That's from making:
>
hm, i'll add the inclusions
(here it fails anyway doe to some
clearboxes->clearboxes
.clearb_(h);
clearboxes->clearboxes
.clearb_(h);
clearboxes->clearboxes
.clearb_(h);
clearboxes->clearboxes
.clearb_(h);
clearboxes->clearboxes
no time to look into that now (i never use boxes)
i'll make a new beta
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