auctex
[Top][All Lists]

## Re: [AUCTeX] Options problem with LaTeX using AucTeX

 From: Tassilo Horn Subject: Re: [AUCTeX] Options problem with LaTeX using AucTeX Date: Tue, 03 Feb 2015 13:58:55 +0100 User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

Hi François,

> In my file, I use the package minted that require to use the option -
> shell-escape . In order to use this option, I need to add the following line
> in
> AucTeX : %%% TeX-command-extra-options: "-shell-escape" in the block local
> variables. So the end of my file look like this :
> %%% Local Variables:
> %%% coding: utf-8
> %%% mode: latex
> %%% TeX-engine: pdflatex
> %%% TeX-master: t
> %%% TeX-command-extra-options: "-shell-escape"
> %%% End:
>
> Since this option is unsafe, I have reset AucTeX. Indeed he asked me if I want
> to use this option and I said yes.
>
> However, I style have an issue when I’m compiling (with minted) saying that
>
> Package minted Error: You must invoke LaTeX with the -shell-escape flag.

It's better to provide a minimal example when asking such questions.
The following works fine for me.

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage{minted}
\begin{document}
\begin{minted}{java}
enum Colors {RED, GREEN, BLUE};
\end{minted}
\end{document}

%%% Local Variables:
%%% coding: utf-8
%%% mode: latex
%%% TeX-master: t
%%% TeX-command-extra-options: "-shell-escape"
%%% End:
--8<---------------cut here---------------end--------------->8---

After invoking the LaTeX command, switch to the log buffer using C-c
C-l'.  Its first line shows the actual command being executed.  What is
it?  Here, it is

Running LaTeX' on minimal-minted' with pdflatex \
-file-line-error -shell-escape --synctex=1 \
-interaction=nonstopmode "\input" minimal-minted.tex''

I guess yours doesn't include the -shell-escape option although it
should.  Did you configure the "TeX"/"LaTeX" entries in
TeX-command-list'?  Or did you configure LaTeX-command-style'?

BTW: Why do you have a pdflatex TeX-engine'?  That's not predefined in
AUCTeX.  When you want to compile to PDF, you only need to enable
TeX-PDF-mode' which is actually the default since AUCTeX 11.88.

> Beyond that, I have the following error :
>
> Package minted Error: You must have pygmentize' installed to use this
> package.

This means that pygmentize is not in PATH.

> But I don’t understand why since when I open an shell and I enter the
> following command :
>
> pdflatex -shell-escape myfile.tex
>
> then the file is compiling.

This means that pygmentize is in PATH when pdflatex is called from your
default shell.  I guess that's BASH.  Do you have something like

export PATH="\$PATH:/path/to/pygments/bin/"

in your ~/.bashrc?  If yes, that should probably go into a file that's
sourced by any shell, not only BASH.  On many distros that's ~/.profile.

Alternatively, you could adjust the PATH in emacs using:

,----[ C-h f setenv RET ]
| setenv is an interactive compiled Lisp function in env.el'.
|
| (setenv VARIABLE &optional VALUE SUBSTITUTE-ENV-VARS)
|
| Set the value of the environment variable named VARIABLE to VALUE.
| VARIABLE should be a string.  VALUE is optional; if not provided or
| nil, the environment variable VARIABLE will be removed.
|
| Interactively, a prefix argument means to unset the variable, and
| otherwise the current value (if any) of the variable appears at
| the front of the history list when you type in the new value.
| This function always replaces environment variables in the new
| value when called interactively.
|
| SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment
| variables in VALUE with substitute-env-vars', which see.
| This is normally used only for interactive calls.
|
| The return value is the new value of VARIABLE, or nil if
| it was removed from the environment.
|
| This function works by modifying process-environment'.
|
| As a special case, setting variable TZ' calls set-time-zone-rule' as
| a side-effect.
----

E.g., you could add something like

(setenv "PATH" (concat (getenv "PATH") ":/path/to/pygments/bin"))

> Moreover, I edited this file last week and I didn’t have this problem
> with pygmentize.  Since I have started to use prelude yesterday, the
> problem is related to that.

I don't use nor recommend prelude (or any other mass-configuration
package).  But if it modifies TeX-command-list' or
LaTeX-command-style' or something like that, this might be the culprit.

> You can see or/and answer to this problem here :
> http://tex.stackexchange.com/posts/226254/edit

I stick to the official support channel for AUCTeX which is this very
mailinglist.  Feel free to link here from the stackexchange entry.

Bye,
Tassilo