8

I haven't seen this asked specifically, though I have seen related questions.

I just installed the minted package and noticed I have to run latex/pdflatex with a command-line option, -shell-escape, for it to run. I can do that manually, of course, but what if I'm using latexmk?

16

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 always run with this option enabled, you should put the following in your .latexmkrc file (yes, that's a thing):

$latex = 'latex  %O  --shell-escape %S';
$pdflatex = 'pdflatex  %O  --shell-escape %S';

Caveat!

Enabling --shell-escape by default is dangerous, since it makes the latex binary execute arbitrary shell commands in latex files.**

  • 1
    You can also consider creating a Makefile (or a script, be it bash or cmd), if you want to have --shell-escape on a per-project basis. – rubdos Jun 9 '17 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.