changeset 219:ad4e0a008972 dev

Add-in function for figure and refine table.
author yuuji@fusion.yk.gentei.org
date Sun, 15 Jan 2012 09:47:56 +0900
parents 58a023f16e07
children 4bb77d7ee8f0
files yatexadd.el
diffstat 1 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/yatexadd.el	Sun Jan 15 09:08:17 2012 +0900
+++ b/yatexadd.el	Sun Jan 15 09:47:56 2012 +0900
@@ -2,7 +2,7 @@
 ;;; YaTeX add-in functions.
 ;;; yatexadd.el rev.19
 ;;; (c)1991-2011 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Mon Mar  7 12:12:11 2011 on firestorm
+;;; Last modified Sun Jan 15 09:39:36 2012 on fusion
 ;;; $Id$
 
 ;;;
@@ -103,18 +103,44 @@
   "YaTeX add-in function for table environment."
   (cond
    ((eq major-mode 'yatex-mode)
-    (setq YaTeX-env-name "tabular"
-	  YaTeX-section-name "caption")
-    (YaTeX:read-position "htbp"))
+    (let (pos (caption "") (label "") (opts ""))
+      (setq pos (YaTeX:read-position "htbp")
+	    caption (read-string "Table Caption: "))
+      (if (string= "" caption)
+	  (setq YaTeX-section-name "caption")
+	(setq opts (format "\n\\caption{%s}" caption)))
+      (setq label (read-string "Label: "))
+      (if (string= "" label)
+	  (setq YaTeX-section-name "label")
+	(setq opts (format "%s\n\\label{%s}" opts label)))
+      (setq YaTeX-env-name "tabular"
+	    YaTeX-section-name "caption")
+      (concat pos opts)))
    ((eq major-mode 'texinfo-mode)
     (concat " "
 	    (completing-read
 	     "Highlights with: "
 	     '(("@samp")("@kbd")("@code")("@asis")("@file")("@var"))
 	     nil nil "@")))))
+(fset 'YaTeX:table* 'YaTeX:table)
 
-(fset 'YaTeX:figure 'YaTeX:table)
-(fset 'YaTeX:figure* 'YaTeX:table)
+;;;
+;; Functions for figure environemnt
+;;;
+(defun YaTeX:figure ()
+  "YaTeX add-in function for figure(*) environment."
+  (let ((caption "") (label "") (opts ""))
+    (setq label (read-string "Figure Label: "))
+    (if (string= "" label)
+	(setq YaTeX-section-name "label")
+      (setq opts (format "\n\\label{%s}" label)))
+    (setq caption (read-string "Figure Caption: "))
+    (if (string= "" caption)
+	(setq YaTeX-section-name "caption")
+      (setq opts (format "%s\n%% figure here\n\\caption{%s}" opts caption)))
+    opts))
+
+(fset 'YaTeX:figure* 'YaTeX:figure)
 
 
 (defun YaTeX:description ()

yatex.org