# [lltx] luamplib + lualatex

Troy Henderson thenders at gmail.com
Wed Jul 24 04:37:12 CEST 2013

Is \begin{mplibcode} ... \end{mplibcode} analogous to ConTeXt's
\startMpcode ... \stopMPcode?  If so, are there a LaTeX versions of

\startMPinclusions ... \stopMPinclusions
\startuseMPgraphic ... \stopuseMPgraphic
\startreusableMPgraphic ... \stopreusableMPgraphic
\startMPpage ... \stopMPpage

Primarily, what I would like to have is a MetaPost "preamble".  That
is, it would be nice to be able to have variables/types defined before
any beginfigs and have their values/types used in each figure.  For
example, I am thinking something like this:

\documentclass{article}
\usepackage{luamplib}
\begin{mplibcode}
u:=72;
\end{mplibcode}
\begin{document}

\begin{mplibcode}
beginfig(0);
draw fullcircle scaled (2*u);
u:=u/2;
endfig;
\end{mplibcode}

\begin{mplibcode}
beginfig(1);
draw unitsquare scaled (2*u);
endfig
\end{mplibcode}

\end{document}

Troy