From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ralf Angeli Newsgroups: gmane.emacs.help Subject: Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX Date: Sun, 27 May 2012 21:08:42 +0200 Organization: nil Message-ID: <4fc27bbb$0$6561$9b4e6d93@newsspool4.arcor-online.net> References: <87mx4tkhwj.fsf@engels.HistoricalMaterialism.info> Reply-To: angeli@caeruleus.net NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1338145820 1359 80.91.229.3 (27 May 2012 19:10:20 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 27 May 2012 19:10:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun May 27 21:10:19 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SYiqy-0002GZ-LY for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 21:10:12 +0200 Original-Received: from localhost ([::1]:46835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SYiqy-0001E5-79 for geh-help-gnu-emacs@m.gmane.org; Sun, 27 May 2012 15:10:12 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!news-1.dfn.de!news.dfn.de!news.uni-stuttgart.de!news.belwue.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Mail-Copies-To: nobody Cancel-Lock: sha1:ynAbcsVzTn4nKpMvGk0lC4dysck= Original-Lines: 51 Original-NNTP-Posting-Date: 27 May 2012 21:08:43 CEST Original-NNTP-Posting-Host: 5a85d871.newsspool4.arcor-online.net Original-X-Trace: DXC=nhPWbJ6T26`]BlmkiiU@Bi4IUKda4SNn9bB_Neh; dBi?kMZld?]1MiSgXGm=Tb>LV@n[l4X@X=QFch Original-X-Complaints-To: usenet-abuse@arcor.de Original-Xref: usenet.stanford.edu gnu.emacs.help:192616 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:85022 Archived-At: * 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