Hi,

this patch adds support for `wrapfig.sty' and `relsize.sty'.  Any
comments welcome.

Best, Arash

>From ff0773d10cdd865566139a57ac00160d34d46922 Mon Sep 17 00:00:00 2001
From: Arash <esb...@gmx.de>
Date: Tue, 30 Dec 2014 16:50:48 +0100
Subject: [PATCH 2/3] Add new styles.

* Makefile.in (STYLESRC): Add new styles.

* style/relsize.el: New file.

* style/wrapfig.el: New file.
---
 ChangeLog        |   6 ++++
 Makefile.in      |   3 +-
 style/relsize.el |  69 +++++++++++++++++++++++++++++++++++
 style/wrapfig.el | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 184 insertions(+), 1 deletion(-)
 create mode 100644 style/relsize.el
 create mode 100644 style/wrapfig.el

diff --git a/ChangeLog b/ChangeLog
index 9baf491..22c474d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2014-12-30  Arash Esbati  <esb...@gmx.de>
 
+	* Makefile.in (STYLESRC): Add new styles.
+
+	* style/relsize.el: New file.
+
+	* style/wrapfig.el: New file.
+
 	* style/hyperref.el ("hyperref"): Add `Form' environment needed
 	for PDF and HTML forms.
 	(LaTeX-hyperref-forms-options): New variable for key-val options
diff --git a/Makefile.in b/Makefile.in
index a132c1c..3d3210c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -142,7 +142,8 @@ STYLESRC = style/prosper.el \
 	   style/XCharter.el  style/zlmtt.el     style/ifluatex.el \
 	   style/luatextra.el style/erewhon.el   style/baskervaldx.el \
 	   style/fbb.el       style/newtxmath.el style/newtxsf.el \
-	   style/newtxtext.el style/newtxttt.el
+	   style/newtxtext.el style/newtxttt.el  style/wrapfig.el \
+	   style/relsize.el
 STYLEELC = $(STYLESRC:.el=.elc)
 
 ifeq (@preview_enabled@,yes)
diff --git a/style/relsize.el b/style/relsize.el
new file mode 100644
index 0000000..20dc975
--- /dev/null
+++ b/style/relsize.el
@@ -0,0 +1,69 @@
+;;; relsize.el --- AUCTeX style for `relsize.sty' version v4.1
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2014-12-14
+;; 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 `relsize.sty' version v4.1 from
+;; 2013/03/29.  `relsize.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "relsize"
+ (lambda ()
+   (TeX-add-symbols
+    ;; Declarations and commands
+    '("relsize"     "Steps"                    )
+    '("relscale"    "Scale factor"             )
+    '("larger"      [ "Steps (default: 1)" ] -1)
+    '("smaller"     [ "Steps (default: 1)" ] -1)
+    '("textlarger"  [ "Steps" ]               t)
+    '("textsmaller" [ "Steps" ]               t)
+    '("textscale"   "Scale factor"            t)
+    '("mathlarger"                            t)
+    '("mathsmaller"                           t))
+
+   ;; Fontification
+   (when (and (featurep 'font-latex)
+	      (eq TeX-install-font-lock 'font-latex-setup))
+     ;; This is not easy, are the first 2 'variable oder rather
+     ;; 'type-declaration?  I start with 'type-declaration, let the
+     ;; users decide
+     (font-latex-add-keywords '(("relsize"            "")
+				("relscale"           "")
+				("larger"             "")
+				("smaller"            ""))
+			      'type-declaration)
+     (font-latex-add-keywords '(("textlarger"         "[{")
+				("textsmaller"        "[{")
+				("textscale"          "{{"))
+			      'type-command)))
+ LaTeX-dialect)
+
+(defvar LaTeX-relsize-package-options nil
+  "Package options for the relsize package.")
+
+;;; relsize.el ends here
diff --git a/style/wrapfig.el b/style/wrapfig.el
new file mode 100644
index 0000000..bcb90c2
--- /dev/null
+++ b/style/wrapfig.el
@@ -0,0 +1,107 @@
+;;; wrapfig.el --- AUCTeX style for `wrapfig.sty' version v3.6
+
+;; Copyright (C) 2014 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: auctex-devel@gnu.org
+;; Created: 2014-12-13
+;; 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 `wrapfig.sty' version v3.6 from
+;; 2003/01/31.  `wrapfig.sty' is part of TeXLive.
+
+;;; Code:
+
+(TeX-add-style-hook
+ "wrapfig"
+ (lambda ()
+   (LaTeX-add-environments
+    ;; \begin{wrapfigure}[No.lines]{Placement}[Overhang]{Width} ... \end{wrapfigure}
+    '("wrapfigure"
+      (lambda (env &rest ignore)
+	(LaTeX-insert-environment
+	 env
+	 (let ((narrow    (read-string "(Optional) Number of narrow lines: "))
+	       (placement (completing-read
+			   "Placement: " '(("r") ("R")
+					   ("l") ("L")
+					   ("i") ("I")
+					   ("o") ("O"))))
+	       (overhang  (read-string "(Optional) Overhang: "))
+	       (width     (read-string "Width: ")))
+	   (concat
+	    (unless (string= narrow "")
+	      (format "[%s]" narrow))
+	    (format "{%s}" placement)
+	    (unless (string= overhang "")
+	      (format "[%s]" overhang))
+	    (format "{%s}" width))))))
+    ;;
+    ;; \begin{wraptable}[No.lines]{Placement}[Overhang]{Width} ... \end{wraptable}
+    '("wraptable"
+      (lambda (env &rest ignore)
+	(LaTeX-insert-environment
+	 env
+	 (let ((narrow    (read-string "(Optional) Number of narrow lines: "))
+	       (placement (completing-read
+			   "Placement: " '(("r") ("R")
+					   ("l") ("L")
+					   ("i") ("I")
+					   ("o") ("O"))))
+	       (overhang  (read-string "(Optional) Overhang: "))
+	       (width     (read-string "Width: ")))
+	   (concat
+	    (unless (string= narrow "")
+	      (format "[%s]" narrow))
+	    (format "{%s}" placement)
+	    (unless (string= overhang "")
+	      (format "[%s]" overhang))
+	    (format "{%s}" width))))))
+    ;;
+    ;; \begin{wrapfloat}{<Type>}[No.lines]{Placement}[Overhang]{Width} ... \end{wrapfloat}
+    '("wrapfloat"
+      (lambda (env &rest ignore)
+	(LaTeX-insert-environment
+	 env
+	 (let ((floattype (read-string "Float type: "))
+	       (narrow    (read-string "(Optional) Number of narrow lines: "))
+	       (placement (completing-read
+			   "Placement: " '(("r") ("R")
+					   ("l") ("L")
+					   ("i") ("I")
+					   ("o") ("O"))))
+	       (overhang  (read-string "(Optional) Overhang: "))
+	       (width     (read-string "Width: ")))
+	   (concat
+	    (format "{%s}" floattype)
+	    (unless (string= narrow "")
+	      (format "[%s]" narrow))
+	    (format "{%s}" placement)
+	    (unless (string= overhang "")
+	      (format "[%s]" overhang))
+	    (format "{%s}" width))))))))
+ LaTeX-dialect)
+
+(defvar LaTeX-wrapfig-package-options '("verbose")
+  "Package options for the wrapfig package.")
+
+;;; wrapfig.el ends here
-- 
2.2.1

_______________________________________________
auctex-devel mailing list
auctex-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to