[luatex] multiple callbacks

Hans Hagen pragma at wxs.nl
Sun Jan 4 16:48:05 CET 2009

Elie Roux wrote:

 > I'm not asking to modify the luatex kernel, I'm just asking for
 > small lua function that everyone could use as a convenience. It
 > would not solve all the problems of priority, but it would make
 > every package maker use the same function to register their
 > callback.


> I agree. In fact I don't see the problems with ConTeXt, LaTeX, plainTeX, 
> etc. it would just be a function provided by a lua file distributed with 
> LuaTeX... I must admit I don't know the exact structure of LuaTeX, so 
> maybe there are problems, but if there are, can you explain them?

The main problem that I see is that one can never be sure if some style 
overloads the callbacks again. Ok, a macro package can overload 
callback.register to intercept this.

I think that the problem is similar to writing a package that does 
something with color: the package then has to recognize what macro 
package it is used in and set up things accordingly (tikz does this). A; 
As a style writer you then can demand from the macro package kernel 
writers some proper hooks and these can be different for context, latex, 
plain etc. Hooks are the only way to prevent interference.

It also depends on the kind of node processing that takes place, for 
instance do you want to intervene before or after hyphenation, before or 
after font related processing. In some cases it might even be possible 
(prefered) to use mechanisms provided by the macro package which might 
save redundant code and/or be faster due to optimizations in the code 
that comes with macro packages. And of course it might make a difference 
in what callback the code is hooked.

I think that for each macro package it will take some time before it is 
clear how they deal with this, so early adopters like you might 
influence the packge writers (to provide hooks for instance) as well as 
have to be prepared to adapt some code once it is clear how the kernels 
deal with this.


                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl

More information about the luatex mailing list