Hans Hagen schrieb: > glue to tex: > > \def\includeMetaPost#1#2% io.loaddata is part of l-io.lua > {\directlua0{tex.print(filterfromMPblob(io.loaddata("#1",#2)))}} > > of course this need to be embeded in some general mp support > > (i'll add it to my todolist; actually a bit more is involved since one > probably wants to include the data between the figures too since it may > be called upon)
Thank you for the outline. For the exact mechanism of how to process an .mp file I think there are three possible cases: 1. Strictly process what's between figure(n)..endfig only. For this example pair pnt; pnt:=origin; beginfig(1); pnt:=(100,100); drawdot pnt; endfig; beginfig(2); drawdot pnt; endfig; end compilation of figure 2 should fail, since variable pnt is undeclared. 2. Process everything up-to the specified figure, omitting stuff inside non-matching figure numbers. In the example above, the output of figure 2 should be a dot at point (0,0). This case is convenient if multiple figures share common variables or macros that are defined outside the scope of beginfig..endfig. This should be the default case for .mp file interpretation. 3. Process everything up-to the specified figure, including all non-matching figures, but discard their output. That is, in the example, the output of figure 2 should be a dot at point (100,100), since pnt was modified in figure 1. Note, this is not a pressing feature for me. The advantage is that MetaPost and TeX code can be held in separate files (which has several advantages) and users can easily compile the code in a single TeX run, without knowing about Makefiles. Well, there is the \write18 feature. But that is as difficult to use as a Makefile or even more difficult for the inexperienced user. Best regards, Stephan Hennig ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________