[luatex] multiple callbacks

Hans Hagen pragma at wxs.nl
Sun Jan 4 16:12:33 CET 2009

Elie Roux wrote:
> Hello,
> As a LuaTeX style developer (Gregorio : http://home.gna.org/gregorio/), 
> I'm confronted with one issue to which I don't see any solution now : 
> multiple callbacks. I personally register one callback in 
> post_linebreak_filter, that affects only lines with a certain attribute, 
> so it would be compatible with callbacks registered by other styles.  
> Currently no other style can register another callback without breaking 
> mine, which is I think a strong limitation. To fix it I was thinking 
> about a small lua function:
> callback.add (callback_name, callback_func, priority)
> that would add callback_func to a list of function, keeping an ascending 
> order of priority in this list. Then it would register a callback 
> function that would call all the functions in the order of the list. 
> With these priorities, style developers could agree on the order their 
> callbacks should be called in.
> I'm not defending this option strongly, but I think it's a simple one, 
> and I think it would work.
> What do you think about that?

the proeblem with such solutions is that even then style developers 
would run into problems due to priorities; also, it add overhead and 
complications that we'd like to avoid (one would need remove code etc too)

a solution can best be created at the macro package level (and each one 
will do it differently i suppose)

some_callback_table = { }

function some_callback(head,...)
   for k,v in ipairs(t) do
      head = some_callback_table(head,...)
   return head


for latex one should implement such a wrapper and probvide it as a 
module in which other style writers can hook in code



                                           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