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?

Zoltán
  • 183

1 Answers1

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.

David Carlisle
  • 757,742