[luatex] Cannot register callback in \everymath

Henri Menke henrimenke at gmail.com
Thu Apr 19 23:49:01 CEST 2018

Dear list,

It seems as if callbacks are not registered if I'm doing it inside \everymath.
The idea is to have a callback in "process_input_buffer", which only acts in
math mode.  To have that semi-automatically, I wanted to register it in
\everymath and deregister after math mode using \aftergroup.  However, the
callback is simply ignored in that constellation.  MWE is below.

Cheers, Henri


function smartlig ( s )
    s = s:gsub ( "%->", "\\rightarrow " )
    s = s:gsub ( "<%-", "\\leftarrow " )
  return s

\def\SmartligOn{\directlua{callback.register("process_input_buffer", smartlig)}}
\def\SmartligOff{\directlua{callback.register("process_input_buffer", false)}}


$a->b$, $c<-d$

$a->b$, $c<-d$

$a->b$, $c<-d$

More information about the luatex mailing list