Initial Commit
[packages] / xemacs-packages / auctex / style / ulem.el
1 ;;; ulem.el --- AUCTeX style for `ulem.sty'
2
3 ;; Copyright (C) 2012 Free Software Foundation, Inc.
4
5 ;; Author: Mads Jensen <mje@inducks.org>
6 ;; Keywords: tex
7
8 ;; This file is part of AUCTeX.
9
10 ;; AUCTeX is free software; you can redistribute it and/or modify it
11 ;; under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 3, or (at your option)
13 ;; any later version.
14
15 ;; AUCTeX is distributed in the hope that it will be useful, but
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 ;; General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with AUCTeX; see the file COPYING.  If not, write to the Free
22 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 ;; 02110-1301, USA.
24
25 ;;; Commentary:
26
27 ;; This file adds support for `ulem.sty'.
28
29 ;;; Code:
30
31 (TeX-add-style-hook
32  "ulem"
33  (lambda ()
34    (TeX-add-symbols
35     '("uline" 1)
36     '("uuline" 1)
37     '("uwave" 1)
38     '("sout" 1)
39     '("xout" 1)
40     ;; can be used with \renewcommand or \setlength
41     "ULthickness"
42     "ULdepth"
43     ;; custom commands can be defined with these commands; see the
44     ;; documentation for an example
45     "ULon"
46     "markoverwith"
47     ;; \useunder {underline_command}{font_declaration}{font_command}
48     ;; replaces occurences of font_declaration and font_command with the
49     ;; underline_command
50     '("useunder" TeX-arg-ulem-useunder
51       TeX-arg-ulem-fontdecl TeX-arg-ulem-fontcmd))
52
53    ;; Fontification
54    (when (and (featurep 'font-latex)
55               (eq TeX-install-font-lock 'font-latex-setup))
56      ;; Tell font-lock about the update.
57      (font-latex-add-keywords '(("useunder" "{{{")) 'function)
58      (font-latex-add-keywords '(("uline" "{")
59                                 ("uwave" "{")
60                                 ("sout" "{")
61                                 ("xout" "{")) 'textual)))
62  LaTeX-dialect)
63
64 (defvar LaTeX-arg-fontdecl
65   (mapcar (lambda (str) (concat "\\" str))
66           '("itshape" "bfseries" "scshape"
67             "ttfamily" "upshape" "mdseries"
68             "rmfamily" "sffamily" "slshape"))
69   "List of font declaration commands in LaTeX")
70
71 (defvar LaTeX-arg-fontcmd
72   (mapcar (lambda (str) (concat "\\" str))
73           '("textit" "textbf" "textsc"
74             "texttt" "textup" "textmd"
75             "textrm" "textsf" "textsl"))
76   "List of font commands in LaTeX")
77
78 (defun TeX-arg-ulem-fontdecl (optional &optional prompt)
79   "Prompt for the font-declaration un \\useunder"
80   (TeX-argument-insert
81    (completing-read (TeX-argument-prompt
82                      optional prompt "Font declaration")
83                     LaTeX-arg-fontdecl nil t) optional))
84
85 (defun TeX-arg-ulem-fontcmd (optional &optional prompt)
86   "Prompt for the font-declaration un \\useunder"
87   (TeX-argument-insert
88    (completing-read (TeX-argument-prompt
89                      optional prompt "Font command")
90                     LaTeX-arg-fontcmd nil t) optional))
91
92 ;; adapted from url.el:TeX-arg-urlstyle
93 (defun TeX-arg-ulem-useunder (optional &optional prompt)
94   "Prompt for underline command used in \\useunder"
95   (TeX-argument-insert
96    (completing-read (TeX-argument-prompt optional prompt "Underline command")
97                     (mapcar 'list
98                             (mapcar (lambda (str) (concat "\\" str))
99                                     '("uline" "uuline"
100                                       "uwave" "sout" "xout")))
101                     nil t) optional))
102
103 (defvar LaTeX-ulem-package-options
104   '("UWforbf" "ULforem" "normalbf" "normalem")
105   "Package options for the ulem package.")
106
107 ;;; ulem.el ends here