yuuji@6: ;;; -*- Emacs-Lisp -*- yuuji@8: ;;; YaTeX add-in functions. yuuji@23: ;;; yatexadd.el rev.9 yuuji@14: ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] yuuji@23: ;;; Last modified Mon Jun 27 17:00:19 1994 on figaro yuuji@8: ;;; $Id$ 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@23: (defvar YaTeX:tabular-thick-vrule "\\vrule width %s" yuuji@23: "*Vertical thick line format (without @{}). %s'll be replaced by its width." yuuji@23: ) yuuji@23: (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}" yuuji@23: "*Horizontal thick line format. %s will be replaced by its width." yuuji@23: ) yuuji@6: (defun YaTeX:tabular () yuuji@18: "YaTeX add-in function for tabular environment. yuuji@18: Notice that this function refers the let-variable `env' in yuuji@18: YaTeX-make-begin-end." yuuji@23: (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline")) yuuji@18: (if (string= env "tabular*") yuuji@18: (setq width (concat "{" (read-string "Width: ") "}"))) yuuji@18: (setq loc (YaTeX:read-position "tb") yuuji@23: bars (string-to-int yuuji@23: (read-string "Number of columns(0 for default format): " "3"))) yuuji@23: (if (<= bars 0) yuuji@23: (setq ;if 0, simple format yuuji@23: rule YaTeX:tabular-default-rule yuuji@23: and "& &") yuuji@23: (while (< j bars) ;repeat bars-1 times yuuji@23: (setq rule (concat rule "c|") yuuji@23: and (concat and "& ") yuuji@23: j (1+ j))) yuuji@23: (setq rule (concat rule "c")) yuuji@23: (message "(N)ormal-frame or (T)hick frame? [nt]") yuuji@23: (setq ans (read-char)) yuuji@23: (cond yuuji@23: ((or (equal ans ?t) (equal ans ?T)) yuuji@23: (setq ans (read-string "Rule width: " "1pt") yuuji@23: rule (concat yuuji@23: "@{" (format YaTeX:tabular-thick-vrule ans) "}" yuuji@23: rule yuuji@23: "@{\\ " (format YaTeX:tabular-thick-vrule ans) "}") yuuji@23: hline (format YaTeX:tabular-thick-hrule ans))) yuuji@23: (t (setq rule (concat "|" rule "|") yuuji@23: hline "\\hline")))) yuuji@23: yuuji@6: (setq rule (read-string "rule format: " rule)) yuuji@6: yuuji@23: (message "Dont forget to remove null line at the end of tabular.") yuuji@23: (format "%s%s{%s}%s" yuuji@23: width loc rule yuuji@23: (if (and (boundp 'region-mode) region-mode) yuuji@23: "" ;do nothing in region-mode yuuji@23: (format "\n%s\n%s \\\\ \\hline\n%s\n\\\\ %s" yuuji@23: hline and and hline)))) yuuji@18: ) yuuji@18: (fset 'YaTeX:tabular* 'YaTeX:tabular) yuuji@18: (defun YaTeX:array () yuuji@18: (concat (YaTeX:read-position "tb") yuuji@18: "{" (read-string "Column format: ") "}") yuuji@6: ) yuuji@6: yuuji@23: (defun YaTeX:read-oneof (oneof) yuuji@23: (let ((pos "") loc (guide "")) yuuji@23: (and (boundp 'name) name (setq guide (format "%s " name))) yuuji@6: (while (not (string-match yuuji@8: (setq loc (read-key-sequence yuuji@23: (format "%s position (`%s') [%s]: " yuuji@23: guide oneof pos)));name is in YaTeX-addin yuuji@6: "\r\^g\n")) yuuji@6: (cond yuuji@8: ((string-match loc oneof) 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@8: (message "Please input one of `%s'." oneof) yuuji@6: (sit-for 3)))) yuuji@8: (message "") yuuji@23: pos) yuuji@23: ) yuuji@23: yuuji@23: (defun YaTeX:read-position (oneof) yuuji@23: "Read a LaTeX (optional) position format such as `[htbp]'." yuuji@23: (let ((pos (YaTeX:read-oneof oneof))) yuuji@23: (if (string= pos "") "" (concat "[" pos "]"))) yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:table () yuuji@8: "YaTeX add-in function for table environment." yuuji@8: (YaTeX:read-position "htbp") yuuji@6: ) yuuji@6: yuuji@6: (defun YaTeX:description () yuuji@6: "Truly poor service:-)" yuuji@6: (setq single-command "item[]") yuuji@8: "" yuuji@6: ) yuuji@6: yuuji@6: (defun YaTeX:itemize () yuuji@6: "It's also poor service." yuuji@6: (setq single-command "item") yuuji@8: "" yuuji@6: ) yuuji@6: yuuji@6: (fset 'YaTeX:enumerate 'YaTeX:itemize) yuuji@8: yuuji@11: (defun YaTeX:picture () yuuji@11: "Ask the size of coordinates of picture environment." yuuji@11: (concat (YaTeX:read-coordinates "Picture size") yuuji@11: (YaTeX:read-coordinates "Initial position")) yuuji@11: ) yuuji@11: yuuji@12: (defun YaTeX:equation () yuuji@12: (if (fboundp 'YaTeX-toggle-math-mode) yuuji@12: (YaTeX-toggle-math-mode t)) ;force math-mode ON. yuuji@12: ) yuuji@12: (fset 'YaTeX:eqnarray 'YaTeX:equation) yuuji@12: (fset 'YaTeX:displaymath 'YaTeX:equation) yuuji@12: yuuji@16: (defun YaTeX:list () yuuji@16: "%\n{} %default label\n{} %formatting parameter" yuuji@16: ) yuuji@16: yuuji@18: (defun YaTeX:minipage () yuuji@18: (concat (YaTeX:read-position "cbt") yuuji@18: "{" (read-string "Width: ") "}") yuuji@18: ) yuuji@18: yuuji@8: ;;; yuuji@8: ;;Sample functions for section-type command. yuuji@8: ;;; yuuji@8: (defun YaTeX:multiput () yuuji@8: (concat (YaTeX:read-coordinates "Pos") yuuji@8: (YaTeX:read-coordinates "Step") yuuji@8: "{" (read-string "How many times: ") "}") yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:put () yuuji@8: (YaTeX:read-coordinates "Pos") yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:makebox () yuuji@23: (cond yuuji@23: ((YaTeX-in-environment-p "picture") yuuji@23: (concat (YaTeX:read-coordinates "Dimension") yuuji@23: (YaTeX:read-position "lrtb"))) yuuji@23: (t yuuji@23: (let ((width (read-string "Width: "))) yuuji@23: (if (string< "" width) yuuji@23: (progn yuuji@23: (or (equal (aref width 0) ?\[) yuuji@23: (setq width (concat "[" width "]"))) yuuji@23: (concat width (YaTeX:read-position "lr"))))))) yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:framebox () yuuji@8: (if (YaTeX-quick-in-environment-p "picture") yuuji@8: (YaTeX:makebox)) yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:dashbox () yuuji@8: (concat "{" (read-string "Dash dimension: ") "}" yuuji@8: (YaTeX:read-coordinates "Dimension")) yuuji@8: ) yuuji@8: yuuji@23: (defun YaTeX:left () yuuji@23: (let (c) yuuji@23: (while (not (string-match yuuji@23: (progn (message "Which parenthesis? One of [{(|)}]: ") yuuji@23: (setq c (regexp-quote (char-to-string (read-char))))) yuuji@23: "[{(|)}]"))) yuuji@23: (setq single-command "right") yuuji@23: (cond yuuji@23: ((string-match c "[(|)]") c) yuuji@23: (t (concat "\\" c)))) yuuji@23: ) yuuji@23: (fset 'YaTeX:right 'YaTeX:left) yuuji@23: yuuji@8: (defun YaTeX:read-coordinates (&optional mes varX varY) yuuji@8: (concat yuuji@8: "(" yuuji@8: (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) yuuji@8: "," yuuji@8: (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) yuuji@8: ")") yuuji@8: ) yuuji@8: yuuji@8: ;;; yuuji@8: ;;Sample functions for maketitle-type command. yuuji@8: ;;; yuuji@8: (defun YaTeX:sum () yuuji@8: "Read range of summation." yuuji@8: (YaTeX:check-completion-type 'maketitle) yuuji@8: (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^")) yuuji@8: ) yuuji@8: yuuji@8: (fset 'YaTeX:int 'YaTeX:sum) yuuji@8: yuuji@8: (defun YaTeX:lim () yuuji@8: "Insert limit notation of \\lim." yuuji@8: (YaTeX:check-completion-type 'maketitle) yuuji@8: (let ((var (read-string "Variable: ")) limit) yuuji@8: (if (string= "" var) "" yuuji@8: (setq limit (read-string "Limit ($ means infinity): ")) yuuji@8: (if (string= "$" limit) (setq limit "\\infty")) yuuji@8: (concat "_{" var " \\rightarrow " limit "}"))) yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:gcd () yuuji@8: "Add-in function for \\gcd(m,n)." yuuji@8: (YaTeX:check-completion-type 'maketitle) yuuji@8: (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)") yuuji@8: ) yuuji@8: yuuji@8: (defun YaTeX:read-boundary (ULchar) yuuji@8: "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." yuuji@11: (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) yuuji@8: (if (string= bndry "") "" yuuji@11: (if (string= bndry "$") (setq bndry "\\infty")) yuuji@8: (concat ULchar "{" bndry "}"))) yuuji@8: ) yuuji@8: yuuji@14: (defun YaTeX:verb () yuuji@14: "Enclose \\verb's contents with the same characters." yuuji@14: (let ((quote-char (read-string "Quoting char: " "|")) yuuji@14: (contents (read-string "Quoted contents: "))) yuuji@14: (concat quote-char contents quote-char)) yuuji@14: ) yuuji@23: (fset 'YaTeX:verb* 'YaTeX:verb) yuuji@14: yuuji@14: ;;; yuuji@14: ;;Subroutine yuuji@14: ;;; yuuji@14: yuuji@8: (defun YaTeX:check-completion-type (type) yuuji@8: "Check valid completion type." yuuji@8: (if (not (eq type YaTeX-current-completion-type)) yuuji@8: (error "This should be completed with %s-type completion." type)) yuuji@8: ) yuuji@11: yuuji@11: yuuji@11: ;;; yuuji@11: ;;; [[Add-in functions for reading section arguments]] yuuji@11: ;;; yuuji@11: ;; All of add-in functions for reading sections arguments should yuuji@11: ;; take an argument ARGP that specify the argument position. yuuji@11: ;; If argument position is out of range, nil should be returned, yuuji@11: ;; else nil should NOT be returned. yuuji@13: yuuji@13: ;; yuuji@13: ; Label selection yuuji@13: ;; yuuji@11: (defvar YaTeX-label-menu-other yuuji@11: (if YaTeX-japan "':他のバッファのラベル\n" "':LABEL IN OTHER BUFFER.\n")) yuuji@23: (defvar YaTeX-label-menu-repeat yuuji@23: (if YaTeX-japan ".:直前の\\refと同じ\n" "/:REPEAT LAST \ref{}\n")) yuuji@11: (defvar YaTeX-label-menu-any yuuji@11: (if YaTeX-japan "*:任意の文字列\n" "*:ANY STRING.\n")) yuuji@11: (defvar YaTeX-label-buffer "*Label completions*") yuuji@11: (defvar YaTeX-label-guide-msg "Select label and hit RETURN.") yuuji@11: (defvar YaTeX-label-select-map nil yuuji@11: "Key map used in label selection buffer.") yuuji@11: (defun YaTeX::label-setup-key-map () yuuji@11: (if YaTeX-label-select-map nil yuuji@11: (message "Setting up label selection mode map...") yuuji@11: (setq YaTeX-label-select-map (copy-keymap global-map)) yuuji@11: (suppress-keymap YaTeX-label-select-map) yuuji@11: (substitute-all-key-definition yuuji@11: 'previous-line 'YaTeX::label-previous YaTeX-label-select-map) yuuji@11: (substitute-all-key-definition yuuji@11: 'next-line 'YaTeX::label-next YaTeX-label-select-map) yuuji@11: (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next) yuuji@11: (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous) yuuji@11: (define-key YaTeX-label-select-map "<" 'beginning-of-buffer) yuuji@11: (define-key YaTeX-label-select-map ">" 'end-of-buffer) yuuji@11: (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit) yuuji@11: (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit) yuuji@11: (define-key YaTeX-label-select-map " " 'exit-recursive-edit) yuuji@11: (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit) yuuji@11: (define-key YaTeX-label-select-map "/" 'isearch-forward) yuuji@11: (define-key YaTeX-label-select-map "?" 'isearch-backward) yuuji@11: (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag) yuuji@23: (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag) yuuji@11: (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag) yuuji@11: (message "Setting up label selection mode map...Done") yuuji@11: (let ((key ?A)) yuuji@11: (while (<= key ?Z) yuuji@11: (define-key YaTeX-label-select-map (char-to-string key) yuuji@11: 'YaTeX::label-search-tag) yuuji@11: (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A))) yuuji@11: 'YaTeX::label-search-tag) yuuji@11: (setq key (1+ key))))) yuuji@11: ) yuuji@11: (defun YaTeX::label-next () yuuji@11: (interactive) (forward-line 1) (message YaTeX-label-guide-msg)) yuuji@11: (defun YaTeX::label-previous () yuuji@11: (interactive) (forward-line -1) (message YaTeX-label-guide-msg)) yuuji@11: (defun YaTeX::label-search-tag () yuuji@11: (interactive) yuuji@23: (let ((case-fold-search t) (tag (regexp-quote (this-command-keys)))) yuuji@11: (cond yuuji@11: ((save-excursion yuuji@11: (forward-char 1) yuuji@23: (re-search-forward (concat "^" tag) nil t)) yuuji@11: (goto-char (match-beginning 0))) yuuji@11: ((save-excursion yuuji@11: (goto-char (point-min)) yuuji@23: (re-search-forward (concat "^" tag) nil t)) yuuji@11: (goto-char (match-beginning 0)))) yuuji@11: (message YaTeX-label-guide-msg)) yuuji@11: ) yuuji@11: (defun YaTeX::ref (argp) yuuji@11: (cond yuuji@11: ((= argp 1) yuuji@11: (save-excursion yuuji@11: (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer)) yuuji@11: (p (point)) initl line) yuuji@11: (goto-char (point-min)) yuuji@11: (message "Collecting labels...") yuuji@11: (save-window-excursion yuuji@12: (YaTeX-showup-buffer yuuji@12: YaTeX-label-buffer (function (lambda (x) (window-width x)))) yuuji@11: (with-output-to-temp-buffer YaTeX-label-buffer yuuji@11: (while (re-search-forward "\\label{\\([^}]+\\)}" nil t) yuuji@11: (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1)) yuuji@11: (if (search-backward yuuji@11: YaTeX-comment-prefix (point-beginning-of-line) t) nil yuuji@11: (setq label (buffer-substring m1 e1) yuuji@11: label-list (cons label label-list)) yuuji@11: (or initl yuuji@11: (if (< p (point)) (setq initl lnum))) yuuji@11: (beginning-of-line) yuuji@11: (skip-chars-forward " \t\n" nil) yuuji@11: (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label yuuji@11: (buffer-substring (point) (point-end-of-line)))) yuuji@11: (setq lnum (1+ lnum)) yuuji@11: (message "Collecting \\label{}... %d" lnum)) yuuji@11: (goto-char e0)) yuuji@11: (princ YaTeX-label-menu-other) yuuji@23: (princ YaTeX-label-menu-repeat) yuuji@11: (princ YaTeX-label-menu-any) yuuji@11: );with yuuji@11: (goto-char p) yuuji@11: (message "Collecting labels...Done") yuuji@11: (pop-to-buffer YaTeX-label-buffer) yuuji@11: (YaTeX::label-setup-key-map) yuuji@11: (setq truncate-lines t) yuuji@11: (setq buffer-read-only t) yuuji@11: (use-local-map YaTeX-label-select-map) yuuji@11: (message YaTeX-label-guide-msg) yuuji@11: (goto-line (or initl lnum)) ;goto recently defined label line yuuji@11: (unwind-protect yuuji@11: (progn yuuji@11: (recursive-edit) yuuji@11: (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion yuuji@11: (beginning-of-line) yuuji@11: (setq line (count-lines (point-min)(point))) yuuji@11: (cond yuuji@11: ((= line lnum) (setq label (YaTeX-label-other))) yuuji@23: ((= line (1+ lnum)) yuuji@23: (save-excursion yuuji@23: (switch-to-buffer buf) yuuji@23: (goto-char p) yuuji@23: (if (re-search-backward "\\\\ref{\\([^}]+\\)}" nil t) yuuji@23: (setq label (buffer-substring yuuji@23: (match-beginning 1) (match-end 1))) yuuji@23: (setq label "")))) yuuji@23: ((>= line (+ lnum 2)) yuuji@11: (setq label (read-string "\\ref{???}: "))) yuuji@11: (t (setq label (nth (- lnum line 1) label-list))))) yuuji@11: (bury-buffer YaTeX-label-buffer))) yuuji@11: label yuuji@11: )) yuuji@11: )) yuuji@11: ) yuuji@16: (fset 'YaTeX::pageref 'YaTeX::ref) yuuji@11: yuuji@11: (defun YaTeX-label-other () yuuji@11: (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv yuuji@11: (ff "**find-file**")) yuuji@12: (YaTeX-showup-buffer yuuji@12: lbuf (function (lambda (x) 1))) ;;Select next window surely. yuuji@11: (with-output-to-temp-buffer lbuf yuuji@11: (while blist yuuji@11: (if (and (buffer-file-name (setq buf (car blist))) yuuji@11: (progn (set-buffer buf) (eq major-mode 'yatex-mode))) yuuji@11: (princ yuuji@11: (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) yuuji@11: (buffer-name buf)))) yuuji@11: (setq blist (cdr blist))) yuuji@11: (princ (format "':{%s}" ff))) yuuji@11: (pop-to-buffer lbuf) yuuji@11: (YaTeX::label-setup-key-map) yuuji@11: (setq buffer-read-only t) yuuji@11: (use-local-map YaTeX-label-select-map) yuuji@11: (message YaTeX-label-guide-msg) yuuji@11: (unwind-protect yuuji@11: (progn yuuji@11: (recursive-edit) yuuji@11: (set-buffer lbuf) yuuji@11: (beginning-of-line) yuuji@11: (setq rv yuuji@11: (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t) yuuji@11: (buffer-substring (match-beginning 1) (match-end 1)) nil))) yuuji@11: (kill-buffer lbuf)) yuuji@11: (cond yuuji@11: ((null rv) "") yuuji@11: ((string= rv ff) yuuji@11: (call-interactively 'find-file) yuuji@11: (YaTeX::ref argp)) yuuji@11: (t yuuji@11: (set-buffer rv) yuuji@11: (YaTeX::ref argp))) yuuji@11: ) yuuji@11: ) yuuji@11: yuuji@13: ;; yuuji@13: ; completion for the arguments of \newcommand yuuji@13: ;; yuuji@13: (defun YaTeX::newcommand (&optional argp) yuuji@13: (cond yuuji@13: ((= argp 1) yuuji@13: (let ((command (read-string "Define newcommand: " "\\"))) yuuji@13: (put 'YaTeX::newcommand 'command (substring command 1)) yuuji@13: command)) yuuji@13: ((= argp 2) yuuji@13: (let ((argc yuuji@13: (string-to-int (read-string "Number of arguments(Default 0): "))) yuuji@13: (def (read-string "Definition: ")) yuuji@13: (command (get 'YaTeX::newcommand 'command))) yuuji@13: ;;!!! It's illegal to insert string in the add-in function !!! yuuji@13: (if (> argc 0) (insert (format "[%d]" argc))) yuuji@13: (if (and (stringp command) yuuji@13: (string< "" command) yuuji@13: (y-or-n-p "Update user completion table?")) yuuji@18: (cond yuuji@18: ((= argc 0) yuuji@18: (YaTeX-update-table yuuji@18: (list command) yuuji@18: 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table)) yuuji@18: ((= argc 1) yuuji@18: (YaTeX-update-table yuuji@18: (list command) yuuji@18: 'section-table 'user-section-table 'tmp-section-table)) yuuji@18: (t (YaTeX-update-table yuuji@18: (list command argc) yuuji@18: 'section-table 'user-section-table 'tmp-section-table)))) yuuji@13: (message "") yuuji@13: def ;return command name yuuji@13: )) yuuji@13: (t "")) yuuji@13: ) yuuji@13: yuuji@16: ;; yuuji@16: ; completion for the arguments of \pagestyle yuuji@16: ;; yuuji@16: (defun YaTeX::pagestyle (&optional argp) yuuji@16: "Read the pagestyle with completion." yuuji@16: (completing-read yuuji@16: "Page style: " yuuji@16: '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)) yuuji@16: ) yuuji@16: ;; yuuji@16: ; completion for the arguments of \pagenumbering yuuji@16: ;; yuuji@16: (defun YaTeX::pagenumbering (&optional argp) yuuji@16: "Read the numbering style." yuuji@16: (completing-read yuuji@16: "Page numbering style: " yuuji@16: '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman"))) yuuji@16: ) yuuji@13: yuuji@23: ;; yuuji@23: ; Length yuuji@23: ;; yuuji@23: (defvar YaTeX:style-parameters-default yuuji@23: '(("\\arraycolsep") yuuji@23: ("\\arrayrulewidth") yuuji@23: ("\\baselineskip") yuuji@23: ("\\columnsep") yuuji@23: ("\\columnseprule") yuuji@23: ("\\doublerulesep") yuuji@23: ("\\evensidemargin") yuuji@23: ("\\footheight") yuuji@23: ("\\footskip") yuuji@23: ("\\headheight") yuuji@23: ("\\headsep") yuuji@23: ("\\itemindent") yuuji@23: ("\\itemsep") yuuji@23: ("\\labelsep") yuuji@23: ("\\labelwidth") yuuji@23: ("\\leftmargin") yuuji@23: ("\\linewidth") yuuji@23: ("\\listparindent") yuuji@23: ("\\marginparsep") yuuji@23: ("\\marginparwidth") yuuji@23: ("\\mathindent") yuuji@23: ("\\oddsidemargin") yuuji@23: ("\\parindent") yuuji@23: ("\\parsep") yuuji@23: ("\\parskip") yuuji@23: ("\\partopsep") yuuji@23: ("\\rightmargin") yuuji@23: ("\\tabcolsep") yuuji@23: ("\\textheight") yuuji@23: ("\\textwidth") yuuji@23: ("\\topmargin") yuuji@23: ("\\topsep") yuuji@23: ("\\topskip") yuuji@23: ) yuuji@23: "Alist of LaTeX style parameters.") yuuji@23: (defvar YaTeX:style-parameters-private nil yuuji@23: "*User definable alist of style parameters.") yuuji@23: (defvar YaTeX:style-parameters-private nil yuuji@23: "Holds the union of LaTeX style parameters.") yuuji@23: (setq YaTeX:style-parameters yuuji@23: (append YaTeX:style-parameters-private YaTeX:style-parameters-default)) yuuji@23: yuuji@23: (defvar YaTeX:length-history nil "Holds history of length.") yuuji@23: (defun YaTeX::setlength (&optional argp) yuuji@23: "YaTeX add-in function for arguments of \\setlength." yuuji@23: (cond yuuji@23: ((equal 1 argp) yuuji@23: (completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")) yuuji@23: ((equal 2 argp) yuuji@23: (let ((minibuffer-history-symbol 'YaTeX:length-history)) yuuji@23: (read-string "Length: ")))) yuuji@23: ) yuuji@23: (fset 'YaTeX::addtolength 'YaTeX::setlength) yuuji@23: yuuji@23: (defun YaTeX::settowidth (&optional argp) yuuji@23: "YaTeX add-in function for arguments of \\settowidth." yuuji@23: (cond yuuji@23: ((equal 1 argp) yuuji@23: (completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")) yuuji@23: ((equal 2 argp) yuuji@23: (read-string "Text: "))) yuuji@23: ) yuuji@23: (defun YaTeX::newlength (&optional argp) yuuji@23: "YaTeX add-in function for arguments of \\newlength" yuuji@23: (cond yuuji@23: ((equal argp 1) yuuji@23: (let ((length (read-string "Length variable: " "\\"))) yuuji@23: (or (assoc length YaTeX:style-parameters-private) yuuji@23: (setq YaTeX:style-parameters-private yuuji@23: (cons (list length) YaTeX:style-parameters-private) yuuji@23: YaTeX:style-parameters yuuji@23: (cons (list length) YaTeX:style-parameters))) yuuji@23: length))) yuuji@23: ) yuuji@23: yuuji@23: ;; \multicolumn's arguments yuuji@23: (defun YaTeX::multicolumn (&optional argp) yuuji@23: "YaTeX add-in function for arguments of \\multicolumn." yuuji@23: (cond yuuji@23: ((equal 1 argp) yuuji@23: (read-string "Number of columns: ")) yuuji@23: ((equal 2 argp) yuuji@23: (let (c) yuuji@23: (while (not (string-match yuuji@23: (progn (message "Format(one of l,r,c): ") yuuji@23: (setq c (char-to-string (read-char)))) yuuji@23: "lrc"))) yuuji@23: c)) yuuji@23: ((equal 3 argp) yuuji@23: (read-string "Item: "))) yuuji@23: ) yuuji@23: yuuji@23: ;;; -------------------- End of yatexadd -------------------- yuuji@23: (provide 'yatexadd)