[luatex] insert a string into node list?

Taco Hoekwater taco at elvenkind.com
Thu Jul 14 17:09:20 CEST 2011

On 07/14/2011 03:23 PM, Arno Trautmann wrote:

> • Second, I'd like to print out the name of every defined
> macro/primitive, i.e. I imagine a list with every character combination
> after a \ that does not throw a undefd control sequence-error.
> Why? Just because I wanted to know if it's possible … and if it is
> possible at all, the odds are best with LuaTeX.

Web2c used to / still has some possibilities to debug the format,
but I have forgotten what it was, sorry.

And no, this is not yet possible with luatex (it will be, eventually,
but not yet).

> Also, I'd like to
> understand how macros are stored internally – but for that I have to
> read some source code, I guess …

There is no way around that. In fact, if you cannot read the source
code, I doubt I would be able to explain to you clearly how it works
in prose, with a reasonable level of detail.

Real quick and rough: a macro body is stored just like a token list
for the toks registers (\toks0 c.s.) except that a few special tokens
are possible that cannot occur inside registers: two types are markers
for arguments, if any, and also a special token that marks the end of
the argument part. The internal token storage of \def\a#1{(#1)} is
5 tokens:

   <match 1>
   <letter (>
   <out_param 1>
   <letter )>

And it is stored in an array together with all other definitions and
commands. Its index in that array is the hash checksum result of 'a'
(the control sequence name without backslash).

Best wishes,

More information about the luatex mailing list