unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: help-gnu-emacs@gnu.org
Subject: Re: How to get xetex/xelatex option  in the Emacs menu?
Date: Fri, 23 Apr 2010 21:23:20 +0300	[thread overview]
Message-ID: <87ljcem3jb.fsf@mithlond.arda> (raw)
In-Reply-To: f20aa459-0512-4317-98f3-a5e64b816aaf@v14g2000yqb.googlegroups.com

* 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:


    (add-hook 'LaTeX-mode-hook #'my-latex-mode-hook)

    (defun my-latex-mode-hook ()
      (add-to-list 'TeX-command-list
                   '("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{}.


    (defun my-latex-mode-hook ()
      (add-to-list 'TeX-command-list
                   '("XeLaTeX" "%`xelatex%(mode)%' %t" TeX-run-TeX nil t))
      (setq TeX-command-default
            (save-excursion
              (save-restriction
                (widen)
                (goto-char (point-min))
                (let ((re (concat "^\\s-*\\\\usepackage\\(?:\\[.*\\]\\)?"
                                  "{.*\\<\\(?:font\\|math\\)spec\\>.*}")))
                  (if (re-search-forward re 3000 t)
                      "XeLaTeX"
                    "LaTeX"))))))


  reply	other threads:[~2010-04-23 18:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-23 17:54 How to get xetex/xelatex option in the Emacs menu? Tariq
2010-04-23 18:23 ` Teemu Likonen [this message]
2010-04-23 19:04   ` Tariq
2010-04-23 19:45     ` Teemu Likonen
2010-04-23 20:13       ` Tariq
2010-04-23 19:11   ` Tariq
2010-04-23 21:32     ` Ralf Angeli
2010-04-23 21:40       ` Tariq

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljcem3jb.fsf@mithlond.arda \
    --to=tlikonen@iki.fi \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).