学生用に\XX{}を追加
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
;;
|
||||
;; \TO:
|
||||
;; 第1引数: 赤太字、背景は変更しない
|
||||
;; \XX:
|
||||
;; 学生が修正した部分。第1引数を黄色太字で表示する。
|
||||
;;
|
||||
;; \CA-\CD:
|
||||
;; \CA は \RA と同じ色
|
||||
@@ -35,6 +37,7 @@
|
||||
(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-XX-body-face '((t ())) "Face for argument of \\XX.")
|
||||
|
||||
|
||||
(defvar my-yatex-review-label-background "gray30"
|
||||
@@ -97,6 +100,13 @@
|
||||
'my-latex-TO-body-face nil
|
||||
:foreground "tomato"
|
||||
:background 'unspecified
|
||||
:weight 'bold)
|
||||
|
||||
;; XX: student revision
|
||||
(set-face-attribute
|
||||
'my-latex-XX-body-face nil
|
||||
:foreground "DeepPink"
|
||||
:background 'unspecified
|
||||
:weight 'bold))
|
||||
|
||||
|
||||
@@ -151,7 +161,9 @@
|
||||
(1 'my-latex-RD-label-face t)
|
||||
(2 'my-latex-RD-body-face t))
|
||||
("\\\\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 のたびには呼ばない
|
||||
(when font-lock-mode
|
||||
@@ -284,7 +296,7 @@ Return number of highlighted answer macros."
|
||||
(goto-char (point-min))
|
||||
|
||||
;; 行頭またはインデント後の \CA, \CB, \CC, \CD を対象にする
|
||||
(while (re-search-forward "^[ \t]*\\\\\\(C[ABCD]\\)\\_>" nil t)
|
||||
(while (re-search-forward "\\\\\\(R[ABCD]\\|TO\\|XX\\)\\_>" nil t)
|
||||
(let* ((macro (match-string-no-properties 1))
|
||||
(faces (my-yatex-review--faces-for-citem-macro macro))
|
||||
(label-face (nth 0 faces))
|
||||
@@ -321,7 +333,7 @@ Return number of highlighted answer macros."
|
||||
;; ============================================================
|
||||
|
||||
(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)
|
||||
|
||||
;; refresh 時は font-lock 削除や face 再設定をしない。
|
||||
@@ -339,7 +351,7 @@ Return number of highlighted answer macros."
|
||||
;; ------------------------------------------------------------
|
||||
(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)))
|
||||
(cond
|
||||
|
||||
@@ -361,7 +373,6 @@ Return number of highlighted answer macros."
|
||||
;; second argument
|
||||
(my-yatex-review--make-overlay
|
||||
(nth 0 arg2) (nth 1 arg2) body-face 1000)))))))
|
||||
|
||||
;; \TO{body}
|
||||
((string= macro "TO")
|
||||
(let ((arg1 (my-yatex-review--read-brace-arg)))
|
||||
@@ -369,8 +380,17 @@ Return number of highlighted answer macros."
|
||||
(setq count (1+ count))
|
||||
(my-yatex-review--make-overlay
|
||||
(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
|
||||
;; ------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user