changeset 427:64c07f0a179f dev

Consider totalwidth=
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 31 Aug 2015 22:41:18 +0900
parents 95b5715c17a5
children fa7408c1a9e3
files yatexadd.el
diffstat 1 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/yatexadd.el	Mon Aug 31 22:28:49 2015 +0900
+++ b/yatexadd.el	Mon Aug 31 22:41:18 2015 +0900
@@ -1,6 +1,6 @@
 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
 ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org]
-;;; Last modified Mon Aug 31 22:28:40 2015 on zxr
+;;; Last modified Mon Aug 31 22:40:47 2015 on zxr
 ;;; $Id$
 
 ;;; Code:
@@ -2130,9 +2130,16 @@
 (defun YaTeX:column-read-width ()
   "Completing function for column environment/macro of Beamer"
   (let ((md (match-data)) (colsinf (YaTeX-quick-in-environment-p "columns"))
-	(colw (float 1)) defw cw)
+	(totalw (float 1)) restw (ww "\\textwidth") defw cw)
     (unwind-protect
 	(progn
+	  (if (save-excursion
+		(YaTeX-re-search-active-backward
+		 "totalwidth=\\([.0-9]+\\)\\(\\\\.*width\\)"
+		 YaTeX-comment-prefix (cdr colsinf) t))
+	      (setq totalw (float (string-to-number (YaTeX-match-string 1)))
+		    ww (YaTeX-match-string 2)))
+	  (setq restw totalw)
 	  (save-excursion
 	    (while (YaTeX-re-search-active-backward
 		    (concat
@@ -2141,16 +2148,14 @@
 		     "\\\\column{\\([.0-9]+\\)\\(\\\\.*width\\)}")
 		    YaTeX-comment-prefix
 		    (cdr colsinf) t)
-	      (setq colw (- colw (string-to-number
-				  (or (YaTeX-match-string 1)
-				      (YaTeX-match-string 3)))))))
-	  (setq defw (format "%.1f%s"
-			     (if (= colw (float 1))
-				 (string-to-number "0.5")
-			       colw)
+	      (setq restw (- restw (string-to-number
+				    (or (YaTeX-match-string 1)
+					(YaTeX-match-string 3)))))))
+	  (setq defw (format "%.2f%s"
+			     (if (= totalw restw) (/ totalw 2) restw)
 			     (or (YaTeX-match-string 2)
 				 (YaTeX-match-string 4)
-				 "\\textwidth"))
+				 ww))
 		cw (YaTeX:read-length
 		    (format "Column width(default: %s): " defw)))
 	  (if (string= "" cw) (setq cw defw))

yatex.org