[metapost] Automatic labeling
mojca.miklavec.lists at gmail.com
Tue Nov 14 18:42:09 CET 2006
On 11/14/06, Peng Yu wrote:
> Suppose I have 100 vertexes, I want to label all of them with the vertex index.
> I'm wondering if it is possible to do it with a for loop in metapost.
> pair v;
> v1 := ...;
> v2 := ...
> v100 = ...;
> label(btex $1$ etex, v1);
> label(btex $2$ etex, v2);
> label(btex $100$ etex, v100);
You can compile the following code with "texexec filename.tex" if you
have ConTeXt installed:
for i=1 upto 2:
label(textext(decimal i), v[i]); % could be label(textext("abc"))
(if you don't have ConTeXt, you can first try that on
http://live.contextgarden.net and ask in case of problems with
More information about the metapost