[luatex] questions about the "reader" in open_read_file callback
Manuel Pégourié-Gonnard
mpg at elzevir.fr
Wed Nov 17 18:34:26 CET 2010
Le 17/11/2010 17:39, Ulrike Fischer a écrit :
> Am Tue, 16 Nov 2010 18:06:26 +0100 schrieb Manuel Pégourié-Gonnard:
>
>> 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.
>
I fully agree.
> 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?
>
Nope. But, afaiu, this variable is only a path, not a set of path for searching.
I mean, it seems to me that
LUATEXDIR=/some/path luatex --lua=script
is equivalent to
luatex --lua=/some/path/script
> And if I register a callback in the script with callback.register
> will this give trouble with the callback code in luatexbase?
>
It will, if someone tries to add another function in this callback, i'm afraid
your function will be silently overridden. (I'll probably add a test so that at
least a warning is issued in this case.)
But you can perfectly do
kpse.set_program_name(arg[0])
require('luatexbase.mcb')
in your startup script and then use luatexbase to register your function in the
callback. (I think you need to explicitly initialise kpse in the startup script
if you want it to be used by require(), but Taco will correct me if I'm wrong.)
(This assumes a recent luatex, obviously.)
Manuel.
More information about the luatex
mailing list