# [lltx] luamplib + lualatex

Troy Henderson thenders at gmail.com
Thu Jul 25 06:27:42 CEST 2013

> Anyway, I have changed the user interface.
>     \mplibpreamble{ ... }
> now you have to use mplibpreamble environment
>     \begin{mplibpreamble}
>     ...
>     \end{mplibpreamble}

This works very well.  The only issue I see is if I update the value
of a variable, then that updated value is not remembered by another
\begin{mplibcode} ... \end{mplibcode}.  For example,

\begin{mplibpreamble}
u:=54;
\end{mplibpreamble}
\begin{mplibcode}
beginfig(1);
draw fullcircle scaled (2*u);
u:=2*u;
endfig;
beginfig(2);
draw fullcircle scaled (2*u);
endfig;
\end{mplibcode}

draws two circles where the second circle has twice the diameter as
the first.  However,

\begin{mplibpreamble}
u:=54;
\end{mplibpreamble}
\begin{mplibcode}
beginfig(1);
draw fullcircle scaled (2*u);
u:=2*u;
endfig;
\end{mplibcode}
\begin{mplibcode}
beginfig(2);
draw fullcircle scaled (2*u);
endfig;
\end{mplibcode}

draws two circles of the same diameter (namely 54bp).  Perhaps there
could be an optional argument to \begin{mplibcode} that would NOT use
the preamble, or perhaps there's a better solution than the optional
argument.

Troy