[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get xetex/xelatex option in the Emacs menu?
From: |
Tariq |
Subject: |
Re: How to get xetex/xelatex option in the Emacs menu? |
Date: |
Fri, 23 Apr 2010 12:11:35 -0700 (PDT) |
User-agent: |
G2/1.0 |
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"))))))
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