On Tue, Sep 12, 2023 at 08:32:10AM +0000, Werner LEMBERG wrote: > > [texinfo.tex version 2023-08-13.14] > > > Please consider the attached files. If I say > > ``` > luatex foo.texinfo > ``` > > the `@tex` environment within this file works just fine, and file > `foo.lua` is correctly loaded. However, saying > > ``` > luatex bar.texinfo > ``` > > which includes file `bar.itexi`, I get an error: > > ``` > (./bar.itexi[\directlua]:1: ')' expected near '@'. > l.5 dofile(kpse.find_file("bar.lua")) } > ``` > > AFAICS, there is a problem with the handling of underscores in > included files that contain a `@tex` environment, having the wrong > catcode.
The problem appears only to occur when the @tex directive follows the "\input texinfo" line directly. The @include directive is a red herring: you get the same error if you remove the blank line after "\input texinfo" in foo.texinfo: \input texinfo @tex \ifx\luatexversion\thisisundefined \else \directlua{ dofile(kpse.find_file("foobar.lua")) } \fi @end tex foobar @bye It appears to be related to code to support Texinfo as a "pre-dumped" TeX format. I'm not aware if this is ever used, but this support was always present and previously relied on the presence of a "@setfilename" line before we made that command optional in Texinfo files. We try to run this code as soon as possible. I've made a change to support @tex (and other block commands) on the second line of the input file (version 2023-09-12.17). Please let me know if it works.