yatex
diff yatexadd.el @ 84:73cba5ddd111
Converted from RCS of yatex
author | yuuji |
---|---|
date | Sun, 27 Sep 2009 13:04:14 +0000 |
parents | 0734be649cb8 |
children | f14ec50103d0 |
line diff
1.1 --- a/yatexadd.el Thu Dec 25 04:10:32 2003 +0000 1.2 +++ b/yatexadd.el Sun Sep 27 13:04:14 2009 +0000 1.3 @@ -1,8 +1,8 @@ 1.4 ;;; -*- Emacs-Lisp -*- 1.5 ;;; YaTeX add-in functions. 1.6 -;;; yatexadd.el rev.17 1.7 -;;; (c)1991-2003 by HIROSE Yuuji.[yuuji@yatex.org] 1.8 -;;; Last modified Thu Nov 27 11:11:30 2003 on firestorm 1.9 +;;; yatexadd.el rev.18 1.10 +;;; (c)1991-2006 by HIROSE Yuuji.[yuuji@yatex.org] 1.11 +;;; Last modified Sun Dec 24 15:12:30 2006 on firestorm 1.12 ;;; $Id$ 1.13 1.14 ;;; 1.15 @@ -56,9 +56,18 @@ 1.16 (format "%s%s{%s}" width loc rule))) 1.17 1.18 (fset 'YaTeX:tabular* 'YaTeX:tabular) 1.19 +(fset 'YaTeX:supertabular 'YaTeX:tabular) 1.20 +(defun YaTeX:alignat () 1.21 + (concat "{" (read-string "Number of columns: ") "}")) 1.22 (defun YaTeX:array () 1.23 (concat (YaTeX:read-position "tb") 1.24 "{" (read-string "Column format: ") "}")) 1.25 +(defun YaTeX:subequations () 1.26 + (message (if YaTeX-japan "分かりやすいコメントに変えるとref補完が楽よ" 1.27 + "Changing comment string reduces effort at `ref' completion")) 1.28 + (concat " " YaTeX-comment-prefix 1.29 + (YaTeX::ref-default-label "%H:%M") 1.30 + (if YaTeX-japan "の式群" "equations"))) 1.31 1.32 (defun YaTeX:read-oneof (oneof &optional quick allow-dup) 1.33 (let ((pos "") loc (guide "")) 1.34 @@ -137,6 +146,12 @@ 1.35 YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat* 1.36 YaTeX:xxalignat YaTeX:xxalignat*)) 1.37 1.38 +(defun YaTeX:alignat () 1.39 + (YaTeX:equation) 1.40 + (concat "{" (read-string "Number of cols: ") "}")) 1.41 + 1.42 + 1.43 + 1.44 (defun YaTeX:list () 1.45 "%\n{} %default label\n{} %formatting parameter") 1.46 1.47 @@ -148,6 +163,9 @@ 1.48 (setq YaTeX-section-name "bibitem") 1.49 (concat "{" (read-string "Longest label: ") "}")) 1.50 1.51 +(defun YaTeX:multicols () 1.52 + (concat "{" (read-string "Number of columns: ") "}")) 1.53 + 1.54 ;;; 1.55 ;;Sample functions for section-type command. 1.56 ;;; 1.57 @@ -163,23 +181,33 @@ 1.58 (cond 1.59 ((YaTeX-in-environment-p "picture") 1.60 (concat (YaTeX:read-coordinates "Dimension") 1.61 - (YaTeX:read-position "lrtb"))) 1.62 + (YaTeX:read-position "lsrtb"))) 1.63 (t 1.64 (let ((width (read-string "Width: "))) 1.65 (if (string< "" width) 1.66 (progn 1.67 (or (equal (aref width 0) ?\[) 1.68 (setq width (concat "[" width "]"))) 1.69 - (concat width (YaTeX:read-position "lr")))))))) 1.70 + (concat width (YaTeX:read-position 1.71 + (if YaTeX-use-LaTeX2e "lrs" "lr"))))))))) 1.72 1.73 -(defun YaTeX:framebox () 1.74 - (if (YaTeX-quick-in-environment-p "picture") 1.75 - (YaTeX:makebox))) 1.76 +;; (defun YaTeX:framebox () 1.77 +;; (if (YaTeX-quick-in-environment-p "picture") 1.78 +;; (YaTeX:makebox))) 1.79 +(fset 'YaTeX:framebox 'YaTeX:makebox) 1.80 + 1.81 +(defun YaTeX:parbox () 1.82 + (YaTeX:read-position "tbc")) 1.83 1.84 (defun YaTeX:dashbox () 1.85 (concat "{" (read-string "Dash dimension: ") "}" 1.86 (YaTeX:read-coordinates "Dimension"))) 1.87 1.88 +(defun YaTeX:savebox (argp) 1.89 + (cond 1.90 + ((= argp 1) (read-string "Saved into name: " "\\")) 1.91 + ((= argp 2) (read-string "Text: ")))) 1.92 + 1.93 (defvar YaTeX-minibuffer-quick-map nil) 1.94 (if YaTeX-minibuffer-quick-map nil 1.95 (setq YaTeX-minibuffer-quick-map 1.96 @@ -220,6 +248,10 @@ 1.97 1.98 (fset 'YaTeX:right 'YaTeX:left) 1.99 1.100 +(defun YaTeX:langle () 1.101 + (setq YaTeX-single-command "rangle") 1.102 + nil) 1.103 + 1.104 (defun YaTeX:read-coordinates (&optional mes varX varY) 1.105 (concat 1.106 "(" 1.107 @@ -471,29 +503,90 @@ 1.108 ; (bury-buffer YaTeX-label-buffer))) 1.109 ; label))))) 1.110 1.111 -(defun YaTeX::ref-generate-label () 1.112 +(defvar YaTeX-ref-default-label-string "%H%M%S_%d%b%y" 1.113 + "*Default \\ref time string format. 1.114 +This format is like strftime(3) but allowed conversion char are as follows; 1.115 +%y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12), 1.116 +%d -> Day, %H -> Hour, %M -> Minute, %S -> Second, 1.117 +%qx -> alphabetical-decimal conversion of yymmdd. 1.118 +%qX -> alphabetical-decimal conversion of HHMMSS. 1.119 +Beware defualt label-string should be always unique. So this format string 1.120 +should have both time part (%H+%M+%S or %qX) and date 1.121 +part (%y+(%b|%m)+%d or %qx).") 1.122 + 1.123 +(defun YaTeX::ref-alphabex (n) 1.124 + (let ((alphabex "")) 1.125 + (while (> n 0) 1.126 + (setq alphabex (concat (char-to-string (+ ?a (% n 26))) alphabex) 1.127 + n (/ n 26))) 1.128 + alphabex)) 1.129 + 1.130 +(defun YaTeX::ref-default-label (&optional format) 1.131 + "Default auto-genarated label string." 1.132 + ;; We do not use (format-time-string) for emacs-19 1.133 + (let*((ts (substring (current-time-string) 4)) 1.134 + (y (substring ts -2)) 1.135 + (b (substring ts 0 3)) 1.136 + (d (format "%d" (string-to-int (substring ts 4 6)))) 1.137 + (H (substring ts 7 9)) 1.138 + (M (substring ts 10 12)) 1.139 + (S (substring ts 13 15)) 1.140 + (HMS (+ (* 10000 (string-to-int H)) 1.141 + (* 100 (string-to-int M)) 1.142 + (string-to-int S))) 1.143 + (talphabex (YaTeX::ref-alphabex HMS)) 1.144 + (mnames "JanFebMarAprMayJunJulAugSepOctNovDec") 1.145 + (m (format "%02d" (/ (string-match b mnames) 3))) 1.146 + (ymd (+ (* 10000 (string-to-int y)) 1.147 + (* 100 (string-to-int m)) 1.148 + (string-to-int d))) 1.149 + (dalphabex (YaTeX::ref-alphabex ymd))) 1.150 + (YaTeX-replace-formats 1.151 + (or format YaTeX-ref-default-label-string) 1.152 + (list (cons "y" y) 1.153 + (cons "b" b) 1.154 + (cons "m" m) 1.155 + (cons "d" d) 1.156 + (cons "H" H) 1.157 + (cons "M" M) 1.158 + (cons "S" S) 1.159 + (cons "qX" talphabex) 1.160 + (cons "qx" dalphabex))))) 1.161 + 1.162 +(defvar YaTeX-ref-generate-label-function 'YaTeX::ref-generate-label 1.163 + "*Function to generate default label for unnamed \\label{}s. 1.164 +The function pointed to this value should take two arguments. 1.165 +First argument is LaTeX macro's name, second is macro's argument.") 1.166 + 1.167 +(defun YaTeX::ref-generate-label (command arg) 1.168 "Generate a label string which is unique in current buffer." 1.169 - (let ((default (substring (current-time-string) 4))) 1.170 + (let ((default (condition-case nil 1.171 + (YaTeX::ref-default-label) 1.172 + (error (substring (current-time-string) 4))))) 1.173 (read-string "Give a label for this line: " 1.174 (if YaTeX-emacs-19 (cons default 1) default)))) 1.175 1.176 -(defun YaTeX::ref-getset-label (buffer point) 1.177 +(defun YaTeX::ref-getset-label (buffer point &optional noset) 1.178 "Get label string in the BUFFER near the POINT. 1.179 -Make \\label{xx} if no label." 1.180 +Make \\label{xx} if no label. 1.181 +If optional third argument NOSET is non-nil, do not generate new label." 1.182 ;;Here, we rewrite the LaTeX source. Therefore we should be careful 1.183 ;;to decide the location suitable for \label. Do straightforward! 1.184 - (let (boundary inspoint cc newlabel (labelholder "label") mathp env 1.185 - (r-escape (regexp-quote YaTeX-comment-prefix))) 1.186 - ;;(set-buffer buffer) 1.187 - (switch-to-buffer buffer) 1.188 + (let (boundary inspoint cc newlabel (labelholder "label") mathp exp1 env 1.189 + (r-escape (regexp-quote YaTeX-comment-prefix)) 1.190 + command arg alreadysought foundpoint) 1.191 + (set-buffer buffer) 1.192 (save-excursion 1.193 (goto-char point) 1.194 (setq cc (current-column)) 1.195 (if (= (char-after (point)) ?\\) (forward-char 1)) 1.196 (cond 1.197 ((looking-at YaTeX-sectioning-regexp) 1.198 + (setq command (YaTeX-match-string 0)) 1.199 (skip-chars-forward "^{") 1.200 - (forward-list 1) 1.201 + (setq arg (buffer-substring 1.202 + (1+ (point)) 1.203 + (progn (forward-list 1) (1- (point))))) 1.204 (skip-chars-forward " \t\n") 1.205 ;(setq boundary "[^\\]") 1.206 (setq inspoint (point)) 1.207 @@ -507,7 +600,8 @@ 1.208 (match-beginning 0) 1.209 (1- (point)))))) 1.210 ((looking-at "item\\s ") 1.211 - (setq cc (+ cc 6)) 1.212 + (setq command "item" 1.213 + cc (+ cc 6)) 1.214 ;(setq boundary (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b")) 1.215 (setq boundary 1.216 (save-excursion 1.217 @@ -518,7 +612,8 @@ 1.218 (1- (point)))) 1.219 inspoint boundary)) 1.220 ((looking-at "bibitem") 1.221 - (setq labelholder "bibitem") ; label holder is bibitem itself 1.222 + (setq labelholder "bibitem" ; label holder is bibitem itself 1.223 + command "bibitem") 1.224 (setq boundary 1.225 (save-excursion 1.226 (if (YaTeX-re-search-active-forward 1.227 @@ -527,19 +622,50 @@ 1.228 (match-beginning 0) 1.229 (1- (point)))) 1.230 inspoint boundary)) 1.231 - ((string-match YaTeX::ref-mathenv-regexp 1.232 + ((string-match YaTeX::ref-nestable-counter-regexp 1.233 (setq env (or (YaTeX-inner-environment t) "document"))) 1.234 - (setq mathp t) 1.235 + (let ((curtop (get 'YaTeX-inner-environment 'point)) 1.236 + (end (point-max)) label) 1.237 + (skip-chars-forward " \t\n") 1.238 + (setq inspoint (point) ;initial candidate 1.239 + cc (current-column) 1.240 + command env 1.241 + alreadysought t) 1.242 + (if (condition-case nil 1.243 + (progn 1.244 + (goto-char curtop) 1.245 + (YaTeX-goto-corresponding-environment)) 1.246 + (error nil)) 1.247 + (setq end (point))) 1.248 + (goto-char inspoint) 1.249 + (while (YaTeX-re-search-active-forward 1.250 + (concat YaTeX-ec-regexp "label{\\([^}]+\\)}" ) 1.251 + r-escape end t) 1.252 + (setq label (YaTeX-match-string 1)) 1.253 + (if (and (equal env (YaTeX-inner-environment t)) 1.254 + (= curtop (get 'YaTeX-inner-environment 'point))) 1.255 + ;;I found the label 1.256 + (setq alreadysought label 1.257 + foundpoint (match-end 0)))) 1.258 + )) 1.259 + ((string-match YaTeX::ref-mathenv-regexp env) ;env is set in above case 1.260 + (setq command env 1.261 + mathp t 1.262 + exp1 (string-match YaTeX::ref-mathenv-exp1-regexp env)) 1.263 ;;(setq boundary (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)")) 1.264 (setq boundary 1.265 (save-excursion 1.266 (if (YaTeX-re-search-active-forward 1.267 - (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)") 1.268 + (concat 1.269 + YaTeX-ec-regexp "\\(" 1.270 + (if exp1 "" "\\\\\\|") 1.271 + "end{" env "}\\)") 1.272 r-escape nil 1) 1.273 (match-beginning 0) 1.274 (1- (point)))) 1.275 inspoint boundary)) 1.276 ((looking-at "footnote\\s *{") 1.277 + (setq command "footnote") 1.278 (skip-chars-forward "^{") ;move onto `{' 1.279 (setq boundary 1.280 (save-excursion 1.281 @@ -550,10 +676,13 @@ 1.282 (1- (point))) 1.283 inspoint boundary)) 1.284 ((looking-at "caption\\|\\(begin\\)") 1.285 + (setq command (YaTeX-match-string 0)) 1.286 (skip-chars-forward "^{") 1.287 ;;;;;;(if (match-beginning 1) (forward-list 1)) 1.288 ;; caption can be treated as mathenv, is it right?? 1.289 - (forward-list 1) 1.290 + (setq arg (buffer-substring 1.291 + (1+ (point)) 1.292 + (progn (forward-list 1) (1- (point))))) 1.293 ;;(setq boundary (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b")) 1.294 (setq inspoint (point)) 1.295 (setq boundary 1.296 @@ -566,55 +695,81 @@ 1.297 (t )) 1.298 (if (save-excursion (skip-chars-forward " \t") (looking-at "%")) 1.299 (forward-line 1)) 1.300 - (if (and (save-excursion 1.301 - (YaTeX-re-search-active-forward 1.302 - ;;(concat "\\(" labelholder "\\)\\|\\(" boundary "\\)") 1.303 - labelholder 1.304 - (regexp-quote YaTeX-comment-prefix) 1.305 - boundary 1)) 1.306 - (match-beginning 0)) 1.307 + (cond 1.308 + ((stringp alreadysought) 1.309 + (put 'YaTeX::ref-getset-label 'foundpoint foundpoint) ;ugly... 1.310 + alreadysought) 1.311 + ((and (null alreadysought) 1.312 + (> boundary (point)) 1.313 + (save-excursion 1.314 + (YaTeX-re-search-active-forward 1.315 + ;;(concat "\\(" labelholder "\\)\\|\\(" boundary "\\)") 1.316 + labelholder 1.317 + (regexp-quote YaTeX-comment-prefix) 1.318 + boundary 1)) 1.319 + (match-beginning 0)) 1.320 ;; if \label{hoge} found, return it 1.321 - (buffer-substring 1.322 - (progn 1.323 - (goto-char (match-end 0)) 1.324 - (skip-chars-forward "^{") (1+ (point))) 1.325 - (progn 1.326 - (forward-sexp 1) (1- (point)))) 1.327 + (put 'YaTeX::ref-getset-label 'foundpoint (1- (match-beginning 0))) 1.328 + (buffer-substring 1.329 + (progn 1.330 + (goto-char (match-end 0)) 1.331 + (skip-chars-forward "^{") (1+ (point))) 1.332 + (progn 1.333 + (forward-sexp 1) (1- (point))))) 1.334 ;;else make a label 1.335 ;(goto-char (match-beginning 0)) 1.336 + (noset nil) ;do not set label if noset 1.337 + (t 1.338 (goto-char inspoint) 1.339 (skip-chars-backward " \t\n") 1.340 - (save-excursion (setq newlabel (YaTeX::ref-generate-label))) 1.341 + (save-excursion 1.342 + (setq newlabel 1.343 + (funcall YaTeX-ref-generate-label-function command arg))) 1.344 (delete-region (point) (progn (skip-chars-backward " \t") (point))) 1.345 (if mathp nil 1.346 (insert "\n") 1.347 (YaTeX-reindent cc)) 1.348 (insert (format "\\label{%s}" newlabel)) 1.349 - newlabel)))) 1.350 + newlabel))))) 1.351 1.352 +(defvar YaTeX::ref-labeling-regexp-alist-default 1.353 + '(("\\\\begin{\\(java\\|program\\)}{\\([^}]+\\)}" . 2) 1.354 + ("\\\\label{\\([^}]+\\)}" . 1)) 1.355 + "Alist of labeling regexp vs. its group number points to label string. 1.356 +This alist is used in \\ref's argument's completion.") 1.357 +(defvar YaTeX::ref-labeling-regexp-alist-private nil 1.358 + "*Private extesion to YaTeX::ref-labeling-regexp-alist. 1.359 +See the documetation of YaTeX::ref-labeling-regexp-alist.") 1.360 (defvar YaTeX::ref-labeling-regexp-alist 1.361 - '(("\\\\begin{java}{\\([^}]+\\)}" . 1) 1.362 - ("\\\\label{\\([^}]+\\)}" . 1))) 1.363 + (append YaTeX::ref-labeling-regexp-alist-default 1.364 + YaTeX::ref-labeling-regexp-alist-private)) 1.365 (defvar YaTeX::ref-labeling-regexp 1.366 (mapconcat 'car YaTeX::ref-labeling-regexp-alist "\\|")) 1.367 (defvar YaTeX::ref-mathenv-regexp 1.368 - "equation\\|eqnarray\\|align\\|gather\\|alignat\\|xalignat") 1.369 + ;; See also YaTeX-ams-math-begin-alist in yatex.el 1.370 + ;; Define only envs which has counter.(without *) 1.371 + "equation\\|eqnarray\\|align\\(at\\)?\\|flalign\\|gather\\|xx?alignat\\|multline") 1.372 +(defvar YaTeX::ref-mathenv-exp1-regexp 1.373 + "\\(equation\\|multline\\)\\b" 1.374 + "*Regexp of math-envname which has only one math-expression.") 1.375 (defvar YaTeX::ref-enumerateenv-regexp 1.376 "enumerate") 1.377 +(defvar YaTeX::ref-nestable-counter-regexp 1.378 + "subequations") 1.379 1.380 (defvar YaTeX::ref-labeling-section-level 2 1.381 "*ref補完で収集するセクショニングコマンドの下限レベル 1.382 YaTeX-sectioning-levelの数値で指定.") 1.383 1.384 -(defun YaTeX::ref (argp &optional labelcmd refcmd) 1.385 +(defun YaTeX::ref (argp &optional labelcmd refcmd predf) 1.386 (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache 1.387 (require 'yatexsec) 1.388 (cond 1.389 ((= argp 1) 1.390 - (let*((lnum 0) e0 x cmd label match-point point-list boundary 1.391 + (let*((lnum 0) m0 e0 x cmd label match-point point-list boundary 1.392 (buf (current-buffer)) 1.393 (llv YaTeX::ref-labeling-section-level) 1.394 - (mathenvs YaTeX::ref-mathenv-regexp) 1.395 + (mathenvs YaTeX::ref-mathenv-regexp) envname endrx 1.396 (enums YaTeX::ref-enumerateenv-regexp) 1.397 (counter 1.398 (or labelcmd 1.399 @@ -631,7 +786,12 @@ 1.400 YaTeX-sectioning-level)) 1.401 "\\|") 1.402 "\\|caption\\(\\[[^]]+\\]\\)?\\|footnote\\){" 1.403 - "\\|\\(begin{\\(" mathenvs "\\|" enums "\\)\\)\\)"))) 1.404 + "\\|\\(begin{\\(" mathenvs "\\|" enums "\\)}\\)" 1.405 + (if YaTeX-use-AMS-LaTeX 1.406 + (concat 1.407 + "\\|\\(begin{" 1.408 + YaTeX::ref-nestable-counter-regexp "}\\)")) 1.409 + "\\)"))) 1.410 (regexp (concat "\\(" counter 1.411 "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)")) 1.412 (itemsep (concat YaTeX-ec-regexp 1.413 @@ -642,9 +802,9 @@ 1.414 (output 1.415 (function 1.416 (lambda (label p) 1.417 - (while (setq x (string-match "\n" label)) 1.418 + (while (setq x (string-match "[\n\t]" label)) 1.419 (aset label x ? )) 1.420 - (while (setq x (string-match "[ \t\n][ \t\n]+" label)) 1.421 + (while (setq x (string-match " +" label)) 1.422 (setq label (concat 1.423 (substring label 0 (1+ (match-beginning 0))) 1.424 (substring label (match-end 0))))) 1.425 @@ -652,6 +812,7 @@ 1.426 (setq point-list (cons p point-list)) 1.427 (message "Collecting labels... %d" lnum) 1.428 (setq lnum (1+ lnum))))) 1.429 + (me (if (boundp 'me) me 'YaTeX::ref)) 1.430 ) 1.431 (message "Collecting labels...") 1.432 (save-window-excursion 1.433 @@ -665,12 +826,16 @@ 1.434 (set-buffer buf))) 1.435 (save-excursion 1.436 (set-buffer (get-buffer-create YaTeX-label-buffer)) 1.437 + (condition-case () 1.438 + (if (and YaTeX-use-font-lock (fboundp 'font-lock-mode)) 1.439 + (font-lock-mode 1)) 1.440 + (error nil)) 1.441 (setq buffer-read-only nil) 1.442 (erase-buffer)) 1.443 (save-excursion 1.444 (set-buffer buf) 1.445 (goto-char (point-min)) 1.446 - (let ((standard-output (get-buffer YaTeX-label-buffer))) 1.447 + (let ((standard-output (get-buffer YaTeX-label-buffer)) existlabel) 1.448 (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) 1.449 (while (YaTeX-re-search-active-forward 1.450 regexp ;;counter 1.451 @@ -678,28 +843,118 @@ 1.452 ;(goto-char (match-beginning 0)) 1.453 (setq e0 (match-end 0)) 1.454 (cond 1.455 + ;; 1.456 + ;;2005/10/21 Skip it if predicate function returns nil 1.457 + ((and predf 1.458 + (let ((md (match-data))) 1.459 + (prog1 1.460 + (condition-case nil 1.461 + (not (funcall predf)) 1.462 + (error nil)) 1.463 + (store-match-data md))))) 1.464 ((YaTeX-literal-p) nil) 1.465 ((YaTeX-match-string 1) 1.466 ;;if standard counter commands found 1.467 - (setq cmd (YaTeX-match-string 2)) 1.468 + (setq cmd (YaTeX-match-string 2) 1.469 + m0 (match-beginning 0)) 1.470 (setq match-point (match-beginning 0)) 1.471 (or initl 1.472 (if (< p (point)) (setq initl lnum))) 1.473 (cond 1.474 + ;; In any case, variables e0 should be set 1.475 + ((and YaTeX-use-AMS-LaTeX 1.476 + (string-match YaTeX::ref-nestable-counter-regexp cmd)) 1.477 + (let (label) 1.478 + (skip-chars-forward "}") 1.479 + (setq label (buffer-substring 1.480 + (point) (min (+ 80 (point)) (point-max)))) 1.481 + ;; to skip (maybe)auto-generated comment 1.482 + (skip-chars-forward " \t") 1.483 + (if (looking-at YaTeX-comment-prefix) 1.484 + (forward-line 1)) 1.485 + (setq e0 (point)) 1.486 + (skip-chars-forward " \t\n") 1.487 + (if (looking-at "\\\\label{\\([^}]+\\)}") 1.488 + (setq label (format "(labe:%s)" (YaTeX-match-string 1)) 1.489 + e0 (match-end 1))) 1.490 + (funcall output (format "--subequation--%s" label) e0))) 1.491 ((string-match mathenvs cmd) ;;if matches mathematical env 1.492 ;(skip-chars-forward "} \t\n") 1.493 - (forward-line 1) 1.494 - (setq x (point)) 1.495 - (catch 'scan 1.496 - (while (YaTeX-re-search-active-forward 1.497 - (concat "\\\\\\\\$\\|\\\\end{\\(" mathenvs "\\)") 1.498 - percent nil t) 1.499 - (let ((quit (match-beginning 1))) 1.500 - (funcall output 1.501 - (buffer-substring x (match-beginning 0)) 1.502 - x) 1.503 - (if quit (throw 'scan t))) 1.504 - (setq x (point)))) 1.505 + ;(forward-line 1) ;2004/1/25 1.506 + (skip-chars-forward "}") 1.507 + (setq x (point) 1.508 + envname (substring 1.509 + cmd (match-beginning 0) (match-end 0))) 1.510 + (save-restriction 1.511 + (narrow-to-region 1.512 + m0 1.513 + (save-excursion 1.514 + (YaTeX-re-search-active-forward 1.515 + (setq endrx (format "%send{%s}" YaTeX-ec-regexp 1.516 + (regexp-quote envname))) 1.517 + percent nil t))) 1.518 + (catch 'scan 1.519 + (while (YaTeX-re-search-active-forward 1.520 + (concat 1.521 + "\\\\end{\\(" (regexp-quote envname) "\\)";;(1) 1.522 + (if YaTeX-use-AMS-LaTeX 1.523 + "\\|\\\\\\(notag\\)") ;;2 1.524 + (if (string-match 1.525 + YaTeX::ref-mathenv-exp1-regexp cmd) 1.526 + "" "\\|\\\\\\\\$") 1.527 + ) 1.528 + percent nil t) 1.529 + (let*((quit (match-beginning 1)) 1.530 + (notag (match-beginning 2)) 1.531 + (label ".......................") l2 1.532 + (e (point)) (m0 (match-beginning 0)) 1.533 + (ln (YaTeX-string-width label))) 1.534 + (cond 1.535 + (notag 1.536 + (YaTeX-re-search-active-forward 1.537 + "\\\\\\\\" percent nil 1) 1.538 + (setq x (point))) 1.539 + (t 1.540 + (if (YaTeX-re-search-active-backward 1.541 + YaTeX::ref-labeling-regexp 1.542 + percent x t) 1.543 + ;; if \label{x} in math-expression, display it 1.544 + ;; because formula source is hard to recognize 1.545 + (progn 1.546 + (goto-char (match-end 0)) 1.547 + (setq l2 (format "\"label:%s\"" 1.548 + (buffer-substring 1.549 + (1- (point)) 1.550 + (progn (forward-sexp -1) 1.551 + (1+ (point)))))) 1.552 + (setq label 1.553 + (if (< (YaTeX-string-width l2) ln) 1.554 + (concat 1.555 + l2 1.556 + (substring 1.557 + label 1.558 + 0 (- ln (YaTeX-string-width l2)))) 1.559 + l2)) 1.560 + (goto-char e))) 1.561 + (funcall output 1.562 + (concat 1.563 + label " " 1.564 + (buffer-substring x m0)) 1.565 + x) 1.566 + (cond 1.567 + ((YaTeX-quick-in-environment-p 1.568 + YaTeX-math-gathering-list) 1.569 + ;; if here is inner split/cases/gathered env., 1.570 + ;; counter for here is only one. 1.571 + ;; Go out this environment and, 1.572 + (YaTeX-end-of-environment) 1.573 + ;; search next expression unit boundary. 1.574 + (YaTeX-re-search-active-forward 1.575 + (concat endrx "\\|\\\\begin{") 1.576 + percent nil 1) 1.577 + (end-of-line))) 1.578 + (if quit (throw 'scan t))))) 1.579 + (setq x (point))))) 1.580 (setq e0 (point))) 1.581 ((string-match enums cmd) 1.582 ;(skip-chars-forward "} \t\n") 1.583 @@ -715,15 +970,51 @@ 1.584 (setq x (match-beginning 0)) 1.585 (funcall 1.586 output 1.587 - (buffer-substring 1.588 - (match-beginning 0) 1.589 - (if (re-search-forward itemsep nil t) 1.590 - (progn (goto-char (match-beginning 0)) 1.591 - (skip-chars-backward " \t") 1.592 - (1- (point))) 1.593 - (point-end-of-line))) 1.594 + (concat 1.595 + existlabel 1.596 + (buffer-substring 1.597 + (match-beginning 0) 1.598 + (if (re-search-forward itemsep nil t) 1.599 + (progn (goto-char (match-beginning 0)) 1.600 + (skip-chars-backward " \t") 1.601 + (1- (point))) 1.602 + (point-end-of-line)))) 1.603 x)) 1.604 (setq e0 (point-max)))) 1.605 + ((string-match "bibitem" cmd) ;maybe generated by myself 1.606 + (setq label "") 1.607 + (skip-chars-forward " \t") 1.608 + (if (looking-at "{") ;sure to be true!! 1.609 + (forward-list 1)) 1.610 + (let ((list '(30 10 65)) 1.611 + (delim ";") q lim len l str) 1.612 + (save-excursion 1.613 + (setq lim (if (re-search-forward itemsep nil 1) 1.614 + (match-beginning 0) (point)))) 1.615 + (while list 1.616 + (skip-chars-forward " \t\n\\") 1.617 + (setq q (looking-at "[\"'{]") 1.618 + len (car list) 1.619 + str 1.620 + (buffer-substring 1.621 + (point) 1.622 + (progn 1.623 + (if q (forward-sexp 1) 1.624 + (search-forward delim lim 1) 1.625 + (forward-char -1)) 1.626 + (point)))) 1.627 + (if (> (setq l (YaTeX-string-width str)) len) 1.628 + (setq str (concat 1.629 + (YaTeX-truncate-string-width 1.630 + str (- len (if q 5 4))) 1.631 + "... " 1.632 + (if q (substring str -1))))) 1.633 + (if (< (setq l (YaTeX-string-width str)) len) 1.634 + (setq str (concat str (make-string (- len l) ? )))) 1.635 + (if (looking-at delim) (goto-char (match-end 0))) 1.636 + (setq label (concat label " " str) 1.637 + list (cdr list))) 1.638 + (funcall output label match-point))) 1.639 ;;else, simple section-type counter 1.640 ((= (char-after (1- (point))) ?{) 1.641 (setq label (buffer-substring 1.642 @@ -733,6 +1024,8 @@ 1.643 (point)))) 1.644 (funcall output label match-point) 1.645 ;; Skip preceding label if exists 1.646 + (if (YaTeX::ref-getset-label (current-buffer) match-point t) 1.647 + (goto-char (get 'YaTeX::ref-getset-label 'foundpoint))) 1.648 (if (save-excursion 1.649 (skip-chars-forward "\t \n") 1.650 (looking-at YaTeX::ref-labeling-regexp)) 1.651 @@ -819,14 +1112,45 @@ 1.652 label))))) 1.653 1.654 (fset 'YaTeX::pageref 'YaTeX::ref) 1.655 +(defun YaTeX::tabref (argp) ; For the style file of IPSJ journal 1.656 + (YaTeX::ref 1.657 + argp nil nil 1.658 + (function 1.659 + (lambda () 1.660 + (YaTeX-quick-in-environment-p "table"))))) 1.661 +(defun YaTeX::figref (argp) ; For the style file of IPSJ journal 1.662 + (YaTeX::ref 1.663 + argp nil nil 1.664 + (function 1.665 + (lambda () 1.666 + (YaTeX-quick-in-environment-p "figure"))))) 1.667 1.668 -(defun YaTeX::cite-collect-bibs-external (&rest files) 1.669 - "Collect bibentry from FILES(variable length argument); 1.670 +(defun YaTeX::cite-collect-bibs-external (bibptn &rest files) 1.671 + "Collect bibentry from FILES(variable length argument) ; 1.672 and print them to standard output." 1.673 ;;Thanks; http://icarus.ilcs.hokudai.ac.jp/comp/biblio.html 1.674 - (let ((tb (get-buffer-create " *bibtmp*"))) 1.675 + (let*((tb (get-buffer-create " *bibtmp*")) 1.676 + (bibitemsep "^\\s *@[A-Za-z]") 1.677 + (target (if (string< "" bibptn) bibptn bibitemsep)) 1.678 + (checkrx (concat "\\(" bibptn "\\)\\|" bibitemsep)) 1.679 + beg 1.680 + (searchnext 1.681 + (if (string< "" bibptn) 1.682 + (function 1.683 + (lambda() 1.684 + (setq beg (point)) 1.685 + (and 1.686 + (prog1 1.687 + (re-search-forward target nil t) 1.688 + (end-of-line)) 1.689 + (re-search-backward bibitemsep beg t)))) 1.690 + (function 1.691 + (lambda() 1.692 + (re-search-forward target nil t))))) 1.693 + ) 1.694 (save-excursion 1.695 (set-buffer tb) 1.696 + (princ (format "%sbegin{thebibliography}\n" YaTeX-ec)) 1.697 (while files 1.698 (erase-buffer) 1.699 (cond 1.700 @@ -836,8 +1160,9 @@ 1.701 (insert-file-contents (concat (car files) ".bib")))) 1.702 (save-excursion 1.703 (goto-char (point-min)) 1.704 - (while (re-search-forward "^\\s *@[A-Za-z]" nil t) 1.705 + (while (funcall searchnext) 1.706 (skip-chars-forward "^{,") 1.707 + (setq beg (point)) 1.708 (if (= (char-after (point)) ?{) 1.709 (princ (format "%sbibitem{%s}%s\n" 1.710 YaTeX-ec 1.711 @@ -845,39 +1170,64 @@ 1.712 (1+ (point)) 1.713 (progn (skip-chars-forward "^,\n") 1.714 (point))) 1.715 - (if (re-search-forward "title\\s *=" nil t) 1.716 - (buffer-substring 1.717 - (progn 1.718 - (goto-char (match-end 0)) 1.719 - (skip-chars-forward " \t\n") 1.720 - (point)) 1.721 - (progn 1.722 - (if (looking-at "[{\"]") 1.723 - (forward-sexp 1) 1.724 - (forward-char 1) 1.725 - (skip-chars-forward "^,")) 1.726 - (point))))))))) 1.727 - (setq files (cdr files)))))) 1.728 + (mapconcat 1.729 + (function 1.730 + (lambda (kwd) 1.731 + (goto-char beg) 1.732 + (if (re-search-forward 1.733 + (concat kwd "\\s *=") nil t) 1.734 + (buffer-substring 1.735 + (progn 1.736 + (goto-char (match-end 0)) 1.737 + (skip-chars-forward " \t\n") 1.738 + (point)) 1.739 + (progn 1.740 + (if (looking-at "[{\"]") 1.741 + (forward-sexp 1) 1.742 + (forward-char 1) 1.743 + (skip-chars-forward "^,}")) 1.744 + (point)))))) 1.745 + '("author" "year" "title" ) 1.746 + ";")))) 1.747 + (and (re-search-forward bibitemsep nil t) 1.748 + (forward-line -1)))) 1.749 + (setq files (cdr files))) 1.750 + (princ (format "%sbegin{thebibliography}\n" YaTeX-ec))))) 1.751 1.752 (defvar YaTeX::cite-bibitem-macro-regexp "bibitem\\|harvarditem" 1.753 "*Regexp of macro name of bibitem definition") 1.754 1.755 -(defun YaTeX::cite-collect-bibs-internal () 1.756 +(defun YaTeX::cite-collect-bibs-internal (bibptn) 1.757 "Collect bibentry in the current buffer and print them to standard output." 1.758 (let ((ptn (concat YaTeX-ec-regexp 1.759 "\\(" YaTeX::cite-bibitem-macro-regexp "\\)\\b")) 1.760 + (lim (concat YaTeX-ec-regexp 1.761 + "\\(" YaTeX::cite-bibitem-macro-regexp "\\b\\)" 1.762 + "\\|\\(end{\\)")) 1.763 (pcnt (regexp-quote YaTeX-comment-prefix))) 1.764 + ;; Using bibptn not yet implemented. 1.765 + ;; Do you need it?? 2005/11/22 1.766 (save-excursion 1.767 (while (YaTeX-re-search-active-forward ptn pcnt nil t) 1.768 (skip-chars-forward "^{\n") 1.769 (or (eolp) 1.770 - (princ (format "%sbibitem{%s}\n" 1.771 + (princ (format "%sbibitem%s %s\n" 1.772 YaTeX-ec 1.773 (buffer-substring 1.774 - (1+ (point)) 1.775 - (progn (forward-sexp 1) (point)))))))))) 1.776 + (point) 1.777 + (progn (forward-sexp 1) (point))) 1.778 + (buffer-substring 1.779 + (progn (skip-chars-forward "\n \t") (point)) 1.780 + (save-excursion 1.781 + (if (YaTeX-re-search-active-forward 1.782 + lim pcnt nil t) 1.783 + (progn 1.784 + (goto-char (match-beginning 0)) 1.785 + (skip-chars-backward "\n \t") 1.786 + (point)) 1.787 + (point-end-of-line))))))))))) 1.788 1.789 -(defun YaTeX::cite (argp) 1.790 +(defun YaTeX::cite (argp &rest dummy) 1.791 (cond 1.792 ((eq argp 1) 1.793 (let* ((cb (current-buffer)) 1.794 @@ -886,8 +1236,10 @@ 1.795 (hilit-auto-highlight nil) 1.796 (pcnt (regexp-quote YaTeX-comment-prefix)) 1.797 (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}")) 1.798 + (bibptn (read-string "Pattern: ")) 1.799 (bbuf (get-buffer-create " *bibitems*")) 1.800 (standard-output bbuf) 1.801 + (me 'YaTeX::cite) ;shuld set this for using YaTeX::ref 1.802 bibs files) 1.803 (set-buffer bbuf)(erase-buffer)(set-buffer cb) 1.804 (save-excursion 1.805 @@ -895,10 +1247,11 @@ 1.806 ;;(1)search external bibdata 1.807 (while (YaTeX-re-search-active-forward bibrx pcnt nil t) 1.808 (apply 'YaTeX::cite-collect-bibs-external 1.809 + bibptn 1.810 (YaTeX-split-string 1.811 (YaTeX-match-string 1) ","))) 1.812 ;;(2)search direct \bibitem usage 1.813 - (YaTeX::cite-collect-bibs-internal) 1.814 + (YaTeX::cite-collect-bibs-internal bibptn) 1.815 (if (progn 1.816 (YaTeX-visit-main t) 1.817 (not (eq (current-buffer) cb))) 1.818 @@ -907,12 +1260,15 @@ 1.819 ;;(1)search external bibdata 1.820 (while (YaTeX-re-search-active-forward bibrx pcnt nil t) 1.821 (apply 'YaTeX::cite-collect-bibs-external 1.822 + bibptn 1.823 (YaTeX-split-string 1.824 (YaTeX-match-string 1) ","))) 1.825 ;;(2)search internal 1.826 - (YaTeX::cite-collect-bibs-internal))) 1.827 + (YaTeX::cite-collect-bibs-internal bibptn))) 1.828 ;;Now bbuf holds the list of bibitem 1.829 (set-buffer bbuf) 1.830 + ;;;(switch-to-buffer bbuf) 1.831 + (if (fboundp 'font-lock-fontify-buffer) (font-lock-fontify-buffer)) 1.832 (YaTeX::ref 1.833 argp 1.834 (concat "\\\\\\(" 1.835 @@ -929,6 +1285,8 @@ 1.836 (fset 'YaTeX::possessivecite 'YaTeX::cite) 1.837 (fset 'YaTeX::citeyear 'YaTeX::cite) 1.838 (fset 'YaTeX::citename 'YaTeX::cite) 1.839 +(fset 'YaTeX::citep 'YaTeX::cite) 1.840 +(fset 'YaTeX::citet 'YaTeX::cite) 1.841 1.842 (defun YaTeX-yatex-buffer-list () 1.843 (save-excursion 1.844 @@ -982,7 +1340,7 @@ 1.845 ((null rv) "") 1.846 (t 1.847 (set-buffer rv) 1.848 - (YaTeX::ref argp labelcmd refcmd))))) 1.849 + (funcall me argp labelcmd refcmd))))) 1.850 1.851 ;; 1.852 ; completion for the arguments of \newcommand 1.853 @@ -1020,6 +1378,12 @@ 1.854 )) 1.855 (t ""))) 1.856 1.857 +(defun YaTeX::newcounter (&optional argp) 1.858 + (cond 1.859 + ((= argp 1) 1.860 + (read-string "New counter name: ")) 1.861 + (t ""))) 1.862 + 1.863 ;; 1.864 ; completion for the arguments of \pagestyle 1.865 ;; 1.866 @@ -1159,16 +1523,6 @@ 1.867 (defvar YaTeX:documentstyle-options-local nil 1.868 "List of LaTeX local documentstyle options.") 1.869 1.870 -(defvar YaTeX-minibuffer-completion-map nil 1.871 - "Minibuffer completion key map that allows comma completion.") 1.872 -(if YaTeX-minibuffer-completion-map nil 1.873 - (setq YaTeX-minibuffer-completion-map 1.874 - (copy-keymap minibuffer-local-completion-map)) 1.875 - (define-key YaTeX-minibuffer-completion-map " " 1.876 - 'YaTeX-minibuffer-complete) 1.877 - (define-key YaTeX-minibuffer-completion-map "\t" 1.878 - 'YaTeX-minibuffer-complete)) 1.879 - 1.880 (defun YaTeX:documentstyle () 1.881 (let*((delim ",") 1.882 (dt (append YaTeX:documentstyle-options-local 1.883 @@ -1210,6 +1564,16 @@ 1.884 (if (string= "" sname) (setq sname YaTeX-default-document-style)) 1.885 (setq YaTeX-default-document-style sname))))) 1.886 1.887 +(defun YaTeX::include (argp &optional prompt) 1.888 + (cond 1.889 + ((= argp 1) 1.890 + (let*((insert-default-directory) 1.891 + (file (read-file-name (or prompt "Input file: ") ""))) 1.892 + (setq file (substring file 0 (string-match "\\.tex$" file))))))) 1.893 + 1.894 +(fset 'YaTeX::input 'YaTeX::include) 1.895 + 1.896 + 1.897 ;;; -------------------- LaTeX2e stuff -------------------- 1.898 (defvar YaTeX:documentclass-options-default 1.899 '(("a4paper") ("a5paper") ("b4paper") ("b5paper") ("10pt") ("11pt") ("12pt") 1.900 @@ -1325,6 +1689,8 @@ 1.901 (fset 'YaTeX:colorbox 'YaTeX:textcolor) 1.902 (fset 'YaTeX::colorbox 'YaTeX::textcolor) 1.903 (fset 'YaTeX:fcolorbox 'YaTeX:textcolor) 1.904 +(fset 'YaTeX:pagecolor 'YaTeX:textcolor) 1.905 +(fset 'YaTeX::pagecolor 'YaTeX::textcolor) 1.906 1.907 (defun YaTeX::fcolorbox (argp) 1.908 (cond 1.909 @@ -1333,14 +1699,46 @@ 1.910 ((= argp 3) (read-string "Colored string: ")))) 1.911 1.912 (defun YaTeX:scalebox () 1.913 - "Add-in for \\rotatebox" 1.914 - (let ((vmag (read-string (if YaTeX-japan "倍率: " "Magnification: "))) 1.915 - (hmag (read-string (if YaTeX-japan "横倍率(省略可): " 1.916 - "Horizontal magnification(Optional): ")))) 1.917 + "Add-in for \\scalebox" 1.918 + (let ((vmag (read-string 1.919 + (if YaTeX-japan "倍率(負で反転): " 1.920 + "Magnification(Negative for flipped): "))) 1.921 + (hmag (read-string (if YaTeX-japan "縦倍率(省略可): " 1.922 + "Vertical magnification(Optional): ")))) 1.923 (if (and hmag (string< "" hmag)) 1.924 (format "{%s}[%s]" vmag hmag) 1.925 (format "{%s}" vmag)))) 1.926 1.927 +(defun YaTeX:rotatebox () 1.928 + "Optional argument add-in for \\rotatebox" 1.929 + (message "Rotate origin? (N)one (O)rigin (X)-Y: ") 1.930 + (let ((c (read-char)) r (defx "x=mm") x (defy "y=mm") y something) 1.931 + (cond 1.932 + ((memq c '(?O ?o)) 1.933 + (if (string< "" (setq r (YaTeX:read-oneof "htbpB"))) 1.934 + (concat "[origin=" r "]"))) 1.935 + ((memq c '(?X ?x ?Y ?y)) 1.936 + (setq r (read-string "" (if YaTeX-emacs-19 (cons defx 3) defx)) 1.937 + x (if (string< "x=" r) r) 1.938 + r (read-string "" (if YaTeX-emacs-19 (cons defy 3) defy)) 1.939 + y (if (string< "y=" r) r) 1.940 + something (or x y)) 1.941 + (format "%s%s%s%s%s" 1.942 + (if something "[" "") 1.943 + (if x x "") 1.944 + (if (and x y) "," "") 1.945 + (if y y "") 1.946 + (if something "]" "")))))) 1.947 + 1.948 +(defun YaTeX::rotatebox (argp) 1.949 + "Argument add-in for \\rotatebox" 1.950 + (cond 1.951 + ((= argp 1) 1.952 + (read-string (if YaTeX-japan "回転角(度; 左回り): " 1.953 + "Angle in degree(unclockwise): "))) 1.954 + ((= argp 2) 1.955 + (read-string (if YaTeX-japan "テキスト: " "Text: "))))) 1.956 + 1.957 (defun YaTeX:includegraphics () 1.958 "Add-in for \\includegraphics's option" 1.959 (let (width height (scale "") angle str) 1.960 @@ -1364,21 +1762,21 @@ 1.961 1.962 (defun YaTeX::includegraphics (argp) 1.963 "Add-in for \\includegraphics" 1.964 - (cond 1.965 - ((= argp 1) 1.966 - (read-file-name "EPS File: " "")))) 1.967 + (YaTeX::include argp "Image File: ")) 1.968 1.969 (defun YaTeX:caption () 1.970 (setq YaTeX-section-name "label") 1.971 nil) 1.972 1.973 + 1.974 (defvar YaTeX::usepackage-alist-default 1.975 '(("version") ("plext") ("url") ("fancybox") ("pifont") ("longtable") 1.976 ("ascmac") ("bm") ("graphics") ("graphicx") ("alltt") ("misc") ("eclbkbox") 1.977 ("amsmath") ("amssymb") ("xymtex") ("chemist") 1.978 ("a4j") ("array") ("epsf") ("color") ("epsfig") ("floatfig") 1.979 - ("landscape") ("path") ("supertabular") ("twocolumn")) 1.980 - "Default completion table for arguments of \usepackage") 1.981 + ("landscape") ("path") ("supertabular") ("twocolumn") 1.982 + ("latexsym") ("times") ("makeidx")) 1.983 + "Default completion table for arguments of \\usepackage") 1.984 1.985 (defvar YaTeX::usepackage-alist-private nil 1.986 "*Private completion list of the argument for usepackage") 1.987 @@ -1390,11 +1788,14 @@ 1.988 (cond 1.989 ((equal argp 1) 1.990 (setq YaTeX-env-name "document") 1.991 - (YaTeX-cplread-with-learning 1.992 - "Use package: " 1.993 - 'YaTeX::usepackage-alist-default 1.994 - 'YaTeX::usepackage-alist-private 1.995 - 'YaTeX::usepackage-alist-local)))) 1.996 + (let ((minibuffer-local-completion-map YaTeX-minibuffer-completion-map) 1.997 + (delim ",")) 1.998 + (YaTeX-cplread-with-learning 1.999 + (if YaTeX-japan "Use package(カンマで区切ってOK): " 1.1000 + "Use package(delimitable by comma): ") 1.1001 + 'YaTeX::usepackage-alist-default 1.1002 + 'YaTeX::usepackage-alist-private 1.1003 + 'YaTeX::usepackage-alist-local))))) 1.1004 1.1005 (defun YaTeX::mask (argp) 1.1006 (cond 1.1007 @@ -1422,8 +1823,20 @@ 1.1008 ((equal argp 4) 1.1009 (YaTeX:read-oneof "lcr" 'quick)) 1.1010 ((equal argp 5) 1.1011 - (read-string "String: ")) 1.1012 -)) 1.1013 + (read-string "String: ")))) 1.1014 + 1.1015 +(defun YaTeX::textcircled (argp) 1.1016 + (cond 1.1017 + ((equal argp 1) 1.1018 + (let ((char (read-string "Circled char: ")) 1.1019 + (left "") (right "") c) 1.1020 + (setq c (read-char 1.1021 + "Enclose also with (s)mall (t)iny s(C)riptsize (N)one:")) 1.1022 + (cond 1.1023 + ((memq c '(?s ?S)) (setq left "{\\small " right "}")) 1.1024 + ((memq c '(?t ?T)) (setq left "{\\tiny " right "}")) 1.1025 + ((memq c '(?c ?C)) (setq left "{\\scriptsize " right "}"))) 1.1026 + (format "%s%s%s" left char right))))) 1.1027 1.1028 ;;; -------------------- math-mode stuff -------------------- 1.1029 (defun YaTeX::tilde (&optional pos) 1.1030 @@ -1509,6 +1922,11 @@ 1.1031 (YaTeX-kill-paren nil)))))) 1.1032 (message "")) 1.1033 1.1034 +(defun YaTeX::DeclareMathOperator (argp) 1.1035 + (cond 1.1036 + ((equal argp 1) 1.1037 + (read-string "Operator: " "\\")))) 1.1038 + 1.1039 ;;; 1.1040 ;; Add-in functions for large-type command. 1.1041 ;;; 1.1042 @@ -1524,5 +1942,5 @@ 1.1043 ; fill-prefix: ";;; " 1.1044 ; paragraph-start: "^$\\|\\|;;;$" 1.1045 ; paragraph-separate: "^$\\|\\|;;;$" 1.1046 -; buffer-file-coding-system: sjis 1.1047 +; coding: sjis 1.1048 ; End: