Hi list,
in AUCTeX there isn't an easy&flexible way to pass arbitrary options
to the TeX processor. The most wanted option probably is
`-shell-escape'. Another useful option can be `-fmt <format file>',
to select a format file, because in AUCTeX first line parsing is de
facto disabled.
Setting `{La,}TeX-command' locally (note that those variables aren't
safe by default as file-local variables) doesn't work with
`TeX-engine's different from `default', so this isn't flexible.
Another possibility is to add the options to `LaTeX-command-style' but
this isn't buffer-local by default, there is no corresponding variable
for plain TeX and it's definitely difficult to be remembered.
One could define a new engine in `TeX-engine-alist' combining an
existent engine with the relevant options, but defining a new engine
for all possible combinations of a TeX engine and options (think about
the `-fmt <format file>' option) isn't easy.
I'm sending a patch to address this problem. It simply adds a new
safe file-local variable (`TeX-command-extra-options') which is the
string of options to be passed to the TeX-processor through a new
expander in `TeX-expand-list'. In this way, eg, the shell escape can
be enabled with
%%% TeX-command-extra-options: "-shell-escape"
in the list of local variables, and a format file can be picked up with
%%% TeX-command-extra-options: "-fmt <format file>"
I tested the patch with plain TeX and LaTeX with default, luatex and
xelatex engines. It works also with `TeX-command-region'.
Any thoughts? Can I install the patch?
Bye,
Mosè
diff --git a/tex.el b/tex.el
index 0d6280e..77bcb09 100644
--- a/tex.el
+++ b/tex.el
@@ -112,24 +112,24 @@ If nil, none is specified."
;; TeX-expand-list for a description of the % escapes
(defcustom TeX-command-list
- `(("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t"
+ `(("TeX" "%(PDF)%(tex) %(extraopts) %`%S%(PDFout)%(mode)%' %t"
TeX-run-TeX nil
(plain-tex-mode ams-tex-mode texinfo-mode) :help "Run plain TeX")
("LaTeX" "%`%l%(mode)%' %t"
TeX-run-TeX nil
(latex-mode doctex-mode) :help "Run LaTeX")
;; Not part of standard TeX.
- ("Makeinfo" "makeinfo %t" TeX-run-compile nil
+ ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with Info output")
- ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil
+ ("Makeinfo HTML" "makeinfo %(extraopts) --html %t" TeX-run-compile nil
(texinfo-mode) :help "Run Makeinfo with HTML output")
- ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t"
+ ("AmSTeX" "%(PDF)amstex %(extraopts) %`%S%(PDFout)%(mode)%' %t"
TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
;; support for ConTeXt --pg
;; first version of ConTeXt to support nonstopmode: 2003.2.10
- ("ConTeXt" "texexec --once --texutil %(execopts)%t"
+ ("ConTeXt" "texexec --once --texutil %(extraopts) %(execopts)%t"
TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
- ("ConTeXt Full" "texexec %(execopts)%t"
+ ("ConTeXt Full" "texexec %(extraopts) %(execopts)%t"
TeX-run-TeX nil
(context-mode) :help "Run ConTeXt until completion")
("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX")
@@ -301,7 +301,7 @@ The executable `latex' is LaTeX version 2e."
(defcustom LaTeX-command-style
;; They have all been combined in LaTeX 2e.
- '(("" "%(PDF)%(latex) %S%(PDFout)"))
+ '(("" "%(PDF)%(latex) %(extraopts) %S%(PDFout)"))
"List of style options and LaTeX commands.
If the first element (a regular expression) matches the name of one of
@@ -408,6 +408,12 @@ string."
:group 'TeX-command
:type '(repeat (group regexp (string :tag "Command"))))
+(defcustom TeX-command-extra-options ""
+ "String with the extra options to be given to the TeX processor."
+ :type 'string)
+(make-variable-buffer-local 'TeX-command-extra-options)
+(put 'TeX-command-extra-options 'safe-local-variable 'stringp)
+
;; This is the list of expansion for the commands in
;; TeX-command-list. Not likely to be changed, but you may e.g. want
;; to handle .ps files.
@@ -455,6 +461,7 @@ string."
("%(tex)" (lambda () (eval (nth 2 (assq TeX-engine (TeX-engine-alist))))))
("%(latex)" (lambda () (eval (nth 3 (assq TeX-engine (TeX-engine-alist))))))
("%(execopts)" ConTeXt-expand-options)
+ ("%(extraopts)" (lambda () TeX-command-extra-options))
("%S" TeX-source-correlate-expand-options)
("%dS" TeX-source-specials-view-expand-options)
("%cS" TeX-source-specials-view-expand-client)
_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel