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

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

[elpa] externals/auctex e301b71 22/28: Add new style textpos.el.


From: Tassilo Horn
Subject: [elpa] externals/auctex e301b71 22/28: Add new style textpos.el.
Date: Fri, 07 Aug 2015 15:59:26 +0000

branch: externals/auctex
commit e301b716c93418f8de5f03bb3d5d3d6b121f5085
Author: Arash Esbati <address@hidden>
Commit: Mosè Giordano <address@hidden>

    Add new style textpos.el.
    
    Signed-off-by: Mosè Giordano <address@hidden>
---
 ChangeLog        |    4 ++
 Makefile.in      |    2 +-
 style/textpos.el |  111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 116 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 13d1120..9832d21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
 
        * Makefile.in (STYLESRC): Add new style.
 
+       * style/textpos.el: New file.
+
+       * Makefile.in (STYLESRC): Add new style.
+
        * style/environ.el: New file.
 
        * style/tabulary.el ("tabulary"): Add `LCRJ' to
diff --git a/Makefile.in b/Makefile.in
index 0552e52..03ff367 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -149,7 +149,7 @@ STYLESRC = style/prosper.el \
           style/geometry.el  style/ltablex.el   style/ltxtable.el \
           style/mn2e.el      style/colortbl.el  style/attachfile.el \
           style/newpxtext.el style/newpxmath.el style/pdfpages.el \
-          style/mnras.el     style/environ.el
+          style/mnras.el     style/environ.el   style/textpos.el
 
 STYLEELC = $(STYLESRC:.el=.elc)
 
diff --git a/style/textpos.el b/style/textpos.el
new file mode 100644
index 0000000..6732361
--- /dev/null
+++ b/style/textpos.el
@@ -0,0 +1,111 @@
+;;; textpos.el --- AUCTeX style for `textpos.sty' version v1.7j
+
+;; Copyright (C) 2015 Free Software Foundation, Inc.
+
+;; Author: Arash Esbati <esbati'at'gmx.de>
+;; Maintainer: address@hidden
+;; Created: 2015-07-04
+;; 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 `textpos.sty' version v1.7j from
+;; 2014/01/03.  `textpos.sty' is part of TeXLive.
+
+;;; Code:
+
+(defun LaTeX-env-arg-textpos (env)
+  "Query for the arguments of `textpos' environment and insert
+them."
+  (let* ((hsize (TeX-read-string "Width: "))
+        (ho    (TeX-read-string "(Optional) X reference point: "))
+        (vo    (when (not (string-equal ho ""))
+                 (TeX-read-string "Y reference point: ")))
+        (hpos  (TeX-read-string "X placement point: "))
+        (vpos  (TeX-read-string "Y placement point: ")))
+    (LaTeX-insert-environment
+     env
+     (concat
+      (when (and hsize (not (string-equal hsize "")))
+       (format "{%s}" hsize))
+      (when (and ho (not (string-equal ho ""))
+                vo (not (string-equal vo "")))
+       (format "[%s,%s]" ho vo))
+      (when (and hpos (not (string-equal hpos ""))
+                vpos (not (string-equal vpos "")))
+       (format "(%s,%s)" hpos vpos))))))
+
+(defun LaTeX-arg-textpos-tpgrid (optional)
+  "Query and insert the optional argument of `\\TPGrid'."
+  (let* ((x (TeX-read-string "(Optional) X start coordinate: "))
+        (y (when (not (string-equal x ""))
+             (TeX-read-string "Y start coordinate: "))))
+    (when (and (not (string-equal x ""))
+              (not (string-equal y "")))
+      (TeX-argument-insert (format "%s,%s" x y) optional))))
+
+(TeX-add-style-hook
+ "textpos"
+ (lambda ()
+
+   (TeX-run-style-hooks "everyshi" "color")
+
+   (LaTeX-add-environments
+    ;; \begin{textpos}{<hsize>}[<ho>,<vo>](<hpos>,<vpos>) ... \end{textpos}
+    '("textpos"  LaTeX-env-arg-textpos)
+    '("textpos*" LaTeX-env-arg-textpos))
+
+   (TeX-add-symbols
+    '("TPGrid" [ LaTeX-arg-textpos-tpgrid ]
+              "Horizontal fraction" "Vertical fraction")
+
+    '("TPMargin"  (TeX-arg-length "Margin around textblock"))
+    '("TPMargin*" (TeX-arg-length "Margin around textblock"))
+
+    ;; We ignore the `\textblock...color' (i.e. without `u') versions
+    '("textblockcolour"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((color (completing-read "Color name: "
+                                      (LaTeX-color-definecolor-list))))
+          (format "%s" color)))))
+
+    '("textblockrulecolour"
+      (TeX-arg-eval
+       (lambda ()
+        (let ((color (completing-read "Color name: "
+                                      (LaTeX-color-definecolor-list))))
+          (format "%s" color)))))
+
+   '("TPshowboxestrue")
+   '("TPshowboxesfalse")
+
+   '("textblocklabel" t)
+   '("textblockorigin" "Horizontal position" "Vertical position"))
+
+   ;; Add the lengths defined by textpos.sty
+   (LaTeX-add-lengths "TPHorizModule" "TPVertModule" "TPboxrulesize"))
+ LaTeX-dialect)
+
+(defvar LaTeX-textpos-package-options
+  '("showboxes" "noshowtext" "absolute" "overlay" "verbose" "quiet")
+  "Package options for the textpos package.")
+
+;;; textpos.el ends here



reply via email to

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