[luatex] another mlist callback
Paul Isambert
zappathustra at free.fr
Tue Oct 11 10:32:33 CEST 2011
Le 11/10/2011 02:13, Frank Kuehnel a écrit :
> I recently started playing with LuaTex to see whether it is suitable for addressing the following problem:
>
> For every math formula in a document I'd like to generate an equivalent content MathML expression and write
> it out into a separate file. Content MathML doesn't require any style elements.
>
> I thought the mlist_hlist callback function may be suitable for this task. However, I couldn't find any suitable
> examples on how to use the mlist_to_hlist callback. I also looked briefly into the code base: "texmath.w".
>
> Here, it seems like that the after_math function could neatly implement another mlist related callback, right after
> the call to the fin_mlist routine (line 2249). The proposed callback function would take an mlist as the argument and return
> either the same mlist or a modified mlist, which would then be processed into an hlist.
>
> I just put out this idea for discussion to see whether somebody else has a better idea?
You can do that directly in mlist_to_hlist, which should host a function
that does what is described in Appendix G of the TeXbook -- so, no small
task, but fortunately the function already exists in LuaTeX:
node.mlist_to_hlist. So you can do whatever you want to your mlist and
then pass it to node.mlist_to_hlist and return the result.
I hope this answer your question. I'll admit I didn't see the necessity
of a new callback here.
Best,
Paul
More information about the luatex
mailing list