annotate yatexadd.el @ 252:73fef09ebc15 dev

Completion relay: documentclass -> title, document -> section.
author HIROSE Yuuji <yuuji@gentei.org>
date Sat, 11 Feb 2012 23:38:51 +0900
parents c2aa2457a74b
children 45ea6e6e5b26
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.
222
6eff724aba41 Increase version indicator.
yuuji@gentei.org
parents: 221
diff changeset
3 ;;; yatexadd.el rev.20
6eff724aba41 Increase version indicator.
yuuji@gentei.org
parents: 221
diff changeset
4 ;;; (c)1991-2012 by HIROSE Yuuji.[yuuji@yatex.org]
252
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
5 ;;; Last modified Sat Feb 11 23:36:21 2012 on firestorm
141
13a717bee066 $TEXMF/tex/plain/dvips/colordvi.tex
yuuji@gentei.org
parents: 105
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}"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
13 "*Your favorite default rule format.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
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"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
16 "*Vertical thick line format (without @{}). %s'll be replaced by its width.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
17
23
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}"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
19 "*Horizontal thick line format. %s will be replaced by its width.")
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
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"))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
26 (if (string= YaTeX-env-name "tabular*")
18
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))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
54 (setq YaTeX-single-command "hline")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
55
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
56 (format "%s%s{%s}" width loc rule)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
57
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
58 (fset 'YaTeX:tabular* 'YaTeX:tabular)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
59 (fset 'YaTeX:supertabular 'YaTeX:tabular)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
60 (defun YaTeX:alignat ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
61 (concat "{" (read-string "Number of columns: ") "}"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
62 (defun YaTeX:array ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
63 (concat (YaTeX:read-position "tb")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
64 "{" (read-string "Column format: ") "}"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
65 (defun YaTeX:subequations ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
66 (message (if YaTeX-japan "分かりやすいコメントに変えるとref補完が楽よ"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
67 "Changing comment string reduces effort at `ref' completion"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
68 (concat " " YaTeX-comment-prefix
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
69 (YaTeX::ref-default-label "%H:%M")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
70 (if YaTeX-japan "の式群" "equations")))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
71
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
72 (defun YaTeX:read-oneof (oneof &optional quick allow-dup)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
73 (let ((pos "") loc (guide ""))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
74 (and (boundp 'name) name (setq guide (format "%s " name)))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
75 (catch 'quick
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
76 (while (not (string-match
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
77 (setq loc (read-key-sequence
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
78 (format "%s position (`%s') [%s]: "
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
79 guide oneof pos));name is in YaTeX-addin
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
80 loc (if (fboundp 'events-to-keys)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
81 (events-to-keys loc) loc))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
82 "\r\^g\n"))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
83 (cond
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
84 ((string-match loc oneof)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
85 (if (or allow-dup (not (string-match loc pos)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
86 (setq pos (concat pos loc)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
87 (if quick (throw 'quick t)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
88 ((and (string-match loc "\C-h\C-?") (> (length pos) 0))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
89 (setq pos (substring pos 0 (1- (length pos)))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
90 (t
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
91 (ding)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
92 (message "Please input one of `%s'." oneof)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
93 (sit-for 3)))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
94 (message "")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
95 pos))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
96
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
97 (defun YaTeX:read-position (oneof)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
98 "Read a LaTeX (optional) position format such as `[htbp]'."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
99 (let ((pos (YaTeX:read-oneof oneof)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
100 (if (string= pos "") "" (concat "[" pos "]"))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
101
220
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
102 ;;;
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
103 ;; Functions for figure environemnt
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
104 ;;;
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
105 (defvar YaTeX:figure-caption-first nil
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
106 "Non-nil indicates put caption before figure.")
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
107 (defun YaTeX:figure (&optional type firstp)
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
108 "YaTeX add-in function for figure(*) environment."
246
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
109 (setq YaTeX-section-name
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
110 (if YaTeX:figure-caption-first "caption" "includegraphics")
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
111 YaTeX-env-name "center")
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
112 (YaTeX:read-position "htbp"))
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
113
220
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
114
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
115 (fset 'YaTeX:figure* 'YaTeX:figure)
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
116
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
117 ;;;
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
118 ;; Functions for table environemnt
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
119 ;;;
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
120 (defvar YaTeX:table-caption-first t
4bb77d7ee8f0 Modify YaTeX:table and YaTeX:figure.
yuuji@fusion.yk.gentei.org
parents: 219
diff changeset
121 "*Non-nil indicates put caption before tabular.")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
122 (defun YaTeX:table ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
123 "YaTeX add-in function for table environment."
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
124 (cond
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
125 ((eq major-mode 'yatex-mode)
246
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
126 (setq YaTeX-section-name
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
127 (if YaTeX:table-caption-first "caption" "label")
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
128 YaTeX-env-name "tabular")
9105918e45a2 Abolish too-much guidance for table/figure.
yuuji@gentei.org
parents: 237
diff changeset
129 (YaTeX:read-position "htbp"))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
130 ((eq major-mode 'texinfo-mode)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
131 (concat " "
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
132 (completing-read
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
133 "Highlights with: "
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
134 '(("@samp")("@kbd")("@code")("@asis")("@file")("@var"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
135 nil nil "@")))))
219
ad4e0a008972 Add-in function for figure and refine table.
yuuji@fusion.yk.gentei.org
parents: 175
diff changeset
136 (fset 'YaTeX:table* 'YaTeX:table)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
137
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
138 (defun YaTeX:description ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
139 "Truly poor service:-)"
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
140 (setq YaTeX-single-command "item[]")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
141 "")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
142
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
143 (defun YaTeX:itemize ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
144 "It's also poor service."
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
145 (setq YaTeX-single-command "item")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
146 "")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
147
249
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
148 (defun YaTeX:enumerate ()
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
149 (setq YaTeX-single-command "item"
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
150 YaTeX-section-name "label")
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
151 "")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
152
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
153 (defun YaTeX:picture ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
154 "Ask the size of coordinates of picture environment."
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
155 (concat (YaTeX:read-coordinates "Picture size")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
156 (YaTeX:read-coordinates "Initial position")))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
157
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
158 (defun YaTeX:equation ()
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
159 (YaTeX-jmode-off)
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
160 (if (fboundp 'YaTeX-toggle-math-mode)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
161 (YaTeX-toggle-math-mode t))) ;force math-mode ON.
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
162
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
163 (mapcar '(lambda (f) (fset f 'YaTeX:equation))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
164 '(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
165 YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
166 YaTeX:aligned* YaTeX:gathered YaTeX:gathered*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
167 YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
168 YaTeX:xxalignat YaTeX:xxalignat*))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
169
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
170 (defun YaTeX:alignat ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
171 (YaTeX:equation)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
172 (concat "{" (read-string "Number of cols: ") "}"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
173
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
174
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
175
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
176 (defun YaTeX:list ()
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
177 "%\n{} %default label\n{} %formatting parameter")
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
178
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
179 (defun YaTeX:minipage ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
180 (concat (YaTeX:read-position "cbt")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
181 "{" (read-string "Width: ") "}"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
182
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 60
diff changeset
183 (defun YaTeX:thebibliography ()
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
184 (setq YaTeX-section-name "bibitem")
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
185 (concat "{" (read-string "Longest label: ") "}"))
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 60
diff changeset
186
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
187 (defun YaTeX:multicols ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
188 (concat "{" (read-string "Number of columns: ") "}"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
189
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
190 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
191 ;;Sample functions for section-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
192 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
193 (defun YaTeX:multiput ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
194 (concat (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
195 (YaTeX:read-coordinates "Step")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
196 "{" (read-string "How many times: ") "}"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
197
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
198 (defun YaTeX:put ()
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
199 (YaTeX:read-coordinates "Pos"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
200
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
201 (defun YaTeX:makebox ()
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
202 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
203 ((YaTeX-in-environment-p "picture")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
204 (concat (YaTeX:read-coordinates "Dimension")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
205 (YaTeX:read-position "lsrtb")))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
206 (t
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
207 (let ((width (read-string "Width: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
208 (if (string< "" width)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
209 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
210 (or (equal (aref width 0) ?\[)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
211 (setq width (concat "[" width "]")))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
212 (concat width (YaTeX:read-position
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
213 (if YaTeX-use-LaTeX2e "lrs" "lr")))))))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
214
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
215 ;; (defun YaTeX:framebox ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
216 ;; (if (YaTeX-quick-in-environment-p "picture")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
217 ;; (YaTeX:makebox)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
218 (fset 'YaTeX:framebox 'YaTeX:makebox)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
219
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
220 (defun YaTeX:parbox ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
221 (YaTeX:read-position "tbc"))
104
47a11079cc56 Add add-in function for parbox (YaTeX::parbox).
yuuji@gentei.org
parents: 86
diff changeset
222 (defun YaTeX::parbox (argp)
47a11079cc56 Add add-in function for parbox (YaTeX::parbox).
yuuji@gentei.org
parents: 86
diff changeset
223 (cond
47a11079cc56 Add add-in function for parbox (YaTeX::parbox).
yuuji@gentei.org
parents: 86
diff changeset
224 ((= argp 1) (read-string "Width: "))
47a11079cc56 Add add-in function for parbox (YaTeX::parbox).
yuuji@gentei.org
parents: 86
diff changeset
225 ((= argp 2) (read-string "Text: "))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
226
105
08daee5495dc YaTeX:dashbox, YaTeX:savebox should be ::
yuuji@gentei.org
parents: 104
diff changeset
227 (defun YaTeX::dashbox ()
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
228 (concat "{" (read-string "Dash dimension: ") "}"
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
229 (YaTeX:read-coordinates "Dimension")))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
230
105
08daee5495dc YaTeX:dashbox, YaTeX:savebox should be ::
yuuji@gentei.org
parents: 104
diff changeset
231 (defun YaTeX::savebox (argp)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
232 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
233 ((= argp 1) (read-string "Saved into name: " "\\"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
234 ((= argp 2) (read-string "Text: "))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
235
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
236 (defvar YaTeX-minibuffer-quick-map nil)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
237 (if YaTeX-minibuffer-quick-map nil
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
238 (setq YaTeX-minibuffer-quick-map
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
239 (copy-keymap minibuffer-local-completion-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
240 (let ((ch (1+ ? )))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
241 (while (< ch 127)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
242 (define-key YaTeX-minibuffer-quick-map (char-to-string ch)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
243 'YaTeX-minibuffer-quick-complete)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
244 (setq ch (1+ ch)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
245
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
246 (defvar YaTeX:left-right-delimiters
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
247 '(("(" . ")") (")" . "(") ("[" . "]") ("]" . "[")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
248 ("\\{" . "\\}") ("\\}" . "\\{") ("|") ("\\|")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
249 ("\\lfloor" . "\\rfloor") ("\\lceil" . "\\rceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
250 ("\\langle" . "\\rangle") ("/") (".")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
251 ("\\rfloor" . "\\rfloor") ("\\rceil" . "\\lceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
252 ("\\rangle" . "\\langle") ("\\backslash")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
253 ("\\uparrow") ("\\downarrow") ("\\updownarrow") ("\\Updownarrow"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
254 "TeX math delimiter, which can be completed after \\right or \\left.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
255
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
256 (defvar YaTeX:left-right-default nil "Default string of YaTeX:right.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
257
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
258 (defun YaTeX:left ()
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
259 (let ((minibuffer-completion-table YaTeX:left-right-delimiters)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
260 delimiter (leftp (string= YaTeX-single-command "left")))
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
261 (setq delimiter
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
262 (read-from-minibuffer
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
263 (format "Delimiter%s: "
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
264 (if YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
265 (format "(default=`%s')" YaTeX:left-right-default)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
266 "(SPC for menu)"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
267 nil YaTeX-minibuffer-quick-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
268 (if (string= "" delimiter) (setq delimiter YaTeX:left-right-default))
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
269 (setq YaTeX-single-command (if leftp "right" "left")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
270 YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
271 (or (cdr (assoc delimiter YaTeX:left-right-delimiters)) delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
272 delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
273
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
274 (fset 'YaTeX:right 'YaTeX:left)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
275
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
276 (defun YaTeX:langle ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
277 (setq YaTeX-single-command "rangle")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
278 nil)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
279
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
280 (defun YaTeX:read-coordinates (&optional mes varX varY)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
281 (concat
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
282 "("
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
283 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
284 ","
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
285 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y")))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
286 ")"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
287
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
288 (defun YaTeX:itembox ()
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
289 (concat "{" (read-string "Item heading string: ") "}"))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
290
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
291 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
292 ;;Sample functions for maketitle-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
293 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
294 (defun YaTeX:sum ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
295 "Read range of summation."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
296 (YaTeX:check-completion-type 'maketitle)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
297 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^")))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
298
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
299 (fset 'YaTeX:int 'YaTeX:sum)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
300
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
301 (defun YaTeX:lim ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
302 "Insert limit notation of \\lim."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
303 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
304 (let ((var (read-string "Variable: ")) limit)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
305 (if (string= "" var) ""
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
306 (setq limit (read-string "Limit ($ means infinity): "))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
307 (if (string= "$" limit) (setq limit "\\infty"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
308 (concat "_{" var " \\rightarrow " limit "}"))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
309
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
310 (defun YaTeX:gcd ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
311 "Add-in function for \\gcd(m,n)."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
312 (YaTeX:check-completion-type 'maketitle)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
313 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
314
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
315 (defun YaTeX:read-boundary (ULchar)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
316 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar."
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
317 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): "))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
318 (if (string= bndry "") ""
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
319 (if (string= bndry "$") (setq bndry "\\infty"))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
320 (concat ULchar "{" bndry "}"))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
321
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
322 (defun YaTeX:verb ()
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
323 "Enclose \\verb's contents with the same characters."
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
324 (let ((quote-char (read-string "Quoting char: " "|"))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
325 (contents (read-string "Quoted contents: ")))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
326 (concat quote-char contents quote-char)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
327
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
328 (fset 'YaTeX:verb* 'YaTeX:verb)
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
329
43
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
330 (defun YaTeX:footnotemark ()
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
331 (setq YaTeX-section-name "footnotetext")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
332 nil)
43
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
333
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
334 (defun YaTeX:cite ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
335 (let ((comment (read-string "Comment for citation: ")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
336 (if (string= comment "") ""
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
337 (concat "[" comment "]"))))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
338
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
339 (defun YaTeX:bibitem ()
64
36a48185b95a Changes are listed in yatex.new.
yuuji
parents: 60
diff changeset
340 (let ((label (read-string "Citation label for bibitem: ")))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
341 (if (string= label "") ""
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
342 (concat "[" label "]"))))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
343
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
344 (defun YaTeX:item ()
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
345 (cond
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
346 ((eq major-mode 'yatex-mode)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
347 (YaTeX-indent-line)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
348 (setq YaTeX-section-name "label"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
349 ((eq major-mode 'texinfo-mode)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
350 (setq YaTeX-section-name "dots"))) ;??
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
351 " ")
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
352 (fset 'YaTeX:item\[\] 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
353 (fset 'YaTeX:subitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
354 (fset 'YaTeX:subsubitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
355
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
356 (defun YaTeX:linebreak ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
357 (let (obl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
358 (message "Break strength 0,1,2,3,4 (default: 4): ")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
359 (setq obl (char-to-string (read-char)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
360 (if (string-match "[0-4]" obl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
361 (concat "[" obl "]")
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
362 "")))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
363 (fset 'YaTeX:pagebreak 'YaTeX:linebreak)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
364
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
365 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
366 ;;Subroutine
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
367 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
368
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
369 (defun YaTeX:check-completion-type (type)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
370 "Check valid completion type."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
371 (if (not (eq type YaTeX-current-completion-type))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
372 (error "This should be completed with %s-type completion." type)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
373
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
374
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
375 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
376 ;;; [[Add-in functions for reading section arguments]]
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
377 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
378 ;; All of add-in functions for reading sections arguments should
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
379 ;; take an argument ARGP that specify the argument position.
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
380 ;; If argument position is out of range, nil should be returned,
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
381 ;; else nil should NOT be returned.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
382
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
383 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
384 ; Label selection
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
385 ;;
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
386 (defvar YaTeX-label-menu-other
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
387 (if YaTeX-japan "':他のバッファのラベル\n" "':LABEL IN OTHER BUFFER.\n"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
388 (defvar YaTeX-label-menu-repeat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
389 (if YaTeX-japan ".:直前の\\refと同じ\n" "/:REPEAT LAST \ref{}\n"))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
390 (defvar YaTeX-label-menu-any
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
391 (if YaTeX-japan "*:任意の文字列\n" "*:ANY STRING.\n"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
392 (defvar YaTeX-label-buffer "*Label completions*")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
393 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
394 (defvar YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
395 "Key map used in label selection buffer.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
396 (defun YaTeX::label-setup-key-map ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
397 (if YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
398 (message "Setting up label selection mode map...")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
399 ;(setq YaTeX-label-select-map (copy-keymap global-map))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
400 (setq YaTeX-label-select-map (make-keymap))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
401 (suppress-keymap YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
402 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
403 'previous-line 'YaTeX::label-previous YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
404 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
405 'next-line 'YaTeX::label-next YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
406 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
407 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
408 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
409 (define-key YaTeX-label-select-map ">" 'end-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
410 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
411 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
412 (define-key YaTeX-label-select-map " " 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
413 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
414 (define-key YaTeX-label-select-map "/" 'isearch-forward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
415 (define-key YaTeX-label-select-map "?" 'isearch-backward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
416 (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
417 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
418 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
419 (message "Setting up label selection mode map...Done")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
420 (let ((key ?A))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
421 (while (<= key ?Z)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
422 (define-key YaTeX-label-select-map (char-to-string key)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
423 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
424 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
425 'YaTeX::label-search-tag)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
426 (setq key (1+ key))))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
427
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
428 (defun YaTeX::label-next ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
429 (interactive) (forward-line 1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
430 (defun YaTeX::label-previous ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
431 (interactive) (forward-line -1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
432 (defun YaTeX::label-search-tag ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
433 (interactive)
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
434 (let ((case-fold-search t)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
435 (tag (regexp-quote (char-to-string last-command-char))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
436 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
437 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
438 (forward-char 1)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
439 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
440 (goto-char (match-beginning 0)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
441 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
442 (goto-char (point-min))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
443 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
444 (goto-char (match-beginning 0))))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
445 (message YaTeX-label-guide-msg)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
446
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
447 ; (defun YaTeX::ref (argp &optional labelcmd refcmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
448 ; (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
449 ; ((= argp 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
450 ; (let ((lnum 0) e0 label label-list (buf (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
451 ; (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
452 ; (p (point)) initl line cf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
453 ; (message "Collecting labels...")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
454 ; (save-window-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
455 ; (YaTeX-showup-buffer
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
456 ; YaTeX-label-buffer (function (lambda (x) (window-width x))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
457 ; (if (fboundp 'select-frame) (setq cf (selected-frame)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
458 ; (if (eq (window-buffer (minibuffer-window)) buf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
459 ; (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
460 ; (other-window 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
461 ; (setq buf (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
462 ; (set-buffer buf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
463 ; ;(message "cb=%s" buf)(sit-for 3)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
464 ; ))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
465 ; (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
466 ; (set-buffer (get-buffer-create YaTeX-label-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
467 ; (setq buffer-read-only nil)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
468 ; (erase-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
469 ; (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
470 ; (goto-char (point-min))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
471 ; (let ((standard-output (get-buffer YaTeX-label-buffer)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
472 ; (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
473 ; (while (YaTeX-re-search-active-forward
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
474 ; (concat "\\\\" labelcmd "\\b")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
475 ; (regexp-quote YaTeX-comment-prefix) nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
476 ; (goto-char (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
477 ; (skip-chars-forward "^{")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
478 ; (setq label
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
479 ; (buffer-substring
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
480 ; (1+ (point))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
481 ; (prog2 (forward-list 1) (setq e0 (1- (point)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
482 ; label-list (cons label label-list))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
483 ; (or initl
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
484 ; (if (< p (point)) (setq initl lnum)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
485 ; (beginning-of-line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
486 ; (skip-chars-forward " \t\n" nil)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
487 ; (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
488 ; (buffer-substring (point) (point-end-of-line))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
489 ; (setq lnum (1+ lnum))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
490 ; (message "Collecting \\%s{}... %d" labelcmd lnum)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
491 ; (goto-char e0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
492 ; (princ YaTeX-label-menu-other)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
493 ; (princ YaTeX-label-menu-repeat)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
494 ; (princ YaTeX-label-menu-any)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
495 ; );standard-output
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
496 ; (goto-char p)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
497 ; (or initl (setq initl lnum))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
498 ; (message "Collecting %s...Done" labelcmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
499 ; (if (fboundp 'select-frame) (select-frame cf))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
500 ; (YaTeX-showup-buffer YaTeX-label-buffer nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
501 ; (YaTeX::label-setup-key-map)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
502 ; (setq truncate-lines t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
503 ; (setq buffer-read-only t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
504 ; (use-local-map YaTeX-label-select-map)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
505 ; (message YaTeX-label-guide-msg)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
506 ; (goto-line (1+ initl)) ;goto recently defined label line
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
507 ; (switch-to-buffer (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
508 ; (unwind-protect
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
509 ; (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
510 ; (recursive-edit)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
511 ; (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
512 ; (beginning-of-line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
513 ; (setq line (1- (count-lines (point-min)(point))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
514 ; (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
515 ; ((= line -1) (setq label ""))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
516 ; ((= line lnum) (setq label (YaTeX-label-other)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
517 ; ((= line (1+ lnum))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
518 ; (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
519 ; (switch-to-buffer buf)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
520 ; (goto-char p)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
521 ; (if (re-search-backward
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
522 ; (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
523 ; (setq label (YaTeX-match-string 1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
524 ; (setq label ""))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
525 ; ((>= line (+ lnum 2))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
526 ; (setq label (read-string (format "\\%s{???}: " refcmd))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
527 ; (t (setq label (nth (- lnum line 1) label-list)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
528 ; (bury-buffer YaTeX-label-buffer)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
529 ; label)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
530
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
531 (defvar YaTeX-ref-default-label-string "%H%M%S_%d%b%y"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
532 "*Default \\ref time string format.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
533 This format is like strftime(3) but allowed conversion char are as follows;
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
534 %y -> Last 2 digit of year, %b -> Month name, %m -> Monthe number(1-12),
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
535 %d -> Day, %H -> Hour, %M -> Minute, %S -> Second,
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
536 %qx -> alphabetical-decimal conversion of yymmdd.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
537 %qX -> alphabetical-decimal conversion of HHMMSS.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
538 Beware defualt label-string should be always unique. So this format string
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
539 should have both time part (%H+%M+%S or %qX) and date
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
540 part (%y+(%b|%m)+%d or %qx).")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
541
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
542 (defun YaTeX::ref-alphabex (n)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
543 (let ((alphabex ""))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
544 (while (> n 0)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
545 (setq alphabex (concat (char-to-string (+ ?a (% n 26))) alphabex)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
546 n (/ n 26)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
547 alphabex))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
548
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
549 (defun YaTeX::ref-default-label (&optional format)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
550 "Default auto-genarated label string."
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
551 ;; We do not use (format-time-string) for emacs-19
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
552 (let*((ts (substring (current-time-string) 4))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
553 (y (substring ts -2))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
554 (b (substring ts 0 3))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
555 (d (format "%d" (string-to-int (substring ts 4 6))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
556 (H (substring ts 7 9))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
557 (M (substring ts 10 12))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
558 (S (substring ts 13 15))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
559 (HMS (+ (* 10000 (string-to-int H))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
560 (* 100 (string-to-int M))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
561 (string-to-int S)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
562 (talphabex (YaTeX::ref-alphabex HMS))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
563 (mnames "JanFebMarAprMayJunJulAugSepOctNovDec")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
564 (m (format "%02d" (/ (string-match b mnames) 3)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
565 (ymd (+ (* 10000 (string-to-int y))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
566 (* 100 (string-to-int m))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
567 (string-to-int d)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
568 (dalphabex (YaTeX::ref-alphabex ymd)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
569 (YaTeX-replace-formats
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
570 (or format YaTeX-ref-default-label-string)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
571 (list (cons "y" y)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
572 (cons "b" b)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
573 (cons "m" m)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
574 (cons "d" d)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
575 (cons "H" H)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
576 (cons "M" M)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
577 (cons "S" S)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
578 (cons "qX" talphabex)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
579 (cons "qx" dalphabex)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
580
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
581 (defvar YaTeX-ref-generate-label-function 'YaTeX::ref-generate-label
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
582 "*Function to generate default label for unnamed \\label{}s.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
583 The function pointed to this value should take two arguments.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
584 First argument is LaTeX macro's name, second is macro's argument.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
585
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
586 (defun YaTeX::ref-generate-label (command arg)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
587 "Generate a label string which is unique in current buffer."
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
588 (let ((default (condition-case nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
589 (YaTeX::ref-default-label)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
590 (error (substring (current-time-string) 4)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
591 (read-string "Give a label for this line: "
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
592 (if YaTeX-emacs-19 (cons default 1) default))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
593
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
594 (defun YaTeX::ref-getset-label (buffer point &optional noset)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
595 "Get label string in the BUFFER near the POINT.
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
596 Make \\label{xx} if no label.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
597 If optional third argument NOSET is non-nil, do not generate new label."
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
598 ;;Here, we rewrite the LaTeX source. Therefore we should be careful
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
599 ;;to decide the location suitable for \label. Do straightforward!
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
600 (let (boundary inspoint cc newlabel (labelholder "label") mathp exp1 env
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
601 (r-escape (regexp-quote YaTeX-comment-prefix))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
602 command arg alreadysought foundpoint)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
603 (set-buffer buffer)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
604 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
605 (goto-char point)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
606 (setq cc (current-column))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
607 (if (= (char-after (point)) ?\\) (forward-char 1))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
608 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
609 ((looking-at YaTeX-sectioning-regexp)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
610 (setq command (YaTeX-match-string 0))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
611 (skip-chars-forward "^{")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
612 (setq arg (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
613 (1+ (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
614 (progn (forward-list 1) (1- (point)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
615 (skip-chars-forward " \t\n")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
616 ;(setq boundary "[^\\]")
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
617 (setq inspoint (point))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
618 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
619 (save-excursion
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
620 (if (YaTeX-re-search-active-forward
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
621 (concat YaTeX-ec-regexp
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
622 "\\(" YaTeX-sectioning-regexp "\\|"
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
623 "begin\\|item\\)")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
624 r-escape nil 1)
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
625 (match-beginning 0)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
626 (1- (point))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
627 ((looking-at "item\\s ")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
628 (setq command "item"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
629 cc (+ cc 6))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
630 ;(setq boundary (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
631 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
632 (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
633 (if (YaTeX-re-search-active-forward
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
634 (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
635 r-escape nil 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
636 (match-beginning 0)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
637 (1- (point))))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
638 inspoint boundary))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
639 ((looking-at "bibitem")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
640 (setq labelholder "bibitem" ; label holder is bibitem itself
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
641 command "bibitem")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
642 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
643 (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
644 (if (YaTeX-re-search-active-forward
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
645 (concat YaTeX-ec-regexp "\\(bibitem\\|end\\)\\b")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
646 r-escape nil 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
647 (match-beginning 0)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
648 (1- (point))))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
649 inspoint boundary))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
650 ((string-match YaTeX::ref-nestable-counter-regexp
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
651 (setq env (or (YaTeX-inner-environment t) "document")))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
652 (let ((curtop (get 'YaTeX-inner-environment 'point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
653 (end (point-max)) label)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
654 (skip-chars-forward " \t\n")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
655 (setq inspoint (point) ;initial candidate
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
656 cc (current-column)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
657 command env
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
658 alreadysought t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
659 (if (condition-case nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
660 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
661 (goto-char curtop)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
662 (YaTeX-goto-corresponding-environment))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
663 (error nil))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
664 (setq end (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
665 (goto-char inspoint)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
666 (while (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
667 (concat YaTeX-ec-regexp "label{\\([^}]+\\)}" )
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
668 r-escape end t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
669 (setq label (YaTeX-match-string 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
670 (if (and (equal env (YaTeX-inner-environment t))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
671 (= curtop (get 'YaTeX-inner-environment 'point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
672 ;;I found the label
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
673 (setq alreadysought label
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
674 foundpoint (match-end 0))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
675 ))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
676 ((string-match YaTeX::ref-mathenv-regexp env) ;env is set in above case
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
677 (setq command env
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
678 mathp t
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
679 exp1 (string-match YaTeX::ref-mathenv-exp1-regexp env))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
680 ;;(setq boundary (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)"))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
681 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
682 (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
683 (if (YaTeX-re-search-active-forward
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
684 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
685 YaTeX-ec-regexp "\\("
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
686 (if exp1 "" "\\\\\\|")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
687 "end{" env "}\\)")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
688 r-escape nil 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
689 (match-beginning 0)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
690 (1- (point))))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
691 inspoint boundary))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
692 ((looking-at "footnote\\s *{")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
693 (setq command "footnote")
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
694 (skip-chars-forward "^{") ;move onto `{'
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
695 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
696 (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
697 (condition-case err
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
698 (forward-list 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
699 (error (error "\\\\footnote at point %s's brace not closed"
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
700 (point))))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
701 (1- (point)))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
702 inspoint boundary))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
703 ((looking-at "caption\\|\\(begin\\)")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
704 (setq command (YaTeX-match-string 0))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
705 (skip-chars-forward "^{")
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
706 ;;;;;;(if (match-beginning 1) (forward-list 1))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
707 ;; caption can be treated as mathenv, is it right??
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
708 (setq arg (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
709 (1+ (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
710 (progn (forward-list 1) (1- (point)))))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
711 ;;(setq boundary (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b"))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
712 (setq inspoint (point))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
713 (setq boundary
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
714 (save-excursion
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
715 (if (YaTeX-re-search-active-forward
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
716 (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b")
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
717 r-escape nil 1)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
718 (match-beginning 0)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
719 (1- (point))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
720 (t ))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
721 (if (save-excursion (skip-chars-forward " \t") (looking-at "%"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
722 (forward-line 1))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
723 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
724 ((stringp alreadysought)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
725 (put 'YaTeX::ref-getset-label 'foundpoint foundpoint) ;ugly...
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
726 alreadysought)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
727 ((and (null alreadysought)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
728 (> boundary (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
729 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
730 (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
731 ;;(concat "\\(" labelholder "\\)\\|\\(" boundary "\\)")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
732 labelholder
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
733 (regexp-quote YaTeX-comment-prefix)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
734 boundary 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
735 (match-beginning 0))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
736 ;; if \label{hoge} found, return it
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
737 (put 'YaTeX::ref-getset-label 'foundpoint (1- (match-beginning 0)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
738 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
739 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
740 (goto-char (match-end 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
741 (skip-chars-forward "^{") (1+ (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
742 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
743 (forward-sexp 1) (1- (point)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
744 ;;else make a label
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
745 ;(goto-char (match-beginning 0))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
746 (noset nil) ;do not set label if noset
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
747 (t
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
748 (goto-char inspoint)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
749 (skip-chars-backward " \t\n")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
750 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
751 (setq newlabel
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
752 (funcall YaTeX-ref-generate-label-function command arg)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
753 (delete-region (point) (progn (skip-chars-backward " \t") (point)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
754 (if mathp nil
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
755 (insert "\n")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
756 (YaTeX-reindent cc))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
757 (insert (format "\\label{%s}" newlabel))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
758 newlabel)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
759
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
760 (defvar YaTeX::ref-labeling-regexp-alist-default
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
761 '(("\\\\begin{\\(java\\|program\\)}{\\([^}]+\\)}" . 2)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
762 ("\\\\label{\\([^}]+\\)}" . 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
763 "Alist of labeling regexp vs. its group number points to label string.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
764 This alist is used in \\ref's argument's completion.")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
765 (defvar YaTeX::ref-labeling-regexp-alist-private nil
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
766 "*Private extension to YaTeX::ref-labeling-regexp-alist.
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
767 See the documetation of YaTeX::ref-labeling-regexp-alist.")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
768 (defvar YaTeX::ref-labeling-regexp-alist
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
769 (append YaTeX::ref-labeling-regexp-alist-default
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
770 YaTeX::ref-labeling-regexp-alist-private))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
771 (defvar YaTeX::ref-labeling-regexp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
772 (mapconcat 'car YaTeX::ref-labeling-regexp-alist "\\|"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
773 (defvar YaTeX::ref-mathenv-regexp
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
774 ;; See also YaTeX-ams-math-begin-alist in yatex.el
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
775 ;; Define only envs which has counter.(without *)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
776 "equation\\|eqnarray\\|align\\(at\\)?\\|flalign\\|gather\\|xx?alignat\\|multline")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
777 (defvar YaTeX::ref-mathenv-exp1-regexp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
778 "\\(equation\\|multline\\)\\b"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
779 "*Regexp of math-envname which has only one math-expression.")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
780 (defvar YaTeX::ref-enumerateenv-regexp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
781 "enumerate")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
782 (defvar YaTeX::ref-nestable-counter-regexp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
783 "subequations")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
784
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
785 (defvar YaTeX::ref-labeling-section-level 2
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
786 "*ref補完で収集するセクショニングコマンドの下限レベル
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
787 YaTeX-sectioning-levelの数値で指定.")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
788
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
789 (defun YaTeX::ref (argp &optional labelcmd refcmd predf)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
790 (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
791 (require 'yatexsec)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
792 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
793 ((= argp 1)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
794 (let*((lnum 0) m0 e0 x cmd label match-point point-list boundary
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
795 (buf (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
796 (llv YaTeX::ref-labeling-section-level)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
797 (mathenvs YaTeX::ref-mathenv-regexp) envname endrx
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
798 (enums YaTeX::ref-enumerateenv-regexp)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
799 (counter
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
800 (or labelcmd
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
801 (concat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
802 YaTeX-ec-regexp "\\(\\("
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
803 (mapconcat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
804 'concat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
805 (delq nil
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
806 (mapcar
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
807 (function
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
808 (lambda (s)
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
809 (if (>= llv (cdr s))
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
810 (car s))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
811 YaTeX-sectioning-level))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
812 "\\|")
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
813 "\\|caption\\(\\[[^]]+\\]\\)?\\|footnote\\){"
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
814 "\\|\\(begin{\\(" mathenvs "\\|" enums "\\)}\\)"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
815 (if YaTeX-use-AMS-LaTeX
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
816 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
817 "\\|\\(begin{"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
818 YaTeX::ref-nestable-counter-regexp "}\\)"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
819 "\\)")))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
820 (regexp (concat "\\(" counter
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
821 "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
822 (itemsep (concat YaTeX-ec-regexp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
823 "\\(\\(bib\\)?item\\|begin\\|end\\)"))
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
824 (refcmd (or refcmd "\\(page\\)?ref"))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
825 (p (point)) initl line cf
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
826 (percent (regexp-quote YaTeX-comment-prefix))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
827 (output
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
828 (function
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
829 (lambda (label p)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
830 (while (setq x (string-match "[\n\t]" label))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
831 (aset label x ? ))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
832 (while (setq x (string-match " +" label))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
833 (setq label (concat
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
834 (substring label 0 (1+ (match-beginning 0)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
835 (substring label (match-end 0)))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
836 (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
837 (setq point-list (cons p point-list))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
838 (message "Collecting labels... %d" lnum)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
839 (setq lnum (1+ lnum)))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
840 (me (if (boundp 'me) me 'YaTeX::ref))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
841 )
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
842 (message "Collecting labels...")
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
843 (save-window-excursion
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
844 (YaTeX-showup-buffer
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
845 YaTeX-label-buffer (function (lambda (x) (window-width x))))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
846 (if (fboundp 'select-frame) (setq cf (selected-frame)))
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
847 (if (eq (window-buffer (minibuffer-window)) buf)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
848 (progn
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
849 (other-window 1)
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
850 (setq buf (current-buffer))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
851 (set-buffer buf)))
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
852 (save-excursion
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
853 (set-buffer (get-buffer-create YaTeX-label-buffer))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
854 (condition-case ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
855 (if (and YaTeX-use-font-lock (fboundp 'font-lock-mode))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
856 (font-lock-mode 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
857 (error nil))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
858 (setq buffer-read-only nil)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
859 (erase-buffer))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
860 (save-excursion
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
861 (set-buffer buf)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
862 (goto-char (point-min))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
863 (let ((standard-output (get-buffer YaTeX-label-buffer)) existlabel)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
864 (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf)))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
865 (while (YaTeX-re-search-active-forward
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
866 regexp ;;counter
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
867 percent nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
868 ;(goto-char (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
869 (setq e0 (match-end 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
870 (cond
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
871 ;;
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
872 ;;2005/10/21 Skip it if predicate function returns nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
873 ((and predf
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
874 (let ((md (match-data)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
875 (prog1
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
876 (condition-case nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
877 (not (funcall predf))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
878 (error nil))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
879 (store-match-data md)))))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
880 ((YaTeX-literal-p) nil)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
881 ((YaTeX-match-string 1)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
882 ;;if standard counter commands found
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
883 (setq cmd (YaTeX-match-string 2)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
884 m0 (match-beginning 0))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
885 (setq match-point (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
886 (or initl
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
887 (if (< p (point)) (setq initl lnum)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
888 (cond
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
889 ;; In any case, variables e0 should be set
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
890 ((and YaTeX-use-AMS-LaTeX
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
891 (string-match YaTeX::ref-nestable-counter-regexp cmd))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
892 (let (label)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
893 (skip-chars-forward "}")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
894 (setq label (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
895 (point) (min (+ 80 (point)) (point-max))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
896 ;; to skip (maybe)auto-generated comment
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
897 (skip-chars-forward " \t")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
898 (if (looking-at YaTeX-comment-prefix)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
899 (forward-line 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
900 (setq e0 (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
901 (skip-chars-forward " \t\n")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
902 (if (looking-at "\\\\label{\\([^}]+\\)}")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
903 (setq label (format "(labe:%s)" (YaTeX-match-string 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
904 e0 (match-end 1)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
905 (funcall output (format "--subequation--%s" label) e0)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
906 ((string-match mathenvs cmd) ;;if matches mathematical env
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
907 ;(skip-chars-forward "} \t\n")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
908 ;(forward-line 1) ;2004/1/25
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
909 (skip-chars-forward "}")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
910 (setq x (point)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
911 envname (substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
912 cmd (match-beginning 0) (match-end 0)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
913 (save-restriction
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
914 (narrow-to-region
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
915 m0
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
916 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
917 (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
918 (setq endrx (format "%send{%s}" YaTeX-ec-regexp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
919 (regexp-quote envname)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
920 percent nil t)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
921 (catch 'scan
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
922 (while (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
923 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
924 "\\\\end{\\(" (regexp-quote envname) "\\)";;(1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
925 (if YaTeX-use-AMS-LaTeX
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
926 "\\|\\\\\\(notag\\)") ;;2
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
927 (if (string-match
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
928 YaTeX::ref-mathenv-exp1-regexp cmd)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
929 "" "\\|\\\\\\\\$")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
930 )
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
931 percent nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
932 (let*((quit (match-beginning 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
933 (notag (match-beginning 2))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
934 (label ".......................") l2
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
935 (e (point)) (m0 (match-beginning 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
936 (ln (YaTeX-string-width label)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
937 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
938 (notag
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
939 (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
940 "\\\\\\\\" percent nil 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
941 (setq x (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
942 (t
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
943 (if (YaTeX-re-search-active-backward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
944 YaTeX::ref-labeling-regexp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
945 percent x t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
946 ;; if \label{x} in math-expression, display it
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
947 ;; because formula source is hard to recognize
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
948 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
949 (goto-char (match-end 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
950 (setq l2 (format "\"label:%s\""
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
951 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
952 (1- (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
953 (progn (forward-sexp -1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
954 (1+ (point))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
955 (setq label
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
956 (if (< (YaTeX-string-width l2) ln)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
957 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
958 l2
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
959 (substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
960 label
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
961 0 (- ln (YaTeX-string-width l2))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
962 l2))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
963 (goto-char e)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
964 (funcall output
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
965 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
966 label " "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
967 (buffer-substring x m0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
968 x)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
969 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
970 ((YaTeX-quick-in-environment-p
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
971 YaTeX-math-gathering-list)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
972 ;; if here is inner split/cases/gathered env.,
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
973 ;; counter for here is only one.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
974 ;; Go out this environment and,
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
975 (YaTeX-end-of-environment)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
976 ;; search next expression unit boundary.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
977 (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
978 (concat endrx "\\|\\\\begin{")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
979 percent nil 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
980 (end-of-line)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
981 (if quit (throw 'scan t)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
982 (setq x (point)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
983 (setq e0 (point)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
984 ((string-match enums cmd)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
985 ;(skip-chars-forward "} \t\n")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
986 (save-restriction
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
987 (narrow-to-region
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
988 (point)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
989 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
990 (YaTeX-goto-corresponding-environment) (point)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
991 (forward-line 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
992 (while (YaTeX-re-search-active-forward
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
993 (concat YaTeX-ec-regexp "item\\s ")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
994 percent nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
995 (setq x (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
996 (funcall
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
997 output
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
998 (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
999 existlabel
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1000 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1001 (match-beginning 0)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1002 (if (re-search-forward itemsep nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1003 (progn (goto-char (match-beginning 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1004 (skip-chars-backward " \t")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1005 (1- (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1006 (point-end-of-line))))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1007 x))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1008 (setq e0 (point-max))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1009 ((string-match "bibitem" cmd) ;maybe generated by myself
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1010 (setq label "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1011 (skip-chars-forward " \t")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1012 (if (looking-at "{") ;sure to be true!!
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1013 (forward-list 1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1014 (let ((list '(30 10 65))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1015 (delim ";") q lim len l str)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1016 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1017 (setq lim (if (re-search-forward itemsep nil 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1018 (match-beginning 0) (point))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1019 (while list
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1020 (skip-chars-forward " \t\n\\")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1021 (setq q (looking-at "[\"'{]")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1022 len (car list)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1023 str
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1024 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1025 (point)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1026 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1027 (if q (forward-sexp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1028 (search-forward delim lim 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1029 (forward-char -1))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1030 (point))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1031 (if (> (setq l (YaTeX-string-width str)) len)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1032 (setq str (concat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1033 (YaTeX-truncate-string-width
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1034 str (- len (if q 5 4)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1035 "... "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1036 (if q (substring str -1)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1037 (if (< (setq l (YaTeX-string-width str)) len)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1038 (setq str (concat str (make-string (- len l) ? ))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1039 (if (looking-at delim) (goto-char (match-end 0)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1040 (setq label (concat label " " str)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1041 list (cdr list)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1042 (funcall output label match-point)))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1043 ;;else, simple section-type counter
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1044 ((= (char-after (1- (point))) ?{)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1045 (setq label (buffer-substring
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1046 (match-beginning 0)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1047 (progn (forward-char -1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1048 (forward-list 1)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1049 (point))))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1050 (funcall output label match-point)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1051 ;; Skip preceding label if exists
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1052 (if (YaTeX::ref-getset-label (current-buffer) match-point t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1053 (goto-char (get 'YaTeX::ref-getset-label 'foundpoint)))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1054 (if (save-excursion
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1055 (skip-chars-forward "\t \n")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1056 (looking-at YaTeX::ref-labeling-regexp))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1057 (setq e0 (match-end 0))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1058 (t
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1059 (skip-chars-forward " \t")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1060 (setq label (buffer-substring
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1061 (match-beginning 0)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1062 (if (re-search-forward
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1063 itemsep
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1064 nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1065 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1066 (goto-char (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1067 (skip-chars-backward " \t")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1068 (1- (point)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1069 (point-end-of-line))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1070 (funcall output label match-point)
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1071 (if (save-excursion
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1072 (skip-chars-forward "\t \n")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1073 (looking-at YaTeX::ref-labeling-regexp))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1074 (setq e0 (match-end 0)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1075 ) ;;put label buffer
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1076 ;;
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1077 ;; if user defined label found
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1078 (t
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1079 ;; memorize line number and label into property
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1080 (goto-char (match-beginning 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1081 (let ((list YaTeX::ref-labeling-regexp-alist)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1082 (cache (symbol-plist 'YaTeX::ref-labeling-regexp)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1083 (while list
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1084 (if (looking-at (car (car list)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1085 (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1086 (setq label (YaTeX-match-string 0))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1087 (put 'YaTeX::ref-labeling-regexp lnum
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1088 (YaTeX-match-string (cdr (car list))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1089 (funcall output label 0) ;;0 is dummy, never used
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1090 (setq list nil)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1091 (setq list (cdr list))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1092 ))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1093 (goto-char e0))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1094 (princ YaTeX-label-menu-other)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1095 (princ YaTeX-label-menu-repeat)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1096 (princ YaTeX-label-menu-any)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1097 );standard-output
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1098 (goto-char p)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1099 (or initl (setq initl lnum))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1100 (message "Collecting labels...Done")
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1101 (if (fboundp 'select-frame) (select-frame cf))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1102 (YaTeX-showup-buffer YaTeX-label-buffer nil t)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1103 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1104 (setq truncate-lines t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1105 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1106 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1107 (message YaTeX-label-guide-msg)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1108 (goto-line (1+ initl)) ;goto recently defined label line
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1109 (switch-to-buffer (current-buffer))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1110 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1111 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1112 (recursive-edit)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1113
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1114 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1115 (beginning-of-line)
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1116 (setq line (1- (count-lines (point-min)(point))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1117 (cond
60
9e08ed569d80 yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents: 59
diff changeset
1118 ((= line -1) (setq label ""))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1119 ((= line lnum) (setq label (YaTeX-label-other)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1120 ((= line (1+ lnum))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1121 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1122 (switch-to-buffer buf)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1123 (goto-char p)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1124 (if (re-search-backward
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1125 (concat "\\\\" refcmd "{") nil t)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1126 (setq label (YaTeX-buffer-substring
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1127 (progn (goto-char (1- (match-end 0)))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1128 (1+ (point)))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1129 (progn (forward-list 1)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1130 (1- (point)))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1131 (setq label ""))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1132 ((>= line (+ lnum 2))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1133 (setq label (read-string (format "\\%s{???}: " refcmd))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1134 (t ;(setq label (nth (- lnum line 1) label-list))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1135 (setq label
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1136 (or (get 'YaTeX::ref-labeling-regexp line)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1137 (YaTeX::ref-getset-label
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1138 buf (nth (- lnum line 1) point-list))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1139 )))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1140 (bury-buffer YaTeX-label-buffer)))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1141 label)))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1142
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1143 (defun YaTeX::label-rename-refs (old new &optional def ref)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1144 "Rename reference tag from OLD to NEW.
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1145 Optional arguments DEF and REF specify defining command and
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1146 referring command respectively.
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1147 ---------------------------------------------------------
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1148 CONTROL KEYS - キーの説明
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1149 y Replace 置換する
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1150 n Do not replace 置換しない
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1151 ! Replace All w/o query 残る全部を確認なしで置換
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1152 r Enter Recursive-edit 再帰編集モードへ
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1153 q Quit from replacing ここまでで置換をやめる
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1154
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1155 Don't forget to exit from recursive edit by typing \\[exit-recursive-edit]
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1156 再帰編集に入ったら \\[exit-recursive-edit] で抜け忘れなきよう。"
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1157 (save-window-excursion
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1158 (catch 'exit
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1159 (let*((bufs (YaTeX-yatex-buffer-list)) buf b e
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1160 (oldptn (regexp-quote old))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1161 (sw (selected-window))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1162 (ptn (concat
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1163 "\\(" YaTeX-refcommand-ref-regexp "\\)"
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1164 "\\s *{" oldptn "}"))
170
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1165 (repface (and (fboundp 'make-overlay)
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1166 (fboundp 'internal-find-face)
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1167 (if (internal-find-face 'isearch) 'isearch 'region)))
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1168 ov
173
7dc3c2332da5 YaTeX::label: Message for yank should remain.
yuuji@gentei.org
parents: 170
diff changeset
1169 (qmsg "Replace to `%s'? [yn!rq?]")
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1170 continue ch)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1171 (while bufs
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1172 (set-buffer (setq buf (car bufs)))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1173 (save-excursion
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1174 (goto-char (point-min))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1175 (while (re-search-forward ptn nil t)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1176 (goto-char (match-end 1))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1177 (skip-chars-forward " \t\n{")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1178 (unwind-protect
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1179 (if (and
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1180 (looking-at oldptn)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1181 (setq b (match-beginning 0)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1182 e (match-end 0))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1183 (or continue
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1184 (catch 'query
170
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1185 (if repface
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1186 (if ov (move-overlay ov b e)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1187 (overlay-put
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1188 (setq ov (make-overlay b e))
170
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1189 'face repface)))
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1190 (switch-to-buffer buf)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1191 (while t
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1192 (message qmsg new)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1193 (setq ch (read-char))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1194 (cond
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1195 ((= ch ?q) (throw 'exit t))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1196 ((= ch ?r)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1197 (message
173
7dc3c2332da5 YaTeX::label: Message for yank should remain.
yuuji@gentei.org
parents: 170
diff changeset
1198 "Don't forget to exit recursive-edit by `%s'"
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1199 (key-description
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1200 (where-is-internal
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1201 'exit-recursive-edit '(keymap) t)))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1202 (sleep-for 2)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1203 (recursive-edit))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1204 ((= ch ?y) (throw 'query t))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1205 ((= ch ?!) (throw 'query (setq continue t)))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1206 ((= ch ??)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1207 (describe-function
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1208 'YaTeX::label-rename-refs)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1209 (select-window (get-buffer-window "*Help*"))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1210 (search-forward "----")
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1211 (forward-line 1)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1212 (set-window-start (selected-window) (point))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1213 (sit-for 0)
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1214 (select-window sw))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1215 ((= ch ?n) (throw 'query nil)))))))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1216 (replace-match new))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1217 (and ov (delete-overlay ov)))))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1218 (setq bufs (cdr bufs)))))))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1219
167
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1220 (defun YaTeX::label (argp &optional labname refname)
163
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1221 "Read label name and return it with copying \\ref{LABEL-NAME} to kill-ring."
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1222 (cond
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1223 ((= argp 1)
168
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1224 (let*((chmode (boundp (intern-soft "old")))
191cffccc912 Replace all \ref{LABEL} when changing \label{LABEL}.
yuuji@gentei.org
parents: 167
diff changeset
1225 (dlab (if chmode old ;if called via YaTeX-change-section (tricky...)
163
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1226 (YaTeX::ref-default-label)))
167
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1227 (label (read-string
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1228 (format "New %s name: " (or labname "label"))
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1229 (cons dlab 1))))
163
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1230 (if (string< "" label)
247
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1231 (let ((refstr (format "\\%s{%s}" (or refname "ref") label)))
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1232 (YaTeX-push-to-kill-ring refstr)
170
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1233 (and chmode
269fb1992c2d YaTeX-change-section: If new string equals to old one, do not change \ref{}-s.
yuuji@gentei.org
parents: 168
diff changeset
1234 (not (equal old label))
247
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1235 (YaTeX::label-rename-refs old label))))
163
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1236 label))))
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1237
a521e761f82c New add-in function YaTeX::label automatically adds \ref{} string to kill-ring.
yuuji@gentei.org
parents: 141
diff changeset
1238
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1239 (fset 'YaTeX::pageref 'YaTeX::ref)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1240 (defun YaTeX::tabref (argp) ; For the style file of IPSJ journal
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1241 (YaTeX::ref
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1242 argp nil nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1243 (function
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1244 (lambda ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1245 (YaTeX-quick-in-environment-p "table")))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1246 (defun YaTeX::figref (argp) ; For the style file of IPSJ journal
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1247 (YaTeX::ref
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1248 argp nil nil
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1249 (function
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1250 (lambda ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1251 (YaTeX-quick-in-environment-p "figure")))))
232
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1252 (defun YaTeX::eqref (argp)
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1253 (YaTeX::ref
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1254 argp nil nil
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1255 (function
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1256 (lambda ()
b46b927914c8 Add-in for \eqref{} searches only equations.
yuuji@gentei.org
parents: 222
diff changeset
1257 (YaTeX-in-math-mode-p)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1258
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1259 (defun YaTeX::cite-collect-bibs-external (bibptn &rest files)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1260 "Collect bibentry from FILES(variable length argument) ;
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1261 and print them to standard output."
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1262 ;;Thanks; http://icarus.ilcs.hokudai.ac.jp/comp/biblio.html
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1263 (let*((tb (get-buffer-create " *bibtmp*"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1264 (bibitemsep "^\\s *@[A-Za-z]")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1265 (target (if (string< "" bibptn) bibptn bibitemsep))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1266 (checkrx (concat "\\(" bibptn "\\)\\|" bibitemsep))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1267 beg
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1268 (searchnext
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1269 (if (string< "" bibptn)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1270 (function
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1271 (lambda()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1272 (setq beg (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1273 (and
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1274 (prog1
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1275 (re-search-forward target nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1276 (end-of-line))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1277 (re-search-backward bibitemsep beg t))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1278 (function
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1279 (lambda()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1280 (re-search-forward target nil t)))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1281 )
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1282 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1283 (set-buffer tb)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1284 (princ (format "%sbegin{thebibliography}\n" YaTeX-ec))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1285 (while files
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1286 (erase-buffer)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1287 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1288 ((file-exists-p (car files))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1289 (insert-file-contents (car files)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1290 ((file-exists-p (concat (car files) ".bib"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1291 (insert-file-contents (concat (car files) ".bib"))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1292 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1293 (goto-char (point-min))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1294 (while (funcall searchnext)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1295 (skip-chars-forward "^{,")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1296 (setq beg (point))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1297 (if (= (char-after (point)) ?{)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1298 (princ (format "%sbibitem{%s}%s\n"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1299 YaTeX-ec
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1300 (buffer-substring
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1301 (1+ (point))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1302 (progn (skip-chars-forward "^,\n")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1303 (point)))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1304 (mapconcat
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1305 (function
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1306 (lambda (kwd)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1307 (goto-char beg)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1308 (if (re-search-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1309 (concat kwd "\\s *=") nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1310 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1311 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1312 (goto-char (match-end 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1313 (skip-chars-forward " \t\n")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1314 (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1315 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1316 (if (looking-at "[{\"]")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1317 (forward-sexp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1318 (forward-char 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1319 (skip-chars-forward "^,}"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1320 (point))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1321 '("author" "year" "title" )
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1322 ";"))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1323 (and (re-search-forward bibitemsep nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1324 (forward-line -1))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1325 (setq files (cdr files)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1326 (princ (format "%sbegin{thebibliography}\n" YaTeX-ec)))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1327
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1328 (defvar YaTeX::cite-bibitem-macro-regexp "bibitem\\|harvarditem"
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1329 "*Regexp of macro name of bibitem definition")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1330
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1331 (defun YaTeX::cite-collect-bibs-internal (bibptn)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1332 "Collect bibentry in the current buffer and print them to standard output."
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1333 (let ((ptn (concat YaTeX-ec-regexp
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1334 "\\(" YaTeX::cite-bibitem-macro-regexp "\\)\\b"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1335 (lim (concat YaTeX-ec-regexp
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1336 "\\(" YaTeX::cite-bibitem-macro-regexp "\\b\\)"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1337 "\\|\\(end{\\)"))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1338 (pcnt (regexp-quote YaTeX-comment-prefix)))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1339 ;; Using bibptn not yet implemented.
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1340 ;; Do you need it?? 2005/11/22
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1341 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1342 (while (YaTeX-re-search-active-forward ptn pcnt nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1343 (skip-chars-forward "^{\n")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1344 (or (eolp)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1345 (princ (format "%sbibitem%s %s\n"
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1346 YaTeX-ec
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1347 (buffer-substring
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1348 (point)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1349 (progn (forward-sexp 1) (point)))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1350 (buffer-substring
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1351 (progn (skip-chars-forward "\n \t") (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1352 (save-excursion
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1353 (if (YaTeX-re-search-active-forward
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1354 lim pcnt nil t)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1355 (progn
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1356 (goto-char (match-beginning 0))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1357 (skip-chars-backward "\n \t")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1358 (point))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1359 (point-end-of-line)))))))))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1360
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1361 (defun YaTeX::cite (argp &rest dummy)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1362 (cond
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1363 ((eq argp 1)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1364 (let* ((cb (current-buffer))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1365 (f (file-name-nondirectory buffer-file-name))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1366 (d default-directory)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1367 (hilit-auto-highlight nil)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1368 (pcnt (regexp-quote YaTeX-comment-prefix))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1369 (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}"))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1370 (bibptn (read-string "Pattern: "))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1371 (bbuf (get-buffer-create " *bibitems*"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1372 (standard-output bbuf)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1373 (me 'YaTeX::cite) ;shuld set this for using YaTeX::ref
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1374 bibs files)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1375 (set-buffer bbuf)(erase-buffer)(set-buffer cb)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1376 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1377 (goto-char (point-min))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1378 ;;(1)search external bibdata
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1379 (while (YaTeX-re-search-active-forward bibrx pcnt nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1380 (apply 'YaTeX::cite-collect-bibs-external
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1381 bibptn
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1382 (YaTeX-split-string
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1383 (YaTeX-match-string 1) ",")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1384 ;;(2)search direct \bibitem usage
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1385 (YaTeX::cite-collect-bibs-internal bibptn)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1386 (if (progn
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1387 (YaTeX-visit-main t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1388 (not (eq (current-buffer) cb)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1389 (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1390 (goto-char (point-min))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1391 ;;(1)search external bibdata
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1392 (while (YaTeX-re-search-active-forward bibrx pcnt nil t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1393 (apply 'YaTeX::cite-collect-bibs-external
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1394 bibptn
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1395 (YaTeX-split-string
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1396 (YaTeX-match-string 1) ",")))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1397 ;;(2)search internal
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1398 (YaTeX::cite-collect-bibs-internal bibptn)))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1399 ;;Now bbuf holds the list of bibitem
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1400 (set-buffer bbuf)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1401 ;;;(switch-to-buffer bbuf)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1402 (if (fboundp 'font-lock-fontify-buffer) (font-lock-fontify-buffer))
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1403 (YaTeX::ref
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1404 argp
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1405 (concat "\\\\\\("
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1406 YaTeX::cite-bibitem-macro-regexp
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1407 "\\)\\(\\[.*\\]\\)?")
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1408 "cite"))))
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1409
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1410 (t nil)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1411
167
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1412 (defun YaTeX::bibitem (argp)
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1413 "Add-in function to insert argument of \\bibitem."
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1414 (YaTeX::label argp "label" "cite"))
d891d7c6cd8e YaTeX::bibitem
yuuji@gentei.org
parents: 166
diff changeset
1415
77
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1416 ;;; for Harvard citation style
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1417 (fset 'YaTeX::citeasnoun 'YaTeX::cite)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1418 (fset 'YaTeX::possessivecite 'YaTeX::cite)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1419 (fset 'YaTeX::citeyear 'YaTeX::cite)
1b172d26b55e Fix auto-fill movement on Emacs21.
yuuji
parents: 73
diff changeset
1420 (fset 'YaTeX::citename 'YaTeX::cite)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1421 (fset 'YaTeX::citep 'YaTeX::cite)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1422 (fset 'YaTeX::citet 'YaTeX::cite)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1423
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1424 (defun YaTeX-select-other-yatex-buffer ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1425 "Select buffer from all yatex-mode's buffers interactivelly."
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1426 (interactive)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1427 (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1428 (lnum -1) buf rv
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1429 (ff "**find-file**"))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1430 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
1431 lbuf (function (lambda (x) 1))) ;;Select next window surely.
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1432 (save-excursion
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1433 (set-buffer (get-buffer lbuf))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1434 (setq buffer-read-only nil)
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1435 (erase-buffer))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1436 (let ((standard-output (get-buffer lbuf)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1437 (while blist
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1438 (princ
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1439 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1440 (buffer-name (car blist))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1441 (setq blist (cdr blist)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1442 (princ (format "':{%s}" ff)))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
1443 (YaTeX-showup-buffer lbuf nil t)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1444 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1445 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1446 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1447 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1448 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1449 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1450 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1451 (set-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1452 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1453 (setq rv
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1454 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1455 (buffer-substring (match-beginning 1) (match-end 1)) nil)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1456 (kill-buffer lbuf))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1457 (if (string= rv ff)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1458 (progn
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1459 (call-interactively 'find-file)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1460 (current-buffer))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1461 rv)))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1462
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1463 (defun YaTeX-label-other ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
1464 (let ((rv (YaTeX-select-other-yatex-buffer)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1465 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1466 ((null rv) "")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1467 (t
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1468 (set-buffer rv)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1469 (funcall me argp labelcmd refcmd)))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
1470
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1471 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1472 ; completion for the arguments of \newcommand
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1473 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1474 (defun YaTeX::newcommand (&optional argp)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1475 (cond
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1476 ((= argp 1)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1477 (let ((command (read-string "Define newcommand: " "\\")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1478 (put 'YaTeX::newcommand 'command (substring command 1))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1479 command))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1480 ((= argp 2)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1481 (let ((argc
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1482 (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
1483 (def (read-string "Definition: "))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1484 (command (get 'YaTeX::newcommand 'command)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1485 ;;!!! 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
1486 (if (> argc 0) (insert (format "[%d]" argc)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1487 (if (and (stringp command)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1488 (string< "" command)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1489 (y-or-n-p "Update dictionary?"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1490 (cond
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1491 ((= argc 0)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1492 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1493 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1494 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1495 ((= argc 1)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1496 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1497 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1498 'section-table 'user-section-table 'tmp-section-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1499 (t (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1500 (list command argc)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
1501 'section-table 'user-section-table 'tmp-section-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1502 (message "")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1503 def ;return command name
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1504 ))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1505 (t "")))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1506
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1507 (defun YaTeX::newcounter (&optional argp)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1508 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1509 ((= argp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1510 (read-string "New counter name: "))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1511 (t "")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1512
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1513 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1514 ; completion for the arguments of \pagestyle
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1515 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1516 (defun YaTeX::pagestyle (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1517 "Read the pagestyle with completion."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1518 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1519 "Page style: "
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1520 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil)))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1521
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1522 (fset 'YaTeX::thispagestyle 'YaTeX::pagestyle)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1523
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1524 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1525 ; completion for the arguments of \pagenumbering
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1526 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1527 (defun YaTeX::pagenumbering (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1528 "Read the numbering style."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1529 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
1530 "Page numbering style: "
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1531 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman"))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
1532
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1533 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1534 ; Length
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1535 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1536 (defvar YaTeX:style-parameters-default
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1537 '(("\\arraycolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1538 ("\\arrayrulewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1539 ("\\baselineskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1540 ("\\columnsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1541 ("\\columnseprule")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1542 ("\\doublerulesep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1543 ("\\evensidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1544 ("\\footheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1545 ("\\footskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1546 ("\\headheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1547 ("\\headsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1548 ("\\itemindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1549 ("\\itemsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1550 ("\\labelsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1551 ("\\labelwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1552 ("\\leftmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1553 ("\\linewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1554 ("\\listparindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1555 ("\\marginparsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1556 ("\\marginparwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1557 ("\\mathindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1558 ("\\oddsidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1559 ("\\parindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1560 ("\\parsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1561 ("\\parskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1562 ("\\partopsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1563 ("\\rightmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1564 ("\\tabcolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1565 ("\\textheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1566 ("\\textwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1567 ("\\topmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1568 ("\\topsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1569 ("\\topskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1570 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1571 "Alist of LaTeX style parameters.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1572 (defvar YaTeX:style-parameters-private nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1573 "*User definable alist of style parameters.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1574 (defvar YaTeX:style-parameters-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1575 "*User definable alist of local style parameters.")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1576
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1577 (defvar YaTeX:length-history nil "Holds history of length.")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1578 (put 'YaTeX:length-history 'no-default t)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1579 (defun YaTeX::setlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1580 "YaTeX add-in function for arguments of \\setlength."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1581 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1582 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1583 ;;(completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1584 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1585 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1586 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1587 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1588 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1589 nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1590 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1591 ((equal 2 argp)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1592 (read-string-with-history "Length: " nil 'YaTeX:length-history))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1593
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1594 (fset 'YaTeX::addtolength 'YaTeX::setlength)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1595
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1596 (defun YaTeX::settowidth (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1597 "YaTeX add-in function for arguments of \\settowidth."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1598 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1599 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1600 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1601 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1602 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1603 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1604 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1605 nil nil "\\"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1606 ((equal 2 argp)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1607 (read-string "Text: "))))
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1608
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1609 (defun YaTeX::newlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1610 "YaTeX add-in function for arguments of \\newlength"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1611 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1612 ((equal argp 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1613 (let ((length (read-string "Length variable: " "\\")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1614 (if (string< "" length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1615 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1616 (list length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1617 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1618 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1619 'YaTeX:style-parameters-local))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1620 length))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1621
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1622 ;; \multicolumn's arguments
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1623 (defun YaTeX::multicolumn (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1624 "YaTeX add-in function for arguments of \\multicolumn."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1625 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1626 ((equal 1 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1627 (read-string "Number of columns: "))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1628 ((equal 2 argp)
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1629 (YaTeX:read-oneof "|lrc" nil t))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1630 ((equal 3 argp)
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1631 (read-string "Item: "))))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
1632
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1633 (defvar YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1634 '(("article") ("jarticle") ("j-article")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1635 ("book") ("jbook") ("j-book")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1636 ("report") ("jreport") ("j-report")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1637 ("letter") ("ascjletter"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1638 "List of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1639 (defvar YaTeX:documentstyles-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1640 "*User defined list of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1641 (defvar YaTeX:documentstyles-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1642 "*User defined list of local LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1643 (defvar YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1644 '(("a4j") ("a5j") ("b4j") ("b5j")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1645 ("twocolumn") ("jtwocolumn") ("epsf") ("epsfig") ("epsbox") ("nfig"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1646 "List of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1647 (defvar YaTeX:documentstyle-options-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1648 "*User defined list of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1649 (defvar YaTeX:documentstyle-options-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1650 "List of LaTeX local documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1651
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1652 (defun YaTeX:documentstyle ()
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1653 (let*((delim ",")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1654 (dt (append YaTeX:documentstyle-options-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1655 YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1656 YaTeX:documentstyle-options-default))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1657 (minibuffer-completion-table dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1658 (opt (read-from-minibuffer
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1659 "Style options ([opt1,opt2,...]): "
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1660 nil YaTeX-minibuffer-completion-map nil))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1661 (substr opt) o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1662 (if (string< "" opt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1663 (progn
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1664 (while substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1665 (setq o (substring substr 0 (string-match delim substr)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1666 (or (assoc o dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1667 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1668 (list o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1669 'YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1670 'YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1671 'YaTeX:documentstyle-options-local))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1672 (setq substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1673 (if (string-match delim substr)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1674 (substring substr (1+ (string-match delim substr))))))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1675 (concat "[" opt "]"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1676 "")))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1677
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1678 (defun YaTeX::documentstyle (&optional argp)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
1679 "YaTeX add-in function for arguments of \\documentstyle."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1680 (cond
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1681 ((equal argp 1)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1682 (setq YaTeX-env-name "document")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1683 (let ((sname
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1684 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1685 (format "Documentstyle (default %s): "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1686 YaTeX-default-document-style)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1687 'YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1688 'YaTeX:documentstyles-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1689 'YaTeX:documentstyles-local)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1690 (if (string= "" sname) (setq sname YaTeX-default-document-style))
69
807c1e7e68b7 yahtml-escape-chars-region
yuuji
parents: 68
diff changeset
1691 (setq YaTeX-default-document-style sname)))))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
1692
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1693 (defun YaTeX::include (argp &optional prompt)
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1694 "Read file name setting default directory to that of main file."
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1695 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1696 ((= argp 1)
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1697 (save-excursion
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1698 (YaTeX-visit-main t)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1699 (let*((insert-default-directory)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1700 (file (read-file-name (or prompt "Input file: ") "")))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1701 (setq file (substring file 0 (string-match "\\.tex$" file))))))))
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1702
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1703 (fset 'YaTeX::input 'YaTeX::include)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1704
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1705
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1706 ;;; -------------------- LaTeX2e stuff --------------------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1707 (defvar YaTeX:documentclass-options-default
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1708 '(("a4paper") ("a5paper") ("b4paper") ("b5paper") ("10pt") ("11pt") ("12pt")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1709 ("latterpaper") ("legalpaper") ("executivepaper") ("landscape")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1710 ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1711 ("tombow") ("titlepage") ("notitlepage") ("dvips")
175
6e959a05ae19 Add `jsarticle' and `jsbook' to YaTeX:documentclasses-default.
yuuji@gentei.org
parents: 173
diff changeset
1712 ("mingoth") ;for jsarticle
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1713 ("clock") ;for slides class only
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1714 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1715 "Default options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1716 (defvar YaTeX:documentclass-options-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1717 "*User defined options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1718 (defvar YaTeX:documentclass-options-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1719 "*User defined options list for local documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1720
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1721 (defun YaTeX:documentclass ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1722 (let*((delim ",")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1723 (dt (append YaTeX:documentclass-options-local
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1724 YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1725 YaTeX:documentclass-options-default))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1726 (minibuffer-completion-table dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1727 (opt (read-from-minibuffer
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1728 "Documentclass options ([opt1,opt2,...]): "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1729 nil YaTeX-minibuffer-completion-map nil))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1730 (substr opt) o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1731 (if (string< "" opt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1732 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1733 (while substr
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1734
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1735 (setq o (substring substr 0 (string-match delim substr)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1736 (or (assoc o dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1737 (YaTeX-update-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1738 (list o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1739 'YaTeX:documentclass-options-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1740 'YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1741 'YaTeX:documentclass-options-local))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1742 (setq substr
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1743 (if (string-match delim substr)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1744 (substring substr (1+ (string-match delim substr))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1745 (concat "[" opt "]"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1746 "")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1747
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1748 (defvar YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1749 '(("article") ("jarticle") ("report") ("jreport") ("book") ("jbook")
175
6e959a05ae19 Add `jsarticle' and `jsbook' to YaTeX:documentclasses-default.
yuuji@gentei.org
parents: 173
diff changeset
1750 ("jsarticle") ("jsbook")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1751 ("j-article") ("j-report") ("j-book")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1752 ("letter") ("slides") ("ltxdoc") ("ltxguide") ("ltnews") ("proc"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1753 "Default documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1754 (defvar YaTeX:documentclasses-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1755 "*User defined documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1756 (defvar YaTeX:documentclasses-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1757 "*User defined local documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1758 (defvar YaTeX-default-documentclass (if YaTeX-japan "jarticle" "article")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1759 "*Default documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1760
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1761 (defun YaTeX::documentclass (&optional argp)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1762 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1763 ((equal argp 1)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1764 (setq YaTeX-env-name "document")
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1765 (let ((sname
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1766 (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1767 (format "Documentclass (default %s): " YaTeX-default-documentclass)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1768 'YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1769 'YaTeX:documentclasses-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1770 'YaTeX:documentclasses-local)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1771 (if (string= "" sname) (setq sname YaTeX-default-documentclass))
252
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1772 (setq YaTeX-section-name "title"
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1773 YaTeX-default-documentclass sname)))))
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
1774
249
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1775 (defun YaTeX::title (&optional argp)
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1776 (prog1 (read-string "Document Title: ")
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1777 (setq YaTeX-section-name "author"
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1778 YaTeX-single-command "maketitle")))
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1779
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1780 (defun YaTeX::author (&optional argp)
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1781 (prog1 (read-string "Document Author: ")
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1782 (setq YaTeX-section-name "date"
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1783 YaTeX-single-command "maketitle")))
c2aa2457a74b Trivial add-in update.
yuuji@gentei.org
parents: 248
diff changeset
1784
252
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1785 (defun YaTeX:document ()
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1786 (setq YaTeX-section-name
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1787 (if (string-match "book\\|bk" YaTeX-default-documentclass)
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1788 "chapter"
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1789 "section"))
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1790 "")
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1791
73fef09ebc15 Completion relay: documentclass -> title, document -> section.
HIROSE Yuuji <yuuji@gentei.org>
parents: 249
diff changeset
1792
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1793 (defvar YaTeX:latex2e-named-color-alist
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1794 '(("GreenYellow") ("Yellow") ("Goldenrod") ("Dandelion") ("Apricot")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1795 ("Peach") ("Melon") ("YellowOrange") ("Orange") ("BurntOrange")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1796 ("Bittersweet") ("RedOrange") ("Mahogany") ("Maroon") ("BrickRed")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1797 ("Red") ("OrangeRed") ("RubineRed") ("WildStrawberry") ("Salmon")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1798 ("CarnationPink") ("Magenta") ("VioletRed") ("Rhodamine") ("Mulberry")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1799 ("RedViolet") ("Fuchsia") ("Lavender") ("Thistle") ("Orchid")("DarkOrchid")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1800 ("Purple") ("Plum") ("Violet") ("RoyalPurple") ("BlueViolet")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1801 ("Periwinkle") ("CadetBlue") ("CornflowerBlue") ("MidnightBlue")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1802 ("NavyBlue") ("RoyalBlue") ("Blue") ("Cerulean") ("Cyan") ("ProcessBlue")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1803 ("SkyBlue") ("Turquoise") ("TealBlue") ("Aquamarine") ("BlueGreen")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1804 ("Emerald") ("JungleGreen") ("SeaGreen") ("Green") ("ForestGreen")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1805 ("PineGreen") ("LimeGreen") ("YellowGreen") ("SpringGreen") ("OliveGreen")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1806 ("RawSienna") ("Sepia") ("Brown") ("Tan") ("Gray") ("Black") ("White"))
141
13a717bee066 $TEXMF/tex/plain/dvips/colordvi.tex
yuuji@gentei.org
parents: 105
diff changeset
1807 "Colors defined in $TEXMF/tex/plain/dvips/colordvi.tex")
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1808
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1809 (defvar YaTeX:latex2e-basic-color-alist
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1810 '(("black") ("white") ("red") ("blue") ("yellow") ("green") ("cyan")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1811 ("magenta"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1812 "Basic colors")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1813
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1814 (defun YaTeX:textcolor ()
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1815 "Add-in for \\color's option"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1816 (if (y-or-n-p "Use `named' color? ")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1817 "[named]"))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1818
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1819 (defun YaTeX::color-completing-read (prompt)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1820 (let ((completion-ignore-case t)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1821 (namedp (save-excursion
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1822 (skip-chars-backward "^\n\\[\\\\")
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1823 (looking-at "named"))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1824 (completing-read
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1825 prompt
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1826 (if namedp
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1827 YaTeX:latex2e-named-color-alist
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1828 YaTeX:latex2e-basic-color-alist)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1829 nil t)))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1830
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1831 (defun YaTeX::textcolor (argp)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1832 "Add-in for \\color's argument"
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1833 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1834 ((= argp 1) (YaTeX::color-completing-read "Color: "))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1835 ((= argp 2) (read-string "Colored string: "))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1836
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1837 (fset 'YaTeX:color 'YaTeX:textcolor)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1838 (fset 'YaTeX::color 'YaTeX::textcolor)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1839 (fset 'YaTeX:colorbox 'YaTeX:textcolor)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1840 (fset 'YaTeX::colorbox 'YaTeX::textcolor)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1841 (fset 'YaTeX:fcolorbox 'YaTeX:textcolor)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1842 (fset 'YaTeX:pagecolor 'YaTeX:textcolor)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1843 (fset 'YaTeX::pagecolor 'YaTeX::textcolor)
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1844
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1845 (defun YaTeX::fcolorbox (argp)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1846 (cond
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1847 ((= argp 1) (YaTeX::color-completing-read "Frame color: "))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1848 ((= argp 2) (YaTeX::color-completing-read "Inner color: "))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1849 ((= argp 3) (read-string "Colored string: "))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1850
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1851 (defun YaTeX:scalebox ()
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1852 "Add-in for \\scalebox"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1853 (let ((vmag (read-string
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1854 (if YaTeX-japan "倍率(負で反転): "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1855 "Magnification(Negative for flipped): ")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1856 (hmag (read-string (if YaTeX-japan "縦倍率(省略可): "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1857 "Vertical magnification(Optional): "))))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1858 (if (and hmag (string< "" hmag))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1859 (format "{%s}[%s]" vmag hmag)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1860 (format "{%s}" vmag))))
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1861
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1862 (defun YaTeX:rotatebox ()
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1863 "Optional argument add-in for \\rotatebox"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1864 (message "Rotate origin? (N)one (O)rigin (X)-Y: ")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1865 (let ((c (read-char)) r (defx "x=mm") x (defy "y=mm") y something)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1866 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1867 ((memq c '(?O ?o))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1868 (if (string< "" (setq r (YaTeX:read-oneof "htbpB")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1869 (concat "[origin=" r "]")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1870 ((memq c '(?X ?x ?Y ?y))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1871 (setq r (read-string "" (if YaTeX-emacs-19 (cons defx 3) defx))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1872 x (if (string< "x=" r) r)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1873 r (read-string "" (if YaTeX-emacs-19 (cons defy 3) defy))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1874 y (if (string< "y=" r) r)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1875 something (or x y))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1876 (format "%s%s%s%s%s"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1877 (if something "[" "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1878 (if x x "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1879 (if (and x y) "," "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1880 (if y y "")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1881 (if something "]" ""))))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1882
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1883 (defun YaTeX::rotatebox (argp)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1884 "Argument add-in for \\rotatebox"
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1885 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1886 ((= argp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1887 (read-string (if YaTeX-japan "回転角(度; 左回り): "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1888 "Angle in degree(unclockwise): ")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1889 ((= argp 2)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1890 (read-string (if YaTeX-japan "テキスト: " "Text: ")))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1891
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1892 (defun YaTeX:includegraphics ()
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1893 "Add-in for \\includegraphics's option"
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1894 (let (width height (scale "") angle str)
237
af1e6c48eac0 YaTeX-skip-next-reader-p turns to YaTeX-read-string-or-skip.
yuuji@gentei.org
parents: 234
diff changeset
1895 (setq width (YaTeX-read-string-or-skip "Width: ")
af1e6c48eac0 YaTeX-skip-next-reader-p turns to YaTeX-read-string-or-skip.
yuuji@gentei.org
parents: 234
diff changeset
1896 height (YaTeX-read-string-or-skip "Height: "))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1897 (or (string< width "") (string< "" height)
237
af1e6c48eac0 YaTeX-skip-next-reader-p turns to YaTeX-read-string-or-skip.
yuuji@gentei.org
parents: 234
diff changeset
1898 (setq scale (YaTeX-read-string-or-skip "Scale: ")))
af1e6c48eac0 YaTeX-skip-next-reader-p turns to YaTeX-read-string-or-skip.
yuuji@gentei.org
parents: 234
diff changeset
1899 (setq angle (YaTeX-read-string-or-skip "Angle(0-359): "))
73
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1900 (setq str
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1901 (mapconcat
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1902 'concat
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1903 (delq nil
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1904 (mapcar '(lambda (s)
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1905 (and (stringp (symbol-value s))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1906 (string< "" (symbol-value s))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1907 (format "%s=%s" s (symbol-value s))))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1908 '(width height scale angle)))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1909 ","))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1910 (if (string= "" str) ""
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1911 (concat "[" str "]"))))
f41b01fef5d6 Stable version(hope to be)
yuuji
parents: 72
diff changeset
1912
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1913 (defun YaTeX::includegraphics (argp)
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1914 "Add-in for \\includegraphics"
247
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1915 (let ((imgfile (YaTeX::include argp "Image File: "))
248
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1916 (case-fold-search t) info bb noupdate needclose)
247
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1917 (and (string-match "\\.\\(jpe?g\\|png\\|gif\\|bmp\\)$" imgfile)
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1918 (file-exists-p imgfile)
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1919 (or (fboundp 'yahtml-get-image-info)
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1920 (progn
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1921 (load "yahtml" t) (featurep 'yahtml))) ;(require 'yahtml nil t)
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1922 (setq info (yahtml-get-image-info imgfile))
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1923 (car info) ;if has width value
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1924 (car (cdr info)) ;if has height value
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1925 (setq bb (format "bb=%d %d %d %d" 0 0 (car info) (car (cdr info))))
248
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1926 (save-excursion
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1927 (cond
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1928 ((and (YaTeX-re-search-active-backward
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1929 "\\\\\\(includegraphics\\)\\|\\(bb=[ \t0-9]+\\)"
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1930 YaTeX-comment-prefix nil t)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1931 (match-beginning 2)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1932 (not (setq noupdate (equal (YaTeX-match-string 2) bb)))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1933 (y-or-n-p (format "Update `bb=' line to `%s'?: " bb)))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1934 (message "")
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1935 (replace-match bb))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1936 (noupdate nil)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1937 ((and (match-beginning 1)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1938 (y-or-n-p "Insert `bb=...' line?: "))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1939 (goto-char (match-end 0))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1940 (message "")
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1941 (if (looking-at "\\[") (forward-char 1)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1942 (insert-before-markers "[")
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1943 (setq needclose t))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1944 (insert-before-markers bb)
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1945 (if needclose (insert-before-markers "]")
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1946 (or (looking-at "\\]") (insert-before-markers ","))))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1947 (t (YaTeX-push-to-kill-ring bb)))))
b9771459243e Automatic `bb=...' generation for jpg/png/gif/bmp files.
yuuji@gentei.org
parents: 247
diff changeset
1948 (setq YaTeX-section-name "caption")
247
3e3ccba06ca1 Construct `bb=...' line automatically and push it into kill-ring.
yuuji@gentei.org
parents: 246
diff changeset
1949 imgfile))
70
44e3a5e1e883 Fix makefile for Windows
yuuji
parents: 69
diff changeset
1950
86
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1951 (defun YaTeX::verbfile (argp)
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1952 "Add-in for \\verbfile"
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1953 (YaTeX::include argp "Virbatim File: "))
f14ec50103d0 as of 2009/9/28
yuuji@gentei.org
parents: 80
diff changeset
1954
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1955 (defun YaTeX:caption ()
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
1956 (setq YaTeX-section-name "label")
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1957 nil)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
1958
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1959
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1960 (defvar YaTeX::usepackage-alist-default
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1961 '(("version") ("plext") ("url") ("fancybox") ("pifont") ("longtable")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1962 ("ascmac") ("bm") ("graphics") ("graphicx") ("alltt") ("misc") ("eclbkbox")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1963 ("amsmath") ("amssymb") ("xymtex") ("chemist")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1964 ("a4j") ("array") ("epsf") ("color") ("epsfig") ("floatfig")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1965 ("landscape") ("path") ("supertabular") ("twocolumn")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1966 ("latexsym") ("times") ("makeidx"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1967 "Default completion table for arguments of \\usepackage")
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1968
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1969 (defvar YaTeX::usepackage-alist-private nil
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1970 "*Private completion list of the argument for usepackage")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1971
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1972 (defvar YaTeX::usepackage-alist-local nil
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1973 "Directory local completion list of the argument for usepackage")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1974
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1975 (defun YaTeX::usepackage (&optional argp)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1976 (cond
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1977 ((equal argp 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1978 (setq YaTeX-env-name "document")
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1979 (let ((minibuffer-local-completion-map YaTeX-minibuffer-completion-map)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1980 (delim ","))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1981 (YaTeX-cplread-with-learning
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1982 (if YaTeX-japan "Use package(カンマで区切ってOK): "
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1983 "Use package(delimitable by comma): ")
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1984 'YaTeX::usepackage-alist-default
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1985 'YaTeX::usepackage-alist-private
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
1986 'YaTeX::usepackage-alist-local)))))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1987
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1988 (defun YaTeX::mask (argp)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1989 (cond
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1990 ((equal argp 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1991 (read-string "String: "))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1992 ((equal argp 2)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1993 (let (c)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1994 (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1995 (message "Mask type(A..K): ")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1996 (setq c (upcase (read-char))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1997 (format "%c" c)))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1998
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
1999 (defun YaTeX::maskbox (argp)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2000 (cond
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2001 ((equal argp 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2002 (read-string "Width: "))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2003 ((equal argp 2)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2004 (read-string "Height: "))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2005 ((equal argp 3)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2006 (let (c)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2007 (while (not (memq c '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2008 (message "Mask type(A..K): ")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2009 (setq c (upcase (read-char))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2010 (format "%c" c)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2011 ((equal argp 4)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2012 (YaTeX:read-oneof "lcr" 'quick))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2013 ((equal argp 5)
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2014 (read-string "String: "))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2015
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2016 (defun YaTeX::textcircled (argp)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2017 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2018 ((equal argp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2019 (let ((char (read-string "Circled char: "))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2020 (left "") (right "") c)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2021 (setq c (read-char
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2022 "Enclose also with (s)mall (t)iny s(C)riptsize (N)one:"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2023 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2024 ((memq c '(?s ?S)) (setq left "{\\small " right "}"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2025 ((memq c '(?t ?T)) (setq left "{\\tiny " right "}"))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2026 ((memq c '(?c ?C)) (setq left "{\\scriptsize " right "}")))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2027 (format "%s%s%s" left char right)))))
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2028
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2029 ;;; -------------------- math-mode stuff --------------------
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2030 (defun YaTeX::tilde (&optional pos)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2031 "For accent macros in mathmode"
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2032 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2033 ((equal pos 1)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2034 (message "Put accent on variable: ")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2035 (let ((v (char-to-string (read-char))) (case-fold-search nil))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2036 (message "")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2037 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2038 ((string-match "i\\|j" v)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2039 (concat "\\" v "math"))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2040 ((string-match "[\r\n\t ]" v)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2041 "")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2042 (t v))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2043 (nil "")))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2044
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2045 (fset 'YaTeX::hat 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2046 (fset 'YaTeX::check 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2047 (fset 'YaTeX::bar 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2048 (fset 'YaTeX::dot 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2049 (fset 'YaTeX::ddot 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2050 (fset 'YaTeX::vec 'YaTeX::tilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2051
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2052 (defun YaTeX::widetilde (&optional pos)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2053 "For multichar accent macros in mathmode"
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2054 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2055 ((equal pos 1)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2056 (let ((m "Put over chars[%s ]: ") v v2)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2057 (message m " ")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2058 (setq v (char-to-string (read-char)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2059 (message "")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2060 (if (string-match "[\r\n\t ]" v)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2061 ""
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2062 (message m v)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2063 (setq v2 (char-to-string (read-char)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2064 (message "")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2065 (if (string-match "[\r\n\t ]" v2)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2066 v
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2067 (concat v v2)))))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2068 (nil "")))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2069
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2070 (fset 'YaTeX::widehat 'YaTeX::widetilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2071 (fset 'YaTeX::overline 'YaTeX::widetilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2072 (fset 'YaTeX::overrightarrow 'YaTeX::widetilde)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2073
79
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2074 ;
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2075 ; for \frac{}{} region
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2076 (defun YaTeX::frac-region (beg end)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2077 (if (catch 'done
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2078 (while (re-search-forward "\\s *\\(\\\\over\\|/\\)\\s *" end t)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2079 (goto-char (match-beginning 0))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2080 (if (y-or-n-p
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2081 (format "Replace this `%s' with `}{'" (YaTeX-match-string 0)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2082 (throw 'done t))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2083 (goto-char (match-end 0))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2084 (let (p (b0 (match-beginning 0)) e0)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2085 (replace-match "}{")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2086 (setq e0 (point))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2087 (save-restriction
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2088 (narrow-to-region beg end)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2089 (goto-char e0)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2090 (skip-chars-forward " \t")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2091 (setq p (point))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2092 (YaTeX-goto-corresponding-paren)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2093 (forward-char 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2094 (skip-chars-forward " \t\r\n")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2095 (if (= end (1+ (point)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2096 (progn
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2097 (goto-char p)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2098 (if (looking-at "\\\\") (forward-char 1))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2099 (YaTeX-kill-paren nil)))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2100 (goto-char beg)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2101 (skip-chars-forward " \t")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2102 (setq p (point))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2103 (YaTeX-goto-corresponding-paren)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2104 (forward-char 1)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2105 (skip-chars-forward " \t\r\n")
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2106 (if (>= (point) b0)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2107 (progn
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2108 (goto-char p)
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2109 (if (looking-at "\\\\") (forward-char 1))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2110 (YaTeX-kill-paren nil))))))
0734be649cb8 Do not care file-coding-system when YaTeX-kanji-code is nil.
yuuji
parents: 77
diff changeset
2111 (message ""))
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2112
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2113 (defun YaTeX::DeclareMathOperator (argp)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2114 (cond
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2115 ((equal argp 1)
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2116 (read-string "Operator: " "\\"))))
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2117
68
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2118 ;;;
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2119 ;; Add-in functions for large-type command.
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2120 ;;;
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2121 (defun YaTeX:em ()
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2122 (cond
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2123 ((eq YaTeX-current-completion-type 'large) "\\/")
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2124 (t nil)))
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2125 (fset 'YaTeX:it 'YaTeX:em)
0eb6997bee16 More adjustment for Emacs20 and XEmacs
yuuji
parents: 64
diff changeset
2126
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2127 ;;; -------------------- End of yatexadd --------------------
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
2128 (provide 'yatexadd)
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2129 ; Local variables:
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2130 ; fill-prefix: ";;; "
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2131 ; paragraph-start: "^$\\| \\|;;;$"
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2132 ; paragraph-separate: "^$\\| \\|;;;$"
80
9b4354af748c Too many changes from 1.72.
yuuji
parents: 79
diff changeset
2133 ; coding: sjis
72
0aaebd07dad0 Support font-lock on XEmacs-21, Emacs-20, Emacs-21.
yuuji
parents: 70
diff changeset
2134 ; End:

yatex.org