[metapost] Metapost doesn't like `z01' for point names

Hartmut Henkel hartmut_henkel at gmx.de
Wed Jun 20 22:06:25 CEST 2007


On Wed, 20 Jun 2007, Hartmut Henkel wrote:

> z is a macro already defined by vardef, see plain.mp, which is always
> preloaded as format:
>
> vardef z@#=(x@#,y@#) enddef;
>
> so you can't just use z for a variable, you first have to undefine the z
> macro, e. g. this seems to work:
>
>
> beginfig(1);
> u=2cm;
>
> let z = undefined; % undefined is just a word,
> % you can say also let z = a or b or anything.
>
> pair z[]; pair z[]_[];
>
> z0 = (0,0) * u;
> z1 = (1,1) * u;
>
> z0_1 = 0.5[z0,z1];
>
> draw z0..z0_1..z1;
>
> endfig;
>
> end

...but the drawback is that you loose the possibility to use x0_1 and
y0_1 as components of z, you would need to say xpart or ypart. So better
keep z the practical macro it is, why not just this:

beginfig(1);
u=2cm;

z0 = (0,0) * u;
z1 = (1,1) * u;

show x1;

z0_1 = 0.5[z0,z1];

draw z0..z0_1..z1;

endfig;

end


Regards, Hartmut



More information about the metapost mailing list