On 1/10/2013 2:18 PM, Aditya Mahajan wrote:
On Thu, 10 Jan 2013, Alan BRASLAU wrote:On Thu, 10 Jan 2013 06:51:50 -0500 Aditya Mahajan <adit...@umich.edu> wrote:Since the beginning of MkIV, colors in metapost labels need to be set at the ConTeXt end (Untested): T := thelabel(textext("\color[blue]{I'm seeing double}"), origin); AdityaI don't believe that this is true, but I am most likely wrong.Well, I think it was true in the beginning (as I remember a discussion from Mojca on how to handle labels differently in the gnuplot module), but clearly that is not the case now.Indeed "\blue text" has worked, but 'draw T withcolor blue;' *should* work as well. The processing of textext() has changed recently, it seems.
The mkiv implementation has always been rather different from the mkii one: text handling as well as dealing with colors.
\startMPcode label(textext("I'm seeing double"),origin) withcolor green ; label(textext("I'm seeing double"),(-1mm,1mm)) withcolor blue ; \stopMPcode DOES work. Of course, these are much simplified minimal examples of what I would like to do.Minimal example to show what is happening: \startbuffer[initialize] picture T; T := textext("Hello"); picture Q; Q := T; \stopbuffer \startbuffer[T] draw T withcolor blue; \stopbuffer \startbuffer[Q] draw Q shifted (-1mm, 1mm) withcolor red; \stopbuffer \startlines Only draw T: \processMPbuffer[initialize,T] Only draw Q: \processMPbuffer[initialize,Q] Draw T & Q : \processMPbuffer[initialize,T,Q] Draw Q & T : \processMPbuffer[initialize,Q,T] \stoplines
You and Alan can pick up the beta from the ftp server and play with this: \setupbodyfont[dejavu] \starttext \startMPpage[offset=10pt] picture MyText ; MyText := textext("Dummy") ; % not used later on picture MyText ; MyText := textext("\red Red") ; draw MyText ; draw MyText scaled 2 shifted (0,-1cm) ; draw MyText scaled 3 shifted (0,-2cm) ; picture MyText ; MyText := textext("Blue Green Red") ;draw MyText rotatedaround(center MyText,10) shifted (0,-3cm) withcolor blue ;
draw MyText shifted (0,-4cm) withcolor green ;draw MyText rotatedaround(center MyText,-10) shifted (0,-5cm) withcolor red ;
picture MyText ; MyText := image ( draw textext("Green Red Blue {\yellow YELLOW} Whatever 1") ;draw textext("Green Red Blue {\yellow YELLOW} Whatever 2") shifted (10cm,0) ;
) ; draw MyText shifted (0,-6cm) withcolor green ; draw MyText shifted (0,-7cm) withcolor red ; draw MyText shifted (0,-8cm) withcolor blue ; \stopMPpage \stoptextThe complication is that we reuse a picture which once defined has frozen properties. However, after hours of lua/tex juggling I managed to made a variant that better keeps track of applied colors. I'm not sure if this is foolproof but it's probably quite ok for what Alan wants to do. Although ... being a scientist he will look for the next frontier ... (or even more scientific: try to prove me wrong).
Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
textext-002.pdf
Description: Adobe PDF document
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________