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

Hartmut Henkel hartmut_henkel at gmx.de
Wed Jun 20 22:00:52 CEST 2007


On Wed, 20 Jun 2007, Rodolfo Medina wrote:

> ; instead, if I simply put `z' in place of `p', it fails:
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> beginfig(1);
> u=2cm;
>
> 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
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
> $ mpost test
> This is MetaPost, Version 0.641 (Web2C 7.4.5)
> (test.mp
> ! Declared variable conflicts with previous vardef.
> <to be read again>
>                    ;
> l.5 pair z[];
>               pair z[]_[];
> ?

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


Regards, Hartmut


More information about the metapost mailing list