yatex
diff yatexadd.el @ 8:c746646cecf5
Restrict YaTeX:framebox in picture environment.
author | yuuji |
---|---|
date | Tue, 04 May 1993 13:00:17 +0000 |
parents | 49be9ccb0b65 |
children | 390df0e505da |
line diff
1.1 --- a/yatexadd.el Mon Feb 22 11:04:53 1993 +0000 1.2 +++ b/yatexadd.el Tue May 04 13:00:17 1993 +0000 1.3 @@ -1,8 +1,9 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 -;;; YaTeX add in functions. 1.6 -;;; yatexadd.el rev.2 1.7 +;;; YaTeX add-in functions. 1.8 +;;; yatexadd.el rev.3 1.9 ;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] 1.10 -;;; Last modified Fri Feb 5 09:36:06 1993 on gloria 1.11 +;;; Last modified Tue May 4 21:50:37 1993 on figaro 1.12 +;;; $Id$ 1.13 1.14 (provide 'yatexadd) 1.15 1.16 @@ -14,46 +15,131 @@ 1.17 "*Your favorite default rule format." 1.18 ) 1.19 (defun YaTeX:tabular () 1.20 - "YaTeX add in function for tabular environment." 1.21 - (let (bars (rule "") (j 0) loc) 1.22 + "YaTeX add-in function for tabular environment." 1.23 + (let (bars (rule "") (j 0) (loc (YaTeX:read-position "tb"))) 1.24 (setq bars (string-to-int (read-string "Number of `|': "))) 1.25 (if (> bars 0) 1.26 (while (< j bars) (setq rule (concat rule "|")) (setq j (1+ j))) 1.27 (setq rule YaTeX:tabular-default-rule)) 1.28 (setq rule (read-string "rule format: " rule)) 1.29 1.30 - (insert (format "{%s}" rule)) 1.31 - (message "")) 1.32 + (message "") 1.33 + (format "%s{%s}" loc rule)) 1.34 ) 1.35 1.36 -(defun YaTeX:table () 1.37 - (let ((pos "")) 1.38 - (message "Position []:") 1.39 +(defun YaTeX:read-position (oneof) 1.40 + (let ((pos "") loc) 1.41 (while (not (string-match 1.42 - (setq loc (read-key-sequence (format "Position [%s]: " pos))) 1.43 + (setq loc (read-key-sequence 1.44 + (format "Position (`%s') [%s]: " oneof pos))) 1.45 "\r\^g\n")) 1.46 (cond 1.47 - ((string-match loc "htbp") 1.48 + ((string-match loc oneof) 1.49 (if (not (string-match loc pos)) 1.50 (setq pos (concat pos loc)))) 1.51 ((and (string-match loc "\C-h\C-?") (> (length pos) 0)) 1.52 (setq pos (substring pos 0 (1- (length pos))))) 1.53 (t 1.54 (ding) 1.55 - (message "Please input one of `htbp'.") 1.56 + (message "Please input one of `%s'." oneof) 1.57 (sit-for 3)))) 1.58 - (if (string= pos "") nil 1.59 - (insert "[" pos "]"))) 1.60 + (message "") 1.61 + (if (string= pos "") "" 1.62 + (concat "[" pos "]"))) 1.63 +) 1.64 + 1.65 +(defun YaTeX:table () 1.66 + "YaTeX add-in function for table environment." 1.67 + (YaTeX:read-position "htbp") 1.68 ) 1.69 1.70 (defun YaTeX:description () 1.71 "Truly poor service:-)" 1.72 (setq single-command "item[]") 1.73 + "" 1.74 ) 1.75 1.76 (defun YaTeX:itemize () 1.77 "It's also poor service." 1.78 (setq single-command "item") 1.79 + "" 1.80 ) 1.81 1.82 (fset 'YaTeX:enumerate 'YaTeX:itemize) 1.83 + 1.84 +;;; 1.85 +;;Sample functions for section-type command. 1.86 +;;; 1.87 +(defun YaTeX:multiput () 1.88 + (concat (YaTeX:read-coordinates "Pos") 1.89 + (YaTeX:read-coordinates "Step") 1.90 + "{" (read-string "How many times: ") "}") 1.91 +) 1.92 + 1.93 +(defun YaTeX:put () 1.94 + (YaTeX:read-coordinates "Pos") 1.95 +) 1.96 + 1.97 +(defun YaTeX:makebox () 1.98 + (concat (YaTeX:read-coordinates "Dimension") 1.99 + (YaTeX:read-position "lrtb")) 1.100 +) 1.101 + 1.102 +(defun YaTeX:framebox () 1.103 + (if (YaTeX-quick-in-environment-p "picture") 1.104 + (YaTeX:makebox)) 1.105 +) 1.106 + 1.107 +(defun YaTeX:dashbox () 1.108 + (concat "{" (read-string "Dash dimension: ") "}" 1.109 + (YaTeX:read-coordinates "Dimension")) 1.110 +) 1.111 + 1.112 +(defun YaTeX:read-coordinates (&optional mes varX varY) 1.113 + (concat 1.114 + "(" 1.115 + (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) 1.116 + "," 1.117 + (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) 1.118 + ")") 1.119 +) 1.120 + 1.121 +;;; 1.122 +;;Sample functions for maketitle-type command. 1.123 +;;; 1.124 +(defun YaTeX:sum () 1.125 + "Read range of summation." 1.126 + (YaTeX:check-completion-type 'maketitle) 1.127 + (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^")) 1.128 +) 1.129 + 1.130 +(fset 'YaTeX:int 'YaTeX:sum) 1.131 + 1.132 +(defun YaTeX:lim () 1.133 + "Insert limit notation of \\lim." 1.134 + (YaTeX:check-completion-type 'maketitle) 1.135 + (let ((var (read-string "Variable: ")) limit) 1.136 + (if (string= "" var) "" 1.137 + (setq limit (read-string "Limit ($ means infinity): ")) 1.138 + (if (string= "$" limit) (setq limit "\\infty")) 1.139 + (concat "_{" var " \\rightarrow " limit "}"))) 1.140 +) 1.141 + 1.142 +(defun YaTeX:gcd () 1.143 + "Add-in function for \\gcd(m,n)." 1.144 + (YaTeX:check-completion-type 'maketitle) 1.145 + (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)") 1.146 +) 1.147 + 1.148 +(defun YaTeX:read-boundary (ULchar) 1.149 + "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." 1.150 + (let ((bndry (read-string (concat ULchar "{...}: ")))) 1.151 + (if (string= bndry "") "" 1.152 + (concat ULchar "{" bndry "}"))) 1.153 +) 1.154 + 1.155 +(defun YaTeX:check-completion-type (type) 1.156 + "Check valid completion type." 1.157 + (if (not (eq type YaTeX-current-completion-type)) 1.158 + (error "This should be completed with %s-type completion." type)) 1.159 +)