[metapost] Typeset the value of a variabe using LaTeX in METAPOST

j.romildo at gmail.com j.romildo at gmail.com
Mon Oct 23 23:54:59 CEST 2006


Hello.

How can I typeset with LaTeX the value of variable in Metapost. Say for
instance that I want to put an axe in a row and have its tickets
labeled, with the labels formatted with LaTeX:

   prologues := 2;

   verbatimtex
   \documentclass{article}
   \begin{document}
   etex

   beginfig(0)
     u := 6mm;
     drawarrow (0,0)--(11u,0);
     for i = 0 upto 10:
       draw (i*u,-1mm) -- (i*u,1mm);
       label.bot (btex i etex, (i*u,-1mm) );
   %              ^^^^^^^^^^^
   %              How to use the value of i here?
     endfor;
   endfig;

   verbatimtex
   \end{document}
   etex

   end;

Any clue?

Romildo


More information about the metapost mailing list