af9542342ae1923fe058dabd1c2aaffbb4f7a5f9
[packages] / xemacs-packages / auctex / style / Alegreya.el
1 ;;; Alegreya.el --- AUCTeX style for `Alegreya.sty' (v2015/10/22)
2
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
4
5 ;; Author: Arash Esbati <arash@gnu.org>
6 ;; Maintainer: auctex-devel@gnu.org
7 ;; Created: 2015-09-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 `Alegreya.sty' (v2015/10/22).
30 ;; `Alegreya.sty' is part of TeXLive.
31
32 ;;; Code:
33
34 (TeX-add-style-hook
35  "Alegreya"
36  (lambda ()
37
38    ;; Run style hook for packages loaded by Alegreya
39    (TeX-run-style-hooks "textcomp")
40
41    ;; Load `fontaxes' or `fontspec' dep. on `type1' option:
42    (if (or (LaTeX-provided-package-options-member "Alegreya" "type1")
43            (LaTeX-provided-package-options-member "Alegreya" "type1=true"))
44        (TeX-run-style-hooks "fontaxes")
45      (TeX-run-style-hooks "fontspec"))
46
47    (TeX-add-symbols
48     ;; Should be used in preamble only
49     '("useosf")
50     ;; Text commands
51     '("Alegreya"      -1)
52     '("AlegreyaBlack" -1)
53     '("AlegreyaLF"    -1)
54     '("AlegreyaOsF"   -1)
55     '("AlegreyaTLF"   -1)
56     '("AlegreyaTOsF"  -1)
57     '("textsu"         t)  ; superior figures
58     '("sufigures"     -1)  ;
59     '("textin"         t)  ; inferior figures
60     '("infigures"     -1))
61
62    ;; Fontification
63    (when (and (featurep 'font-latex)
64               (eq TeX-install-font-lock 'font-latex-setup))
65      (font-latex-add-keywords '(("textsu"    "{")
66                                 ("textin"    "{"))
67                               'type-command)
68      (font-latex-add-keywords '(("Alegreya"      "")
69                                 ("AlegreyaBlack" "")
70                                 ("AlegreyaLF"    "")
71                                 ("AlegreyaOsF"   "")
72                                 ("AlegreyaTLF"   "")
73                                 ("AlegreyaTOsF"  "")
74                                 ("sufigures"     "")
75                                 ("infigures"     ""))
76                               'type-declaration)))
77  LaTeX-dialect)
78
79 (defvar LaTeX-Alegreya-package-options-list
80   '(("lining"       ("true" "false"))
81     ("lf"           ("true" "false"))
82     ("oldstyle"     ("true" "false"))
83     ("osf"          ("true" "false"))
84     ("tabular"      ("true" "false"))
85     ("tf"           ("true" "false"))
86     ("proportional" ("true" "false"))
87     ("pf"           ("true" "false"))
88     ("black"        ("true" "false"))
89     ("type1"        ("true" "false"))
90     ("scaled")
91     ("scale"))
92   "Package options for the Alegreya package.")
93
94 (defun LaTeX-Alegreya-package-options ()
95   "Prompt for package options for the Alegreya package."
96   (TeX-read-key-val t LaTeX-Alegreya-package-options-list))
97
98 ;;; Alegreya.el ends here