From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tariq Newsgroups: gmane.emacs.help Subject: Re: How to get xetex/xelatex option in the Emacs menu? Date: Fri, 23 Apr 2010 12:11:35 -0700 (PDT) Organization: http://groups.google.com Message-ID: <45f0c259-d394-4ab8-9f44-2a4d85a86302@g23g2000yqn.googlegroups.com> References: <87ljcem3jb.fsf@mithlond.arda> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1273063818 24318 80.91.229.12 (5 May 2010 12:50:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 May 2010 12:50:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed May 05 14:50:17 2010 connect(): No such file or directory Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1O9e3M-0001mO-6Y for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 14:50:16 +0200 Original-Received: from localhost ([127.0.0.1]:55017 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O9e3L-0007l1-Iu for geh-help-gnu-emacs@m.gmane.org; Wed, 05 May 2010 08:50:15 -0400 Original-Path: usenet.stanford.edu!postnews.google.com!g23g2000yqn.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 48 Original-NNTP-Posting-Host: 70.33.84.130 Original-X-Trace: posting.google.com 1272049895 27757 127.0.0.1 (23 Apr 2010 19:11:35 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 23 Apr 2010 19:11:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: g23g2000yqn.googlegroups.com; posting-host=70.33.84.130; posting-account=j4-J0goAAACTdeq3UQ6SnmoX2cXrehae User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:177844 X-Mailman-Approved-At: Tue, 04 May 2010 16:56:07 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:73434 Archived-At: On Apr 23, 2:23=A0pm, Teemu Likonen wrote: > * 2010-04-23 10:54 (-0700), Tariq wrote: > > > I would like to include in one of these menus (preferably under the > > Command menu) the option to run xetex/xelatex also so that I can use > > Emacs to compile XeLaTeX files. > > You could do it with hook: > > =A0 =A0 (add-hook 'LaTeX-mode-hook #'my-latex-mode-hook) > > =A0 =A0 (defun my-latex-mode-hook () > =A0 =A0 =A0 (add-to-list 'TeX-command-list > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'("XeLaTeX" "%`xelatex%(mode)%' %t= " TeX-run-TeX nil t))) > > The following is a fancier version of the hook. It sets XeLaTeX the > default compiler when it finds fontspec or mathspec package being loaded > with \usepackage{}. > > =A0 =A0 (defun my-latex-mode-hook () > =A0 =A0 =A0 (add-to-list 'TeX-command-list > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0'("XeLaTeX" "%`xelatex%(mode)%' %t= " TeX-run-TeX nil t)) > =A0 =A0 =A0 (setq TeX-command-default > =A0 =A0 =A0 =A0 =A0 =A0 (save-excursion > =A0 =A0 =A0 =A0 =A0 =A0 =A0 (save-restriction > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (widen) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (goto-char (point-min)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (let ((re (concat "^\\s-*\\\\usepackage\\= (?:\\[.*\\]\\)?" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "{.*\= \<\\(?:font\\|math\\)spec\\>.*}"))) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (if (re-search-forward re 3000 t) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "XeLaTeX" > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "LaTeX")))))) Perhaps I am being too demanding here (but considering this is Emacs we are talking about, it should come as no surprise): it possible to have a little icon or something show up (along with other icons below the main menu) indicating XeLaTeX and one could just click with mouse to run xelatex? I see LaTeX (or pdf) icons among others that do this for pdflatex or latex. Best regards, Tariq