[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX
From: |
Teemu Likonen |
Subject: |
Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX |
Date: |
Sun, 27 May 2012 14:16:46 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.97 (gnu/linux) |
* Haines Brown [2012-05-27 07:00:44 -0400] wrote:
> 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))
If you know nothing of Lisp this may not help you but I'll paste my
settings anyway. It could be modified to match your needs.
(add-hook 'LaTeX-mode-hook #'tl-latex-mode-hook)
(defun tl-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\\>.*}")))
(save-match-data
(if (re-search-forward re 3000 t)
"XeLaTeX"
"LaTeX"))))))
(auto-fill-mode 1)
(outline-minor-mode 1)
(abbrev-mode 1)
(setq fill-column 72))