[Dev-luatex] dofile, require and kpathsea

Jonathan Sauer Jonathan.Sauer at silverstroke.com
Wed Aug 22 09:27:25 CEST 2007


Hello,

> [...]
> "dofile" etc will not be adapted to kpse based loading since 
> in principle this is pure lua, but you can easily write a 
> wrapper, say "doluatexfile" that first locates the file 
> (using kpse) and then does it.

I disagree about this being the correct way: IMO, TeX uses some kind
of virtual file system: All files, as far as TeX The Program is
concerned, are in the same directory, and kpathsea is simply a
way of mapping real directories onto this virtual one. When I
say "\input myfile", TeX simply tries to open this file by calling
a system-specific routine -- in web2c one that first uses kpathsea
to resolve the real file name and path, in OzTeX one which uses a
config file directly etc.

You can "escape" this virtual file system by specifying a full
path name, or partially by specifying a partial path name (IIRC,
I am not quite sure if the latter is correct).

Still, normally you are inside the virtual file system TeX uses
to find and read files -- all files, .tex files as well as fonts,
graphics etc. Now, Lua resides inside TeX, and therefore I think
it should use this same virtual file system when accessing files,
meaning kpathsea. Otherwise, two parts of LuaTeX behave
differently.

So IMO changing dofile to use kpathsea would not change its "pure
Lua" status, but simply adapt it to the host environment.


Jonathan



More information about the dev-luatex mailing list