# [lltx] luamplib + lualatex

Dohyun Kim nomosnomos at gmail.com
Thu Jul 25 09:02:21 CEST 2013

2013/7/25 Troy Henderson <thenders at gmail.com>:
> 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.
>

Currently, I have no idea about how to inherit the variables of
previous environment.
So what I can do for now is to allow optional argument to mplibcode,
which I have pushed just now.
\begin{mplibcode}[nopreamble]
...
\end{mplibcode}

I'm afraid this is not that much useful to you.
Regards,
--
Dohyun Kim
Seoul, Republic of Korea