yatex

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 diff
     1.1 --- a/yatexadd.el	Mon Aug 31 22:28:49 2015 +0900
     1.2 +++ b/yatexadd.el	Mon Aug 31 22:41:18 2015 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
     1.5  ;;; (c)1991-2015 by HIROSE Yuuji.[yuuji@yatex.org]
     1.6 -;;; Last modified Mon Aug 31 22:28:40 2015 on zxr
     1.7 +;;; Last modified Mon Aug 31 22:40:47 2015 on zxr
     1.8  ;;; $Id$
     1.9  
    1.10  ;;; Code:
    1.11 @@ -2130,9 +2130,16 @@
    1.12  (defun YaTeX:column-read-width ()
    1.13    "Completing function for column environment/macro of Beamer"
    1.14    (let ((md (match-data)) (colsinf (YaTeX-quick-in-environment-p "columns"))
    1.15 -	(colw (float 1)) defw cw)
    1.16 +	(totalw (float 1)) restw (ww "\\textwidth") defw cw)
    1.17      (unwind-protect
    1.18  	(progn
    1.19 +	  (if (save-excursion
    1.20 +		(YaTeX-re-search-active-backward
    1.21 +		 "totalwidth=\\([.0-9]+\\)\\(\\\\.*width\\)"
    1.22 +		 YaTeX-comment-prefix (cdr colsinf) t))
    1.23 +	      (setq totalw (float (string-to-number (YaTeX-match-string 1)))
    1.24 +		    ww (YaTeX-match-string 2)))
    1.25 +	  (setq restw totalw)
    1.26  	  (save-excursion
    1.27  	    (while (YaTeX-re-search-active-backward
    1.28  		    (concat
    1.29 @@ -2141,16 +2148,14 @@
    1.30  		     "\\\\column{\\([.0-9]+\\)\\(\\\\.*width\\)}")
    1.31  		    YaTeX-comment-prefix
    1.32  		    (cdr colsinf) t)
    1.33 -	      (setq colw (- colw (string-to-number
    1.34 -				  (or (YaTeX-match-string 1)
    1.35 -				      (YaTeX-match-string 3)))))))
    1.36 -	  (setq defw (format "%.1f%s"
    1.37 -			     (if (= colw (float 1))
    1.38 -				 (string-to-number "0.5")
    1.39 -			       colw)
    1.40 +	      (setq restw (- restw (string-to-number
    1.41 +				    (or (YaTeX-match-string 1)
    1.42 +					(YaTeX-match-string 3)))))))
    1.43 +	  (setq defw (format "%.2f%s"
    1.44 +			     (if (= totalw restw) (/ totalw 2) restw)
    1.45  			     (or (YaTeX-match-string 2)
    1.46  				 (YaTeX-match-string 4)
    1.47 -				 "\\textwidth"))
    1.48 +				 ww))
    1.49  		cw (YaTeX:read-length
    1.50  		    (format "Column width(default: %s): " defw)))
    1.51  	  (if (string= "" cw) (setq cw defw))