At 18:40 26/09/2003 +0200, Jean-Christophe Dubacq wrote:
I would like to include colored text in metapost, but dvitomp does not manage color.
I saw solutions using ConTexT --- but I do not know ConTexT (not this year, maybe next year). I use only the mptopdf macros from ConTexT (loaded automatically by the pdfdriver).
Do people out ther know how to do that ?
(btw, my metapost is something like label(btex The answer is \textcolor{\teacheronly}{42} etex,(0,0));
However, the color specification is in the dvi used as an intermediate format by mpost, just the dvi -> MP extraction does not work good.
Remark: there seems to exist a patch on a spanish speaking page, but this is a patch in C, not web.
The following code can give you a clue on how to do this; keep in mind that specials (used to switch color) get lost in mp! \starttext \setupcolors[state=start] \startMPpage draw image ( draw btex The answer is etex ; draw btex { }42 etex shifted (xpart lrcorner currentpicture,0) withcolor red ; ) ; \stopMPpage \stoptext or if you need more of that: \starttext \setupcolors[state=start] \startMPpage def append expr txt = draw btex \strut{ }\strut etex shifted (xpart lrcorner currentpicture,0) ; draw txt shifted (xpart lrcorner currentpicture,0) enddef ; draw image ( draw btex The answer is etex ; append btex 42 etex withcolor red ; ) ; \stopMPpage \stoptext (the mp code should work with any-mp/tex) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------