# [metapost] Different colours in a label

Pétiard François petiard.francois at free.fr
Sat Nov 10 12:36:54 CET 2007

Mojca Miklavec a écrit :
> On 11/10/07, Pétiard François wrote:
>> Hello
>>
>> I want to typeset a label like that :
>>
>> E=Q(i)
>>
>> where E is in blue and i is in red.
>>
>> The command :
>>
>> label(btex \$\color{blue}E\color{black}=Q(\color{red}i\color{black})\$
>> etex,z0);
>>
>> does'nt work : all the label is in black.
>>
>> How can I make ?
>
> That's because "btex/etex" labels are processed with plain TeX (unless
> you have switched to LaTeX explicitely) which doesn't know that it
> should turn the color on. You probably need to add something like
>     verbatimtex ... \usepackage{color} etex
> at the beginning (no idea how to do the same in plain TeX) since the
> separate (La)TeX run doesn't include any special packages by default.

No, it doesn't work with \usepackage{color} (I have switched to LaTeX).

> Another approach is depicted here as a complete example in metafun (to
> be processed with texexec) - since I forgot most of what I have ever
>
> \setupcolors[state=start]
> \starttext
> \startMPpage
> % metapost code goes here
> label(\sometxt{\$\color[blue]{E}=Q(\color[red]{i})\$}, origin);
> \stopMPpage
> \stoptext
>

I am not familiar with texexec.
I've saved these lines :

\setupcolors[state=start]
\starttext
\startMPpage
% metapost code goes here
label(\sometxt{\$\color[blue]{E}=Q(\color[red]{i})\$}, origin);
\stopMPpage
\stoptext

in test.tex