[metapost] [solved with ConTeXt] a problem of label when using metapost

Hans Hagen pragma at wxs.nl
Thu Nov 17 19:08:19 CET 2011


On 17-11-2011 17:37, Paul Menzel wrote:
> Dear Liu,
>
>
> please find your example and the output of ConTeXt attached
>
>          $ context mproof

The endfig/beginfig is not needed. If you want tight images, you can use 
the following (watch how we use textext instead of btex/etex):

\starttext

\startMPpage

     z1=(0,1cm);
     z2=(1cm,0cm);
     z3=(5cm,2cm);

     z4=2/3[z1,z3];

     pickup pencircle scaled 2pt;

     drawdot z1;
     drawdot z2;
     drawdot z3;
     drawdot z4;

     pickup pencircle scaled 0.1mm;

     drawarrow z2..z1;
     drawarrow z2..z4;
     drawarrow z4..z3;
     draw z1..z4 dashed evenly;

     dotlabel.lft(textext("$q$"), z1);
     dotlabel.lrt(textext("$O$"), z2);
     dotlabel.top(textext("$p$"), z4);

     label.llft(textext("$x_1$"),        1/2[z1,z2]);
     label.ulft(textext("$x$"),          1/2[z2,z4]);
     label.urt (textext("$\mathrm{E}$"), 0.8[z3,z4]);

\stopMPpage

\startMPpage

     u:=1cm;

     z1=-z3=(-4u,0);
     z2=-z4=(0,-3u);

     z11=(3u,0);
     z12=(0,-2u);
     z13=(-2u,-2u);
     z14=(-3.5u,0);
     z15=(-1.5u,0.5u);
     z16=(0,2u);

     fill z11...z12...z13...z14...z15...z16...cycle withcolor 0.7white;

     z21=(3.5u,2u);
     z22=0.4[z21,(0,0)];

     pickup pencircle scaled 0.1mm;
     fill fullcircle scaled 0.2cm xscaled 0.8 rotated 30 shifted z22 
withcolor white;
     draw fullcircle scaled 0.2cm xscaled 0.8 rotated 30 shifted z22 
dashed evenly scaled 0.5;

     draw (0,0)--z22 dashed evenly;
     drawarrow z22--2[(0,0),z22];
     label.ulft(textext("$\mathbf{E}$"), 1.5[(0,0),z22]);
     z23=(1.5u,0);
     drawarrow z22--2[z23,z22];
     label.ulft(textext("$\mathbf{n}$"), 1.5[z23,z22]);

     pickup pencircle scaled 0.5mm;

     label.llft(textext("$O$"), (0,0));

     drawarrow z1--z3 withcolor 0.3white;
     label.bot(textext("$x$"), z3);

     drawarrow z2--z4 withcolor 0.3white;
     label.lft(textext("$y$"), z4);

     label.ulft(textext("$S$"), (0,2u));

\stopMPpage

\stoptext



-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the metapost mailing list