unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tariq <tariq.perwez@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to get xetex/xelatex option in the Emacs menu?
Date: Fri, 23 Apr 2010 12:04:23 -0700 (PDT)	[thread overview]
Message-ID: <52ac7ffb-26b3-4d04-b722-3802190ca554@j17g2000yqa.googlegroups.com> (raw)
In-Reply-To: 87ljcem3jb.fsf@mithlond.arda

On Apr 23, 2:23 pm, Teemu Likonen <tliko...@iki.fi> 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:
>
>     (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"))))))

Thank you so much for the code for two hooks. Consider this my naivity
but I cannot tell the difference (if any) in the behaviour of Emacs
when using the first or the second (fancier) hook. Specifically, I see
the appearance of XeLaTeX under the Command menu after opening a .tex
file and this is the case with either code. Similarly, when I select
(in TeXing Options) PDF Mode, I still need to press XeLaTeX in Command
menu.

I got the impression from your description that with the fancier code,
the LaTeX option would execute XeLaTeX if the file has
\usepackage{fontspec} in it. this does not appear to be the case. Most
likely, I am confused about something. What specifically is the
difference in the expected behaviour of these two codes? I would
appreciate if you could elaborate. Regards,

Tariq



  reply	other threads:[~2010-04-23 19:04 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
2010-04-23 19:04   ` Tariq [this message]
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=52ac7ffb-26b3-4d04-b722-3802190ca554@j17g2000yqa.googlegroups.com \
    --to=tariq.perwez@gmail.com \
    --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).