[luatex] On category code tables

Joseph Wright joseph.wright at morningstar2.co.uk
Sat Jul 10 20:59:34 CEST 2010


Hello all,

I'm taking a look at the category code table primitives provided by 
LuaTeX (\completable, \initcatcodetable and \savecatcodetable). I'm not 
entirely clear on a few things.

I'd initially imagined when I first saw about category code tables that 
you'd be able to set up a table then use it to reset a large number of 
category codes in one go. However, I pick up from

   http://tug.org/mailman/htdig/luatex/2010-March/001389.html

that if I have something like

   \catcodetable<number>\relax
   \catcode<char> <code>\relax

then the category code change will become part of the table in force, 
i.e. without an explicit \savecatcodetable<number> instruction. At the 
same time, there does not seem to be a way to copy category codes from 
one table to another. So how do I achieve:

   \savecatcodetable<number>\relax % Fixed table of codes
   \catcode<x> <y>
   ...
   \catcodetable<number>

such that I can treat category code table <number> as a fixed set of 
category codes that will never be accidentally altered? This also seems 
to be an issue in that

   \catcodetable<number>\relax
   \catcode<x> <y>
   \catcodetable<number>\relax

doesn't reset the code for <x>. I must be missing something, as this 
otherwise undermines the entire point, as far as I can see.

At the same time, I don't see how I know which tables I can safely use. 
In a LaTeX2e situation other packages might have already set up tables 
for their own use. So to 'play nicely' I need to find out which tables 
are free before I do \savecatcodetable and potentially trash someone 
else's work?

(The context here is the LaTeX3 \ExplSyntax stack. It would be nice to 
take advantage of LuaTeX, when available, and exploit category code 
tables. However, first I need to understand how they work.)
-- 
Joseph Wright


More information about the luatex mailing list