annotate yatexadd.el @ 601:cd375a3d7a29 draft dev

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

yatex.org