[metapost] Metapost doesn't like `z01' for point names
Rodolfo Medina
rodolfo.medina at gmail.com
Wed Jun 20 21:09:14 CEST 2007
On Sun, 17 Jun 2007, Rodolfo Medina wrote:
>> Please excuse the basic question.
>> If I name a point `z01' Metapost complains:
>>
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> %file test.mp
>> beginfig(1);
>>
>> z0 = (0,0);
>> z1 = (1,1);
>>
>> z01 = 0.5[z0,z1];
>>
>> endfig;
>>
>> end
>> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>>
>> $ mpost test
>> This is MetaPost, Version 0.641 (Web2C 7.4.5)
>> (test.mp
>> ! Inconsistent equation (off by -0.5).
>> <to be read again>
>> ;
>> l.8 z01 = 0.5[z0,z1];
>>
>> ?
>>
>>
>> Instead, if I name it `z11' it's okay. Why? I really would like to name it
>> `z01': is it definitely impossible?
Hartmut Henkel <hartmut_henkel at gmx.de> writes:
> z01 == z1 == z[1] == e. g. z0001.0 due to MetaPost's token rules, see e.
> g. MFBook p. 50. And z1 was defined already. Numeric suffixes even
> include the decimal point, another example: z.0100 == z.01 == z[0.01].
I worked it out this way:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
beginfig(1);
u=2cm;
pair p[]; pair p[]_[];
p0 = (0,0) * u;
p1 = (1,1) * u;
p0_1 = 0.5[p0,p1];
draw p0..p0_1..p1;
endfig;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
; 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[]_[];
?
I can't understand: so there are some letters which are forbidden to be
used that way? Can anyone provide some explanation?
Thanks,
Rodolfo
More information about the metapost
mailing list