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

I am trying to use TikzEdt, an editor for TikZ graphics. For some tasks TikZ needs to call other commands so I tried to enable this by the parameter --shell-escape passed to lualatex (on Windows, MiKTeX 2.9). Strangely this fails to enable the feature. After some fiddling around it turns out that it even fails with this MWE:


    \write18{echo SHELL ENABLED}

TikzEdt appends the switch and calls lualatex test.tex --shell-escape which does not seem to work. The same command with pdflatex works nicely. It turns out that other than in pdflatex the order of arguments seem to play a role in lualatex, lualatex --shell-escape test.tex runs nicely. Unfortunately TikzEdt only allows to append switches not insert switches. Is this a bug in lualatex or is TikzEdt using a wrong assumption?

share|improve this question
If I'm not mistaken, everything that goes after the filename is treated as a command. As the --help flag gives us the hint, "Any remaining COMMANDS are processed as pdfTeX input, after TEXNAME is read. If the first line of TEXNAME is %&FMT, and FMT is an existing .fmt file, use it. Else use NAME.fmt, where NAME is the program invocation name, most commonly pdftex." – Paulo Cereda Feb 4 '13 at 13:42
By the way, my test was consistent here with both pdflatex and lualatex (I got the same results), so flags really should come before the filename. :) – Paulo Cereda Feb 4 '13 at 13:43
Probably it is another MiKTeX feature; commandline parsing is not done by support code from the Web2c system (and its equivalent in MiKTeX), except probably for LuaTeX. – Khaled Hosny Feb 4 '13 at 14:21
up vote 7 down vote accepted

Let's try a simple document test.tex; the package pdftexcmds is loaded in order to have \pdf@shellescape available with all engines.



Here's what happens with

  • pdflatex test
  • pdflatex test --shell-escape
  • lualatex test
  • lualatex test --shell-escape
  • xelatex test
  • xelatex test --shell-escape

The execution stops because of \showthe, showing

> 2.
l.5 \showthe\count@

in all six invocations (TeX Live 2012 on Mac OS X, but I don't think it's different with other platforms).

If we put --shell-escape at its proper place, the execution of any of

  • pdflatex --shell-escape test
  • lualatex --shell-escape test
  • xelatex --shell-escape test

stops showing

> 1.
l.5 \showthe\count@

This means that the setting of --shell-escape can be done only in "infix notation" and that the option has no effect if postfixed.

As kindly as usual, Paulo Cereda confirms that, on MiKTeX, options can be specified after the file name for pdftex and xetex, but not for luatex. As the most common syntax format on other systems is with "infix" options, my opinion is that TikZEdt is wrong in its assumptions.

share|improve this answer
Hmm, this seems to be different here. Your example document stops and shows \showthe\count@ with both, lualatex --shell-escape example and pdflatex --shell-escape example on MikTeX 2.9. I really dislike these strange incompatibilities. – Alexander Feb 4 '13 at 14:35
@Alexander My opinion is that it's best to stick to the most common "cross platform" way of doing things. For instance, MiKTeX adopted --shell-escape after having used --enable-write18 for some years. – egreg Feb 4 '13 at 14:42
Yes egreg, I absolutely agree. I looked up the POSIX guidelines and they state that option processing stops after the first command, so according to what you observe. – Alexander Feb 4 '13 at 15:03
@mafp Yes. I should've made it clearer. – egreg Feb 4 '13 at 15:07

the syntax of luatex (lualatex) is

Usage: luatex --lua=FILE [OPTION]... [TEXNAME[.tex]] [COMMANDS]
   or: luatex --lua=FILE [OPTION]... \FIRST-LINE
   or: luatex --lua=FILE [OPTION]... &FMT ARGS

--shell-escape is an option the reason why it must be before the TEXNAME[.tex]

share|improve this answer

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.