I want to compile my tex file with -shell-escape option in Emacs + AucTex using C-c C-c key binding.

It gave me an error to run with -shell-escape. I know I can do it through terminal by latex -shell-escape la.tex but I want AucTeX to do it.

I even added a local varible % TeX-command-extra-options: -shell-escape but it gave the same error


You have to put it into a Local Variables block.


%%% Local Variables: 
%%% TeX-command-extra-options: "-shell-escape"
%%% End:

When I open the file Emacs warns me:

The local variables list in test.tex
contains values that may not be safe (*).

Do you want to apply it?  You can type
y  -- to apply the local variables list.
n  -- to ignore the local variables list.
!  -- to apply the local variables list, and permanently mark these
      values (*) as safe (in the future, they will be set automatically.)

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

When I answer y and use the C-c C-c shortcut, I see in the log

Running `LaTeX' on `test' with ``lualatex --jobname=test  -file-line-error -shell-escape  -interaction=nonstopmode "\input" test.tex''

Your output might differ slightly because I have changed some of Emacs' and AucTeX's default settings.

  • well. when I added the variable, the variable block entered automatically, but the warning didn't open. So I did M-x revert-buffer and warning came and every thing went smoothly. So thank you. Dec 27 '18 at 17:18

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.