4

Consider the following two excerpts.

  1. The imakeidx package's user manual states (version v1.3e, 2016/10/15, Section 1 Introduction, p. 2):

    depending on the distribution and the shell editor that is being used to work on a specific document, it is necessary to add -shell-escape (or --enable-write18 for MiKTEX) to the command with which the typesetting program is launched, possibly through the shell editor.

  2. The tcolorbox package's user manual states (version 4.03, 2017/04/25, Chapter 22 Library external, p. 427):

    To use the externalization options, the compiler has to be called with the -shell-escape permission to authorize potentially dangerous system calls.

In both cases using a certain package, or activating some of its options, requires passing some flag(s) to the typesetting engine. For example, compiling the following LaTeX document:

\documentclass{article}
\usepackage[all]{tcolorbox}
\begin{document}
Hello, world!
\end{document}

results in the following error message:

ERROR: Package minted Error: You must invoke LaTeX with the -shell-escape flag.

How can flags be passed to the typesetting engine using AUCTeX?

6

Use TeX-command-extra-options (and check out the manual before asking questions ;-)

AUCTeX handles in a special way most of the main options that can be given to the TeX processors. When you need to pass to the TeX processor arbitrary options not handled by AUCTeX, you can use the file local variable TeX-command-extra-options.

User Option: TeX-command-extra-options

String with the extra options to be given to the TeX processor. For example, if you need to enable the shell escape feature to compile a document, add the following line to the list of local variables of the source file:

%%% TeX-command-extra-options: "-shell-escape"

By default this option is not safe as a file-local variable because a specially crafted document compiled with shell escape enabled can be used for malicious purposes.

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.