26
votes
How to enable `shell escape' (or `write18') - Visual Studio Code (Latex Workshop extension)
I got it working by modifying latexmk task which seems to be invoked by default (auto-update on file edit).
See the LaTeX Workshop extension FAQ for more info.
Open settings.json (e.g. cmd/ctrl + ...
25
votes
How to have latexmk always use -shell-escape?
If you need to do this just once, run:
latexmk -e '$latex=q/latex %O -shell-escape %S/'
or
latexmk -e '$pdflatex=q/pdflatex %O -shell-escape %S/' -pdf
for PDF output.
If you want latexmk to ...
21
votes
Accepted
How can I enable shell-escape?
General information: what is shell escape?
A number of LaTeX packages need to use external tools to function. Such a tool is called from the LaTeX source code using a system command. However, by ...
Community wiki
20
votes
How should I have found out that LuaTeX removed \write18?
The manual of luatex mentions the change:
Also, we no longer support write18 because os.execute can do the same.
But I doubt very much that even if you had read this that you would have understand ...
19
votes
Accepted
Solution to 'Multiple PDF generation with one tex file' does not work anymore with TeXLive 2016
\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{.....
17
votes
Accepted
How to have latexmk always use -shell-escape?
You can pass the parameter directly to latexmk as such:
latexmk -shell-escape
This option is not mentioned in the manpage. The manpage suggests the -e option which is also used in the first answer. ...
14
votes
Custom Build Settings in Sublime
What worked for me was adding "options": ["--shell-escape"], to builder_settings. The whole block looks like this for me:
"builder_settings" : {
// General settings:
// See README or third-...
12
votes
Accepted
How should I have found out that LuaTeX removed \write18?
It's a bit unfortunate that Christian Schenk deploys in MiKTeX new versions of the binaries (luatex in this case) as soon as they are available.
TeX Live only changes (core) binaries with the yearly ...
12
votes
Accepted
Multiple pdf outputs from one single .tex file
(Tom from the Overleaf Support Team writing.)
Please note that due to the Overleaf setup, while you can run pdflatex within \immediate\write18 or \ShellEsc, you have to be careful about file names. ...
12
votes
Accepted
Inconsistent behaviour of \detokenize on macro beginning with "e" or "f"
This is nothing to do with TeX, \e is a control character to printf.
If you try
printf "\cXXX"
on the command line you get \cXXX
But if you try
printf "\eXXX"
you get nothing.
...
11
votes
Accepted
How to enable shell escape when building with latexmk and xelatex
There are multiple options:
latexmk -xelatex -latexoption="-shell-escape" document
latexmk -xelatex -shell-escape document (this option is not listed in the normal latexmk -help menu, but you have to ...
11
votes
How can I add programs allowed with restricted write18?
For TeX Live, issue from the terminal
kpsewhich texmf.cnf
This should answer
/usr/local/texlive/2019/texmf.cnf
(the year can vary). This is the top level texmf.cnf and values set here are not ...
10
votes
How should I have found out that LuaTeX removed \write18?
If using a beta release of software it's best to follow its development channels as breaking changes are expected in beta releases. This was discussed on the luatex list before the change was made. (...
10
votes
Use minted without unrestricted shell escape
Recent minted release have a finalizecache option that saves the cache in a less transient form, then you can change the document to use the frozencache option and from then on --shell-escape is not ...
10
votes
How can I enable shell-escape?
AUCTeX (Emacs)
Custmize variable TeX-command-extra-options to have value " -shell-escape ":
Enter customization typing (in Emacs jargon) M-x customize-option RET TeX-command-extra-options ...
Community wiki
9
votes
Accepted
with tikzexternalize, how to name the images with the current name of the imported file
For this to work, the code for the picture must actually be in an external file. Otherwise, the file name is identical with the name of the main file, which won't work.
You can create such files on-...
9
votes
How to have latexmk always use -shell-escape?
To enable shell-escape for all *latex commands using a latexmkrc file:
set_tex_cmds( '--shell-escape %O %S' );
9
votes
How can I enable shell-escape?
Arara
Arara uses 'magic comments' at the top of the .tex file to determine the options. For shell escape you need to add the option shell: true or equivalently shell: yes. The options are specified ...
Community wiki
9
votes
Accepted
How to change the shell used by \write18?
You can invoke bash as part of the command, for example
\immediate\write18{bash -c 'echo \ current shell is: $0'}
\bye
produces a terminal output
$ pdftex --shell-escape file
This is pdfTeX, Version ...
8
votes
How can I enable shell-escape?
Latexmk
To enable shell escape in Latexmk you need to add the -shell-escape option to the Latexmk call, as follows:
latexmk -shell-escape yourfile.tex
Community wiki
7
votes
Accepted
Using tikz/pgf and gnuplot with lualatex
\write18 shell escape does not work by default for newer luatex, the shellesc package puts it back, this works for me:
\RequirePackage{luatex85,shellesc}
\documentclass{article}
\usepackage{tikz}
\...
7
votes
Accepted
accessing bash to get git information in TeX macro
As suggested in the comments, there are the gitinfo packages, which offer a broad range of features. If you are looking for a quick-and-dirty solution instead, you can use Heiko's package catchfile ...
7
votes
Accepted
How to run shell command with \write18?
I don't think that cmd.exe was ever directly allowed (in restricted mode). You need to run your document with --shell-escape.
When I try your document I get a prompt in the window where pdflatex ...
7
votes
How can I enable write 18 on a MikTeX installation
In Windows + TexWorks, when using texify, I have to add:
--tex-option=--shell-escape
To the tool configuration window:
Source: How to do shell-escape in TeXWorks?
7
votes
Accepted
Get write18 to accept / expand command
If you check the log, you'll see
runsystem(pdfcrop mypath/myimage.pdf mypath/myimage.cropped.pdf)...executed.
runsystem(pdfcrop mypath/myimage.pdfmypath/myimage.cropped.pdf)...executed.
Notice the ...
7
votes
Accepted
how to compile tex file with -shell-escape in AucTeX using C-c C-c on ubuntu
You have to put it into a Local Variables block.
\documentclass{article}
\begin{document}
\end{document}
%%% Local Variables:
%%% TeX-command-extra-options: "-shell-escape"
%%% End:
When I open ...
7
votes
Accepted
Can I get the output of a command line program with TeX (using e.g. \read18)?
You could use \input|"inkscape -V" (requires -shell-escape). However, I suggest defining a macro so that you can also manipulate the output:
\documentclass{article}
\usepackage{catchfile}
\...
7
votes
Accepted
How to conditionally load a package only if shell-escape (write18) is passed
expl3 has a test:
\documentclass{article}
\usepackage{expl3}
\csname sys_if_shell_unrestricted:T\endcsname{\usepackage{gitver}}
\begin{document}
Hello world!
\end{document}
7
votes
How do I \write18 a koma var?
As Ulrike said, \usekomavar is not expandable, but a functionally-equivalent expandable version can be easily created. Being non-expandable means that the command does assignments as part of its ...
7
votes
How do I \write18 a koma var?
It is also possible to use the optional argument of \usekomavar. Therefore I have to define a new macro which will take the content for the file as its last argument.
\newcommand\writetofile[2]{% \...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
shell-escape × 315pdftex × 45
tikz-pgf × 29
luatex × 29
tikz-external × 21
miktex × 19
minted × 17
pgfplots × 14
gnuplot × 14
graphics × 12
xetex × 11
latexmk × 11
macros × 10
windows × 10
texlive × 9
texstudio × 9
input × 9
write × 9
errors × 8
compiling × 8
eps × 8
svg × 7
scripts × 7
auto-pst-pdf × 7
listings × 6