AUCTeX Sync -- New Style Files
[packages] / xemacs-packages / auctex / style / arabxetex.el
1 ;;; arabxetex.el --- AUCTeX style for `arabxetex.sty' (v1.2.1)
2
3 ;; Copyright (C) 2017 Free Software Foundation, Inc.
4
5 ;; Author: Arash Esbati <arash@gnu.org>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2017-08-12
8 ;; Keywords: tex
9
10 ;; This file is part of AUCTeX.
11
12 ;; AUCTeX is free software; you can redistribute it and/or modify it
13 ;; under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 3, or (at your option)
15 ;; any later version.
16
17 ;; AUCTeX is distributed in the hope that it will be useful, but
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 ;; General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
24 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 ;; 02110-1301, USA.
26
27 ;;; Commentary:
28
29 ;; This file adds support for `arabxetex.sty' (v1.2.1) from 2015/09/04.
30 ;; `arabxetex.sty' is part of TeXLive.
31
32 ;;; Code:
33
34 (TeX-add-style-hook
35  "arabxetex"
36  (lambda ()
37
38    ;; Run the style hooks for packages required by arabxetex:
39    (TeX-run-style-hooks "amsmath" "fontspec" "bidi")
40
41    ;; We need xelatex, so check for the engine here:
42    (TeX-check-engine-add-engines 'xetex)
43
44    ;; New macros & environments:
45    (let ((langs '("arab"
46                   "farsi" "persian"
47                   "urdu"
48                   "sindhi"
49                   "pashto"
50                   "ottoman" "turk"
51                   "kurdisch"
52                   "kashmiri"
53                   "malay" "jawi"
54                   "uighur")))
55      ;; Add \text<language>[option]{...}
56      (mapc #'TeX-add-symbols
57            (mapcar
58             (lambda (symbol)
59               (list symbol
60                     [ TeX-arg-eval completing-read
61                                    (TeX-argument-prompt optional nil "Mode")
62                                    LaTeX-arabxetex-package-options ]
63                     t))
64             (mapcar (lambda (lang) (concat "text" lang)) langs)))
65      ;;
66      ;; Add \begin{<language>}[option] ... \end{<language>}
67      (mapc #'LaTeX-add-environments
68            (mapcar
69             (lambda (environment)
70               (list environment
71                     #'LaTeX-env-args
72                     [ TeX-arg-eval completing-read
73                                    (TeX-argument-prompt optional nil "Mode")
74                                    LaTeX-arabxetex-package-options ]))
75             langs))
76      ;;
77      ;; Fontification
78      (when (and (featurep 'font-latex)
79                 (eq TeX-install-font-lock 'font-latex-setup))
80        (font-latex-add-keywords (mapcar (lambda (lang)
81                                           (list (concat "text" lang) "[{"))
82                                         langs)
83                                 'textual)))
84
85    ;; Other macros:
86    (TeX-add-symbols
87     '("textLR" t)
88     '("aemph" t)
89
90     ;; 3.3 Transliteration
91     '("SetTranslitConvention"
92       (TeX-arg-eval completing-read
93                     (TeX-argument-prompt optional nil "Mapping")
94                     '("dmg" "loc")))
95     '("SetTranslitStyle" "Style"))
96
97    ;; Fontification
98    (when (and (featurep 'font-latex)
99               (eq TeX-install-font-lock 'font-latex-setup))
100      (font-latex-add-keywords '(("textLR" "{"))
101                               'textual)
102      (font-latex-add-keywords '(("aemph"  "{"))
103                               'italic-command)
104      (font-latex-add-keywords '(("SetTranslitConvention" "{")
105                                 ("SetTranslitStyle"      "{"))
106                               'function)))
107  LaTeX-dialect)
108
109 (defvar LaTeX-arabxetex-package-options
110   '("novoc" "voc" "fullvoc" "trans" "utf")
111   "Package options for the arabxetex package.")
112
113 ;;; arabxetex.el ends here