[Dev-luatex] Snapshot 20060908

Taco Hoekwater taco at elvenkind.com
Fri Sep 8 17:45:31 CEST 2006

Hi again,

Another friday, another snapshot!

While last Wednesday's snapshot was more of a bugfix release,
this one adds some extra features.

* BIG CHANGE: \directlua now runs \scantokens internally.

   There is no longer a need to call scantokens yourself, the
   tex.print() output is now fed straight into a pseudo file.
   This is quite a bit faster as well as easier to use, but
   just in case you want it, the old behaviour is still present,
   under the new name


* The texio library now has its own (partial) set of I/O commands,
   so that the standard lua io library is back to the distributed
   state (no more patched garbage collector)

   Note: This is really a very small change (it should not have any
   impact on wellbehaved input files), but I attempt to be complete
   in these notes, since there is no official documentation yet.

* There is a new standard library available: kpse

   The most important function in that library is find_file:

     string = kpse.find_file(string filename
                             [,string type]
                             [,boolean mustexist])

   both "type" and "mustexist" are optional, so the function
   has from one upto three arguments.

   "type" is like the '-format' argument of kpsewhich. You can
      run 'kpsewich -h'  for a list. The default type is "tex".

   "mustexist" is like '-must-exist', and the default  is false.
      If you specify "true" (or a nonzero integer), then the kpse
      library will search the disk as well as the ls-R databases

   The new library also has three other functions that map
   straight to kpsewhich commandline options:

     string = kpse.expand_path(string)
     string = kpse.expand_var(string)
     string = kpse.expand_braces(string)

* There is a second callback possibility:

     texio.show_error_hook(string message,
                           string|number indicator,
                           number lineno)

   This command is run from inside the TeX error function, and the
   idea is to allow you to do some extra reporting on top of what
   TeX already does (none of the normal actions are removed).

   "message" is the formal error message tex has given to the
      user (the line after the "! ")
   "indicator" is either a filename (when it is a string) or a
      location indicator (a number) that can means lots of different
      things like a token list id or a \read number.
   "lineno"  is the current line number

   This is an investigative item only, comments are welcome but do
   not take the syntax seriously.

   The final goal IMO is the total replacement of TeX's error
   handling routines, but that needs lots of adjustments
   in the web source because TeX deals with errors in a somewhat
   haphazard fashion (it needs unification first). The current
   hook is only for 'testing the water'.

* It is now possible to use named items in the


   subtables, so you can have

	tex.count.scratchcounter = 0
         local enormous = tex.dimen["maxdimen"]

   Luatex looks up the value for you on the fly. You have to use a
   valid \countdef (or \dimendef, or \toksdef), anything else will
   generate an error.

   In a normal TeX file, you don't do \dimen\maxdimen, but the
   lua syntax seems to be a bit cleaner to me. The intention is
   to evntually also allow \chardefs and macros that expand
   into a number (todo)

* The tex table has also been extended with a large list of internal
   parameters (partially read/write). It is possible to access
   about every primitive that you can use after \the *and* is a
   single token. So there is

        integer   = tex.tracingcommands (\the\tracingcommands)
        integer   = tex.prevgraf        (\the\prevgraf)
        string    = tex.output          (\the\output)

   etc. for all of the internal parameters, but not the items
   that need extra arguments (like \the\scriptfont )

   The subset comprising simple integer and dimension registers
   are writable as well as readable (stuff like \tracingcommands
   and \parindent).

   The fact that both lists are still quite limited is a result of
   the very different types of things that can occur after \the and
   also on the LHS of an assignment. The remaining primitives will
   be filled in when there is a real need or implementation becomes
   simple, whichever comes first.

Have fun, Taco


Downloading and installation details:

If you go to


you will see that there are two released files:

* luatex-snapshot-20060908.tar.gz
      This is the source tree.

* luatex-snapshot-20060908-win32.zip
      A cross-compiled (mingw) windows binary. This is a web2c
      based binary, so it needs a texmf.cnf file (It will NOT
      work if you have only miktex installed).

      This executable cannot run dynamically loaded lua dlls. Perhaps
      that can be fixed but I do not know how.

More information about the dev-luatex mailing list