0

Does anybody know how to enable first line parsing in LuaTeX/LuaLaTeX? Please consider that I cannot change the default command line option to run the job, so I'm relying solely on this first line syntax in my source tex file:

%&mylualatex
\documentclass{...}

But it didn't work. My custom (pre-built) format never loads. As usual, issuing:

> lualatex "&mylualatex.fmt" "fmt-test.tex"

did work. But I can't rely on this method in my remote (web) environment. I'm using texlive 2021 and help output from the lualatex command reads:

Usage: luahbtex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]
   or: luahbtex --lua=FILE [OPTION]... \FIRST-LINE

But the second line above means nothing to me.

bgeneto
  • 175
  • 3
    LuaTeX doesn't seem to support that syntax... – Phelype Oleinik Nov 09 '21 at 22:49
  • Googling for this comes up with a post from... me to my surprise.... https://tug.org/pipermail/luatex/2015-August/005327.html – David Carlisle Nov 09 '21 at 23:46
  • @DavidCarlisle Though I think Luigi's suggestion of using os.execute doesn't work here either, because it needs shell-escape... – Phelype Oleinik Nov 10 '21 at 12:49
  • That's really unfortunate... Maybe it imposes a security issue with LuaTeX, because it is so easy to implement. Can I use \input somehow to include my custom format fmt file? – bgeneto Nov 10 '21 at 13:57
  • @bgeneto No, a fmt file is read at a much lower level by the engine. I'm not sure what you want can actually be done. But is running a custom format worth the hassle? – Phelype Oleinik Nov 10 '21 at 14:22
  • 1
    if your web framework can run a controlling script such as latexmk or arara rather than call lualatex directly then you can use magic comments in the file to customise the luatex commandline and pass in the format name. (@PhelypeOleinik don't tell Paulo I recommended arara) – David Carlisle Nov 10 '21 at 14:40
  • @PhelypeOleinik if I remember correctly early versions of luatex didn't restrict os.execute so shell-escape was a bit pointless as it only controlled calling from tex but that got fixed. – David Carlisle Nov 10 '21 at 14:43
  • @DavidCarlisle Your secret is safe ;-) – Phelype Oleinik Nov 10 '21 at 14:44

0 Answers0