all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Haines Brown <haines@histomat.net>
To: Teemu Likonen <tlikonen@iki.fi>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Having .emacs distinguish betweeen LaTeX and XeLaTeX
Date: Sun, 27 May 2012 09:31:33 -0400	[thread overview]
Message-ID: <20120527133133.GY4844@histomat.net> (raw)
In-Reply-To: <87d35pzxep.fsf@mithlond.arda>

On Sun, May 27, 2012 at 02:16:46PM +0300, Teemu Likonen wrote:
> * 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))

If I understand, this presumes that initially latex is the default 
TeX-engine, but it adds the xelatex engine to the available commands 
if the expression is matched. This expression is way beyond my ken. 

Would it be possible instead to put a comment line just before the 
preamble of a document that contains either the word "latex" or 
"xelatex" (assuming those words do not appear elsewhere in the 
document) and base the forward search on it? Also, for my purposes it 
would probably be more convenient to make xelatex the default 
TeX-engine and if the word "latex" is found it would instead be used 
as the TeX-engine. I assume this would also avoid having to enlarge 
the TeX-command-list because I suppose latex would already be in it.

Haines 



  reply	other threads:[~2012-05-27 13:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-27 11:00 Having .emacs distinguish betweeen LaTeX and XeLaTeX Haines Brown
2012-05-27 11:16 ` Teemu Likonen
2012-05-27 13:31   ` Haines Brown [this message]
2012-05-27 17:06   ` Haines Brown
2012-05-27 12:51 ` XeCycle
2012-05-27 19:08 ` Ralf Angeli

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

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

  git send-email \
    --in-reply-to=20120527133133.GY4844@histomat.net \
    --to=haines@histomat.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tlikonen@iki.fi \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.