[metapost] MetaPost and LuaTeX

Hans Hagen pragma at wxs.nl
Tue Nov 9 11:03:37 CET 2010

On 9-11-2010 10:05, Dirk Laurie wrote:
> I have the following perceptions:
>
> 1. LuaTeX is in stable release 0.60 but the developers don't really want
>     the public to write anything in it yet since a lot may change.

anyone might write anything in it as long as they keep in mind that they
have to adapt to changes; for instance, large parts of context mkiv are
written in lua and are being adapted / rewritten occasionally to keep in
pace with luatex; of course users of context pay the price there but so
far they're willing to update frequently

> 2. They therefore have on purpose not written any primer or anything
>     else that will make it attractive to non-geeks.

eh ... there is a manual in luatex that describes all functionality

for most users luatex is just another engine and if they use a macro
package they let the package writers deal with programming; if somewone
writes macros him/herself using luatex is not different from any other
tex: you have to play with it and spend time on it

talking of geeks ... it seems that you operate outside the tex community
as for the last couple of years the team has presented quite a lot on
user group meetings as well as in journals .. you can't expect us to do
more as we already spend quite some time on these matters

(as luatex development is closely related to context development it is
no surprise that much is written in that perspective; also, context
users write code in luatex so it's not that alien as you make in sound)

we do have plans for more written material but that will not happen
before 1.0

> 3. The MetaPost capability of lualatex sits entirely inside the Lua part.

no ... the mplib in luatex is the same as mplib in metapost; the only
difference is that there is a lua backend interface i.e. one can request
a lua representation and then can convert that to (say) pdf
... there is currently no lua extension interface (unlikely to happen
soon as there are other priorities in the mplib project)

> 4. You can get MetaPost capability inside LaTeX with \usepackage{luamplib},
>     which however is documented for other developers, not for users.

then complain to the latex developers ... metapost development is not
related to macro packages

> 5. luamplib.sty is fairly short and you can easily see the handful of
>     commands available.  Use at your own risk though.

no comment ... as it's a matter of the developers of that package

> I will like nothing more than to be told that these perceptions
> are out of date.

they are mostly wrong

> My own level of MetaPost expertise in LuaTeX has progressed to the
> point where I can insert the following code copied from
>      http://www.luatex.org/talks/print-plain-tug-2009.pdf,
> and am just clever enough to change the first and last lines
> to LaTeX usage:
>
> \begin{mplibcode}
> beginfig(1);
> draw fullcircle
> scaled 10cm
> withcolor red
> withpen pencircle xscaled 4mm yscaled 2mm rotated 30 ;
> endfig;
> \end{mplibcode}
>
> I then admire the nice big red circle which appears at just that point
> in the document.
>
> But I am not expert enough to figure out why the circle is not drawn
> with that pen, but with an ordinary pen of constant thickness.

I don't know either .. the plain example works ok on my machine so maybe
you use an old binary of old macros

luatex-plain.*
luatex-fonts.*
luatex-mplib.*

are shipped as part of the context distribution but what others do with
them cq. derive is out of our control (and support)

> I am in the process of improving my expertise through the tried and
> trusted scientific method of experimentation.  But a little advice
> (it does not need to be friendly advice) may come in handy.

that has is

- fetch the latest binaries from contextgarden.net or some other place

- when something does not work and you expect help from the developers,
best test if it works in context as that is our benchmark; installing
the minimal distribution helps as then one can process files like

\startTEXpage
some mp code
\stopTEXpage

using the 'context' command.

- if you use latex exclusively, try to get answers from its developers

Hans

-----------------------------------------------------------------