Mercurial > hgrepos > hgweb.cgi > yatex
comparison yatexadd.el @ 591:e3b7e199a87d draft
Add-in for {column,row,cell}color
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Fri, 23 Sep 2022 18:42:59 +0900 |
parents | c6a26b422d30 |
children | 6061dd3a6dec |
comparison
equal
deleted
inserted
replaced
590:7810c4ec21fe | 591:e3b7e199a87d |
---|---|
1 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- | 1 ;;; yatexadd.el --- YaTeX add-in functions -*- coding: sjis -*- |
2 ;;; (c)1991-2019 by HIROSE Yuuji.[yuuji@yatex.org] | 2 ;;; (c)1991-2019 by HIROSE Yuuji.[yuuji@yatex.org] |
3 ;;; Last modified Wed Sep 21 21:22:37 2022 on firestorm | 3 ;;; Last modified Thu Sep 22 11:41:04 2022 on firestorm |
4 ;;; $Id$ | 4 ;;; $Id$ |
5 | 5 |
6 ;;; Code: | 6 ;;; Code: |
7 ;;; | 7 ;;; |
8 ;;Sample functions for LaTeX environment. | 8 ;;Sample functions for LaTeX environment. |
1991 (cond | 1991 (cond |
1992 ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) | 1992 ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) |
1993 ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) | 1993 ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) |
1994 ((= argp 3) (YaTeX-read-string-or-skip "Colored string: ")))) | 1994 ((= argp 3) (YaTeX-read-string-or-skip "Colored string: ")))) |
1995 | 1995 |
1996 (defun YaTeX:columncolor () | |
1997 (let ((model (YaTeX-completing-read-or-skip | |
1998 "Color model: " '(("rgb") ("gray") ("named"))))) | |
1999 (put 'YaTeX:columncolor 'model model) | |
2000 (if (string= "" model) "" (concat "[" model "]")))) | |
2001 | |
2002 (fset 'YaTeX:rowcolor 'YaTeX:columncolor) | |
2003 (fset 'YaTeX:cellcolor 'YaTeX:columncolor) | |
2004 | |
2005 (defun YaTeX::columncolor (argp) | |
2006 (let ((model (get 'YaTeX:columncolor 'model)) | |
2007 (type (cond ((string-match "column" YaTeX-section-name) "Column") | |
2008 ((string-match "row" YaTeX-section-name) "Row") | |
2009 ((string-match "cell" YaTeX-section-name) "Cell") | |
2010 (t "Table"))) | |
2011 (last (get 'YaTeX::columncolor 'last-color)) | |
2012 str) | |
2013 (put 'YaTeX::columncolor 'last-color | |
2014 (cond | |
2015 ((equal model "rgb") | |
2016 (setq str (YaTeX-read-string-or-skip | |
2017 "R, G, B values: " | |
2018 (cons (or last "0.6, 0.8, 0.9") 0))) | |
2019 (cond | |
2020 ((string-match ",.*," str) str) | |
2021 ((string-match "\\(\\S +\\)\\s +\\(\\S +\\)\\s +\\(\\S +\\)" str) | |
2022 (format "%s, %s, %s" (YaTeX-match-string 1 1 str) | |
2023 (YaTeX-match-string 2 2 str)(YaTeX-match-string 3 3 str))) | |
2024 (t (message "%s may cause error on typesetting" str) | |
2025 str))) | |
2026 ((equal model "gray") | |
2027 (setq str (YaTeX-read-string-or-skip "Grayscale values(0.0 - 1.0): ")) | |
2028 (if (<= (string-to-number str) 1) | |
2029 str | |
2030 (message "%s may be an error. Values from 0.0 to 1.0 are acceptable") | |
2031 str)) | |
2032 ((equal model "named") | |
2033 (YaTeX::color-completing-read (concat type " color"))) | |
2034 )))) | |
2035 (fset 'YaTeX::rowcolor 'YaTeX::columncolor) | |
2036 (fset 'YaTeX::cellcolor 'YaTeX::columncolor) | |
2037 | |
1996 (defun YaTeX:scalebox () | 2038 (defun YaTeX:scalebox () |
1997 "Add-in for \\scalebox" | 2039 "Add-in for \\scalebox" |
1998 (let ((vmag (YaTeX-read-string-or-skip (if YaTeX-japan "{(Ŕ]): " | 2040 (let ((vmag (YaTeX-read-string-or-skip (if YaTeX-japan "{(Ŕ]): " |
1999 "Magnification(Negative for flipped): "))) | 2041 "Magnification(Negative for flipped): "))) |
2000 (hmag (YaTeX-read-string-or-skip (if YaTeX-japan "c{(ȗ): " | 2042 (hmag (YaTeX-read-string-or-skip (if YaTeX-japan "c{(ȗ): " |