[metapost] Different colours in a label
Pétiard François
petiard.francois at free.fr
Fri Nov 16 17:11:40 CET 2007
Tommy Ekola a écrit :
>> I want to typeset a label like that :
>>
>> E=Q(i)
>>
>> where E is in blue and i is in red.
>
> A not-so-elegant solution is to let metapost color the label. In the code
> below I define a picture for each part of the label that should have the
> same color (blocking other parts of the label with \phantom) and then draw
> each part of the label using different colors.
>
> beginfig(1);
> picture p, q, r;
> p := thelabel(btex $E\phantom{{}=Q(i)}$ etex, (0,0));
> q := thelabel(btex $\phantom{E}=Q(\phantom{i})$ etex, (0,0));
> r := thelabel(btex $\phantom{E=Q(}i\phantom{)}$ etex, (0,0));
> draw p withcolor blue;
> draw q withcolor black;
> draw r withcolor red;
> endfig;
>
> end.
>
Thank you for your tip.
I have founded a similar solution but, of course, I would prefer dvitomp
solution. Christian Schenk has promised that for MiKTeX 2.7.
Best regards
F. Pétiard
More information about the metapost
mailing list