On Tue, 5 Jul 2011, Manuel Pégourié-Gonnard wrote:
Hi,
Le 04/07/2011 21:02, Arno Trautmann a écrit :
I was wondering what would be the best way to pack metapost-code so I
can use a LaTeX-command to typeset it. But I fail due to fancy verb (I
guess …), assume the following code:
\documentclass{minimal}
\usepackage{luamplib}
\def\foo{
\begin{mplibcode}
beginfig(1)
draw (0,0) -- (7,2);
endfig
\end{mplibcode}
}
\begin{document}
\foo
\end{document}
I'm afraid there is no easy way to achieve that right now. I've noted it and
future versions of luamplib will probably provide a wider range of commands and
environments with different catcode regimes, probably like luacode now, to make
this easier.
FWIW, the corresponding ConTeXt code works fine:
\def\foo
{\startMPcode
draw (0,0) -- (7,2);
\stopMPcode}
\starttext
\foo
\stoptext
I don't know what is the difference between the implementation of
mllibcode and MPcode environments.
Aditya