12

The solution in Multiple PDF generation with one tex file worked with TeXLive 2015 and is now broken in TeXLive 2016, at least on OS X El Capitan.

Minimal Example:

\documentclass{article}
\ifx\conditionmacro\undefined
\immediate\write18{%
  lualatex --synctex=1 -interaction=nonstopmode -shell-escape --jobname="\jobname"
  "\gdef\string\conditionmacro{1}\string\input\space\jobname"
}%
\expandafter\stop
\fi
\begin{document}
asdf
\end{document}

Result with TeXLive 2015:

Running `LaTeX' on `mini' with ``lualatex --jobname=mini  -file-line-error -shell-escape --synctex=1 -interaction=nonstopmode "\input" mini.tex''
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) 
 \write18 enabled.
LaTeX2e <2016/03/31>
Babel <3.9q> and hyphenation patterns for 1 language(s) loaded.
(./mini.tex (/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) 
 \write18 enabled.
LaTeX2e <2016/03/31>
Babel <3.9q> and hyphenation patterns for 1 language(s) loaded.
(./mini.tex (/usr/local/texlive/2015/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2015/texmf-dist/tex/latex/base/size10.clo))
No file mini.aux.
[1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./mini.aux))
 264 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 40 glue_spec, 1 write nodes
   avail lists: 2:12,3:3,4:22,6:11,7:1,9:6
<</usr/local/texlive/2015/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on mini.pdf (1 page, 10762 bytes).

SyncTeX written on mini.synctex.gz.Transcript written on mini.log.
)
 262 words of node memory still in use:
   2 hlist, 1 vlist, 1 rule, 2 glue, 39 glue_spec, 2 write nodes
   avail lists: 2:12,3:1,6:3,9:1
No pages of output.
Transcript written on mini.log.

TeX Output finished at Mon Jun 13 14:32:07

Result in TeXLive 2016:

Running `LaTeX' on `mini' with ``lualatex --jobname=mini  -file-line-error -shell-escape --synctex=1 -interaction=nonstopmode "\input" mini.tex''
This is LuaTeX, Version 0.95.0 (TeX Live 2016) 
 system commands enabled.
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 1 language(s) loaded.
(./mini.tex (/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo))
lualatex --synctex=1 -interaction=nonstopmode -shell-escape --jobname="mini" "\gdef \conditionmacro{1}\input mini" 
)
 347 words of node memory still in use:
2 hlist, 1 vlist, 1 rule, 6 glue, 40 glue_spec, 2 write nodes
avail lists: 2:12,3:1,4:1,5:2,7:1,9:1

warning  (pdf backend): no pages of output.
Transcript written on mini.log.

TeX Output finished at Mon Jun 13 14:20:51

Any hints how one can get it running in TeXLive 2016?

  • As I look at the log: --shell-escape seems not to enable \write18 anymore – Zoltán Jun 13 '16 at 12:45
  • In order to use shell-escape, you will need the shellesc package: tex.stackexchange.com/questions/313693/… – 804b18f832fb419fb142 Jun 13 '16 at 12:45
  • @AlexanderWilms better to say in order to use \write18 you need that package (--shell-escape still enables/disables os.execute as it did before) – David Carlisle Jun 13 '16 at 12:55
  • Thanks for clarifying, I didn't know the difference – 804b18f832fb419fb142 Jun 13 '16 at 12:56
19

\write18 no longer means execute system commands in luatex.

add

\usepackage{shellesc}

to re-enable it.

That package will also allow the clearer syntax

\ShellEscape{...} 

instead of

\write18{...}

or since you are writing code specifically for luatex you could avoid using shellesc and use

\directlua{os.execute("\luaescapestring{...}")}

which would work in old or new luatex.

  • 1
    @Zoltán Please accept the answer, click on the hook. (Is it a »hook« in English?) – Keks Dose Jun 13 '16 at 13:29
  • 1
    @KeksDose do you mean the \checkmark? ;) – Hirshy Jun 13 '16 at 15:26
  • 1
    @KeksDose I'd call it a 'tick'. I don't think Americans say that though. – cfr Jun 16 '16 at 0:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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