[metapost] Different colours in a label

Pétiard François petiard.francois at free.fr
Sat Nov 10 13:08:25 CET 2007


Mojca Miklavec a écrit :
> 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"?

The file is compiled but all the label is black.


> According to Taco's remark there's one important question: which TeX 
> distribution are you using? Can you send some logs?

My distribution is MiKTeX 2.6

The file zz.mp is :

verbatimtex
\documentclass{article}
\usepackage{color}
\begin{document}
etex
prologues:=3;
beginfig(1)
z0=origin;
label(btex $\color{blue}E\color{black}=Q(\color{red}i\color{black})$
etex,z0);
endfig;
end

With mpost --tex=latex zz

the log is :

This is MetaPost, Version 1.000 (MiKTeX 2.6) (preloaded mem=mpost 
2007.11.5)  10 NOV 2007 12:59
**zz
(zz.mp [1{pdftex.map}<C:/Program Files/MiKTeX 
2.6/fonts/type1/bluesky/cm/cmmi10
.pfb><C:/Program Files/MiKTeX 2.6/fonts/type1/bluesky/cm/cmr10.pfb>] )
1 output file written: zz.1


and there is a file zz.mpx which is :

% Written by DVItoMP, Version 1.000 (MiKTeX 2.6)
begingroup save _p,_r,_s,_n; picture _p; _p=nullpicture;
string _n[];
vardef _s(expr _t,_f,_m,_x,_y)=
   addto _p also _t infont _f scaled _m shifted (_x,_y); enddef;
_n0="cmmi10";
_s("E",_n0,1.00000,0.0000,0.0000);
_n1="cmr10";
_s("=",_n1,1.00000,10.6959,0.0000);
_s("Q",_n0,1.00000,21.2120,0.0000);
_s("(",_n1,1.00000,29.0880,0.0000);
_s("i",_n0,1.00000,32.9624,0.0000);
_s(")",_n1,1.00000,36.3946,0.0000);
setbounds _p to (0,-2.4907)--(43.5899,-2.4907)--
  (43.5899,7.4720)--(0,7.4720)--cycle;
_p endgroup
mpxbreak


In the file zz.1, the lines after %%EndSetup is :

%%Page: 1 1
  0 0 0 setrgbcolor
-21.79495 -2.49065 moveto
(E) cmmi10 9.96265 fshow
-11.09904 -2.49065 moveto
(=) cmr10 9.96265 fshow
-0.58295 -2.49065 moveto
(Q) cmmi10 9.96265 fshow
7.29305 -2.49065 moveto
(\() cmr10 9.96265 fshow
11.16745 -2.49065 moveto
(i) cmmi10 9.96265 fshow
14.59966 -2.49065 moveto
(\)) cmr10 9.96265 fshow
showpage


>> 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) 

Perl is installed on my computer.

> - too old
> TeX distribution 

That the most recent stable version of MiKTeX (2.6)

> - no format file, but in that case you would get an
> error (least probable)

Do you know what is the name of the format ?

François


More information about the metapost mailing list