yatex

changeset 342:90bdb4173c97 dev

Add-in for wrapfigure and YaTeX:read-length added
author HIROSE Yuuji <yuuji@gentei.org>
date Thu, 18 Dec 2014 22:54:48 +0900
parents 0f6c76dc7a23
children 43fb2bf403e4
files yatexadd.el
diffstat 1 files changed, 34 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/yatexadd.el	Thu Dec 18 20:51:15 2014 +0900
     1.2 +++ b/yatexadd.el	Thu Dec 18 22:54:48 2014 +0900
     1.3 @@ -1,7 +1,7 @@
     1.4  ;;; yatexadd.el --- YaTeX add-in functions
     1.5  ;;; yatexadd.el rev.21
     1.6  ;;; (c)1991-2014 by HIROSE Yuuji.[yuuji@yatex.org]
     1.7 -;;; Last modified Thu Dec 18 17:37:11 2014 on firestorm
     1.8 +;;; Last modified Thu Dec 18 22:53:03 2014 on firestorm
     1.9  ;;; $Id$
    1.10  
    1.11  ;;; Code:
    1.12 @@ -24,7 +24,7 @@
    1.13  YaTeX-make-begin-end."
    1.14    (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline"))
    1.15      (if (string= YaTeX-env-name "tabular*")
    1.16 -	(setq width (concat "{" (read-string "Width: ") "}")))
    1.17 +	(setq width (concat "{" (YaTeX:read-length "Width: ") "}")))
    1.18      (setq loc (YaTeX:read-position "tb")
    1.19  	  bars (string-to-int
    1.20  		(read-string "Number of columns(0 for default format): " "3")))
    1.21 @@ -99,6 +99,15 @@
    1.22    (let ((pos (YaTeX:read-oneof oneof)))
    1.23      (if (string= pos "")  "" (concat "[" pos "]"))))
    1.24  
    1.25 +(defun YaTeX:read-length (prompt)
    1.26 +  "Read a LaTeX dimensional parameter with magnifying numerics prepend."
    1.27 +  (let ((minibuffer-local-completion-map YaTeX-minibuffer-completion-map)
    1.28 +	(delim "-0-9*+/.")
    1.29 +	(tbl (append YaTeX:style-parameters-local
    1.30 +		     YaTeX:style-parameters-private
    1.31 +		     YaTeX:style-parameters-default)))
    1.32 +    (YaTeX-completing-read-or-skip prompt tbl nil)))
    1.33 +
    1.34  ;;;
    1.35  ;; Functions for figure environemnt
    1.36  ;;;
    1.37 @@ -160,7 +169,7 @@
    1.38    (if (fboundp 'YaTeX-toggle-math-mode)
    1.39        (YaTeX-toggle-math-mode t)))		;force math-mode ON.
    1.40  
    1.41 -(mapcar '(lambda (f) (fset f 'YaTeX:equation))
    1.42 +(mapcar (function (lambda (f) (fset f 'YaTeX:equation)))
    1.43  	'(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align*
    1.44  	  YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather*
    1.45  	  YaTeX:aligned* YaTeX:gathered YaTeX:gathered*
    1.46 @@ -178,7 +187,7 @@
    1.47  
    1.48  (defun YaTeX:minipage ()
    1.49    (concat (YaTeX:read-position "cbt")
    1.50 -	  "{" (read-string "Width: ") "}"))
    1.51 +	  "{" (YaTeX:read-length "Width: ") "}"))
    1.52  
    1.53  (defun YaTeX:thebibliography ()
    1.54    (setq YaTeX-section-name "bibitem")
    1.55 @@ -187,6 +196,18 @@
    1.56  (defun YaTeX:multicols ()
    1.57    (concat "{" (read-string "Number of columns: ") "}"))
    1.58  
    1.59 +
    1.60 +;; wrapfig.sty
    1.61 +(defun YaTeX:wrapfigure ()
    1.62 +  (YaTeX-help "wrapfigure")
    1.63 +  (concat
    1.64 +   (let ((lines (YaTeX-read-string-or-skip "Wrap Lines(Optional): ")))
    1.65 +     (if (string< "" lines)
    1.66 +	 (concat "[" lines "]")))
    1.67 +   "{" (YaTeX:read-oneof "rlioRLIO" t) "}"
    1.68 +   "{" (YaTeX:read-length "Image width: ") "}"))
    1.69 + 
    1.70 +
    1.71  ;;;
    1.72  ;;Sample functions for section-type command.
    1.73  ;;;
    1.74 @@ -204,7 +225,7 @@
    1.75      (concat (YaTeX:read-coordinates "Dimension")
    1.76  	    (YaTeX:read-position "lsrtb")))
    1.77     (t
    1.78 -    (let ((width (read-string "Width: ")))
    1.79 +    (let ((width (YaTeX:read-length "Width: ")))
    1.80        (if (string< "" width)
    1.81  	  (progn
    1.82  	    (or (equal (aref width 0) ?\[)
    1.83 @@ -221,7 +242,7 @@
    1.84    (YaTeX:read-position "tbc"))
    1.85  (defun YaTeX::parbox (argp)
    1.86    (cond
    1.87 -   ((= argp 1) (read-string "Width: "))
    1.88 +   ((= argp 1) (YaTeX:read-length "Width: "))
    1.89     ((= argp 2) (read-string "Text: "))))
    1.90  
    1.91  (defun YaTeX::dashbox ()
    1.92 @@ -1906,13 +1927,9 @@
    1.93  
    1.94  (defun YaTeX:includegraphics ()
    1.95    "Add-in for \\includegraphics's option"
    1.96 -  (let (width height (scale "") angle str (delim "-0-9*+/.")
    1.97 -	(minibuffer-local-completion-map YaTeX-minibuffer-completion-map)
    1.98 -	(tbl (append YaTeX:style-parameters-local
    1.99 -		     YaTeX:style-parameters-private
   1.100 -		     YaTeX:style-parameters-default)))
   1.101 -    (setq width (YaTeX-completing-read-or-skip "Width: " tbl nil)
   1.102 -	  height (YaTeX-completing-read-or-skip "Height: " tbl nil))
   1.103 +  (let (width height (scale "") angle str)
   1.104 +    (setq width (YaTeX:read-length "Width: ")
   1.105 +	  height (YaTeX:read-length "Height: "))
   1.106      (or (string< "" width) (string< "" height)
   1.107  	(setq scale (YaTeX-read-string-or-skip "Scale: ")))
   1.108      (setq angle (YaTeX-read-string-or-skip "Angle(0-359): "))
   1.109 @@ -1920,11 +1937,11 @@
   1.110  	  (mapconcat
   1.111  	   'concat
   1.112  	   (delq nil
   1.113 -		 (mapcar '(lambda (s)
   1.114 +		 (mapcar (function (lambda (s)
   1.115  			    (and (stringp (symbol-value s))
   1.116  				 (string< "" (symbol-value s))
   1.117  				 (format "%s=%s" s (symbol-value s))))
   1.118 -			 '(width height scale angle)))
   1.119 +			 '(width height scale angle))))
   1.120  	   ","))
   1.121      (if (string= "" str) ""
   1.122        (concat "[" str "]"))))
   1.123 @@ -2052,9 +2069,9 @@
   1.124  (defun YaTeX::maskbox (argp)
   1.125    (cond
   1.126     ((equal argp 1)
   1.127 -    (read-string "Width: "))
   1.128 +    (YaTeX:read-length "Width: "))
   1.129     ((equal argp 2)
   1.130 -    (read-string "Height: "))
   1.131 +    (YaTeX:read-length "Height: "))
   1.132     ((equal argp 3)
   1.133      (let (c)
   1.134        (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K)))