[luatex] parsing the first line of a file for format name

luigi scarso luigi.scarso at gmail.com
Wed Aug 26 20:02:14 CEST 2015


On Sat, Jul 25, 2015 at 7:12 PM, David Carlisle <d.p.carlisle at gmail.com>
wrote:

> If you process the  following with (plain) pdftex
>
> %&pdflatex
>
> \stop
>
> then you get
>
> This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015)
> (preloaded format=pdflatex)
>
>
> showing that the first line comment has been read to load pdflatex.fmt
>
> The analogous file for (plain) luatex
>
> %&lualatex
>
> \stop
>
>
>
> produces
>
> This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238)
>  restricted \write18 enabled.
> (./xx.tex
> ! Undefined control sequence.
> l.3 \stop
>
> showing that the file is being processed by plain.
>
> luatex --help  and page 30 of the (0.80) manual indicate that there are
>   --(no-)parse-first-line command line options which at least implies
> that the web2c style first line parsing should be active?
>
> If it isn't intended to work could those options be removed thanks, also
> in that case is it possible to do a similar thing from lua at the top
> of the file?
>
> (no-)parse-first-line are recognized but currently do nothing, apart a
message on the log.
I will fix the  manual.

One can use the lua interpreter in this way:

-- myscript.lua
print("arg[1]=",arg[1])
print("arg[2]=",arg[2])
print("arg[3]=",arg[3])


$> luatex --luaonly myscript.lua -i latex test.tex

that gives

arg[1]= -i
arg[2]= latex
arg[3]= test.tex

(note that  the standard lua options are not recognized as such)
Of course in you case the script can parse the first line of test.tex and
eventually run luatex with the right
options (i.e. luatex --fmt=lualatex test.tex) with os.execute .

-- 
luigi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/luatex/attachments/20150826/0e2a32c3/attachment.html>


More information about the luatex mailing list