[metapost] Different colours in a label
Mojca Miklavec
mojca.miklavec.lists at gmail.com
Sat Nov 10 13:28:26 CET 2007
On 11/10/07, Pétiard François wrote:
> 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
Mine is
%%Page: 1 1
0 0 1 setrgbcolor
-20.1345 -2.49065 moveto
(E) cmmi10 9.96265 fshow
0 0 0 setrgbcolor
-9.4386 -2.49065 moveto
(=) cmr10 9.96265 fshow
1.0775 -2.49065 moveto
(Q) cmmi10 9.96265 fshow
8.95349 -2.49065 moveto
(\() cmr10 9.96265 fshow
1 0 0 setrgbcolor
12.8279 -2.49065 moveto
(i) cmmi10 9.96265 fshow
0 0 0 setrgbcolor
16.2601 -2.49065 moveto
(\)) cmr10 9.96265 fshow
showpage
So there's indeed some difference (color switches turned on).
Hmmm. Taco pointed out that one needs a recent version of dvitomp, but
binaries in MikTeX seem to be recent enough. My binaries on gwTeX (TeX
Live 2007) are
> mpost --version
MetaPost 0.993 (Web2C 7.5.6)
> dvitomp --version
DVItoMP 0.992/color (Web2C 7.5.6)
and the colors work OK.
(Perhaps the functionality has been broken again in version 1.000 and
you have too recent binaries then :) - only joking of course :)
Well, the banner on my distribution says "% Written by DVItoMP,
Version 0.992/color (Web2C 7.5.6)", while the banner on MikTeX says
"Written by DVItoMP, Version 1.000 (MiKTeX 2.6)". Perhaps a question
should be sent to Christian Schenk, asking about why there is no
"/color" in MikTeX's dvitomp :)
Does anyone have MikTeX 2.7 to test if anything has changed in the
latest version?
> >> 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 ?
cont-en.fmt. But if you're on MikTeX 2.6, that should not be a problem.
If you don't get any output, you probably have no ruby installed
("ruby --version" should work from a command-line). It can be
downloaded from either page (the first one is an installer and the
second one is "unzip-and-add-bin-folder-to-path" as far as I
remember):
http://rubyinstaller.rubyforge.org/wiki/wiki.pl
http://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/
Mojca
More information about the metapost
mailing list