[NTG-context] Diagnositics in LuaTeX

Henri Menke henri at henrimenke.de
Mon Dec 28 15:54:31 CET 2020

Dear lists,

Recently I've been working a bit on PGF/TikZ and many times I wished I had
certain metrics that are available in regular programming languages.  In
particular I am missing:

- A callback that is triggered when a macro is defined.  This would allow me to
trap when a cs is defined in the wrong place.  That could probably be done by
overriding `\def` but there are some gotchas with prefixes, e.g. `\long\def`.

- A callback that is triggered when a token is expanded (or executed in the case
of primitives).  In conjunction with the previous request, this would allow me
to measure code coverage by comparing which macros are defined and which ones
are used.

- Switches to trap on certain pathological events.  For example I want to trap
when TeX inserts a frozen \relax because a number couldn't be read.  Another
thing I want to trap is `Missing character: There is no <char> in font <font>!`.
There are probably more silent TeX errors that I currently don't have in mind.

Are these things possible in LuaTeX right now or could they be made possible in
the future?

Kind regards,

More information about the ntg-context mailing list