summaryrefslogtreecommitdiff
path: root/elpa/auctex-13.1.3/style/tex-live.el
blob: b74890d6757b820dfeb959acab232f67c8e69a1a (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
;;; tex-live.el --- AUCTeX style for `tex-live.sty'  -*- lexical-binding: t; -*-

;; Copyright (C) 2020--2021 Free Software Foundation, Inc.

;; Author: Arash Esbati <arash@gnu.org>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2020-03-29
;; Keywords: tex

;; This file is part of AUCTeX.

;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING.  If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.

;;; Commentary:

;; This file adds support for `tex-live.sty' from 2019/08/14.
;; `tex-live.sty' is part of TeXLive.

;; Chances are high that this style is not feature complete, and
;; fontification is not ideal.  But this might be a starting point for
;; TeXLive documentation editors who use AUCTeX.

;;; Code:

(require 'tex)
(require 'latex)

;; Silence the compiler:
(declare-function LaTeX-add-fancyvrb-environments
                  "fancyvrb"
                  (&rest fancyvrb-environments))
(declare-function LaTeX-fancyvrb-key-val-options "fancyvrb" ())

(declare-function font-latex-add-keywords
                  "font-latex"
                  (keywords class))

(TeX-add-style-hook
 "tex-live"
 (lambda ()

   ;; Run hooks for required packages:
   (TeX-run-style-hooks "geometry"
                        "alltt"
                        "array"
                        "colortbl"
                        "comment"
                        "float"
                        "graphicx"
                        "longtable"
                        "ulem"
                        "url"
                        "xspace"
                        "relsize"
                        "fancyvrb")

   ;; Add | to a local version of `LaTeX-shortvrb-chars' before
   ;; running the style hook `shortvrb.el':
   (add-to-list (make-local-variable 'LaTeX-shortvrb-chars) ?|)
   (TeX-run-style-hooks "shortvrb")

   ;; Add support for custom environments defined with `fancyvrb.sty':
   (LaTeX-add-fancyvrb-environments
    '("verbatim" "Verbatim")
    '("sverbatim" "Verbatim")
    '("fverbatim" "Verbatim")
    '("boxedverbatim" "Verbatim"))

   (TeX-add-symbols
    '("verbatiminput" LaTeX-fancyvrb-arg-file-relative)
    '("boxedverbatiminput" LaTeX-fancyvrb-arg-file-relative)
    '("listinginput"
      (TeX-arg-eval completing-read
                    (TeX-argument-prompt nil nil "Value of firstnumber key")
                    (cadr (assoc "firstnumber" (LaTeX-fancyvrb-key-val-options))))
      LaTeX-fancyvrb-arg-file-relative)

    ;; Various sorts of names:
    '("pkgname" "Package")
    '("optname" "Option")
    '("cmdname" "Command")
    '("colname" "Collection")
    '("dirname" "Directory")
    '("filename" "Directory")
    '("envname"
      (TeX-arg-eval completing-read
                    (TeX-argument-prompt nil nil "Environment")
                    '("TEXMFCACHE"
                      "TEXMFCNF"
                      "TEXMFCONFIG"
                      "TEXMFDIST"
                      "TEXMFHOME"
                      "TEXMFLOCAL"
                      "TEXMFMAIN"
                      "TEXMFOUTPUT"
                      "TEXMFSYSCONFIG"
                      "TEXMFSYSVAR"
                      "TEXMFVAR"
                      "TEXINPUTS"
                      "TEXFONTMAPS"
                      "ENCFONTS"
                      "PATH" "MANPATH" "INFOPATH" "DISPLAY")))
    '("code" "Code")
    '("file" "File")
    '("prog" "Program")
    '("samp" "Sample")
    '("var" "Variable")
    '("ttbar" "Variable (typewriter)")

    '("Ucom" "Command (bold)")

    ;; Special names:
    '("dpi" 0)
    '("bs" 0)
    '("cs" TeX-arg-macro))

   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "dirname")
   (add-to-list 'LaTeX-verbatim-macros-with-braces-local "filename")

   (LaTeX-add-environments
    '("ttdescription" LaTeX-env-item)
    '("cmddescription" LaTeX-env-item)
    '("itemize*" LaTeX-env-item)
    '("enumerate*" LaTeX-env-item)
    '("warningbox")
    '("lrBox"))

   ;; `tex-live.sty' adds one new column specification letter P:
   (set (make-local-variable 'LaTeX-array-column-letters)
        (concat LaTeX-array-column-letters "P"))

   ;; Custom env's where \item takes an opt. argument:
   (let ((envs '("ttdescription" "cmddescription")))
     (dolist (env envs)
       (add-to-list 'LaTeX-item-list `(,env . LaTeX-item-argument) t)))

   ;; Fontification
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("verbatiminput"      "{")
                                ("boxedverbatiminput" "{")
                                ("listinginput"       "{{")
                                ("pkgname"       "{")
                                ("optname"       "{")
                                ("cmdname"       "{")
                                ("colname"       "{")
                                ("dirname"       "")
                                ("filename"      "")
                                ("envname"       "{")
                                ("cs"            "{"))
                              'reference)
     (font-latex-add-keywords '(("code" "{")
                                ("file" "{")
                                ("prog" "{")
                                ("samp" "{")
                                ("ttvar" "{"))
                              'type-command)
     (font-latex-add-keywords '(("var" "{") )
                              'italic-command)
     (font-latex-add-keywords '(("Ucom" "{"))
                              'bold-command)))
 TeX-dialect)

;;; tex-live.el ends here