TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why do \message{\input|"texlua ..."} and \message{\input|"texlua ..." } give very different results? Notice the extra space before } in the second case.

Minimal example to be compiled with pdftex --shell-escape below.

% Create an empty file \jobname.lua
% Only difference between \A and \B: a trailing space.
% Set \everyeof to allow \input within \edef.
\edef\A{\input|"texlua \jobname.lua"}
\edef\B{\input|"texlua \jobname.lua" }
% Display the meanings in the terminal.
    \meaning\A % => macro:->Script file <jobname>.lua
    \meaning\B % => macro:->\par
share|improve this question
Maybe the " character is active here? Like it is when using [ngerman]{babel} for composing glyphs with a diaeresis ("aä). – Patrick Bergner Aug 2 '12 at 10:30
@PatrickBergner No, it's not that as if you have for example a letter after the closing " then all is fine. I think it's to do with the fact that TeX delimits file names with a space, but can't quite work out why that gives the behaviour seen. – Joseph Wright Aug 2 '12 at 11:24
hmm in an unmodified TL2012 (cygwin) I get $ luatex --shell-escape in This is LuaTeX, Version beta-0.70.2-2012062812 (TeX Live 2012) \write18 enabled. (./in.tex ! I can't find file `|texlua in.lua}'. – David Carlisle Aug 2 '12 at 11:45
@DavidCarlisle This syntax is only available in pdfTeX, as for LuaTeX you are supposed to use the Lua interface. (That is true for several pdfTeX primitives. See most obviously \pdfstrcmp.) – Joseph Wright Aug 2 '12 at 12:29
up vote 4 down vote accepted

I would say it is because the quotes are not argument braces, only quotes to guard e.g. spaces. If you run e.g. this:

\input "abc"d

\input "abc" d

You will get this error messages (assuming of course that the files don't exist):

! I can't find file `abcd'.
l.14 \input "abc"d


! I can't find file `abc'.
l.16 \input "abc" 

Also e.g. with xetex \XeTeXinputencoding "utf8"cde will lead to Unknown encoding utf8cde. You must use a space to actually end the input.

Addition after the discussion in the comments:

This means that the \edef\A case is processed probably along this lines: \edef\A{\input|"texlua \jobname.lua"}\relax => \edef\A{Script file <jobname>.lua>} not found => \A is Script file <jobname>.lua and not found is typeset.

share|improve this answer
I can see this argument, but shouldn't the space in Bruno's question terminate the 'filename', and leave \input with the same string to deal with. – Joseph Wright Aug 2 '12 at 12:37
Which space? In the case of \B the processing order is clear: The argument of \input is ended inside the braces. But in case of A things are more complicated. E.g. {\input|"texlua \jobname.lua"}abc leads for me (with --enable-pipes to this text in the pdf: Script le test-utf8.luaabc not found. Which shows that the \input looks behind the brace. – Ulrike Fischer Aug 2 '12 at 12:51
I think this only partially answers the question. If |texlua \jobname.lua} is taken as a file name, hence texlua \jobname.lua} is run in the command, how come texlua doesn't just return a "no such file" error? – Bruno Le Floch Aug 2 '12 at 12:55
Ah! I think your last comment leads to an explanation: {\input|"texlua foo.lua"}abc => texlua issues the error message Script file foo.lua}abc not found, so in TeX we have the equivalent of {Script file foo.lua}abc not found, which leads to your foo.luaabc output in the pdf, but in my case leads to putting a mysterious Script file foo.lua in \A and typesets abc not found. – Bruno Le Floch Aug 2 '12 at 13:00
@UlrikeFischer I think the rest is simply left in the input stream after the \edef ends, and is typeset. So \edef\A{\input|"texlua \jobname.lua"}\relax => \edef\A{Script file <jobname>.lua>} not found => \A is Script file and not found is typeset. Can you add something along those lines to your answer, should I, or should I add a separate answer? – Bruno Le Floch Aug 2 '12 at 13:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.