auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX-devel] TeX-add-local-engine


From: Arash Esbati
Subject: Re: [AUCTeX-devel] TeX-add-local-engine
Date: Sat, 12 Aug 2017 12:38:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2

Uwe Brauer <address@hidden> writes:

> The function TeX-check-engine is not interactive and I can't bind it
> to key.

True, and I think this is intended.

> Hm, but there are files which require xelatex, but auctex fails to auto
> detect it. For example the files found in
> https://tex.stackexchange.com/a/197732/76063
> like
> [...]
> should be compiled with xelatex but does not include
> \usepackage{fontspec}.
>
> I am not sure I will remember all the time to add that line to my latex
> files in question nor do I find that very convenient for other users.
> One could amplify the list of package which requires xelatex for
> scanning and automatic detection, but what's about making
> TeX-check-engine interactive?

I think the best solution is to write an AUCTeX style for
arabxetex.sty :-)  Can you try this and report back?

--8<---------------cut here---------------start------------->8---
;;; Code:

(TeX-add-style-hook
 "arabxetex"
 (lambda ()

   ;; We need xelatex, so check for the engine here:
   (TeX-check-engine-add-engines 'xetex)

   ;; Run the style hooks for packages required by arabxetex:
   (TeX-run-style-hooks "amsmath" "fontspec" "bidi")

   ;; New macros & environments:
   (let ((langs '("arab"
                  "farsi" "persian"
                  "urdu"
                  "sindhi"
                  "pashto"
                  "ottoman" "turk"
                  "kurdisch"
                  "kashmiri"
                  "malay" "jawi"
                  "uighur")))
     ;; Add \text<language>[option]{...}
     (mapc #'TeX-add-symbols
           (mapcar
            (lambda (symbol)
              (list symbol
                    [ TeX-arg-eval completing-read
                                   (TeX-argument-prompt t nil "Mode")
                                   (remove "utf" 
LaTeX-arabxetex-package-options) ]
                    t))
            (mapcar (lambda (lang) (concat "text" lang)) langs)))

     ;; Add \begin{<language>}[option] ... \end{<language>}
     (mapc #'LaTeX-add-environments
           (mapcar
            (lambda (environment)
              (list environment
                    'LaTeX-env-args
                    [ TeX-arg-eval completing-read
                                   (TeX-argument-prompt t nil "Mode")
                                   (remove "utf" 
LaTeX-arabxetex-package-options) ]))
            langs)))

   ;; Other macros:
   (TeX-add-symbols
    '("textLR" t)
    '("aemph" t))

   ;; Fontification
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("textarab"  "[{")
                                ("textfarsi" "[{")
                                ("textLR"    "{")
                                ("aemph"     "{"))
                              'textual)))
 LaTeX-dialect)

(defvar LaTeX-arabxetex-package-options
  '(;; 3 Usage
    "novoc" "voc" "fullvoc" "trans" "utf")
  "Package options for the arabxetex package.")

;;; arabxetex.el ends here
--8<---------------cut here---------------end--------------->8---

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]