[luatex] lualatex cannot process paths containing a tilde (~) correctly

Matthias Deeg mail at md.sy.gs
Thu Nov 26 12:28:57 CET 2020

TEXNAME comes from the lualatex or luahbtex help and had in my examples
the following values:


The beginning of the lualatex help text on my system is as follows:

$ lualatex --help
Usage: luahbtex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]
   or: luahbtex --lua=FILE [OPTION]... \FIRST-LINE
   or: luahbtex --lua=FILE [OPTION]... &FMT ARGS
  Run LuaHBTeX on TEXNAME, usually creating TEXNAME.pdf.
  Any remaining COMMANDS are processed as luatex input, after TEXNAME is

  Alternatively, if the first non-option argument begins with a backslash,
  luahbtex interprets all non-option arguments as an input line.

  Alternatively, if the first non-option argument begins with a &, the
  next word is taken as the FMT to read, overriding all else.  Any
  remaining arguments are processed as above.

  If no arguments or options are specified, prompt for input.

Maybe I'm just understanding the [[TEXNAME[.tex]] part of the help
wrong. And according to the help text, the first non-option argument can
have different meanings. But I don't see why lualatex/luahbtex would try
to interpret a path argument (TEXNAME) as valid TeX code. I expect
lualatex/luahbtex to interpret the file content of the provided TeX file
as TeX when the TEXNAME argument is actually an existing file in the
file system.

On 26.11.20 12:02, Philip Taylor wrote:
> Now I am confused, Matthias — where does "TEXNAME" come into it ?  In
> your example, there was no instance of "TEXNAME" but rather a direct use
> of the tilde :
>> $ lualatex "/home/matt/reports/test~report/report.tex"
> Are you now saying that that was not the actual test, but that what you
> actually wrote was :
>> $ lualatex TEXNAME
> where "TEXNAME" was an logical name, environment variable, or similar ?
> Anyhow, regardless of whether or not the tilde was explicit or implicit,
> it will be processed by TeX, and will therefore be subject to expansion. 
> Consider this from another perspective — if you were to write :
>> $ tex \expandafter \def \csname my:file\endcsname {Source.tex}\input
>> \csname my:file\endcsname
> you would expect TeX to try to open a file "Source.tex", would you not
> ?  And indeed it does :
>> This is TeX, Version 3.14159265 (TeX Live 2020/W32TeX) (preloaded
>> format=tex)
>> *\end
>> ! I can't find file `Source.tex'.
>> <to be read again>
>>                    \end
>> <*> \end
>> (Press Enter to retry, or Control-Z to exit)
>> Please type another input file name:
> Thus /everything/ that follows the imperative "tex" at the command
> prompt is interpreted as TeX source, and is not interpreted specially
> just because it /might/ be a file name.
> /Philip Taylor/

More information about the luatex mailing list.