yatex

changeset 591:e3b7e199a87d

Add-in for {column,row,cell}color
author HIROSE Yuuji <yuuji@gentei.org>
date Fri, 23 Sep 2022 18:42:59 +0900
parents 7810c4ec21fe
children 86ceef677ca2
files yatexadd.el yatexpkg.el
diffstat 2 files changed, 45 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/yatexadd.el	Fri Sep 23 06:46:32 2022 +0900
     1.2 +++ b/yatexadd.el	Fri Sep 23 18:42:59 2022 +0900
     1.3 @@ -1,6 +1,6 @@
     1.4  ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*-
     1.5  ;;; (c)1991-2019 by HIROSE Yuuji.[yuuji@yatex.org]
     1.6 -;;; Last modified Wed Sep 21 21:22:37 2022 on firestorm
     1.7 +;;; Last modified Thu Sep 22 11:41:04 2022 on firestorm
     1.8  ;;; $Id$
     1.9  
    1.10  ;;; Code:
    1.11 @@ -1993,6 +1993,48 @@
    1.12     ((= argp 2) (YaTeX::color-completing-read "Inner color: "))
    1.13     ((= argp 3) (YaTeX-read-string-or-skip "Colored string: "))))
    1.14  
    1.15 +(defun YaTeX:columncolor ()
    1.16 +  (let ((model (YaTeX-completing-read-or-skip
    1.17 +		"Color model: " '(("rgb") ("gray") ("named")))))
    1.18 +    (put 'YaTeX:columncolor 'model model)
    1.19 +    (if (string= "" model) "" (concat "[" model "]"))))
    1.20 +
    1.21 +(fset 'YaTeX:rowcolor 'YaTeX:columncolor)
    1.22 +(fset 'YaTeX:cellcolor 'YaTeX:columncolor)
    1.23 +
    1.24 +(defun YaTeX::columncolor (argp)
    1.25 +  (let ((model (get 'YaTeX:columncolor 'model))
    1.26 +	(type (cond ((string-match "column" YaTeX-section-name) "Column")
    1.27 +		    ((string-match "row" YaTeX-section-name) "Row")
    1.28 +		    ((string-match "cell" YaTeX-section-name) "Cell")
    1.29 +		    (t "Table")))
    1.30 +	(last (get 'YaTeX::columncolor 'last-color))
    1.31 +	str)
    1.32 +    (put 'YaTeX::columncolor 'last-color
    1.33 +	 (cond
    1.34 +	  ((equal model "rgb")
    1.35 +	   (setq str (YaTeX-read-string-or-skip
    1.36 +		      "R, G, B values: "
    1.37 +		      (cons (or last "0.6, 0.8, 0.9") 0)))
    1.38 +	   (cond
    1.39 +	    ((string-match ",.*," str) str)
    1.40 +	    ((string-match "\\(\\S +\\)\\s +\\(\\S +\\)\\s +\\(\\S +\\)" str)
    1.41 +	     (format "%s, %s, %s" (YaTeX-match-string 1 1 str)
    1.42 +		     (YaTeX-match-string 2 2 str)(YaTeX-match-string 3 3 str)))
    1.43 +	    (t (message "%s may cause error on typesetting" str)
    1.44 +	       str)))
    1.45 +	  ((equal model "gray")
    1.46 +	   (setq str (YaTeX-read-string-or-skip "Grayscale values(0.0 - 1.0): "))
    1.47 +	   (if (<= (string-to-number str) 1)
    1.48 +	       str
    1.49 +	     (message "%s may be an error.  Values from 0.0 to 1.0 are acceptable")
    1.50 +	     str))
    1.51 +	  ((equal model "named")
    1.52 +	   (YaTeX::color-completing-read (concat type " color")))
    1.53 +	  ))))
    1.54 +(fset 'YaTeX::rowcolor 'YaTeX::columncolor)
    1.55 +(fset 'YaTeX::cellcolor 'YaTeX::columncolor)
    1.56 +
    1.57  (defun YaTeX:scalebox ()
    1.58    "Add-in for \\scalebox"
    1.59    (let ((vmag (YaTeX-read-string-or-skip (if YaTeX-japan "”{—¦(•‰‚Å”½“]): "
     2.1 --- a/yatexpkg.el	Fri Sep 23 06:46:32 2022 +0900
     2.2 +++ b/yatexpkg.el	Fri Sep 23 18:42:59 2022 +0900
     2.3 @@ -1,7 +1,7 @@
     2.4  ;;; yatexpkg.el --- YaTeX package manager -*- coding: sjis -*-
     2.5  ;;; 
     2.6  ;;; (c)2003-2019 by HIROSE, Yuuji [yuuji@yatex.org]
     2.7 -;;; Last modified Sat May 25 14:46:27 2019 on firestorm
     2.8 +;;; Last modified Thu Sep 22 20:20:37 2022 on firestorm
     2.9  ;;; $Id$
    2.10  
    2.11  ;;; Code:
    2.12 @@ -76,6 +76,7 @@
    2.13      ("cases"	(env "numcases" "subnumcases"))
    2.14      ("subfigure"	(section "subfigure"))
    2.15      ("okumacro"	(section "ruby" "kenten"))
    2.16 +    ("colortbl"	(section "columncolor" "rowcolor"))
    2.17      )
    2.18    "Default package vs. macro list.
    2.19  Alists contains '(PACKAGENAME . MACROLIST)