emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/auctex 5ddbd04 12/57: Add new style/titleps.el


From: Tassilo Horn
Subject: [elpa] externals/auctex 5ddbd04 12/57: Add new style/titleps.el
Date: Wed, 11 Jan 2017 18:01:38 +0000 (UTC)

branch: externals/auctex
commit 5ddbd048163fd1b0c19fc09320aeac1dc3bf2cfe
Author: Arash Esbati <address@hidden>
Commit: Arash Esbati <address@hidden>

    Add new style/titleps.el
    
    * Makefile.in (STYLESRC): Add new style.
    
    * style/titleps.el: New file.
---
 Makefile.in      |    3 +-
 style/titleps.el |  233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 235 insertions(+), 1 deletion(-)

diff --git a/Makefile.in b/Makefile.in
index 0db7ff1..35d7753 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -159,7 +159,8 @@ STYLESRC = style/prosper.el \
           style/framed.el    style/paracol.el   style/menukeys.el \
           style/bidi.el      style/FiraMono.el  style/FiraSans.el \
           style/bicaption.el style/amsfonts.el  style/subfiles.el \
-          style/dcolumn.el   style/mdframed.el  style/tcolorboxlib-raster.el
+          style/dcolumn.el   style/mdframed.el  style/tcolorboxlib-raster.el \
+          style/titleps.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/titleps.el b/style/titleps.el
new file mode 100644
index 0000000..8ef46a8
--- /dev/null
+++ b/style/titleps.el
@@ -0,0 +1,233 @@
+;;; titleps.el --- AUCTeX style for `titleps.sty' (v1.1.1)
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <arash.esbati'at'gmail.com>
+;; Maintainer: address@hidden
+;; Created: 2016-06-22
+;; 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 `titleps.sty' (v1.1.1) from 2016/03/15.
+;; `titleps.sty' is part of TeXLive.
+
+;;; Code:
+
+(defvar LaTeX-titleps-section-command-list
+  '("part"
+    "chapter"
+    "section"
+    "subsection"
+    "subsubsection"
+    "paragraph"
+    "subparagraph")
+  "List of sectioning commands available in \"titleps.sty\".")
+
+(defun LaTeX-titleps-section-command-list ()
+  "Remove \"chapter\" from variable
+`LaTeX-titleps-section-command-list' and return the remainder.
+Removal is based on the return value of function
+`LaTeX-largest-level'."
+  (if (< (LaTeX-largest-level) 2)
+      (symbol-value 'LaTeX-titleps-section-command-list)
+    (remove "chapter" LaTeX-titleps-section-command-list)))
+
+(defvar LaTeX-titleps-newpagestyle-regexp
+  '("\\\\newpagestyle[ \t\n\r%]*{\\([^}]+\\)}" 1 LaTeX-auto-pagestyle)
+  "Match the argument of \"\\newpagestyle\" from titleps.sty.")
+
+(add-hook 'TeX-update-style-hook #'TeX-auto-parse t)
+
+(TeX-add-style-hook
+ "titleps"
+ (lambda ()
+
+   ;; Add titleps to the parser.
+   (TeX-auto-add-regexp LaTeX-titleps-newpagestyle-regexp)
+
+   ;; Add \<section>title's
+   (dolist (sec (LaTeX-titleps-section-command-list))
+     (TeX-add-symbols `(,(concat sec "title") 0)))
+
+   (TeX-add-symbols
+   ;; 2. Defining Page Styles
+    '("newpagestyle"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((ps (TeX-read-string
+                   (TeX-argument-prompt optional nil "Page style"))))
+          (LaTeX-add-pagestyles ps)
+          (format "%s" ps))))
+      (TeX-arg-conditional (y-or-n-p "With optional global style? ")
+                          ( [ t ] nil)
+                        ( t )))
+
+    '("renewpagestyle" TeX-arg-pagestyle
+      (TeX-arg-conditional (y-or-n-p "With optional global style? ")
+                          ( [ t ] nil)
+                        ( t )))
+
+    '("sethead"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil)
+                        ( 3 )))
+
+    '("setfoot"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil)
+                        ( 3 )))
+
+    '("sethead*" 3)
+    '("setfoot*" 3)
+
+    '("settitlemarks"
+      (TeX-arg-eval mapconcat #'identity
+                   (TeX-completing-read-multiple
+                    (TeX-argument-prompt optional nil "Level names")
+                    (LaTeX-titleps-section-command-list))
+                   ","))
+
+    '("settitlemarks"
+      (TeX-arg-eval mapconcat #'identity
+                   (TeX-completing-read-multiple
+                    (TeX-argument-prompt optional nil "Level names")
+                    (LaTeX-titleps-section-command-list))
+                   ","))
+
+    '("headrule" 0)
+    '("setheadrule" "Thickness")
+
+    '("footrule" 0)
+    '("setfootrule" "Thickness")
+
+    '("makeheadrule" 0)
+    '("makefootrule" 0)
+
+    ;; 3. On \markboth and \markleft
+    '("setmarkboth" t)
+    '("resetmarkboth" 0)
+
+    ;; 4. Headline/footline width
+    '("widenhead"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 2 ] nil nil)
+                        ( 2 )))
+
+    '("widenhead*" 2)
+
+    '("TitlepsPatchSection"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Sectioning command")
+                   (LaTeX-titleps-section-command-list)))
+
+    '("TitlepsPatchSection*"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Sectioning command")
+                   (LaTeX-titleps-section-command-list)))
+
+    ;; 5. Marks
+    '("bottitlemarks"     0)
+    '("toptitlemarks"     0)
+    '("firsttitlemarks"          0)
+    '("nexttoptitlemarks" 0)
+    '("outertitlemarks"   0)
+    '("innertitlemarks"   0)
+
+    '("newtitlemark" (TeX-arg-macro "Command name"))
+    '("newtitlemark*" (TeX-arg-counter "Variable name"))
+
+    '("pretitlemark"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Sectioning command")
+                   (LaTeX-titleps-section-command-list))
+      "Text")
+
+    '("pretitlemark*"
+      (TeX-arg-eval completing-read
+                   (TeX-argument-prompt optional nil "Sectioning command")
+                   (LaTeX-titleps-section-command-list))
+      "Text")
+
+    '("ifsamemark"
+      (TeX-arg-macro "Marks group: \\")
+      (TeX-arg-macro "Command: \\")
+      2)
+
+    ;; 6. Running heads with floats
+    '("setfloathead"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil nil [ nil ] )
+                        ( 4 [ nil ] )))
+
+    '("setfloatfoot"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil nil [ nil ] )
+                        ( 4 [ nil ] )))
+
+    '("setfloathead*" 4 [ nil ] )
+    '("setfloatfoot*" 4 [ nil ] )
+
+    '("nextfloathead"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil nil [ nil ] )
+                        ( 4 [ nil ] )))
+
+    '("nextfloatfoot"
+      (TeX-arg-conditional (y-or-n-p "With optional even pages? ")
+                          ( [ 3 ] nil nil nil nil [ nil ] )
+                        ( 4 [ nil ] )))
+
+    '("nextfloathead*" 4 [ nil ] )
+    '("nextfloatfoot*" 4 [ nil ] )
+
+    ;; 7. Extra marks: I'm not clear how the marks commands work;
+    ;; until then, I ignore them
+    )
+
+   (when (and (featurep 'font-latex)
+             (eq TeX-install-font-lock 'font-latex-setup))
+     (font-latex-add-keywords '(("newpagestyle"         "{[{")
+                               ("renewpagestyle"       "{[{")
+                               ("settitlemarks"        "*{")
+                               ("widenhead"            "*[[{{")
+                               ("TitlepsPatchSection"  "*{")
+                               ("newtitlemark"         "*{")
+                               ("pretitlemark"         "*{{")
+                               ("nextfloathead"        "*[[[{{{{[")
+                               ("nextfloatfoot"        "*[[[{{{{["))
+                             'function)))
+ LaTeX-dialect)
+
+(defvar LaTeX-titleps-package-options
+  '(;; 4. Headline/footline width
+    "nopatches"
+
+    ;; 5. Marks
+    "outermarks" "innermarks" "topmarks" "botmarks"
+
+    ;; 6. Running heads with floats
+    "psfloats"
+
+    ;; 7. Extra marks
+    "extramarks")
+  "Package options for the titleps package.")
+
+;;; titleps.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]