1 ;;; titleps.el --- AUCTeX style for `titleps.sty' (v1.1.1)
3 ;; Copyright (C) 2016 Free Software Foundation, Inc.
5 ;; Author: Arash Esbati <arash@gnu.org>
6 ;; Maintainer: auctex-devel@gnu.org
10 ;; This file is part of AUCTeX.
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)
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.
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
29 ;; This file adds support for `titleps.sty' (v1.1.1) from 2016/03/15.
30 ;; `titleps.sty' is part of TeXLive.
34 (defvar LaTeX-titleps-section-command-list
42 "List of sectioning commands available in \"titleps.sty\".")
44 (defun LaTeX-titleps-section-command-list ()
45 "Remove \"chapter\" from variable
46 `LaTeX-titleps-section-command-list' and return the remainder.
47 Removal is based on the return value of function
48 `LaTeX-largest-level'."
49 (if (< (LaTeX-largest-level) 2)
50 (symbol-value 'LaTeX-titleps-section-command-list)
51 (remove "chapter" LaTeX-titleps-section-command-list)))
53 (defvar LaTeX-titleps-newpagestyle-regexp
54 '("\\\\newpagestyle[ \t\n\r%]*{\\([^}]+\\)}" 1 LaTeX-auto-pagestyle)
55 "Match the argument of \"\\newpagestyle\" from titleps.sty.")
57 (add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
63 ;; Add titleps to the parser.
64 (TeX-auto-add-regexp LaTeX-titleps-newpagestyle-regexp)
66 ;; Add \<section>title's
67 (dolist (sec (LaTeX-titleps-section-command-list))
68 (TeX-add-symbols `(,(concat sec "title") 0)))
71 ;; 2. Defining Page Styles
75 (let ((ps (TeX-read-string
76 (TeX-argument-prompt optional nil "Page style"))))
77 (LaTeX-add-pagestyles ps)
79 (TeX-arg-conditional (y-or-n-p "With optional global style? ")
83 '("renewpagestyle" TeX-arg-pagestyle
84 (TeX-arg-conditional (y-or-n-p "With optional global style? ")
89 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
94 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
102 (TeX-arg-eval mapconcat #'identity
103 (TeX-completing-read-multiple
104 (TeX-argument-prompt optional nil "Level names")
105 (LaTeX-titleps-section-command-list))
109 (TeX-arg-eval mapconcat #'identity
110 (TeX-completing-read-multiple
111 (TeX-argument-prompt optional nil "Level names")
112 (LaTeX-titleps-section-command-list))
116 '("setheadrule" "Thickness")
119 '("setfootrule" "Thickness")
124 ;; 3. On \markboth and \markleft
128 ;; 4. Headline/footline width
130 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
136 '("TitlepsPatchSection"
137 (TeX-arg-eval completing-read
138 (TeX-argument-prompt optional nil "Sectioning command")
139 (LaTeX-titleps-section-command-list)))
141 '("TitlepsPatchSection*"
142 (TeX-arg-eval completing-read
143 (TeX-argument-prompt optional nil "Sectioning command")
144 (LaTeX-titleps-section-command-list)))
149 '("firsttitlemarks" 0)
150 '("nexttoptitlemarks" 0)
151 '("outertitlemarks" 0)
152 '("innertitlemarks" 0)
154 '("newtitlemark" (TeX-arg-macro "Command name"))
155 '("newtitlemark*" (TeX-arg-counter "Variable name"))
158 (TeX-arg-eval completing-read
159 (TeX-argument-prompt optional nil "Sectioning command")
160 (LaTeX-titleps-section-command-list))
164 (TeX-arg-eval completing-read
165 (TeX-argument-prompt optional nil "Sectioning command")
166 (LaTeX-titleps-section-command-list))
170 (TeX-arg-macro "Marks group: \\")
171 (TeX-arg-macro "Command: \\")
174 ;; 6. Running heads with floats
176 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
177 ( [ 3 ] nil nil nil nil [ nil ] )
181 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
182 ( [ 3 ] nil nil nil nil [ nil ] )
185 '("setfloathead*" 4 [ nil ] )
186 '("setfloatfoot*" 4 [ nil ] )
189 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
190 ( [ 3 ] nil nil nil nil [ nil ] )
194 (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
195 ( [ 3 ] nil nil nil nil [ nil ] )
198 '("nextfloathead*" 4 [ nil ] )
199 '("nextfloatfoot*" 4 [ nil ] )
201 ;; 7. Extra marks: I'm not clear how the marks commands work;
202 ;; until then, I ignore them
205 (when (and (featurep 'font-latex)
206 (eq TeX-install-font-lock 'font-latex-setup))
207 (font-latex-add-keywords '(("newpagestyle" "{[{")
208 ("renewpagestyle" "{[{")
209 ("settitlemarks" "*{")
210 ("widenhead" "*[[{{")
211 ("TitlepsPatchSection" "*{")
212 ("newtitlemark" "*{")
213 ("pretitlemark" "*{{")
214 ("nextfloathead" "*[[[{{{{[")
215 ("nextfloatfoot" "*[[[{{{{["))
219 (defvar LaTeX-titleps-package-options
220 '(;; 4. Headline/footline width
224 "outermarks" "innermarks" "topmarks" "botmarks"
226 ;; 6. Running heads with floats
231 "Package options for the titleps package.")
233 ;;; titleps.el ends here