# [luatex] macros to invoke lua in LaTeX

Hans Hagen pragma at wxs.nl
Fri Mar 6 08:48:49 CET 2009

```> There are quite some applications in LaTeX, that are based on
> the possibility to redefine a primitive command, e.g.
> \shipout is redefined in various packages (atbegshi, everyshi,
> pdftex.def for background color, ...).
>   Another application is debugging, e.g. \special is a candidate,
> that can be redefined to print its contents to the .log file
>   All these wouldn't be possible, if \(pdf)primitive was used.

i assume that if the core engine uses \primitive\shipout that it doe
with a purpose; actually the core should provide a proper way to
overload its behaviour then; i woul dnot be surprised that when packages
order, problems show up anyway

> As example, you got lucky with \formatname: LaTeX uses \fmtname,
> quite close already, I would say.

normally when choosing a new name, a scan on the tex live tree is done

> The point is that there is software written at a time with
> a known set of command names from the engines.
> Now the engines evolve further and introduces new command names.
> This can lead to name clashes, because the engine developer
> cannot know all software that is based on the engine to avoid them.
> Prefixing helps to reduce the probability of such name clashes.
> With reserved prefixes they can even be avoided.

\let\reservedlatexprefixsomethingnew=\somethingnew

or even \luatexprimitivesomethingnew=\somethingnew if it wants.

this can be done even for older ones; that keeps the engine clean and
puts the burden on the macro package (as it should)

Hans

-----------------------------------------------------------------