EasyPG 1.07 Released
[packages] / xemacs-packages / auctex / style / hologo.el
1 ;;; hologo.el --- AUCTeX style for `hologo.sty' (v1.10)
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-10-31
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 `hologo.sty' (v1.10) from 2012/04/26.
30 ;;  `hologo.sty' is part of TeXLive.
31
32 ;;; Code:
33
34 (defvar LaTeX-hologo-logo-names
35   '("(La)TeX"
36     "AmSLaTeX"
37     "AmSTeX"
38     "biber"
39     "BibTeX"
40     "BibTeX8"
41     "ConTeXt"
42     "emTeX"
43     "eTeX"
44     "ExTeX"
45     "HanTheThanh"
46     "iniTeX"
47     "KOMAScript"
48     "La"
49     "LaTeX"
50     "LaTeX2e"
51     "LaTeX3"
52     "LaTeXe"
53     "LaTeXML"
54     "LaTeXTeX"
55     "LuaLaTeX"
56     "LuaTeX"
57     "LyX"
58     "METAFONT"
59     "MetaFun"
60     "METAPOST"
61     "MetaPost"
62     "MiKTeX"
63     "NTS"
64     "OzMF"
65     "OzMP"
66     "OzTeX"
67     "OzTtH"
68     "PCTeX"
69     "pdfTeX"
70     "pdfLaTeX"
71     "PiC"
72     "PiCTeX"
73     "plainTeX"
74     "SageTeX"
75     "SLiTeX"
76     "SliTeX"
77     "teTeX"
78     "TeX"
79     "TeX4ht"
80     "TTH"
81     "virTeX"
82     "VTeX"
83     "Xe"
84     "XeLaTeX"
85     "XeTeX")
86   "List of logos provided by \"hologo.sty\".")
87
88 (defvar LaTeX-hologo-key-val-options-global
89   '(("break"              ("true" "false"))
90     ("hyphenbreak"        ("true" "false"))
91     ("spacebreak"         ("true" "false"))
92     ("discretionarybreak" ("true" "false")))
93   "Global key=value options for hologo macros.")
94
95 (defvar LaTeX-hologo-key-val-options-local
96   '(("variant" ("sf" "sc"                          ; BibTeX
97                 "lift"                             ; SliTeX
98                 "narrow" "simple"                  ; SliTeX, ConTeXt
99                 "space"  "hyphen" "runtogether"))) ; plainTeX
100   "Local key=value options for hologo macros.")
101
102 (TeX-add-style-hook
103  "hologo"
104  (lambda ()
105    (TeX-add-symbols
106
107     ;; Insert logo macros
108     '("hologo" (TeX-arg-eval completing-read
109                              "Logo name: " LaTeX-hologo-logo-names))
110
111     '("Hologo" (TeX-arg-eval completing-read
112                              "Logo name: " LaTeX-hologo-logo-names))
113
114     ;; Setup macros
115     '("hologoSetup" (TeX-arg-key-val LaTeX-hologo-key-val-options-global))
116
117     '("hologoLogoSetup"
118       (TeX-arg-eval
119        (lambda ()
120          (let* ((logo   (completing-read "Logo name: " LaTeX-hologo-logo-names))
121                 (keyval (TeX-read-key-val
122                          nil
123                          (cond ((string= logo "BibTeX")
124                                 (append '(("variant" ("sf" "sc")))
125                                         LaTeX-hologo-key-val-options-global))
126                                ((string= logo "ConTeXt")
127                                 (append '(("variant" ("narrow" "simple")))
128                                         LaTeX-hologo-key-val-options-global))
129                                ((string= logo "plainTeX")
130                                 (append '(("variant" ("space" "hyphen" "runtogether")))
131                                         LaTeX-hologo-key-val-options-global))
132                                ((or (string= logo "SLiTeX")
133                                     (string= logo "SliTeX"))
134                                 (append '(("variant" ("lift" "narrow" "lift")))
135                                         LaTeX-hologo-key-val-options-global))
136                                (t
137                                 LaTeX-hologo-key-val-options-global)))))
138            (TeX-argument-insert logo optional)
139            (format "%s" keyval)))))
140
141     '("hologoDriverSetup" (TeX-arg-eval completing-read
142                                         "Driver: "
143                                         '("pdftex"  "luatex"
144                                           "dvipdfm" "dvipdfmx"
145                                           "dvips"   "dvipsone" "xdvi"
146                                           "xetex"   "vtex"     "driverfallback")))
147
148     '("hologoFontSetup"
149       (TeX-arg-key-val (("general") ("bibsf")
150                         ("rm") ("sc") ("sf") ("sy") ("logo"))))
151
152     '("hologoLogoFontSetup"
153       (TeX-arg-eval
154        (lambda ()
155          (let* ((logo   (completing-read "Logo name: "
156                                          '("BibTeX"
157                                            "ExTeX"
158                                            "SliTeX"
159                                            "AmS"
160                                            "NTS"
161                                            "KOMAScript"
162                                            "METAFONT"
163                                            "METAPOST")))
164                 (keyval (TeX-read-key-val
165                          nil
166                          (cond ((string= logo "BibTeX")
167                                 '(("bibsf") ("sc")))
168                                ((string= logo "ExTeX")
169                                 '(("rm") ("sy")))
170                                ((string= logo "SliTeX")
171                                 '(("rm") ("sc")))
172                                ((or (string= logo "AmS")
173                                     (string= logo "NTS"))
174                                 '(("sy")))
175                                ((string= logo "KOMAScript")
176                                 '(("sf")))
177                                ((or (string= logo "METAFONT")
178                                     (string= logo "METAPOST"))
179                                 '(("logo")))
180                                (t
181                                 nil)))))
182            (TeX-argument-insert logo optional)
183            (format "%s" keyval)))))
184
185     ;; Additional user macros
186     '("hologoVariant"
187       (TeX-arg-eval completing-read
188                     "Logo name: " LaTeX-hologo-logo-names)
189       (TeX-arg-eval
190        (lambda ()
191          (let ((setup (TeX-read-key-val
192                        nil
193                        (append LaTeX-hologo-key-val-options-local
194                                LaTeX-hologo-key-val-options-global))))
195            (format "%s" setup)))))
196
197     '("HologoVariant"
198       (TeX-arg-eval completing-read
199                     "Logo name: " LaTeX-hologo-logo-names)
200       (TeX-arg-eval
201        (lambda ()
202          (let ((setup (TeX-read-key-val
203                        nil
204                        (append LaTeX-hologo-key-val-options-local
205                                LaTeX-hologo-key-val-options-global))))
206            (format "%s" setup)))))
207
208     '("hologoList" 0)
209
210     '("hologoEntry" "Logo name" "Variant" "Since"))
211
212    ;; Fontification
213    (when (and (featurep 'font-latex)
214               (eq TeX-install-font-lock 'font-latex-setup))
215      (font-latex-add-keywords '(("hologo"   "{")
216                                 ("Hologo"   "{"))
217                               'textual)
218      (font-latex-add-keywords '(("hologoSetup"         "{")
219                                 ("hologoLogoSetup"     "{{")
220                                 ("hologoDriverSetup"   "{")
221                                 ("hologoFontSetup"     "{")
222                                 ("hologoLogoFontSetup" "{{")
223                                 ("hologoVariant"       "{{")
224                                 ("HologoVariant"       "{{")
225                                 ("hologoList"          "")
226                                 ("hologoEntry"         "{{{"))
227                               'function)))
228  LaTeX-dialect)
229
230 (defvar LaTeX-hologo-package-options nil
231   "Package options for the hologo package.")
232
233 ;;; hologo.el ends here