yuuji@6: ;;; -*- Emacs-Lisp -*- yuuji@6: ;;; YaTeX add in functions. yuuji@6: ;;; yatexadd.el rev.2 yuuji@6: ;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] yuuji@6: ;;; Last modified Fri Feb 5 09:36:06 1993 on gloria yuuji@6: yuuji@6: (provide 'yatexadd) yuuji@6: yuuji@6: ;;; yuuji@6: ;;Sample functions for LaTeX environment. yuuji@6: ;;; yuuji@6: (defvar YaTeX:tabular-default-rule yuuji@6: "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}" yuuji@6: "*Your favorite default rule format." yuuji@6: ) yuuji@6: (defun YaTeX:tabular () yuuji@6: "YaTeX add in function for tabular environment." yuuji@6: (let (bars (rule "") (j 0) loc) yuuji@6: (setq bars (string-to-int (read-string "Number of `|': "))) yuuji@6: (if (> bars 0) yuuji@6: (while (< j bars) (setq rule (concat rule "|")) (setq j (1+ j))) yuuji@6: (setq rule YaTeX:tabular-default-rule)) yuuji@6: (setq rule (read-string "rule format: " rule)) yuuji@6: yuuji@6: (insert (format "{%s}" rule)) yuuji@6: (message "")) yuuji@6: ) yuuji@6: yuuji@6: (defun YaTeX:table () yuuji@6: (let ((pos "")) yuuji@6: (message "Position []:") yuuji@6: (while (not (string-match yuuji@6: (setq loc (read-key-sequence (format "Position [%s]: " pos))) yuuji@6: "\r\^g\n")) yuuji@6: (cond yuuji@6: ((string-match loc "htbp") yuuji@6: (if (not (string-match loc pos)) yuuji@6: (setq pos (concat pos loc)))) yuuji@6: ((and (string-match loc "\C-h\C-?") (> (length pos) 0)) yuuji@6: (setq pos (substring pos 0 (1- (length pos))))) yuuji@6: (t yuuji@6: (ding) yuuji@6: (message "Please input one of `htbp'.") yuuji@6: (sit-for 3)))) yuuji@6: (if (string= pos "") nil yuuji@6: (insert "[" pos "]"))) yuuji@6: ) yuuji@6: yuuji@6: (defun YaTeX:description () yuuji@6: "Truly poor service:-)" yuuji@6: (setq single-command "item[]") yuuji@6: ) yuuji@6: yuuji@6: (defun YaTeX:itemize () yuuji@6: "It's also poor service." yuuji@6: (setq single-command "item") yuuji@6: ) yuuji@6: yuuji@6: (fset 'YaTeX:enumerate 'YaTeX:itemize)