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 + ...
Jun Murakami's user avatar
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 ...
einpoklum's user avatar
  • 12.2k
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 ...
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 ...
Ulrike Fischer's user avatar
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{.....
David Carlisle's user avatar
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. ...
snwflk's user avatar
  • 530
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-...
sk1ll3r's user avatar
  • 241
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 ...
egreg's user avatar
  • 1.1m
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. ...
yo''s user avatar
  • 50.9k
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. ...
David Carlisle's user avatar
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 ...
samcarter_is_at_topanswers.xyz's user avatar
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 ...
egreg's user avatar
  • 1.1m
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. (...
David Carlisle's user avatar
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 ...
David Carlisle's user avatar
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 ...
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-...
cfr's user avatar
  • 194k
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' );
user35915's user avatar
  • 287
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 ...
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 ...
David Carlisle's user avatar
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
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} \...
David Carlisle's user avatar
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 ...
Henri Menke's user avatar
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 ...
Ulrike Fischer's user avatar
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?
will-hart's user avatar
  • 255
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 ...
Joseph Wright's user avatar
  • 257k
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 ...
Henri Menke's user avatar
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} \...
egreg's user avatar
  • 1.1m
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}
Ulrike Fischer's user avatar
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 ...
Phelype Oleinik's user avatar
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]{% \...
esdd's user avatar
  • 85k

Only top scored, non community-wiki answers of a minimum length are eligible