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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
53 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 ...
user avatar
  • 225
2 votes
1 answer
54 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 ...
user avatar
  • 227
2 votes
1 answer
158 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 ...
user avatar
  • 1,143
2 votes
1 answer
80 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 ...
user avatar
  • 5,093
0 votes
0 answers
77 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.
user avatar
3 votes
1 answer
61 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{...
user avatar
1 vote
1 answer
41 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 ...
user avatar
0 votes
1 answer
122 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 ...
user avatar
  • 393
1 vote
1 answer
50 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} \...
user avatar
1 vote
1 answer
49 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 ...
user avatar
  • 9,498
7 votes
1 answer
257 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}}$}}% \...
user avatar
0 votes
1 answer
146 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} ...
user avatar
1 vote
1 answer
37 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} !\...
user avatar
0 votes
1 answer
64 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 ...
user avatar
  • 373
0 votes
1 answer
25 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 ...
user avatar
  • 27
0 votes
1 answer
318 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 ...
user avatar
1 vote
1 answer
65 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 ...
user avatar
28 votes
11 answers
4k 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
139 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 ...
user avatar
0 votes
1 answer
107 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 ...
user avatar
  • 515
1 vote
1 answer
70 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} \...
user avatar
  • 1,491
0 votes
0 answers
43 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?
user avatar
  • 310
0 votes
1 answer
211 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} \...
user avatar
7 votes
3 answers
538 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 ...
user avatar
  • 1,115
0 votes
1 answer
39 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....
user avatar
  • 155
2 votes
1 answer
70 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....
user avatar
  • 1,770
2 votes
2 answers
630 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 ...
user avatar
  • 1,248
1 vote
1 answer
70 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{% ...
user avatar
  • 2,248
3 votes
1 answer
38 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 \...
user avatar
  • 133
1 vote
1 answer
158 views

Inclusion of graphics with on-the-fly conversion using XeTeX

I would like to make \inclugraphics{file.ext} perform on-the-fly conversion of graphics files with unsupported formats, e.g. .ext is .svg or .gif. This use case happens at least with the package ...
user avatar
  • 343
2 votes
2 answers
120 views

What's the best way to write over an image?

I'm trying to write text over an image like this exemple: I've read a lot about this topic but as I'm quite a beginner with Latex I'm lost (I'm using Overleaf with pdflatex btw). I did the exemple ...
user avatar
0 votes
1 answer
101 views

Xelatex shell escape custom command [duplicate]

I've configured my xelatex for shell escape (to use tikzexternal), but can I use it to run an arbitrary shell command at the end of compilation? How do I pass it the command to run from inside my .tex ...
user avatar
  • 281
1 vote
0 answers
42 views

markdown.sty --- embedding latex recursively

I am using overleaf. It conveniently makes it easy to include markdown.sty (which requires --shell-escape). I can include book chapters with \markdownInput{chaptername.md}, which allows my latex-...
user avatar
  • 3,411
0 votes
1 answer
299 views

Compiler does not start with --shell-escape (pdflatex)

I try to compile a document with shell-escape and pdflatex. But everytime I want to start compiling, my compiler does not even start. The logs do not show any error... I enabling shell-escape the way ...
user avatar
1 vote
1 answer
256 views

Execute system command after compile

I'm using \immediate\write18{...} to create a temporary file that is used in the document body, e.g.: \documentclass{beamer} \immediate\write18{sed 's/foo/bar/' in.tsv > out.tmp} \begin{document} ...
user avatar
  • 225
0 votes
0 answers
37 views

latex l3sys get exit code of script

I am using l3sys of the latex3 interfaces, i need to get the exit code of a script after running it. I am running \sys_get_shell:nnN, i tried giving it echo $? and echo \$, but the shell for some ...
user avatar
1 vote
1 answer
34 views

Safer aproach than shell-escape to solve problem

I have a folder of files which follows this naming convention: "<id>-<name>". I need to refer to them from a latex document, but "<name>" often changes, so i need ...
user avatar
3 votes
2 answers
92 views

How to use % inside \write18 command? [duplicate]

I'm doing this: \documentclass{article} \begin{document} \write18{echo '100%' > hash.tex} \input{hash.tex} \end{document} However, this doesn't work (doesn't compile). What is the workaround?
user avatar
  • 10.2k
7 votes
2 answers
500 views

Switch based on whether or not an environment variable is set

TLDR: Problem: kpsewhich outputs \par for unset environment variables and I do not know how to strip it. I was inspired from the question Can I access system/environment variables from LaTeX? For ...
user avatar
  • 396
1 vote
0 answers
54 views

Escape return value from \sys_get_shell [duplicate]

I stumbled upon this question regarding accessing environment variables from latex and have problems properly escaping variables containing special tex symbols (e.g. LANG=en_US.UTF-8) My closest ...
user avatar
  • 396
0 votes
0 answers
16 views

\@percentchar in \newcommand function [duplicate]

I moved a part of my code to function and that stopped working. I don't understand why? this code is working: \begin{document} \makeatletter \immediate\write18{start cmd echo /k magick convert ...
user avatar
2 votes
2 answers
101 views

Space after macro \@percentchar

I am trying to call ImageMagic to crop my pictures. I send command to system with \write18, and I need to use percent symbol into my command line. Can't use "\%", but \@percentchar works almost good. ...
user avatar
2 votes
1 answer
70 views

How can I throw an error if --shell-escape isn't enabled?

I'm writing a document that makes heavy use of \includesvg; that in turn requires --shell-escape so it can call inkscape. I'm compiling (as always) from the terminal, and don't really want to alias ...
user avatar
  • 8,310
1 vote
0 answers
59 views

Saving pdf with Date and name

I have a file called quotes.tex. When I run it, it creates my quote for that date for a certain customer. I now want to save this quote.pdf automatically as date_customer_quote. How can I do that? \...
user avatar
  • 105
0 votes
0 answers
36 views

Shell escape copying out a compiled pdf out of Texshop results in a corrupt version, why?

I use pdflatex --shell-escape -output-directory=tex-aux my-tex-file.tex in Texshop to put my aux files inside a folder called tex-aux and have the following code in my-tex-file.tex: \usepackage{...
user avatar
0 votes
2 answers
189 views

escaping the backslash inside \immediate\write18 with del command

I pasted the following line into the DOS PROMPT/DOS Command Line: del D:\myTempFolder\myTempFile.txt It worked well -- I was able to delete the file myTempFile.txt'' inside the foldermyTempFolder''. ...
user avatar
7 votes
1 answer
620 views

How can I add programs allowed with restricted write18?

By default, TeX is in restricted write18 mode, which means it can only call a select few external programs. How can I edit that list of programs? This would enable me to use packages that need to call ...
user avatar
  • 12.7k
0 votes
0 answers
4k views

Restricted \write18 enabled entering extended mode error [duplicate]

Hi I am creating pdf on my windows 8 machine. I am using texlive 2019. While giving command pdflatex test.tex I am getting this error. I have no clue why this error is happening. This is pdfTeX, ...
user avatar
  • 1
1 vote
1 answer
83 views

Re-using externalised tikzpicture always fails for no discernible reason

This MWE works, based on the answer to this question. However, attempting to achieve the same result in a real document always fails to generate the external image, usually with an error along the ...
user avatar
  • 2,773
4 votes
2 answers
197 views

Escaping backslash within \@@input or \write18

Problem I want to include a word count in my document, using texcount. But I also want to include a comma as a thousand separator. This is the code I came up with: \makeatletter\@@input|"echo `...
user avatar

1
2 3 4 5 6