annotate yatexadd.el @ 57:18f4939986e6

(j)LaTeX2e supported yatex19.el fixed a lot
author yuuji
date Sat, 02 Dec 1995 18:35:28 +0000
parents 5f4b18da14b3
children 3a7c0c2bf16d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
2 ;;; YaTeX add-in functions.
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3 ;;; yatexadd.el rev.13
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
4 ;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
5 ;;; Last modified Mon Nov 6 14:30:25 1995 on inspire
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
6 ;;; $Id$
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
7
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
8 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
9 ;;Sample functions for LaTeX environment.
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
10 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
11 (defvar YaTeX:tabular-default-rule
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
12 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
13 "*Your favorite default rule format."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
14 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
15 (defvar YaTeX:tabular-thick-vrule "\\vrule width %s"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
16 "*Vertical thick line format (without @{}). %s'll be replaced by its width."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
17 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
18 (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
19 "*Horizontal thick line format. %s will be replaced by its width."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
20 )
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
21 (defun YaTeX:tabular ()
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
22 "YaTeX add-in function for tabular environment.
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
23 Notice that this function refers the let-variable `env' in
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
24 YaTeX-make-begin-end."
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
25 (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
26 (if (string= env "tabular*")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
27 (setq width (concat "{" (read-string "Width: ") "}")))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
28 (setq loc (YaTeX:read-position "tb")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
29 bars (string-to-int
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
30 (read-string "Number of columns(0 for default format): " "3")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
31 (if (<= bars 0)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
32 (setq ;if 0, simple format
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
33 rule YaTeX:tabular-default-rule
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
34 and "& &")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
35 (while (< j bars) ;repeat bars-1 times
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
36 (setq rule (concat rule "c|")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
37 and (concat and "& ")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
38 j (1+ j)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
39 (setq rule (concat rule "c"))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
40 (message "(N)ormal-frame or (T)hick frame? [nt]")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
41 (setq ans (read-char))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
42 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
43 ((or (equal ans ?t) (equal ans ?T))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
44 (setq ans (read-string "Rule width: " "1pt")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
45 rule (concat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
46 "@{" (format YaTeX:tabular-thick-vrule ans) "}"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
47 rule
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
48 "@{\\ " (format YaTeX:tabular-thick-vrule ans) "}")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
49 hline (format YaTeX:tabular-thick-hrule ans)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
50 (t (setq rule (concat "|" rule "|")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
51 hline "\\hline"))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
52
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
53 (setq rule (read-string "rule format: " rule))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
54
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
55 (message "Dont forget to remove null line at the end of tabular.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
56 (format "%s%s{%s}%s"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
57 width loc rule
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
58 (if (and (boundp 'region-mode) region-mode)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
59 "" ;do nothing in region-mode
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
60 (format "\n%s\n%s \\\\ \\hline\n%s\n\\\\ %s"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
61 hline and and hline))))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
62 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
63 (fset 'YaTeX:tabular* 'YaTeX:tabular)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
64 (defun YaTeX:array ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
65 (concat (YaTeX:read-position "tb")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
66 "{" (read-string "Column format: ") "}")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
67 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
68
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
69 (defun YaTeX:read-oneof (oneof)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
70 (let ((pos "") loc (guide ""))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
71 (and (boundp 'name) name (setq guide (format "%s " name)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
72 (while (not (string-match
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
73 (setq loc (read-key-sequence
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
74 (format "%s position (`%s') [%s]: "
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
75 guide oneof pos)));name is in YaTeX-addin
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
76 "\r\^g\n"))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
77 (cond
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
78 ((string-match loc oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
79 (if (not (string-match loc pos))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
80 (setq pos (concat pos loc))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
81 ((and (string-match loc "\C-h\C-?") (> (length pos) 0))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
82 (setq pos (substring pos 0 (1- (length pos)))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
83 (t
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
84 (ding)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
85 (message "Please input one of `%s'." oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
86 (sit-for 3))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
87 (message "")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
88 pos)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
89 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
90
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
91 (defun YaTeX:read-position (oneof)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
92 "Read a LaTeX (optional) position format such as `[htbp]'."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
93 (let ((pos (YaTeX:read-oneof oneof)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
94 (if (string= pos "") "" (concat "[" pos "]")))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
95 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
96
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
97 (defun YaTeX:table ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
98 "YaTeX add-in function for table environment."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
99 (YaTeX:read-position "htbp")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
100 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
101
46
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
102 (fset 'YaTeX:figure 'YaTeX:table)
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
103 (fset 'YaTeX:figure* 'YaTeX:table)
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
104
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
105
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
106 (defun YaTeX:description ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
107 "Truly poor service:-)"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
108 (setq single-command "item[]")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
109 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
110 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
111
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
112 (defun YaTeX:itemize ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
113 "It's also poor service."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
114 (setq single-command "item")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
115 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
116 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
117
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
118 (fset 'YaTeX:enumerate 'YaTeX:itemize)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
119
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
120 (defun YaTeX:picture ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
121 "Ask the size of coordinates of picture environment."
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
122 (concat (YaTeX:read-coordinates "Picture size")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
123 (YaTeX:read-coordinates "Initial position"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
124 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
125
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
126 (defun YaTeX:equation ()
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
127 (if (fboundp 'YaTeX-toggle-math-mode)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
128 (YaTeX-toggle-math-mode t)) ;force math-mode ON.
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
129 )
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
130 (fset 'YaTeX:eqnarray 'YaTeX:equation)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
131 (fset 'YaTeX:displaymath 'YaTeX:equation)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
132
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
133 (defun YaTeX:list ()
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
134 "%\n{} %default label\n{} %formatting parameter"
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
135 )
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
136
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
137 (defun YaTeX:minipage ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
138 (concat (YaTeX:read-position "cbt")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
139 "{" (read-string "Width: ") "}")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
140 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
141
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
142 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
143 ;;Sample functions for section-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
144 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
145 (defun YaTeX:multiput ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
146 (concat (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
147 (YaTeX:read-coordinates "Step")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
148 "{" (read-string "How many times: ") "}")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
149 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
150
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
151 (defun YaTeX:put ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
152 (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
153 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
154
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
155 (defun YaTeX:makebox ()
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
156 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
157 ((YaTeX-in-environment-p "picture")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
158 (concat (YaTeX:read-coordinates "Dimension")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
159 (YaTeX:read-position "lrtb")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
160 (t
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
161 (let ((width (read-string "Width: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
162 (if (string< "" width)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
163 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
164 (or (equal (aref width 0) ?\[)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
165 (setq width (concat "[" width "]")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
166 (concat width (YaTeX:read-position "lr")))))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
167 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
168
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
169 (defun YaTeX:framebox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
170 (if (YaTeX-quick-in-environment-p "picture")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
171 (YaTeX:makebox))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
172 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
173
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
174 (defun YaTeX:dashbox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
175 (concat "{" (read-string "Dash dimension: ") "}"
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
176 (YaTeX:read-coordinates "Dimension"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
177 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
178
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
179 (defvar YaTeX-minibuffer-quick-map nil)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
180 (if YaTeX-minibuffer-quick-map nil
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
181 (setq YaTeX-minibuffer-quick-map
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
182 (copy-keymap minibuffer-local-completion-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
183 (let ((ch (1+ ? )))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
184 (while (< ch 127)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
185 (define-key YaTeX-minibuffer-quick-map (char-to-string ch)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
186 'YaTeX-minibuffer-quick-complete)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
187 (setq ch (1+ ch)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
188
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
189 (defvar YaTeX:left-right-delimiters
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
190 '(("(" . ")") (")" . "(") ("[" . "]") ("]" . "[")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
191 ("\\{" . "\\}") ("\\}" . "\\{") ("|") ("\\|")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
192 ("\\lfloor" . "\\rfloor") ("\\lceil" . "\\rceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
193 ("\\langle" . "\\rangle") ("/") (".")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
194 ("\\rfloor" . "\\rfloor") ("\\rceil" . "\\lceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
195 ("\\rangle" . "\\langle") ("\\backslash")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
196 ("\\uparrow") ("\\downarrow") ("\\updownarrow") ("\\Updownarrow"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
197 "TeX math delimiter, which can be completed after \\right or \\left.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
198
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
199 (defvar YaTeX:left-right-default nil "Default string of YaTeX:right.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
200
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
201 (defun YaTeX:left ()
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
202 (let ((minibuffer-completion-table YaTeX:left-right-delimiters)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
203 delimiter (leftp (string= single-command "left")))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
204 (setq delimiter
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
205 (read-from-minibuffer
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
206 (format "Delimiter%s: "
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
207 (if YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
208 (format "(default=`%s')" YaTeX:left-right-default)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
209 "(SPC for menu)"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
210 nil YaTeX-minibuffer-quick-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
211 (if (string= "" delimiter) (setq delimiter YaTeX:left-right-default))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
212 (setq single-command (if leftp "right" "left")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
213 YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
214 (or (cdr (assoc delimiter YaTeX:left-right-delimiters)) delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
215 delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
216
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
217 (fset 'YaTeX:right 'YaTeX:left)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
218
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
219
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
220 (defun YaTeX:read-coordinates (&optional mes varX varY)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
221 (concat
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
222 "("
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
223 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
224 ","
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
225 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
226 ")")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
227 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
228
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
229 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
230 ;;Sample functions for maketitle-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
231 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
232 (defun YaTeX:sum ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
233 "Read range of summation."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
234 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
235 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
236 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
237
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
238 (fset 'YaTeX:int 'YaTeX:sum)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
239
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
240 (defun YaTeX:lim ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
241 "Insert limit notation of \\lim."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
242 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
243 (let ((var (read-string "Variable: ")) limit)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
244 (if (string= "" var) ""
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
245 (setq limit (read-string "Limit ($ means infinity): "))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
246 (if (string= "$" limit) (setq limit "\\infty"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
247 (concat "_{" var " \\rightarrow " limit "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
248 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
249
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
250 (defun YaTeX:gcd ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
251 "Add-in function for \\gcd(m,n)."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
252 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
253 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
254 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
255
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
256 (defun YaTeX:read-boundary (ULchar)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
257 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar."
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
258 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): "))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
259 (if (string= bndry "") ""
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
260 (if (string= bndry "$") (setq bndry "\\infty"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
261 (concat ULchar "{" bndry "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
262 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
263
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
264 (defun YaTeX:verb ()
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
265 "Enclose \\verb's contents with the same characters."
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
266 (let ((quote-char (read-string "Quoting char: " "|"))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
267 (contents (read-string "Quoted contents: ")))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
268 (concat quote-char contents quote-char))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
269 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
270 (fset 'YaTeX:verb* 'YaTeX:verb)
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
271
43
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
272 (defun YaTeX:footnotemark ()
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
273 (setq section-name "footnotetext")
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
274 nil
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
275 )
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
276
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
277 (defun YaTeX:cite ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
278 (let ((comment (read-string "Comment for citation: ")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
279 (if (string= comment "") ""
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
280 (concat "[" comment "]")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
281 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
282
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
283 (defun YaTeX:bibitem ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
284 (let ((label (read-string "Citation label: ")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
285 (if (string= label "") ""
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
286 (concat "[" label "]")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
287 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
288
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
289 (defun YaTeX:item ()
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
290 (YaTeX-indent-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
291 (setq section-name "label")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
292 " ")
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
293 (fset 'YaTeX:item\[\] 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
294 (fset 'YaTeX:subitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
295 (fset 'YaTeX:subsubitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
296
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
297 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
298 ;;Subroutine
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
299 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
300
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
301 (defun YaTeX:check-completion-type (type)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
302 "Check valid completion type."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
303 (if (not (eq type YaTeX-current-completion-type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
304 (error "This should be completed with %s-type completion." type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
305 )
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
306
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
307
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
308 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
309 ;;; [[Add-in functions for reading section arguments]]
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
310 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
311 ;; All of add-in functions for reading sections arguments should
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
312 ;; take an argument ARGP that specify the argument position.
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
313 ;; If argument position is out of range, nil should be returned,
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
314 ;; else nil should NOT be returned.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
315
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
316 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
317 ; Label selection
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
318 ;;
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
319 (defvar YaTeX-label-menu-other
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
320 (if YaTeX-japan "':‘¼‚̃oƒbƒtƒ@‚̃‰ƒxƒ‹\n" "':LABEL IN OTHER BUFFER.\n"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
321 (defvar YaTeX-label-menu-repeat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
322 (if YaTeX-japan ".:’¼‘O‚Ì\\ref‚Æ“¯‚¶\n" "/:REPEAT LAST \ref{}\n"))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
323 (defvar YaTeX-label-menu-any
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
324 (if YaTeX-japan "*:”CˆÓ‚Ì•¶Žš—ñ\n" "*:ANY STRING.\n"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
325 (defvar YaTeX-label-buffer "*Label completions*")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
326 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
327 (defvar YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
328 "Key map used in label selection buffer.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
329 (defun YaTeX::label-setup-key-map ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
330 (if YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
331 (message "Setting up label selection mode map...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
332 (setq YaTeX-label-select-map (copy-keymap global-map))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
333 (suppress-keymap YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
334 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
335 'previous-line 'YaTeX::label-previous YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
336 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
337 'next-line 'YaTeX::label-next YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
338 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
339 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
340 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
341 (define-key YaTeX-label-select-map ">" 'end-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
342 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
343 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
344 (define-key YaTeX-label-select-map " " 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
345 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
346 (define-key YaTeX-label-select-map "/" 'isearch-forward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
347 (define-key YaTeX-label-select-map "?" 'isearch-backward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
348 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
349 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
350 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
351 (message "Setting up label selection mode map...Done")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
352 (let ((key ?A))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
353 (while (<= key ?Z)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
354 (define-key YaTeX-label-select-map (char-to-string key)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
355 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
356 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
357 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
358 (setq key (1+ key)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
359 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
360 (defun YaTeX::label-next ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
361 (interactive) (forward-line 1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
362 (defun YaTeX::label-previous ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
363 (interactive) (forward-line -1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
364 (defun YaTeX::label-search-tag ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
365 (interactive)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
366 (let ((case-fold-search t) (tag (regexp-quote (this-command-keys))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
367 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
368 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
369 (forward-char 1)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
370 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
371 (goto-char (match-beginning 0)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
372 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
373 (goto-char (point-min))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
374 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
375 (goto-char (match-beginning 0))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
376 (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
377 )
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
378 (defun YaTeX::ref (argp &optional labelcmd refcmd)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
379 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
380 ((= argp 1)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
381 (save-excursion
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
382 (let ((lnum 0) e0 label label-list (buf (current-buffer))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
383 (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
384 (p (point)) initl line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
385 (goto-char (point-min))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
386 (message "Collecting labels...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
387 (save-window-excursion
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
388 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
389 YaTeX-label-buffer (function (lambda (x) (window-width x))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
390 (with-output-to-temp-buffer YaTeX-label-buffer
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
391 (while (YaTeX-re-search-active-forward
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
392 (concat "\\\\" labelcmd "\\b")
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
393 (regexp-quote YaTeX-comment-prefix) nil t)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
394 (goto-char (match-beginning 0))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
395 (skip-chars-forward "^{")
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
396 (setq label
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
397 (buffer-substring
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
398 (1+ (point))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
399 (prog2 (forward-list 1) (setq e0 (1- (point)))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
400 label-list (cons label label-list))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
401 (or initl
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
402 (if (< p (point)) (setq initl lnum)))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
403 (beginning-of-line)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
404 (skip-chars-forward " \t\n" nil)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
405 (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
406 (buffer-substring (point) (point-end-of-line))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
407 (setq lnum (1+ lnum))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
408 (message "Collecting \\%s{}... %d" labelcmd lnum)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
409 (goto-char e0))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
410 (princ YaTeX-label-menu-other)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
411 (princ YaTeX-label-menu-repeat)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
412 (princ YaTeX-label-menu-any)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
413 );with
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
414 (goto-char p)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
415 (message "Collecting %s...Done" labelcmd)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
416 (pop-to-buffer YaTeX-label-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
417 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
418 (setq truncate-lines t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
419 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
420 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
421 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
422 (goto-line (or initl lnum)) ;goto recently defined label line
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
423 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
424 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
425 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
426 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
427 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
428 (setq line (count-lines (point-min)(point)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
429 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
430 ((= line lnum) (setq label (YaTeX-label-other)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
431 ((= line (1+ lnum))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
432 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
433 (switch-to-buffer buf)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
434 (goto-char p)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
435 (if (re-search-backward
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
436 (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
437 (setq label (YaTeX-match-string 1))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
438 (setq label ""))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
439 ((>= line (+ lnum 2))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
440 (setq label (read-string (format "\\%s{???}: " refcmd))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
441 (t (setq label (nth (- lnum line 1) label-list)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
442 (bury-buffer YaTeX-label-buffer)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
443 label
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
444 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
445 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
446 )
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
447 (fset 'YaTeX::pageref 'YaTeX::ref)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
448 (defun YaTeX::cite (argp)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
449 (cond
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
450 ((eq argp 1)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
451 (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite"))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
452 (t nil)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
453
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
454 (defun YaTeX-yatex-buffer-list ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
455 (save-excursion
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
456 (delq nil (mapcar (function (lambda (buf)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
457 (set-buffer buf)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
458 (if (eq major-mode 'yatex-mode) buf)))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
459 (buffer-list))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
460 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
461
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
462 (defun YaTeX-select-other-yatex-buffer ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
463 "Select buffer from all yatex-mode's buffers interactivelly."
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
464 (interactive)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
465 (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
466 (lnum -1) buf rv
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
467 (ff "**find-file**"))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
468 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
469 lbuf (function (lambda (x) 1))) ;;Select next window surely.
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
470 (with-output-to-temp-buffer lbuf
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
471 (while blist
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
472 (princ
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
473 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
474 (buffer-name (car blist))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
475 (setq blist (cdr blist)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
476 (princ (format "':{%s}" ff)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
477 (pop-to-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
478 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
479 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
480 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
481 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
482 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
483 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
484 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
485 (set-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
486 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
487 (setq rv
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
488 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
489 (buffer-substring (match-beginning 1) (match-end 1)) nil)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
490 (kill-buffer lbuf))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
491 (if (string= rv ff)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
492 (progn
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
493 (call-interactively 'find-file)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
494 (current-buffer))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
495 rv))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
496 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
497
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
498 (defun YaTeX-label-other ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
499 (let ((rv (YaTeX-select-other-yatex-buffer)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
500 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
501 ((null rv) "")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
502 (t
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
503 (set-buffer rv)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
504 (YaTeX::ref argp labelcmd refcmd)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
505 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
506 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
507
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
508 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
509 ; completion for the arguments of \newcommand
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
510 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
511 (defun YaTeX::newcommand (&optional argp)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
512 (cond
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
513 ((= argp 1)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
514 (let ((command (read-string "Define newcommand: " "\\")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
515 (put 'YaTeX::newcommand 'command (substring command 1))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
516 command))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
517 ((= argp 2)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
518 (let ((argc
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
519 (string-to-int (read-string "Number of arguments(Default 0): ")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
520 (def (read-string "Definition: "))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
521 (command (get 'YaTeX::newcommand 'command)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
522 ;;!!! It's illegal to insert string in the add-in function !!!
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
523 (if (> argc 0) (insert (format "[%d]" argc)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
524 (if (and (stringp command)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
525 (string< "" command)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
526 (y-or-n-p "Update dictionary?"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
527 (cond
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
528 ((= argc 0)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
529 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
530 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
531 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
532 ((= argc 1)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
533 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
534 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
535 'section-table 'user-section-table 'tmp-section-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
536 (t (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
537 (list command argc)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
538 'section-table 'user-section-table 'tmp-section-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
539 (message "")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
540 def ;return command name
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
541 ))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
542 (t ""))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
543 )
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
544
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
545 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
546 ; completion for the arguments of \pagestyle
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
547 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
548 (defun YaTeX::pagestyle (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
549 "Read the pagestyle with completion."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
550 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
551 "Page style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
552 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
553 )
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
554 (fset 'YaTeX::thispagestyle 'YaTeX::pagestyle)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
555
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
556 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
557 ; completion for the arguments of \pagenumbering
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
558 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
559 (defun YaTeX::pagenumbering (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
560 "Read the numbering style."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
561 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
562 "Page numbering style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
563 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman")))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
564 )
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
565
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
566 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
567 ; Length
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
568 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
569 (defvar YaTeX:style-parameters-default
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
570 '(("\\arraycolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
571 ("\\arrayrulewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
572 ("\\baselineskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
573 ("\\columnsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
574 ("\\columnseprule")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
575 ("\\doublerulesep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
576 ("\\evensidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
577 ("\\footheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
578 ("\\footskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
579 ("\\headheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
580 ("\\headsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
581 ("\\itemindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
582 ("\\itemsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
583 ("\\labelsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
584 ("\\labelwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
585 ("\\leftmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
586 ("\\linewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
587 ("\\listparindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
588 ("\\marginparsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
589 ("\\marginparwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
590 ("\\mathindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
591 ("\\oddsidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
592 ("\\parindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
593 ("\\parsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
594 ("\\parskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
595 ("\\partopsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
596 ("\\rightmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
597 ("\\tabcolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
598 ("\\textheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
599 ("\\textwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
600 ("\\topmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
601 ("\\topsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
602 ("\\topskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
603 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
604 "Alist of LaTeX style parameters.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
605 (defvar YaTeX:style-parameters-private nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
606 "*User definable alist of style parameters.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
607 (defvar YaTeX:style-parameters-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
608 "*User definable alist of local style parameters.")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
609
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
610 (defvar YaTeX:length-history nil "Holds history of length.")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
611 (put 'YaTeX:length-history 'no-default t)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
612 (defun YaTeX::setlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
613 "YaTeX add-in function for arguments of \\setlength."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
614 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
615 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
616 ;;(completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
617 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
618 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
619 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
620 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
621 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
622 nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
623 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
624 ((equal 2 argp)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
625 (read-string-with-history "Length: " nil 'YaTeX:length-history)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
626 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
627 (fset 'YaTeX::addtolength 'YaTeX::setlength)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
628
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
629 (defun YaTeX::settowidth (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
630 "YaTeX add-in function for arguments of \\settowidth."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
631 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
632 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
633 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
634 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
635 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
636 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
637 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
638 nil nil "\\"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
639 ((equal 2 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
640 (read-string "Text: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
641 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
642 (defun YaTeX::newlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
643 "YaTeX add-in function for arguments of \\newlength"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
644 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
645 ((equal argp 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
646 (let ((length (read-string "Length variable: " "\\")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
647 (if (string< "" length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
648 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
649 (list length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
650 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
651 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
652 'YaTeX:style-parameters-local))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
653 length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
654 ))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
655 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
656
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
657 ;; \multicolumn's arguments
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
658 (defun YaTeX::multicolumn (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
659 "YaTeX add-in function for arguments of \\multicolumn."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
660 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
661 ((equal 1 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
662 (read-string "Number of columns: "))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
663 ((equal 2 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
664 (let (c)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
665 (while (not (string-match
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
666 (progn (message "Format(one of l,r,c): ")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
667 (setq c (char-to-string (read-char))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
668 "lrc")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
669 c))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
670 ((equal 3 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
671 (read-string "Item: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
672 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
673
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
674 (defvar YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
675 '(("article") ("jarticle") ("j-article")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
676 ("book") ("jbook") ("j-book")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
677 ("report") ("jreport") ("j-report")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
678 ("letter") ("ascjletter"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
679 "List of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
680 (defvar YaTeX:documentstyles-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
681 "*User defined list of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
682 (defvar YaTeX:documentstyles-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
683 "*User defined list of local LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
684 (defvar YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
685 '(("a4j") ("a5j") ("b4j") ("b5j")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
686 ("twocolumn") ("jtwocolumn") ("epsf") ("epsfig") ("epsbox") ("nfig"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
687 "List of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
688 (defvar YaTeX:documentstyle-options-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
689 "*User defined list of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
690 (defvar YaTeX:documentstyle-options-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
691 "List of LaTeX local documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
692
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
693 (defvar YaTeX-minibuffer-completion-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
694 "Minibuffer completion key map that allows comma completion.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
695 (if YaTeX-minibuffer-completion-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
696 (setq YaTeX-minibuffer-completion-map
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
697 (copy-keymap minibuffer-local-completion-map))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
698 (define-key YaTeX-minibuffer-completion-map " "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
699 'YaTeX-minibuffer-complete)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
700 (define-key YaTeX-minibuffer-completion-map "\t"
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
701 'YaTeX-minibuffer-complete))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
702
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
703 (defun YaTeX:documentstyle ()
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
704 (let*((delim ",")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
705 (dt (append YaTeX:documentstyle-options-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
706 YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
707 YaTeX:documentstyle-options-default))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
708 (minibuffer-completion-table dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
709 (opt (read-from-minibuffer
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
710 "Style options ([opt1,opt2,...]): "
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
711 nil YaTeX-minibuffer-completion-map nil))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
712 (substr opt) o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
713 (if (string< "" opt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
714 (progn
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
715 (while substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
716 (setq o (substring substr 0 (string-match delim substr)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
717 (or (assoc o dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
718 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
719 (list o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
720 'YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
721 'YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
722 'YaTeX:documentstyle-options-local))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
723 (setq substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
724 (if (string-match delim substr)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
725 (substring substr (1+ (string-match delim substr))))))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
726 (concat "[" opt "]"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
727 "")))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
728
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
729 (defun YaTeX::documentstyle (&optional argp)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
730 "YaTeX add-in function for arguments of \\documentstyle."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
731 (cond
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
732 ((equal argp 1)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
733 (setq env-name "document")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
734 (let ((sname
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
735 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
736 (format "Documentstyle (default %s): "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
737 YaTeX-default-document-style)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
738 'YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
739 'YaTeX:documentstyles-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
740 'YaTeX:documentstyles-local)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
741 (if (string= "" sname) (setq sname YaTeX-default-document-style))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
742 (setq YaTeX-default-document-style sname))))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
743 )
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
744
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
745 ;;; -------------------- LaTeX2e stuff --------------------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
746 (defvar YaTeX:documentclass-options-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
747 '(("a4paper") ("a5paper") ("b5paper") ("10pt") ("11pt") ("12pt")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
748 ("latterpaper") ("legalpaper") ("executivepaper") ("landscape")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
749 ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
750 ("clock") ;for slides class only
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
751 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
752 "Default options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
753 (defvar YaTeX:documentclass-options-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
754 "*User defined options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
755 (defvar YaTeX:documentclass-options-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
756 "*User defined options list for local documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
757
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
758 (defun YaTeX:documentclass ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
759 (let*((delim ",")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
760 (dt (append YaTeX:documentclass-options-local
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
761 YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
762 YaTeX:documentclass-options-default))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
763 (minibuffer-completion-table dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
764 (opt (read-from-minibuffer
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
765 "Documentclass options ([opt1,opt2,...]): "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
766 nil YaTeX-minibuffer-completion-map nil))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
767 (substr opt) o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
768 (if (string< "" opt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
769 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
770 (while substr
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
771 (setq o (substring substr 0 (string-match delim substr)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
772 (or (assoc o dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
773 (YaTeX-update-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
774 (list o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
775 'YaTeX:documentclass-options-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
776 'YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
777 'YaTeX:documentclass-options-local))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
778 (setq substr
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
779 (if (string-match delim substr)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
780 (substring substr (1+ (string-match delim substr))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
781 (concat "[" opt "]"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
782 "")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
783
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
784 (defvar YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
785 '(("article") ("jarticle") ("report") ("jreport") ("book") ("jbook")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
786 ("j-article") ("j-report") ("j-book")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
787 ("letter") ("slides") ("ltxdoc") ("ltxguide") ("ltnews") ("proc"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
788 "Default documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
789 (defvar YaTeX:documentclasses-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
790 "*User defined documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
791 (defvar YaTeX:documentclasses-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
792 "*User defined local documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
793 (defvar YaTeX-default-documentclass (if YaTeX-japan "jarticle" "article")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
794 "*Default documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
795
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
796 (defun YaTeX::documentclass (&optional argp)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
797 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
798 ((equal argp 1)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
799 (setq env-name "document")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
800 (let ((sname
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
801 (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
802 (format "Documentclass (default %s): " YaTeX-default-documentclass)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
803 'YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
804 'YaTeX:documentclasses-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
805 'YaTeX:documentclasses-local)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
806 (if (string= "" sname) (setq sname YaTeX-default-documentclass))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
807 (setq YaTeX-default-documentclass sname)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
808
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
809 ;;; -------------------- End of yatexadd --------------------
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
810 (provide 'yatexadd)

yatex.org