Uwe Brauer <o...@mat.ucm.es> 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:

 (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"
                  "ottoman" "turk"
                  "malay" "jawi"
     ;; Add \text<language>[option]{...}
     (mapc #'TeX-add-symbols
            (lambda (symbol)
              (list symbol
                    [ TeX-arg-eval completing-read
                                   (TeX-argument-prompt t nil "Mode")
                                   (remove "utf" 
LaTeX-arabxetex-package-options) ]
            (mapcar (lambda (lang) (concat "text" lang)) langs)))

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

   ;; Other macros:
    '("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"     "{"))

(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

auctex-devel mailing list

Reply via email to