1 ;;; scrbase.el --- AUCTeX style for the KOMA-Script bundle.
3 ;; Copyright (C) 2002, 2004, 2005, 2007 Free Software Foundation, Inc.
5 ;; Author: Mark Trettin <Mark.Trettin@gmx.de>
9 ;; This file is part of AUCTeX.
11 ;; AUCTeX is free software; you can redistribute it and/or modify it
12 ;; under the terms of the GNU General Public License as published by
13 ;; the Free Software Foundation; either version 3, or (at your option)
16 ;; AUCTeX is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ;; General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with AUCTeX; see the file COPYING. If not, write to the Free
23 ;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
28 ;; This file adds support for the KOMA-Script bundle. This file
29 ;; contains the base definitions that work with all KOMA-Script
30 ;; classes (scrarctl.cls, scrreprt.cls, scrbook.cls and scrlttr2.cls).
31 ;; You need this file since it's loaded from the class-styles.
34 (TeX-add-style-hook "scrbase"
39 '("addtokomafont" TeX-arg-KOMA-fontelements t)
40 '("areaset" [ "BCOR" ] "Width" "Height")
41 '("captionabove" [ "Lof entry" ] "Caption")
42 '("captionbelow" [ "Lof entry" ] "Caption")
43 '("cleardoubleemptypage")
44 '("cleardoubleplainpage")
45 '("cleardoublestandardpage")
47 '("deffootnote" [ "Mark width" ] "Indent" "Parindent" "Definition")
48 '("deffootnotemark" "Definition")
50 '("ifpdfoutput" t nil)
51 '("ifthispageodd" t nil)
53 '("maketitle" [ "Pagenumber" ])
55 '("publishers" "Publishers")
56 '("sectionmark" "Running head")
57 '("setbibpreamble" "Preamble")
59 '("setcapindent" "Indent")
60 '("setcapindent*" "X-Indent")
61 '("setcapmargin" [ "Margin left" ] "Margin")
62 '("setcapmargin*" [ "Margin inside" ] "Margin")
63 '("setcapwidth" [ TeX-arg-KOMA-capjust ] "Width")
64 '("setindexpreamble" "Preamble")
65 '("setkomafont" TeX-arg-KOMA-fontelements t)
66 '("subject" "Subject")
67 '("subsectionmark" "Running head")
68 '("textsubscript" "Text")
69 '("thanks" "Footnote")
73 '("usekomafont" TeX-arg-KOMA-fontelements))
74 (LaTeX-add-environments
75 '("labeling" (lambda (env &rest ignore)
76 (LaTeX-insert-environment
78 (let ((delim (read-string "(Optional) Delimiter: "))
79 (width (read-string "Longest item: ")))
81 (if (not (zerop (length delim)))
82 (format "[%s]" delim))
83 (format "{%s}" width))))
84 (LaTeX-find-matching-begin)
87 '("addmargin" (lambda (env &rest ignore)
88 (LaTeX-insert-environment
90 (let ((leftin (read-string "(Optional) Left Indentation: "))
91 (indent (read-string "Indentation: ")))
93 (if (not (zerop (length leftin)))
94 (format "[%s]" leftin))
95 (format "{%s}" indent))))))
96 '("addmargin*" (lambda (env &rest ignore)
97 (LaTeX-insert-environment
99 (let ((innin (read-string "(Optional) Inner Indentation: "))
100 (indent (read-string "Indentation: ")))
102 (if (not (zerop (length innin)))
103 (format "[%s]" innin))
104 (format "{%s}" indent))))))
105 '("captionbeside" (lambda (env &rest ignore)
106 (LaTeX-insert-environment
108 (let ((lofent (read-string "(Optional) Lof Entry: "))
109 (title (read-string "Caption: "))
110 (place (read-string "(Optional) Placement (l,r,o,i): "))
111 (width (read-string "(Optional) Width: "))
112 (offset (read-string "(Optional) Offset: ")))
114 (if (not (zerop (length lofent)))
115 (format "[%s]" lofent))
116 (format "{%s}" title)
117 (if (not (zerop (length place)))
118 (format "[%s]" place))
119 (if (not (zerop (length width)))
120 (format "[%s]" width))
122 (not (zerop (length place)))
123 (not (zerop (length offset)))
124 (format "[%s]%s" offset
125 (if (y-or-n-p "Starred? ")
127 (LaTeX-section-list-add-locally '(("addpart" 0)
130 ;; This doesn't work. Maybe it's RefTeX's label insertion?
131 (make-local-variable 'LaTeX-section-label)
132 (setq LaTeX-section-label (append
138 (when (and (featurep 'font-latex)
139 (eq TeX-install-font-lock 'font-latex-setup))
141 (font-latex-add-keywords '(("captionabove" "[{")
142 ("captionbelow" "[{")
145 ("lowertitleback" "{")
151 ("setbibpreamble" "{")
152 ("setindexpreamble" "{")
153 ("subsectionmark" "{")
154 ("textsubscript" "{")
156 ("uppertitleback" "{"))
159 (font-latex-add-keywords '(("deffootnote" "[{{{")
160 ("deffootnotemark" "{")
162 ("ifthispageodd" "{{"))
165 (font-latex-add-keywords '(("addtokomafont" "{{")
169 ("setcapmargin" "*[{")
176 (font-latex-add-keywords '("cleardoublestandardpage"
177 "cleardoubleplainpage"
178 "cleardoubleemptypage")
180 ;; Sectioning keywords
181 (font-latex-add-keywords '(("addpart" "[{")) 'sectioning-1)
182 (font-latex-add-keywords '(("addsec" "[{")) 'sectioning-2)
183 (font-latex-add-keywords '(("minisec" "[{")) 'sectioning-4))))
185 (defun TeX-arg-KOMA-setpreamble (optional &optional prompt)
186 "Prompt for KOMA-Script's \\set*preamble position with completion."
189 (TeX-argument-prompt optional prompt "Position")
190 '(("") ("l") ("r") ("c") ("o") ("u")
191 ("lo") ("lu") ("ro") ("ru") ("co") ("cu"))
195 (defun TeX-arg-KOMA-capjust (optional &optional prompt)
196 "Prompt for KOMA-Script's \\setcapwidth justification with completion."
199 (TeX-argument-prompt optional prompt "Justification")
200 '(("") ("l") ("r") ("c") ("i") ("o"))
204 (defun TeX-arg-KOMA-fontelements (optional &optional prompt)
205 "Prompt for KOMA-Script's fontelements with completion."
208 (TeX-argument-prompt optional prompt "Element")
210 ("caption") ("captionlabel")
211 ("descriptionlabel") ("dictum") ("dictumauthor") ("dictumtext")
212 ("footnote") ("footnotelabel") ("footnotereference")
213 ("pagefoot") ("pagehead") ("pagenumber") ("pagination")
214 ("sectioning") ("part") ("partnumber") ("chapter") ("section")
215 ("subsection") ("subsubsection") ("paragraph") ("subparagraph")
216 ("title") ("disposition") ("minisec"))
220 (add-to-list 'LaTeX-item-list '("labeling" . LaTeX-item-argument))
222 ;;; scrbase.el ends here