Re: [metafont] MetaPost variables used as labels

"pth" <[email protected]> Fri, 26 Sep 2003 13:32:54 +0200
Newsgroups gmane.comp.tex.metapost,gmane.comp.tex.metafont
Message-ID <001b01c38421$efe42780$713380d9@oemcomputer>
----- Original Message -----
From: "Ivan Ivanov" <[email protected]>
To: <[email protected]>; <[email protected]>
Sent: Friday, September 26, 2003 11:20 AM
Subject: [metafont] MetaPost variables used as labels


> Dear colleagues,
>
> I have the following question concerning MetaPost. If
> I have a numeric variable defined in a MetaPost file
> is it possible to use its value as a label? For
> examle:
> n := 5;
> pair p;
> p := (100,100);
> label(value_of_n, p);
>
> or more complex:
> n := 5;
> pair p[];
> for i=0 upto n-1:
>   p[i] := (i+1)*(100,100);
>   label(value_of_i, p[i]);
> endfor;
>

n := 5;
pair p[];
for i=0 upto n-1:
   p[i] := (i+1)*(100,100);
 write "label(btex $"&decimal(i)&"$
etex,("&decimal(xpart(p[i]))&","&decimal(ypart(p[i]))&"));"
      to "mptextmp.mp";
endfor
write EOF to "mptextmp.mp";
scantokens "input mptextmp";


pth