[metapost] a problem of label when using metapost

Dan Luecking luecking at uark.edu
Wed Nov 23 20:14:36 CET 2011


At 08:25 PM 11/23/2011, Source Liu wrote:
>Hi all
>
>
>Now i'm wondering whether it is possible to use enumerate in 
>metapost. (i mean, like \begin{enumerate} in latex, which automatic 
>enum the coming item a number).
>
>I used the
>
>==============================
>verbatimtex
>\documentclass{article}
>
>\begin{document}
>\begin{enumerate}
>
>etex
>
>*somethings here*
>
>verbatimtex
>
>\end{enumerate}
>\end{document}
>etex
>==============================
>
>after that, I tried to set a new counter, which still failed to work.

You can use enumerate, provided the entire enumerate environment
is in a \parbox and that is inside a single btex/etex.

If you want separate btex/etex groups to be sequentially numbered,
then you will have to arrange for the numbering your self.
For example:

============================
verbatimtex
  \documentclass{article}
  \newcounter{mynum}
  \newcommand{\nextmynum}{\stepcounter{mynum}\themynum}
  \begin{document}
etex

% somethings here
label(btex \nextmynum. First item. etex, z1);
% something else
  label(btex \nextmynum. Second second. etex, z2);
% etc.
end
============================

Note: there is no need to put \end{document} in your metapost
file. Metapost adds that automatically.

Regards,
Dan

Daniel H. Luecking
Department of Mathematical Sciences
Fayetteville, Arkansas
http://www-cs-faculty.stanford.edu/~knuth/iaq.html 



More information about the metapost mailing list