summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/altsubsup/altsubsup.el
blob: 8d2346bec68c3cdd65908311bcf40bcfe8bdd438 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
;;; altsubsup.el --- AUCTeX style for `altsubsup.sty'

;; Copyright (C) 2022 by Julien Labbé <Julien.Labbe@univ-grenoble-alpes.fr>

;; This file may be distributed and/or modified under the conditions of the LaTeX
;; Project Public License, either version 1.3 of this license or (at your option)
;; any later version. The latest version of this license is in:
;;      http://www.latex-project.org/lppl.txt
;; and version 1.3 or later is part of all distributions of LaTeX version
;; 2005/12/01 or later.

;;; Commentary:

;; This file adds support for `altsubsup.sty'.

;;; Code:

;; Silence the compiler:

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

   ;; New symbols
   (TeX-add-symbols
    "SetAltSubscriptCommand"
    "SetAltSuperscriptCommand"
    "SetAltSubSupCommands")

   ;; Fontification
   (when (and (featurep 'font-latex)
	      (eq TeX-install-font-lock 'font-latex-setup))
     (add-hook 'TeX-update-style-hook
             (lambda ()
               (font-lock-add-keywords
                nil
                (list
                 '("\\^\\(\\[[^]]*\\]\\)" (1 'font-latex-superscript-face))
                 '("_\\(\\[[^]]*\\]\\)"   (1 'font-latex-subscript-face))))))))

LaTeX-dialect)

;;; altsubsup.el ends here