[luatex] invoking a lua script in TeX

Taco Hoekwater taco at elvenkind.com
Tue Apr 12 09:24:56 CEST 2011


On 04/12/2011 01:33 AM, Bob Tennent wrote:
> musixflx.lua is the script I hope can be invoked from within a TeX
> macro package after generation of the .mx1 file; then, I would want to
> re-invoke TeX from the Lua script after generation of the .mx2 file.
> It might be possible and/or desirable not to have to use auxiliary files
> basename.mx1 and basename.mx2, but I would consider that a refinement
> that could be deferred if it is problematic.

That would mean that musixflx.lua needs some small adjustments. A 
function that takes an input string and returns an output string instead 
of writing to a file is needed. But that is not a hard change in itself, 
so there is no need to worry about that right away.

If you want to do all the processing in one pass, then basically each 
\endmusic has to 'everything': it has to create a full .mx1 file, make 
musixflx process that file, and read the .mx2 file to feed it back to 
luatex. You have to do the musixflx processing in snippets since 
otherwise the .mx1 file will not be finished until the end of the run, 
and at that stage a second tex pass is definitely required (since it is 
impossible to change already generated pages).

You will need some support from musixtex itself, as one has to make sure 
that each of the snippets uses the right global settings. Also, if 
musixflx does any document-wide optimizations, this functionality will 
be lost if you want a single pass.

Best wishes,

More information about the luatex mailing list