Mercurial > hgrepos > hgweb.cgi > yatex
annotate yatexadd.el @ 46:cd1b63102eed
Support Mule2
author | yuuji |
---|---|
date | Mon, 19 Sep 1994 16:54:19 +0000 |
parents | ef686a35472d |
children | a0640ff3f72f |
rev | line source |
---|---|
6 | 1 ;;; -*- Emacs-Lisp -*- |
8 | 2 ;;; YaTeX add-in functions. |
23 | 3 ;;; yatexadd.el rev.9 |
14 | 4 ;;; (c )1991-1994 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp] |
46 | 5 ;;; Last modified Mon Aug 22 14:19:39 1994 on figaro |
8 | 6 ;;; $Id$ |
6 | 7 |
8 ;;; | |
9 ;;Sample functions for LaTeX environment. | |
10 ;;; | |
11 (defvar YaTeX:tabular-default-rule | |
12 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}" | |
13 "*Your favorite default rule format." | |
14 ) | |
23 | 15 (defvar YaTeX:tabular-thick-vrule "\\vrule width %s" |
16 "*Vertical thick line format (without @{}). %s'll be replaced by its width." | |
17 ) | |
18 (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}" | |
19 "*Horizontal thick line format. %s will be replaced by its width." | |
20 ) | |
6 | 21 (defun YaTeX:tabular () |
18 | 22 "YaTeX add-in function for tabular environment. |
23 Notice that this function refers the let-variable `env' in | |
24 YaTeX-make-begin-end." | |
23 | 25 (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline")) |
18 | 26 (if (string= env "tabular*") |
27 (setq width (concat "{" (read-string "Width: ") "}"))) | |
28 (setq loc (YaTeX:read-position "tb") | |
23 | 29 bars (string-to-int |
30 (read-string "Number of columns(0 for default format): " "3"))) | |
31 (if (<= bars 0) | |
32 (setq ;if 0, simple format | |
33 rule YaTeX:tabular-default-rule | |
34 and "& &") | |
35 (while (< j bars) ;repeat bars-1 times | |
36 (setq rule (concat rule "c|") | |
37 and (concat and "& ") | |
38 j (1+ j))) | |
39 (setq rule (concat rule "c")) | |
40 (message "(N)ormal-frame or (T)hick frame? [nt]") | |
41 (setq ans (read-char)) | |
42 (cond | |
43 ((or (equal ans ?t) (equal ans ?T)) | |
44 (setq ans (read-string "Rule width: " "1pt") | |
45 rule (concat | |
46 "@{" (format YaTeX:tabular-thick-vrule ans) "}" | |
47 rule | |
48 "@{\\ " (format YaTeX:tabular-thick-vrule ans) "}") | |
49 hline (format YaTeX:tabular-thick-hrule ans))) | |
50 (t (setq rule (concat "|" rule "|") | |
51 hline "\\hline")))) | |
52 | |
6 | 53 (setq rule (read-string "rule format: " rule)) |
54 | |
23 | 55 (message "Dont forget to remove null line at the end of tabular.") |
56 (format "%s%s{%s}%s" | |
57 width loc rule | |
58 (if (and (boundp 'region-mode) region-mode) | |
59 "" ;do nothing in region-mode | |
60 (format "\n%s\n%s \\\\ \\hline\n%s\n\\\\ %s" | |
61 hline and and hline)))) | |
18 | 62 ) |
63 (fset 'YaTeX:tabular* 'YaTeX:tabular) | |
64 (defun YaTeX:array () | |
65 (concat (YaTeX:read-position "tb") | |
66 "{" (read-string "Column format: ") "}") | |
6 | 67 ) |
68 | |
23 | 69 (defun YaTeX:read-oneof (oneof) |
70 (let ((pos "") loc (guide "")) | |
71 (and (boundp 'name) name (setq guide (format "%s " name))) | |
6 | 72 (while (not (string-match |
8 | 73 (setq loc (read-key-sequence |
23 | 74 (format "%s position (`%s') [%s]: " |
75 guide oneof pos)));name is in YaTeX-addin | |
6 | 76 "\r\^g\n")) |
77 (cond | |
8 | 78 ((string-match loc oneof) |
6 | 79 (if (not (string-match loc pos)) |
80 (setq pos (concat pos loc)))) | |
81 ((and (string-match loc "\C-h\C-?") (> (length pos) 0)) | |
82 (setq pos (substring pos 0 (1- (length pos))))) | |
83 (t | |
84 (ding) | |
8 | 85 (message "Please input one of `%s'." oneof) |
6 | 86 (sit-for 3)))) |
8 | 87 (message "") |
23 | 88 pos) |
89 ) | |
90 | |
91 (defun YaTeX:read-position (oneof) | |
92 "Read a LaTeX (optional) position format such as `[htbp]'." | |
93 (let ((pos (YaTeX:read-oneof oneof))) | |
94 (if (string= pos "") "" (concat "[" pos "]"))) | |
8 | 95 ) |
96 | |
97 (defun YaTeX:table () | |
98 "YaTeX add-in function for table environment." | |
99 (YaTeX:read-position "htbp") | |
6 | 100 ) |
101 | |
46 | 102 (fset 'YaTeX:figure 'YaTeX:table) |
103 (fset 'YaTeX:figure* 'YaTeX:table) | |
104 | |
105 | |
6 | 106 (defun YaTeX:description () |
107 "Truly poor service:-)" | |
108 (setq single-command "item[]") | |
8 | 109 "" |
6 | 110 ) |
111 | |
112 (defun YaTeX:itemize () | |
113 "It's also poor service." | |
114 (setq single-command "item") | |
8 | 115 "" |
6 | 116 ) |
117 | |
118 (fset 'YaTeX:enumerate 'YaTeX:itemize) | |
8 | 119 |
11 | 120 (defun YaTeX:picture () |
121 "Ask the size of coordinates of picture environment." | |
122 (concat (YaTeX:read-coordinates "Picture size") | |
123 (YaTeX:read-coordinates "Initial position")) | |
124 ) | |
125 | |
12 | 126 (defun YaTeX:equation () |
127 (if (fboundp 'YaTeX-toggle-math-mode) | |
128 (YaTeX-toggle-math-mode t)) ;force math-mode ON. | |
129 ) | |
130 (fset 'YaTeX:eqnarray 'YaTeX:equation) | |
131 (fset 'YaTeX:displaymath 'YaTeX:equation) | |
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 | 137 (defun YaTeX:minipage () |
138 (concat (YaTeX:read-position "cbt") | |
139 "{" (read-string "Width: ") "}") | |
140 ) | |
141 | |
8 | 142 ;;; |
143 ;;Sample functions for section-type command. | |
144 ;;; | |
145 (defun YaTeX:multiput () | |
146 (concat (YaTeX:read-coordinates "Pos") | |
147 (YaTeX:read-coordinates "Step") | |
148 "{" (read-string "How many times: ") "}") | |
149 ) | |
150 | |
151 (defun YaTeX:put () | |
152 (YaTeX:read-coordinates "Pos") | |
153 ) | |
154 | |
155 (defun YaTeX:makebox () | |
23 | 156 (cond |
157 ((YaTeX-in-environment-p "picture") | |
158 (concat (YaTeX:read-coordinates "Dimension") | |
159 (YaTeX:read-position "lrtb"))) | |
160 (t | |
161 (let ((width (read-string "Width: "))) | |
162 (if (string< "" width) | |
163 (progn | |
164 (or (equal (aref width 0) ?\[) | |
165 (setq width (concat "[" width "]"))) | |
166 (concat width (YaTeX:read-position "lr"))))))) | |
8 | 167 ) |
168 | |
169 (defun YaTeX:framebox () | |
170 (if (YaTeX-quick-in-environment-p "picture") | |
171 (YaTeX:makebox)) | |
172 ) | |
173 | |
174 (defun YaTeX:dashbox () | |
175 (concat "{" (read-string "Dash dimension: ") "}" | |
176 (YaTeX:read-coordinates "Dimension")) | |
177 ) | |
178 | |
23 | 179 (defun YaTeX:left () |
180 (let (c) | |
181 (while (not (string-match | |
182 (progn (message "Which parenthesis? One of [{(|)}]: ") | |
183 (setq c (regexp-quote (char-to-string (read-char))))) | |
184 "[{(|)}]"))) | |
185 (setq single-command "right") | |
186 (cond | |
187 ((string-match c "[(|)]") c) | |
188 (t (concat "\\" c)))) | |
189 ) | |
190 (fset 'YaTeX:right 'YaTeX:left) | |
191 | |
8 | 192 (defun YaTeX:read-coordinates (&optional mes varX varY) |
193 (concat | |
194 "(" | |
195 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) | |
196 "," | |
197 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) | |
198 ")") | |
199 ) | |
200 | |
201 ;;; | |
202 ;;Sample functions for maketitle-type command. | |
203 ;;; | |
204 (defun YaTeX:sum () | |
205 "Read range of summation." | |
206 (YaTeX:check-completion-type 'maketitle) | |
207 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^")) | |
208 ) | |
209 | |
210 (fset 'YaTeX:int 'YaTeX:sum) | |
211 | |
212 (defun YaTeX:lim () | |
213 "Insert limit notation of \\lim." | |
214 (YaTeX:check-completion-type 'maketitle) | |
215 (let ((var (read-string "Variable: ")) limit) | |
216 (if (string= "" var) "" | |
217 (setq limit (read-string "Limit ($ means infinity): ")) | |
218 (if (string= "$" limit) (setq limit "\\infty")) | |
219 (concat "_{" var " \\rightarrow " limit "}"))) | |
220 ) | |
221 | |
222 (defun YaTeX:gcd () | |
223 "Add-in function for \\gcd(m,n)." | |
224 (YaTeX:check-completion-type 'maketitle) | |
225 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)") | |
226 ) | |
227 | |
228 (defun YaTeX:read-boundary (ULchar) | |
229 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." | |
11 | 230 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) |
8 | 231 (if (string= bndry "") "" |
11 | 232 (if (string= bndry "$") (setq bndry "\\infty")) |
8 | 233 (concat ULchar "{" bndry "}"))) |
234 ) | |
235 | |
14 | 236 (defun YaTeX:verb () |
237 "Enclose \\verb's contents with the same characters." | |
238 (let ((quote-char (read-string "Quoting char: " "|")) | |
239 (contents (read-string "Quoted contents: "))) | |
240 (concat quote-char contents quote-char)) | |
241 ) | |
23 | 242 (fset 'YaTeX:verb* 'YaTeX:verb) |
14 | 243 |
43
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
244 (defun YaTeX:footnotemark () |
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
245 (setq section-name "footnotetext") |
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
246 nil |
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
247 ) |
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
248 |
14 | 249 ;;; |
250 ;;Subroutine | |
251 ;;; | |
252 | |
8 | 253 (defun YaTeX:check-completion-type (type) |
254 "Check valid completion type." | |
255 (if (not (eq type YaTeX-current-completion-type)) | |
256 (error "This should be completed with %s-type completion." type)) | |
257 ) | |
11 | 258 |
259 | |
260 ;;; | |
261 ;;; [[Add-in functions for reading section arguments]] | |
262 ;;; | |
263 ;; All of add-in functions for reading sections arguments should | |
264 ;; take an argument ARGP that specify the argument position. | |
265 ;; If argument position is out of range, nil should be returned, | |
266 ;; else nil should NOT be returned. | |
13 | 267 |
268 ;; | |
269 ; Label selection | |
270 ;; | |
11 | 271 (defvar YaTeX-label-menu-other |
272 (if YaTeX-japan "':‘¼‚̃oƒbƒtƒ@‚̃‰ƒxƒ‹\n" "':LABEL IN OTHER BUFFER.\n")) | |
23 | 273 (defvar YaTeX-label-menu-repeat |
274 (if YaTeX-japan ".:’¼‘O‚Ì\\ref‚Æ“¯‚¶\n" "/:REPEAT LAST \ref{}\n")) | |
11 | 275 (defvar YaTeX-label-menu-any |
276 (if YaTeX-japan "*:”CˆÓ‚Ì•¶Žš—ñ\n" "*:ANY STRING.\n")) | |
277 (defvar YaTeX-label-buffer "*Label completions*") | |
278 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.") | |
279 (defvar YaTeX-label-select-map nil | |
280 "Key map used in label selection buffer.") | |
281 (defun YaTeX::label-setup-key-map () | |
282 (if YaTeX-label-select-map nil | |
283 (message "Setting up label selection mode map...") | |
284 (setq YaTeX-label-select-map (copy-keymap global-map)) | |
285 (suppress-keymap YaTeX-label-select-map) | |
286 (substitute-all-key-definition | |
287 'previous-line 'YaTeX::label-previous YaTeX-label-select-map) | |
288 (substitute-all-key-definition | |
289 'next-line 'YaTeX::label-next YaTeX-label-select-map) | |
290 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next) | |
291 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous) | |
292 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer) | |
293 (define-key YaTeX-label-select-map ">" 'end-of-buffer) | |
294 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit) | |
295 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit) | |
296 (define-key YaTeX-label-select-map " " 'exit-recursive-edit) | |
297 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit) | |
298 (define-key YaTeX-label-select-map "/" 'isearch-forward) | |
299 (define-key YaTeX-label-select-map "?" 'isearch-backward) | |
300 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag) | |
23 | 301 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag) |
11 | 302 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag) |
303 (message "Setting up label selection mode map...Done") | |
304 (let ((key ?A)) | |
305 (while (<= key ?Z) | |
306 (define-key YaTeX-label-select-map (char-to-string key) | |
307 'YaTeX::label-search-tag) | |
308 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A))) | |
309 'YaTeX::label-search-tag) | |
310 (setq key (1+ key))))) | |
311 ) | |
312 (defun YaTeX::label-next () | |
313 (interactive) (forward-line 1) (message YaTeX-label-guide-msg)) | |
314 (defun YaTeX::label-previous () | |
315 (interactive) (forward-line -1) (message YaTeX-label-guide-msg)) | |
316 (defun YaTeX::label-search-tag () | |
317 (interactive) | |
23 | 318 (let ((case-fold-search t) (tag (regexp-quote (this-command-keys)))) |
11 | 319 (cond |
320 ((save-excursion | |
321 (forward-char 1) | |
23 | 322 (re-search-forward (concat "^" tag) nil t)) |
11 | 323 (goto-char (match-beginning 0))) |
324 ((save-excursion | |
325 (goto-char (point-min)) | |
23 | 326 (re-search-forward (concat "^" tag) nil t)) |
11 | 327 (goto-char (match-beginning 0)))) |
328 (message YaTeX-label-guide-msg)) | |
329 ) | |
330 (defun YaTeX::ref (argp) | |
331 (cond | |
332 ((= argp 1) | |
333 (save-excursion | |
334 (let ((lnum 0) e0 m1 e1 label label-list (buf (current-buffer)) | |
335 (p (point)) initl line) | |
336 (goto-char (point-min)) | |
337 (message "Collecting labels...") | |
338 (save-window-excursion | |
12 | 339 (YaTeX-showup-buffer |
340 YaTeX-label-buffer (function (lambda (x) (window-width x)))) | |
11 | 341 (with-output-to-temp-buffer YaTeX-label-buffer |
342 (while (re-search-forward "\\label{\\([^}]+\\)}" nil t) | |
343 (setq e0 (match-end 0) m1 (match-beginning 1) e1 (match-end 1)) | |
344 (if (search-backward | |
345 YaTeX-comment-prefix (point-beginning-of-line) t) nil | |
346 (setq label (buffer-substring m1 e1) | |
347 label-list (cons label label-list)) | |
348 (or initl | |
349 (if (< p (point)) (setq initl lnum))) | |
350 (beginning-of-line) | |
351 (skip-chars-forward " \t\n" nil) | |
352 (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label | |
353 (buffer-substring (point) (point-end-of-line)))) | |
354 (setq lnum (1+ lnum)) | |
355 (message "Collecting \\label{}... %d" lnum)) | |
356 (goto-char e0)) | |
357 (princ YaTeX-label-menu-other) | |
23 | 358 (princ YaTeX-label-menu-repeat) |
11 | 359 (princ YaTeX-label-menu-any) |
360 );with | |
361 (goto-char p) | |
362 (message "Collecting labels...Done") | |
363 (pop-to-buffer YaTeX-label-buffer) | |
364 (YaTeX::label-setup-key-map) | |
365 (setq truncate-lines t) | |
366 (setq buffer-read-only t) | |
367 (use-local-map YaTeX-label-select-map) | |
368 (message YaTeX-label-guide-msg) | |
369 (goto-line (or initl lnum)) ;goto recently defined label line | |
370 (unwind-protect | |
371 (progn | |
372 (recursive-edit) | |
373 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion | |
374 (beginning-of-line) | |
375 (setq line (count-lines (point-min)(point))) | |
376 (cond | |
377 ((= line lnum) (setq label (YaTeX-label-other))) | |
23 | 378 ((= line (1+ lnum)) |
379 (save-excursion | |
380 (switch-to-buffer buf) | |
381 (goto-char p) | |
382 (if (re-search-backward "\\\\ref{\\([^}]+\\)}" nil t) | |
383 (setq label (buffer-substring | |
384 (match-beginning 1) (match-end 1))) | |
385 (setq label "")))) | |
386 ((>= line (+ lnum 2)) | |
11 | 387 (setq label (read-string "\\ref{???}: "))) |
388 (t (setq label (nth (- lnum line 1) label-list))))) | |
389 (bury-buffer YaTeX-label-buffer))) | |
390 label | |
391 )) | |
392 )) | |
393 ) | |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
394 (fset 'YaTeX::pageref 'YaTeX::ref) |
11 | 395 |
396 (defun YaTeX-label-other () | |
397 (let ((lbuf "*YaTeX mode buffers*") (blist (buffer-list)) (lnum -1) buf rv | |
398 (ff "**find-file**")) | |
12 | 399 (YaTeX-showup-buffer |
400 lbuf (function (lambda (x) 1))) ;;Select next window surely. | |
11 | 401 (with-output-to-temp-buffer lbuf |
402 (while blist | |
403 (if (and (buffer-file-name (setq buf (car blist))) | |
404 (progn (set-buffer buf) (eq major-mode 'yatex-mode))) | |
405 (princ | |
406 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) | |
407 (buffer-name buf)))) | |
408 (setq blist (cdr blist))) | |
409 (princ (format "':{%s}" ff))) | |
410 (pop-to-buffer lbuf) | |
411 (YaTeX::label-setup-key-map) | |
412 (setq buffer-read-only t) | |
413 (use-local-map YaTeX-label-select-map) | |
414 (message YaTeX-label-guide-msg) | |
415 (unwind-protect | |
416 (progn | |
417 (recursive-edit) | |
418 (set-buffer lbuf) | |
419 (beginning-of-line) | |
420 (setq rv | |
421 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t) | |
422 (buffer-substring (match-beginning 1) (match-end 1)) nil))) | |
423 (kill-buffer lbuf)) | |
424 (cond | |
425 ((null rv) "") | |
426 ((string= rv ff) | |
427 (call-interactively 'find-file) | |
428 (YaTeX::ref argp)) | |
429 (t | |
430 (set-buffer rv) | |
431 (YaTeX::ref argp))) | |
432 ) | |
433 ) | |
434 | |
13 | 435 ;; |
436 ; completion for the arguments of \newcommand | |
437 ;; | |
438 (defun YaTeX::newcommand (&optional argp) | |
439 (cond | |
440 ((= argp 1) | |
441 (let ((command (read-string "Define newcommand: " "\\"))) | |
442 (put 'YaTeX::newcommand 'command (substring command 1)) | |
443 command)) | |
444 ((= argp 2) | |
445 (let ((argc | |
446 (string-to-int (read-string "Number of arguments(Default 0): "))) | |
447 (def (read-string "Definition: ")) | |
448 (command (get 'YaTeX::newcommand 'command))) | |
449 ;;!!! It's illegal to insert string in the add-in function !!! | |
450 (if (> argc 0) (insert (format "[%d]" argc))) | |
451 (if (and (stringp command) | |
452 (string< "" command) | |
453 (y-or-n-p "Update user completion table?")) | |
18 | 454 (cond |
455 ((= argc 0) | |
456 (YaTeX-update-table | |
457 (list command) | |
458 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table)) | |
459 ((= argc 1) | |
460 (YaTeX-update-table | |
461 (list command) | |
462 'section-table 'user-section-table 'tmp-section-table)) | |
463 (t (YaTeX-update-table | |
464 (list command argc) | |
465 'section-table 'user-section-table 'tmp-section-table)))) | |
13 | 466 (message "") |
467 def ;return command name | |
468 )) | |
469 (t "")) | |
470 ) | |
471 | |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
472 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
473 ; completion for the arguments of \pagestyle |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
474 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
475 (defun YaTeX::pagestyle (&optional argp) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
476 "Read the pagestyle with completion." |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
477 (completing-read |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
478 "Page style: " |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
479 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
480 ) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
481 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
482 ; completion for the arguments of \pagenumbering |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
483 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
484 (defun YaTeX::pagenumbering (&optional argp) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
485 "Read the numbering style." |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
486 (completing-read |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
487 "Page numbering style: " |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
488 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman"))) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
489 ) |
13 | 490 |
23 | 491 ;; |
492 ; Length | |
493 ;; | |
494 (defvar YaTeX:style-parameters-default | |
495 '(("\\arraycolsep") | |
496 ("\\arrayrulewidth") | |
497 ("\\baselineskip") | |
498 ("\\columnsep") | |
499 ("\\columnseprule") | |
500 ("\\doublerulesep") | |
501 ("\\evensidemargin") | |
502 ("\\footheight") | |
503 ("\\footskip") | |
504 ("\\headheight") | |
505 ("\\headsep") | |
506 ("\\itemindent") | |
507 ("\\itemsep") | |
508 ("\\labelsep") | |
509 ("\\labelwidth") | |
510 ("\\leftmargin") | |
511 ("\\linewidth") | |
512 ("\\listparindent") | |
513 ("\\marginparsep") | |
514 ("\\marginparwidth") | |
515 ("\\mathindent") | |
516 ("\\oddsidemargin") | |
517 ("\\parindent") | |
518 ("\\parsep") | |
519 ("\\parskip") | |
520 ("\\partopsep") | |
521 ("\\rightmargin") | |
522 ("\\tabcolsep") | |
523 ("\\textheight") | |
524 ("\\textwidth") | |
525 ("\\topmargin") | |
526 ("\\topsep") | |
527 ("\\topskip") | |
528 ) | |
529 "Alist of LaTeX style parameters.") | |
530 (defvar YaTeX:style-parameters-private nil | |
531 "*User definable alist of style parameters.") | |
532 (defvar YaTeX:style-parameters-private nil | |
533 "Holds the union of LaTeX style parameters.") | |
534 (setq YaTeX:style-parameters | |
535 (append YaTeX:style-parameters-private YaTeX:style-parameters-default)) | |
536 | |
537 (defvar YaTeX:length-history nil "Holds history of length.") | |
538 (defun YaTeX::setlength (&optional argp) | |
539 "YaTeX add-in function for arguments of \\setlength." | |
540 (cond | |
541 ((equal 1 argp) | |
542 (completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")) | |
543 ((equal 2 argp) | |
544 (let ((minibuffer-history-symbol 'YaTeX:length-history)) | |
545 (read-string "Length: ")))) | |
546 ) | |
547 (fset 'YaTeX::addtolength 'YaTeX::setlength) | |
548 | |
549 (defun YaTeX::settowidth (&optional argp) | |
550 "YaTeX add-in function for arguments of \\settowidth." | |
551 (cond | |
552 ((equal 1 argp) | |
553 (completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")) | |
554 ((equal 2 argp) | |
555 (read-string "Text: "))) | |
556 ) | |
557 (defun YaTeX::newlength (&optional argp) | |
558 "YaTeX add-in function for arguments of \\newlength" | |
559 (cond | |
560 ((equal argp 1) | |
561 (let ((length (read-string "Length variable: " "\\"))) | |
562 (or (assoc length YaTeX:style-parameters-private) | |
563 (setq YaTeX:style-parameters-private | |
564 (cons (list length) YaTeX:style-parameters-private) | |
565 YaTeX:style-parameters | |
566 (cons (list length) YaTeX:style-parameters))) | |
567 length))) | |
568 ) | |
569 | |
570 ;; \multicolumn's arguments | |
571 (defun YaTeX::multicolumn (&optional argp) | |
572 "YaTeX add-in function for arguments of \\multicolumn." | |
573 (cond | |
574 ((equal 1 argp) | |
575 (read-string "Number of columns: ")) | |
576 ((equal 2 argp) | |
577 (let (c) | |
578 (while (not (string-match | |
579 (progn (message "Format(one of l,r,c): ") | |
580 (setq c (char-to-string (read-char)))) | |
581 "lrc"))) | |
582 c)) | |
583 ((equal 3 argp) | |
584 (read-string "Item: "))) | |
585 ) | |
586 | |
587 ;;; -------------------- End of yatexadd -------------------- | |
588 (provide 'yatexadd) |