Questions tagged [shell-escape]
{shell-escape} is about the “--shell-escape” argument, i.e. to enable external running of commands from inside the ‘.tex’ file.
311
questions
1
vote
1
answer
29
views
How to run `--shell-escape` for LuaLaTeX in Texshop
Is there a way to run the --shell-escape command for the LuaLaTex engine in Texshop? I know there are editable TEX and Latex commands in the Texshop settings under Engine->pdfTeX settings, but I do ...
0
votes
0
answers
55
views
Python from LaTeX: Strange Networkx/Graphviz error
It is hard to give a minimal example, because Python3 with some packages is needed. I want to call Python from LaTeX, here is an example how I want to do it (--shell-escape is needed):
\documentclass[]...
2
votes
1
answer
36
views
How to insert a eps file
I have a .EPs file I need to include in my latex document.
A previous answer suggested epstopdf. Also how can I incorporate shell-escapae into my preamble.
2
votes
0
answers
79
views
svg can't call Inkscape from LuaLaTeX
The following MWE fails with LuaLaTeX but runs fine with pdfLaTeX on an up to date MiKTeX installation. Both cases work on a different machine with a TeX Live installation. Any idea what the problem ...
1
vote
1
answer
38
views
Piping shell command output to another command
I'm trying to write a command that wraps \href with a QR code to the given URL. For this I need to generate a temp file and reuse it later, so I wrote a \mktemp command that wraps the mktemp utility:
%...
0
votes
1
answer
61
views
Using a batch script in latex \immediate\write18 env [closed]
I am trying to write a script that using texcount will output only the number of characters including spaces. I made a batch script which works, no problems there.
The problem is trying to run it in ...
0
votes
2
answers
36
views
Ouptut the current time using `datetime` to a file
How do I print the current time to a file using the datetime pacakge. While running pdflatex I am generating a foo.def in which I would like to add a comment at the top with the current date time in ...
0
votes
0
answers
120
views
Still getting a "Restricted shell escape" on Kile
In order to add gnuplots in my documents, I'm using this basic code to verify my system (Ubuntu 22.04.2 LTS + Kile 2.9.93)
\documentclass{standalone}
\usepackage{shellesc}
\begin{document}
\...
0
votes
1
answer
57
views
Post build processes with shell script and write18
I would like to start a shell script from LaTeX. In the shell script I need to wait until the .pdf file is generated and afterwards I want to do some stuff with this file.
So I created a MWE Test.tex ...
1
vote
1
answer
72
views
Package PAGELAYOUT, 'cannot access shell'
While running the package-supplied *.tex samples for pagelayout.cls, I am getting error messages. That alone is odd, because I would expect those examples to be rock-solid. The errors claim that the ...
0
votes
0
answers
190
views
Issue with Loading Packages into MikTeX using a .tex file
I have uninstalled and reinstalled MikTeX along with all updates. I have loaded all packages because I have still gotten the same error after trying to load .tex file someone more experienced with ...
1
vote
1
answer
145
views
\ShellEscape fails in certain cases with lualatex
This question stems from my question here about minted and lualatex, with similar issues reported by another user here.
I think I've isolated the issue to the following. minted relies on \ShellEscape ...
0
votes
0
answers
140
views
LuaLaTeX issue using minted (continued from ...)
In issue with minted and LuaLaTeX there is a discussion in the comments underneath the question and an answer confirming the issue. Since I can confirm the issue as well and have additional ...
2
votes
1
answer
102
views
\sys_get_shell:nnN seems to strip newlines from shell output
Goal: run a shell command and \input its output as LaTeX code.
See related: How to protect \input shell command args with backslashes
When using expl3's \sys_get_shell:nnN, newlines from the shell ...
0
votes
1
answer
62
views
Consuming variable's value (produced from shell call) as `\input`
Note: \input is not expandable: Why is \input not expandable?
However, \@@input is.
The goal is to \@@input some text produced from a shell call, obtained via \sys_get_shell:nnN (for how, see egreg's ...
0
votes
1
answer
326
views
TeXstudio does not find shell command with LuaLaTeX
I am relying on shell commands to include git information in my documents. This was working fine, but stopped recently. I am yet unable to figure out why.
Check the following MWE. Of course this would ...
1
vote
2
answers
101
views
How to write the string "^^^^" into a file
I am trying to write "^^^" into an already opened file (under the variable \myfile) using the command
\immediate\write\myfile{"^^^"}
This, however results in an error.
I am ...
2
votes
1
answer
462
views
issue with minted and LuaLaTeX
The following document test.tex compiles with both pdflatex --shell-escape test.tex and xelatex --shell-escape test.tex, but not lualatex --shell-escape test.tex (from a fully updated MikTeX ...
0
votes
1
answer
57
views
How to redefine the behavior of dollar and then use dollar for \write18?
I did what was suggested here (I just want to use $...$ instead of \texttt{...}, for the sake of experiment):
\documentclass{article}
\catcode`\$=\active
\gdef$#1${\texttt{#1}}
\begin{document}
Hello, ...
0
votes
0
answers
47
views
Call metapost with command line arguments through shell-escape; then include the resulting graphics
I would like to use metapost to draw long curved lines and overset the resulting images over long subformulas instead of relatively short widetilde.
Would be great if I can choose not from the set of ...
1
vote
1
answer
29
views
What happens with ECHO via \write18?
This is my code:
\documentclass{article}
\begin{document}
\immediate\write18{echo '\detokenize{\hi \foo \hi}' > x.txt}
\end{document}
The content of x.txt contains:
\hi
oo \hi
What happened ...
0
votes
0
answers
171
views
Is there a secure way to use --shell-escape with untrusted content?
I'm planning to create a service that would allow users to render LaTeX documents online with TeX Live running on the server, and I would like to enable certain features (such as gnuplot) that require ...
2
votes
1
answer
123
views
How to escape percent sign in shell command
I am working on a macro which will build revision history table in my document using Git tags.
Each published version of my document has a tag with short description.
I want to use them to ...
2
votes
1
answer
400
views
When to use `--no-shell-escape`?
I saw an introduction of -shell-escape here: https://tex.stackexchange.com/a/598819/180617
I know that if I want to use a package like minted or tkz-fct, I have to use pdflatex --shell-escape main to ...
2
votes
1
answer
351
views
Stop at error + Meaningfull errors with shell-escape and Tikz externalize
I've been trying to use shell escape and tikz externalize (see for instance here), but I have two issues:
when the tikz picture fails with some errors, the compilation does not stops if it compiled ...
0
votes
0
answers
541
views
restricted\write18 enabled, on MacOS, when I try to compile to a PDF on TeXMaker and TeXshop
How to solve this error message: restricted\write18 enabled, on MacOS, when I try to compile to a PDF on TeXMaker and TeXshop.
3
votes
1
answer
117
views
Use \immediate\write18 with Single Quote
I would like to use \immediate\write18 (encoded in the \OuputToFileA macro) to output a string containing a single quote. If I replace the single quote with another character, such as X
\StrSubstitute{...
1
vote
1
answer
44
views
Using \immediate\write18 when lineno package yields spurious text
I am getting spurious text in the output of \immediate\write18 when the lineno package is used. The MWE below yields the following in the file foo.tex:
If one comments out the line that includes ...
0
votes
1
answer
409
views
TikZ externalize while using -output-directory
I'm using tikzexternalize to speed things up and to have a clean working directory, And I'm using -output-directory on compilation to have a clean working directory (actually I use cluttex, but I've ...
2
votes
1
answer
89
views
Problem tikzexternalize with \def
I am trying to save some plots as individual PDFs, but I want to decide which ones to save with a condition.
mwe.tex:
\documentclass[11pt]{article}
\...
1
vote
1
answer
85
views
Can I enable FFI by default without shell-escape?
The FFI library included in luatex could be dangerous so it is disabled by default (at least in TeXLive). In order to access the library, one has to invoke luatex with the --shell-escape option. Is ...
7
votes
1
answer
264
views
Inconsistent behaviour of \detokenize on macro beginning with "e" or "f"
I need to write to a file the unexpanded LaTeX. The macro \OuputToFile is bascially an \immediate\write18 and works fine with the following:
\OuputToFile{\detokenize{$\OuterMacro{\cXXX{X}}$}}%
\...
1
vote
1
answer
787
views
pdflatex doesn't allow me to enable system calls from another directory
I am trying to save the plots in my file into separate PDFs. My file is called my_file.tex located in /full/path/to/my/file
This is my_file.tex:
\documentclass[11pt]{article} ...
1
vote
2
answers
117
views
\verbatiminput shell command Minted equivalent
\verbatiminput{|"echo foo"}
produces foo, wrapped in verbatim.
Is it possible to do the same with Minted’s syntax highlighting?
I have tried
\begin{minted}[escapeinside=!]{text}
!\...
0
votes
1
answer
102
views
How to prevent script (via \immediate\write18) from running multiple times?
How to prevent the execution of script (via \immediate\write18) multiple times when running latexmk (which calls pdftex multiple times)? The problem is that during each iteration of pdftex, the script ...
0
votes
1
answer
42
views
Format inline result of bashful
I discovered the package bashful to print result of a shell command inside the document.
We can print the result in the current line (without carriage return) using the command \bashStdout. Here is an ...
0
votes
1
answer
734
views
How do I invoke LaTeX with the -shell-escape flag in MikTex? [duplicate]
I am trying to use the minted package but get the error
! Package minted Error: You must invoke LaTeX with the -shell-escape flag.
I am using MikTex and have tried going into Edit/Preferences and ...
1
vote
1
answer
67
views
Running several PdfTeX processes in parallel from within PdfTeX
I have a complex document setup where I have to produce several document versions. I want to start these runs in parallel to speed things up - and I want to control this from within PdfTeX. For this ...
35
votes
13
answers
14k
views
How can I enable shell-escape?
I need to enable shell escape for a package that I want to use. What is shell escape exactly, and how do I enable it in my editor or compiling toolchain?
Links to answers for different editors/...
0
votes
1
answer
382
views
Path problems in write18-call after miktex-update
After updating miktex on 2021/04/18 I realized a changed behaviour when using
write18-calls from within TeX.
In one of my source files I have the line
\immediate\write18{ skizze.bat 1 mp }
and with ...
0
votes
1
answer
198
views
auto-pst-pdf not compiling any more (after a year or so)
Some background:
Before May 2020 (or even earlier), the code runs fine without any problem.
Then I digged up the project and with to update some contents today,
it would not compile any more.
Here is ...
1
vote
1
answer
162
views
Error even after enabling --shell-escape in TeXworks and installing gnuplots 5.4, when using gnuplot {4*x**2 - 5}
On my troubleshooting of the code got from page 42/571 of the pgfplots package:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.17}
\begin{document}
\...
0
votes
0
answers
137
views
Where to add shellescape in texstudio when using latexmk?
For using svg images in pdflatex, I have to enable shell-escape. I am using texstudio and latexmk. Where to set shell-escape?
0
votes
1
answer
834
views
Automatic pdf_tex export from svg via inkscape and svg package on Windows
I have the following code:
\documentclass[12pt]{article}
\usepackage{svg}
\setsvg{inkscape=inkscape -z -D, inkscapeversion=1, svgpath=figures/}
\begin{document}
\begin{figure}
\...
7
votes
3
answers
577
views
How do I \write18 a koma var?
I'm trying to do some shell processing of data that depends on the settings inside the TeX file.
To do this I want to \immediate\write18 a command that depends on a \usekomavar, but pdflatex complains ...
0
votes
1
answer
46
views
is it possible to omit lines from template in the produced document?
My tex files look like this:
\documentclass[varwidth=13.20cm,border=2mm]{standalone}
\usepackage{minted}
\usemintedstyle{solarized}
\begin{document}
\begin{LARGE}
\inputminted{php}{create_array....
2
votes
1
answer
89
views
Accessing sqlite3 with xparse (under XeLaTeX)
I was very happy when I read egreg's 2019 Addendum about how to launch a shell script from LaTeX and grab the output.
But when I tried to use it to connect with a SQLite database, I got a LaTeX3 error....
2
votes
2
answers
917
views
LuaLaTeX: Is shell-escape not required? Does it really make lualatex more vulnerable as an application?
Few weeks ago when I did a fresh install of MacTeX 2020 and tried compiling some documents with command >>lualatex filename.tex I would get this error: attempt to call a nil value (field 'cpath ...
1
vote
1
answer
104
views
Generate two files with different class options with package shellesc
I want to generate multiple pdf files with different font sizes. I referred to this solution, and formed the following code.
% test.tex
\documentclass{article}
\usepackage{shellesc}
\ShellEscape{%
...
3
votes
1
answer
46
views
\write18 with \csname not evaluating
I have noticed that the write18 behaves differently when defined within a csname.
That is, given the following code:
\documentclass{article}
\begin{document}
\csname textbf\endcsname{param} after
\...