Compare commits
8 Commits
b91f2f22dd
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| e66cd1c51a | |||
| c981153301 | |||
| db8fa04f1f | |||
| 180c084bbc | |||
| 90128ba06f | |||
| 38dc2a2b3d | |||
| ccd161718a | |||
| af88bcc2df |
+6
-5
@@ -36,8 +36,6 @@ my-yatex-review-highlight.el
|
|||||||
└── my-yatex-review-highlight.el
|
└── my-yatex-review-highlight.el
|
||||||
#+end_example
|
#+end_example
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
* init.el で load-path に追加する
|
* init.el で load-path に追加する
|
||||||
|
|
||||||
まず、=init.el= の先頭付近に以下を追加して、自作Lispのload pathを追加します。
|
まず、=init.el= の先頭付近に以下を追加して、自作Lispのload pathを追加します。
|
||||||
@@ -85,7 +83,7 @@ my-yatex-review-highlight.el
|
|||||||
|
|
||||||
*** 前提条件
|
*** 前提条件
|
||||||
|
|
||||||
- =~/.config/lab-ai/token= に API トークンを保存しておく必要があります。
|
- =~/.config/lab-ai/token= に大窪から配布してもらったAPIトークンを保存しておく必要があります。
|
||||||
- HTTP 通信には =curl= を使います。
|
- HTTP 通信には =curl= を使います。
|
||||||
- クリップボード画像添付には macOS の =pngpaste= が必要です。
|
- クリップボード画像添付には macOS の =pngpaste= が必要です。
|
||||||
- チャット内 LaTeX プレビューには =latex= と =dvipng= が必要です。
|
- チャット内 LaTeX プレビューには =latex= と =dvipng= が必要です。
|
||||||
@@ -162,6 +160,7 @@ my-yatex-review-highlight.el
|
|||||||
|
|
||||||
- =lab-ai--dwim= がファイル内で2回定義されています。後半の定義が有効になります。動作上は問題ありませんが、整理するなら前半の定義は削除できます。
|
- =lab-ai--dwim= がファイル内で2回定義されています。後半の定義が有効になります。動作上は問題ありませんが、整理するなら前半の定義は削除できます。
|
||||||
- 起動画面には =C-c C-m Switch model= と表示されますが、現在の =lab-ai-chat-mode-map= には =C-c C-m= が割り当てられていません。必要なら以下を追加します。
|
- 起動画面には =C-c C-m Switch model= と表示されますが、現在の =lab-ai-chat-mode-map= には =C-c C-m= が割り当てられていません。必要なら以下を追加します。
|
||||||
|
- yatex modeでC-cが重複します。別キーにするか、M-xで関数呼び出ししてください。
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(define-key lab-ai-chat-mode-map (kbd "C-c C-m") #'lab-ai-switch-model)
|
(define-key lab-ai-chat-mode-map (kbd "C-c C-m") #'lab-ai-switch-model)
|
||||||
@@ -373,14 +372,15 @@ LaTeX 原稿、コード、ファイル名、コマンドラインに混入し
|
|||||||
** my-yatex-review-highlight.el
|
** my-yatex-review-highlight.el
|
||||||
|
|
||||||
YaTeX バッファ内で、査読返信や改訂原稿用の独自 LaTeX マクロを色分け表示するツールです。
|
YaTeX バッファ内で、査読返信や改訂原稿用の独自 LaTeX マクロを色分け表示するツールです。
|
||||||
=\RA=, =\RB=, =\RC=, =\RD=, =\TO=, =\CA=, =\CB=, =\CC=, =\CD= を overlay でハイライトします。
|
=\RA=, =\RB=, =\RC=, =\RD=, =\TO=, =\XX=, =\CA=, =\CB=, =\CC=, =\CD= を overlay でハイライトします。
|
||||||
|
|
||||||
*** 主な機能
|
*** 主な機能
|
||||||
|
|
||||||
- =\RA{label}{body}= から =\RD{label}{body}= までを色分け表示します。
|
- =\RA{label}{body}= から =\RD{label}{body}= までを色分け表示します。
|
||||||
- 第1引数、つまりラベル部分は背景付き太字で表示します。
|
- 第1引数、つまりラベル部分は背景付き太字で表示します。
|
||||||
- 第2引数、つまり本文部分は対応色の文字色で表示します。
|
- 第2引数、つまり本文部分は対応色の文字色で表示します。
|
||||||
- =\TO{body}= は赤太字で表示します。
|
- =\TO{body}= は赤太字で表示します(大窪コメント)。
|
||||||
|
- =\XX{body}= は赤ピンク太字で表示します(学生コメント)。
|
||||||
- =\CA{A1}= から =\CD{...}= までは、次の =\CO=, =\CA=, =\CB=, =\CC=, =\CD=, =\end{enumerate}=, =\end{document}= までを本文として色付けします。
|
- =\CA{A1}= から =\CD{...}= までは、次の =\CO=, =\CA=, =\CB=, =\CC=, =\CD=, =\end{enumerate}=, =\end{document}= までを本文として色付けします。
|
||||||
- 編集後に idle timer で自動再ハイライトします。
|
- 編集後に idle timer で自動再ハイライトします。
|
||||||
- 古い font-lock 方式の review macro highlight が残っている場合、enable 時に削除します。
|
- 古い font-lock 方式の review macro highlight が残っている場合、enable 時に削除します。
|
||||||
@@ -393,6 +393,7 @@ YaTeX バッファ内で、査読返信や改訂原稿用の独自 LaTeX マク
|
|||||||
| =\RC{label}{body}= | Reviewer C など | label は緑系背景付き、body は緑系文字 |
|
| =\RC{label}{body}= | Reviewer C など | label は緑系背景付き、body は緑系文字 |
|
||||||
| =\RD{label}{body}= | Reviewer D など | label は紫系背景付き、body は紫系文字 |
|
| =\RD{label}{body}= | Reviewer D など | label は紫系背景付き、body は紫系文字 |
|
||||||
| =\TO{body}= | TODO/対応事項 | 赤太字 |
|
| =\TO{body}= | TODO/対応事項 | 赤太字 |
|
||||||
|
| =\XX{body}= | TODO/対応事項 | 赤ピンク太字 |
|
||||||
| =\CA{label}= | 回答案 A | label と次項目までの本文を RA 系の色で表示 |
|
| =\CA{label}= | 回答案 A | label と次項目までの本文を RA 系の色で表示 |
|
||||||
| =\CB{label}= | 回答案 B | label と次項目までの本文を RB 系の色で表示 |
|
| =\CB{label}= | 回答案 B | label と次項目までの本文を RB 系の色で表示 |
|
||||||
| =\CC{label}= | 回答案 C | label と次項目までの本文を RC 系の色で表示 |
|
| =\CC{label}= | 回答案 C | label と次項目までの本文を RC 系の色で表示 |
|
||||||
|
|||||||
+55
-47
@@ -9,35 +9,64 @@
|
|||||||
;; configuration
|
;; configuration
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(defvar lab-ai-url
|
(defgroup lab-ai nil
|
||||||
"https://amorphous.tf.chiba-u.jp/lab-ai/chat")
|
"Lab-AI client."
|
||||||
|
:group 'applications)
|
||||||
|
|
||||||
(defvar lab-ai-image-url
|
(defconst lab-ai-url
|
||||||
"https://amorphous.tf.chiba-u.jp/lab-ai/image")
|
"https://amorphous.tf.chiba-u.jp/lab-ai/chat"
|
||||||
|
"Lab-AI chat endpoint.")
|
||||||
|
|
||||||
(defvar lab-ai-image-edit-url
|
(defconst lab-ai-image-url
|
||||||
"https://amorphous.tf.chiba-u.jp/lab-ai/image-edit")
|
"https://amorphous.tf.chiba-u.jp/lab-ai/image"
|
||||||
|
"Lab-AI image generation endpoint.")
|
||||||
|
|
||||||
(defvar lab-ai-image-size
|
(defconst lab-ai-image-edit-url
|
||||||
"1024x1024")
|
"https://amorphous.tf.chiba-u.jp/lab-ai/image-edit"
|
||||||
|
"Lab-AI image editing endpoint.")
|
||||||
|
|
||||||
|
(defconst lab-ai-supported-models
|
||||||
|
'("gpt-5.6-luna"
|
||||||
|
"gpt-5.6-terra"
|
||||||
|
"gpt-5.6-sol")
|
||||||
|
"Models supported by the Lab-AI gateway.")
|
||||||
|
|
||||||
(defvar lab-ai-models
|
(defcustom lab-ai-model
|
||||||
'("gpt-5-mini"
|
"gpt-5.6-terra"
|
||||||
"gpt-5"
|
"Default model used by Lab-AI."
|
||||||
"gpt-5.5"))
|
:type '(choice
|
||||||
|
(const :tag "GPT-5.6 Luna" "gpt-5.6-luna")
|
||||||
|
(const :tag "GPT-5.6 Terra" "gpt-5.6-terra")
|
||||||
|
(const :tag "GPT-5.6 Sol" "gpt-5.6-sol"))
|
||||||
|
:group 'lab-ai)
|
||||||
|
|
||||||
(defvar lab-ai-model
|
(defcustom lab-ai-image-size
|
||||||
"gpt-5.5")
|
"1024x1024"
|
||||||
|
"Default image size used by Lab-AI."
|
||||||
|
:type '(choice
|
||||||
|
(const "1024x1024")
|
||||||
|
(const "1024x1536")
|
||||||
|
(const "1536x1024"))
|
||||||
|
:group 'lab-ai)
|
||||||
|
|
||||||
(defvar lab-ai-timeout
|
(defcustom lab-ai-timeout
|
||||||
"600")
|
"600"
|
||||||
|
"Timeout in seconds passed to curl."
|
||||||
|
:type 'string
|
||||||
|
:group 'lab-ai)
|
||||||
|
|
||||||
(defvar lab-ai-max-attachment-size
|
(defcustom lab-ai-max-attachment-size
|
||||||
(* 50 1024 1024))
|
(* 5 1024 1024)
|
||||||
|
"Maximum attachment size in bytes."
|
||||||
|
:type 'integer
|
||||||
|
:group 'lab-ai)
|
||||||
|
|
||||||
|
(defcustom lab-ai-chat-history-max-messages
|
||||||
|
200
|
||||||
|
"Maximum number of chat history messages."
|
||||||
|
:type 'integer
|
||||||
|
:group 'lab-ai)
|
||||||
|
|
||||||
(defvar lab-ai-chat-history-max-messages
|
|
||||||
200)
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; API
|
;; API
|
||||||
@@ -197,29 +226,6 @@
|
|||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(insert text))
|
(insert text))
|
||||||
|
|
||||||
(defun lab-ai--dwim (system user)
|
|
||||||
(let* ((bnds (lab-ai--bounds))
|
|
||||||
(beg (copy-marker (car bnds)))
|
|
||||||
(end (copy-marker (cdr bnds) t))
|
|
||||||
(origin-buffer (current-buffer))
|
|
||||||
(txt (buffer-substring-no-properties beg end))
|
|
||||||
(prompt
|
|
||||||
(concat system "\n\n"
|
|
||||||
user "\n\n"
|
|
||||||
txt)))
|
|
||||||
(message "Lab-AI: sending request... model=%s" lab-ai-model)
|
|
||||||
(lab-ai-request-async
|
|
||||||
prompt
|
|
||||||
(lambda (answer)
|
|
||||||
(when (buffer-live-p origin-buffer)
|
|
||||||
(with-current-buffer origin-buffer
|
|
||||||
(save-excursion
|
|
||||||
(lab-ai--replace-region beg end answer))
|
|
||||||
(message "Lab-AI: done. model=%s" lab-ai-model))))
|
|
||||||
(lambda (err)
|
|
||||||
(message "Lab-AI: error: %s"
|
|
||||||
(error-message-string err))))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; translation/editing commands
|
;; translation/editing commands
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -533,6 +539,8 @@ Run again to clear previews."
|
|||||||
#'lab-ai-chat-clear-attachments)
|
#'lab-ai-chat-clear-attachments)
|
||||||
(define-key map (kbd "C-c C-h")
|
(define-key map (kbd "C-c C-h")
|
||||||
#'lab-ai-chat-clear-history)
|
#'lab-ai-chat-clear-history)
|
||||||
|
(define-key map (kbd "C-c C-m")
|
||||||
|
#'lab-ai-switch-model)
|
||||||
map))
|
map))
|
||||||
|
|
||||||
|
|
||||||
@@ -908,13 +916,16 @@ Run again to clear previews."
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; misc
|
;; misc
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
(defun lab-ai-show-model ()
|
||||||
|
(interactive)
|
||||||
|
(message "Lab-AI model: %s" lab-ai-model))
|
||||||
|
|
||||||
(defun lab-ai-switch-model ()
|
(defun lab-ai-switch-model ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(setq lab-ai-model
|
(setq lab-ai-model
|
||||||
(completing-read
|
(completing-read
|
||||||
"Model: "
|
"Model: "
|
||||||
lab-ai-models
|
lab-ai-supported-models
|
||||||
nil t
|
nil t
|
||||||
lab-ai-model))
|
lab-ai-model))
|
||||||
(when (get-buffer lab-ai-chat-buffer)
|
(when (get-buffer lab-ai-chat-buffer)
|
||||||
@@ -922,9 +933,6 @@ Run again to clear previews."
|
|||||||
(lab-ai-chat-update-mode-line)))
|
(lab-ai-chat-update-mode-line)))
|
||||||
(message "lab-ai model => %s" lab-ai-model))
|
(message "lab-ai model => %s" lab-ai-model))
|
||||||
|
|
||||||
(defun lab-ai-show-model ()
|
|
||||||
(interactive)
|
|
||||||
(message "Lab-AI model: %s" lab-ai-model))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Keys
|
;; Keys
|
||||||
|
|||||||
+5
-4
@@ -12,11 +12,11 @@
|
|||||||
"QR frame size in pixels."
|
"QR frame size in pixels."
|
||||||
:type 'integer)
|
:type 'integer)
|
||||||
|
|
||||||
(defcustom my-qrcode-frame-left 100
|
(defcustom my-qrcode-frame-left 0
|
||||||
"QR frame left position."
|
"QR frame left position."
|
||||||
:type 'integer)
|
:type 'integer)
|
||||||
|
|
||||||
(defcustom my-qrcode-frame-top 100
|
(defcustom my-qrcode-frame-top 0
|
||||||
"QR frame top position."
|
"QR frame top position."
|
||||||
:type 'integer)
|
:type 'integer)
|
||||||
|
|
||||||
@@ -177,7 +177,8 @@
|
|||||||
(make-frame
|
(make-frame
|
||||||
`((name . "QR Code")
|
`((name . "QR Code")
|
||||||
(left . ,my-qrcode-frame-left)
|
(left . ,my-qrcode-frame-left)
|
||||||
(top . ,my-qrcode-frame-top)))))
|
(top . ,my-qrcode-frame-top)
|
||||||
|
(user-position . t)))))
|
||||||
|
|
||||||
;; 正方形サイズ(ピクセル単位)
|
;; 正方形サイズ(ピクセル単位)
|
||||||
(set-frame-size
|
(set-frame-size
|
||||||
@@ -199,7 +200,7 @@
|
|||||||
|
|
||||||
;; (global-set-key
|
;; (global-set-key
|
||||||
;; (kbd "C-c q")
|
;; (kbd "C-c q")
|
||||||
;; #'my-region-to-qrcode)
|
;; #'my-qrcode-from-region)
|
||||||
|
|
||||||
(provide 'my-qrcode)
|
(provide 'my-qrcode)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
\
|
|
||||||
;;; my-replace-zen-to-ascii.el --- Convert fullwidth/superscript/subscript chars to ASCII -*- lexical-binding: t; -*-
|
;;; my-replace-zen-to-ascii.el --- Convert fullwidth/superscript/subscript chars to ASCII -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; This library converts selected fullwidth ASCII-like characters,
|
;; This library converts selected fullwidth ASCII-like characters,
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
;;
|
;;
|
||||||
;; \TO:
|
;; \TO:
|
||||||
;; 第1引数: 赤太字、背景は変更しない
|
;; 第1引数: 赤太字、背景は変更しない
|
||||||
|
;; \XX:
|
||||||
|
;; 学生が修正した部分。第1引数を黄色太字で表示する。
|
||||||
;;
|
;;
|
||||||
;; \CA-\CD:
|
;; \CA-\CD:
|
||||||
;; \CA は \RA と同じ色
|
;; \CA は \RA と同じ色
|
||||||
@@ -35,6 +37,7 @@
|
|||||||
(defface my-latex-RD-body-face '((t ())) "Face for second argument of \\RD.")
|
(defface my-latex-RD-body-face '((t ())) "Face for second argument of \\RD.")
|
||||||
|
|
||||||
(defface my-latex-TO-body-face '((t ())) "Face for argument of \\TO.")
|
(defface my-latex-TO-body-face '((t ())) "Face for argument of \\TO.")
|
||||||
|
(defface my-latex-XX-body-face '((t ())) "Face for argument of \\XX.")
|
||||||
|
|
||||||
|
|
||||||
(defvar my-yatex-review-label-background "gray30"
|
(defvar my-yatex-review-label-background "gray30"
|
||||||
@@ -97,6 +100,13 @@
|
|||||||
'my-latex-TO-body-face nil
|
'my-latex-TO-body-face nil
|
||||||
:foreground "tomato"
|
:foreground "tomato"
|
||||||
:background 'unspecified
|
:background 'unspecified
|
||||||
|
:weight 'bold)
|
||||||
|
|
||||||
|
;; XX: student revision
|
||||||
|
(set-face-attribute
|
||||||
|
'my-latex-XX-body-face nil
|
||||||
|
:foreground "DeepPink"
|
||||||
|
:background 'unspecified
|
||||||
:weight 'bold))
|
:weight 'bold))
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +161,9 @@
|
|||||||
(1 'my-latex-RD-label-face t)
|
(1 'my-latex-RD-label-face t)
|
||||||
(2 'my-latex-RD-body-face t))
|
(2 'my-latex-RD-body-face t))
|
||||||
("\\\\TO{\\([^{}\n]*\\)}"
|
("\\\\TO{\\([^{}\n]*\\)}"
|
||||||
(1 'my-latex-TO-body-face t))))
|
(1 'my-latex-TO-body-face t))
|
||||||
|
("\\\\XX{\\([^{}\n]*\\)}"
|
||||||
|
(1 'my-latex-XX-body-face t))))
|
||||||
|
|
||||||
;; 重いので refresh のたびには呼ばない
|
;; 重いので refresh のたびには呼ばない
|
||||||
(when font-lock-mode
|
(when font-lock-mode
|
||||||
@@ -283,8 +295,8 @@ Return number of highlighted answer macros."
|
|||||||
(let ((count 0))
|
(let ((count 0))
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
|
||||||
;; 行頭またはインデント後の \CA, \CB, \CC, \CD を対象にする
|
;; 行頭に限定せず、\CA, \CB, \CC, \CD を検索する
|
||||||
(while (re-search-forward "^[ \t]*\\\\\\(C[ABCD]\\)\\_>" nil t)
|
(while (re-search-forward "\\\\\\(C[ABCD]\\)\\_>" nil t)
|
||||||
(let* ((macro (match-string-no-properties 1))
|
(let* ((macro (match-string-no-properties 1))
|
||||||
(faces (my-yatex-review--faces-for-citem-macro macro))
|
(faces (my-yatex-review--faces-for-citem-macro macro))
|
||||||
(label-face (nth 0 faces))
|
(label-face (nth 0 faces))
|
||||||
@@ -303,25 +315,29 @@ Return number of highlighted answer macros."
|
|||||||
|
|
||||||
;; \CA{A1} の A1 部分
|
;; \CA{A1} の A1 部分
|
||||||
(my-yatex-review--make-overlay
|
(my-yatex-review--make-overlay
|
||||||
(nth 0 arg1) (nth 1 arg1) label-face 1000)
|
(nth 0 arg1)
|
||||||
|
(nth 1 arg1)
|
||||||
|
label-face
|
||||||
|
1000)
|
||||||
|
|
||||||
;; A1 に続く本文部分
|
;; ラベルに続く回答本文
|
||||||
;; \RA などの局所 overlay より少し低い priority にする
|
|
||||||
(my-yatex-review--make-overlay
|
(my-yatex-review--make-overlay
|
||||||
body-beg body-end body-face 900)
|
body-beg
|
||||||
|
body-end
|
||||||
|
body-face
|
||||||
|
900)
|
||||||
|
|
||||||
;; 次の item まで飛ぶ
|
;; 次の回答項目まで移動
|
||||||
(goto-char body-end))))))
|
(goto-char body-end))))))
|
||||||
|
|
||||||
count))
|
count))
|
||||||
|
|
||||||
|
|
||||||
;; ============================================================
|
;; ============================================================
|
||||||
;; Main refresh
|
;; Main refresh
|
||||||
;; ============================================================
|
;; ============================================================
|
||||||
|
|
||||||
(defun my-yatex-review-highlight-refresh ()
|
(defun my-yatex-review-highlight-refresh ()
|
||||||
"Refresh highlighting for \\RA, \\RB, \\RC, \\RD, \\TO, and \\CA-\\CD."
|
"Refresh highlighting for \\RA-\\RD, \\TO, \\XX, and \\CA-\\CD."
|
||||||
(interactive)
|
(interactive)
|
||||||
|
|
||||||
;; refresh 時は font-lock 削除や face 再設定をしない。
|
;; refresh 時は font-lock 削除や face 再設定をしない。
|
||||||
@@ -339,7 +355,7 @@ Return number of highlighted answer macros."
|
|||||||
;; ------------------------------------------------------------
|
;; ------------------------------------------------------------
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
|
|
||||||
(while (re-search-forward "\\\\\\(R[ABCD]\\|TO\\)\\_>" nil t)
|
(while (re-search-forward "\\\\\\(R[ABCD]\\|TO\\|XX\\)\\_>" nil t)
|
||||||
(let ((macro (match-string-no-properties 1)))
|
(let ((macro (match-string-no-properties 1)))
|
||||||
(cond
|
(cond
|
||||||
|
|
||||||
@@ -361,7 +377,6 @@ Return number of highlighted answer macros."
|
|||||||
;; second argument
|
;; second argument
|
||||||
(my-yatex-review--make-overlay
|
(my-yatex-review--make-overlay
|
||||||
(nth 0 arg2) (nth 1 arg2) body-face 1000)))))))
|
(nth 0 arg2) (nth 1 arg2) body-face 1000)))))))
|
||||||
|
|
||||||
;; \TO{body}
|
;; \TO{body}
|
||||||
((string= macro "TO")
|
((string= macro "TO")
|
||||||
(let ((arg1 (my-yatex-review--read-brace-arg)))
|
(let ((arg1 (my-yatex-review--read-brace-arg)))
|
||||||
@@ -369,7 +384,16 @@ Return number of highlighted answer macros."
|
|||||||
(setq count (1+ count))
|
(setq count (1+ count))
|
||||||
(my-yatex-review--make-overlay
|
(my-yatex-review--make-overlay
|
||||||
(nth 0 arg1) (nth 1 arg1)
|
(nth 0 arg1) (nth 1 arg1)
|
||||||
'my-latex-TO-body-face 1000)))))))
|
'my-latex-TO-body-face 1000))))
|
||||||
|
|
||||||
|
;; \XX{body}: student revision
|
||||||
|
((string= macro "XX")
|
||||||
|
(let ((arg1 (my-yatex-review--read-brace-arg)))
|
||||||
|
(when arg1
|
||||||
|
(setq count (1+ count))
|
||||||
|
(my-yatex-review--make-overlay
|
||||||
|
(nth 0 arg1) (nth 1 arg1)
|
||||||
|
'my-latex-XX-body-face 1000)))))))
|
||||||
|
|
||||||
;; ------------------------------------------------------------
|
;; ------------------------------------------------------------
|
||||||
;; \CA, \CB, \CC, \CD
|
;; \CA, \CB, \CC, \CD
|
||||||
|
|||||||
Reference in New Issue
Block a user