help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX


From: Ralf Angeli
Subject: Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX
Date: Sun, 27 May 2012 21:08:42 +0200

* Haines Brown (2012-05-27) writes:

> I would like to specify the TeX engine with the emacs command line, such
> as with C-c C-c latex and C-c C-c xelatex, rather than having it only
> call whichever TeX-engine is specified in AUCTeX configuration or in
> .emacs init file. At present I can only switch between processing LaTeX
> and XeLaTeX files by inserting or commenting a line in .emacs (setq
> TeX-engine 'xetex) and reload emacs.
> 
> Simplest would be to have AUCTeX not specify any TeX-engine and instead
> use the engine specified at the command prompt. There does not seem to
> be any way to do this, and so an alternative might be for .emacs to
> specify the TeX engine by distinguishing between LaTeX and XeLaTeX
> files.

You can set the engine as a file variable in the files which require
XeTeX.

For example like this:

%%% Local Variables: 
%%% mode: latex
%%% TeX-engine: xetex
%%% TeX-PDF-mode: t
%%% TeX-master: t
%%% End: 

> Someone using the Jed editor does this. He sets the default TeX-engine to
> xetex if the document uses packages peculiar to XeTeX:
>
>    if (re_fsearch("\\usepackage.*unicode-math") or
>        re_fsearch("\\usepackage.*fontspec") or
>        re_fsearch("\\usepackage.*polyglossia")
>       )
>       define_blocal_var("latex_output", "xetex");
>
> Is it possible to something comparable to this if construction in .emacs
> init? I know nothing of lisp, but guess it would be something like:
>
>    ( if 
>         (search-forward "\usepackage*fontspec") or
>         (search-forward "\usepackage*polyglossia")
>      (setq TeX-engine 'xetex))

AUCTeX uses style files for things like this.  For example for
fontspec.sty you'd write a file called fontspec.el which is placed in
AUCTeX's style directory and which switches the TeX engine to XeTeX.
See (info "(auctex)Style Files") for details.

-- 
Ralf


reply via email to

[Prev in Thread] Current Thread [Next in Thread]