# [metapost] Metafun + plainLuaTeX/LuaLaTeX

Arno Trautmann Arno.Trautmann at gmx.de
Sun Jul 31 21:48:10 CEST 2011

Hi Hans,

Hans Hagen wrote:
> On 31-7-2011 12:03, Arno Trautmann wrote:
>> Hi all,
>>
>> maybe this question is a really stupid one, but I hope someone of you
>> can help me: I'd like to learn MetaFun; however, I don't want to use it
>> with ConTeXt, but with plainLuaTeX or LuaLaTeX, using LuaTeXs mplib. As
>> far as I understood, MetaFun is a format for MetaPost and therefore I
>> thought it should be independent of the TeX format used – is this true?
>> Or does ConTeXt offer additional stuff on format level that are
>> necessary for using MetaFun?
>> Finally, if one can use MetaFun with plainLuaTeX – how to do so on a
>> (Linux x86_64) TeX live 2011? In TeX live 2010, I find the file
>> metafun.mp from which I guess it is the format for MetaPost.
>>
>> As you see, I have basically no idea what I need in order to get MetaFun
>> working – I'll be very thankful for any hints where to start …
>
> Quite some of the metafun macros are generic but there are also a couple
> of extensions that work only with ConTeXt and some even only with
> ConTeXt mkiv (the luatex version). Of course I could make most generic
> but it's not worth the trouble and it would cripple further development.

May I ask why MetaFun depends on ConTeXt? In my simple world, MetaFun is
just a collection of macros for MetaPost, so I don't see where the TeX
format comes in.

> However, you can make independent metafun graphics as follows. Make a
> file, say test.tex:
>
> \startTEXpage
> metafun code
> \stopTEXpage
>
> Then run
>
> context test.tex
>
> and you will get a graphic that you can include in whatever tex macro
> package. So, you only need to know two context commands.

That would be applicable in, say, a private document. However, I'd like
to use it in a package, so in the end the user should only need to say a
TeX command and it should result in a MetaPost graphic. And this should
be independent of the TeX format and not require an extra context run
(as this would need shell-escape).
So from your answer I conclude that an extra context run is the best
way; however, is there another way for me, even if some macro are
missing then?

cheers
Arno