[luatex] questions about the "reader" in open_read_file callback

Ulrike Fischer luatex at nililand.de
Wed Nov 17 17:39:31 CET 2010

Am Tue, 16 Nov 2010 18:06:26 +0100 schrieb Manuel Pégourié-Gonnard:

> Le 16/11/2010 15:48, Ulrike Fischer a écrit :
>> 1. Does that mean that each file has its own "reader" instance? Or
>> is there some scoping involved? 
> Each file *has* to have its own reader, since the reader needs to keep track of,
> eg, the current line of the file.

Makes sense (and I don't complain, it makes things much easier)

>> 2. Currently my code affects only files input later. How could I
>> change the processing of (only) the main document? 
> I'm under the impression the only way to specify a reader for the main file is
> to install a function in the open_read_file callback before the main file is
> opened, which may be tricky.
> You could use process_input_buffer to transcode the individual lines of the main
> file (as luainputenc does), but it doesn't have the nice feature of being
> file-specific.

Well one could perhaps reset the callback at \input/end-of-file, but
it doesn't feel right to use this callback. At least not when more
than one encoding is involved. In such cases files should declare
their encoding and this declaration should be used. 

On-the-whole I think the initialization script is the correct place.
There is only the problem that it isn't found which kpathsea. One
has to set the environment variable LUATEXDIR. Has this variable in
TeXLive a standard value? 

And if I register a callback in the script with callback.register
will this give trouble with the callback code in luatexbase?  

Ulrike Fischer 

More information about the luatex mailing list