[metapost] Different colours in a label
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Sat Nov 10 12:51:29 CET 2007
On 11/10/07, Pétiard François <petiard.francois at free.fr> wrote:
> 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).
Apart from the fact that I needed to use
mpost --tex=latex zz
(Hartmut's proposal didn't work here either since "tex
--parse-first-line" wasn't happy to respect "&latex")
the LaTeX example gives me color here.
What exactly do you mean by "doesn't work"?
According to Taco's remark there's one important question: which TeX
distribution are you using? Can you send some logs?
> > 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
> > known about LaTeX:
> >
> > \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
> Then I've made
>
> texexec test.tex
>
> But nothing ! No file test.dvi, test.pdf, nothing !
>
> Is it correct ?
You did the correct thing, but that fact that you didn't get any
output is not. The only thing that comes to my mind and could go wrong
is:
- no ruby or no perl installed (most probable)
- too old TeX distribution
- no format file, but in that case you would get an error (least probable)
Mojca
More information about the metapost
mailing list