(t
(forward-char))))))))
-(defun chise-tex-encode-region-for-utf-8-jis (start end)
+(defun chise-tex-encode-region-for-utf-8-jis (start end &optional ptex-mode)
(interactive "r")
(save-excursion
(save-restriction
(cond ((eq (char-ucs chr) #x00D7)
(delete-char)
(insert "\\UCSjis{00D7}"))
- ((encode-char chr '=jis-x0208-1983)
+ ((encode-char chr '=jis-x0208@1983)
+ (forward-char))
+ ((encode-char chr '=jis-x0208@1990)
(forward-char))
((and (setq ret (char-ucs chr))
(or (eq ret #x00C5)
(delete-char)
(insert "\\oe{}")
t)
- ((and (setq ret (encode-char chr '=ucs@JP))
+ ((and (not ptex-mode)
+ (setq ret (encode-char chr '=ucs@JP))
(>= ret #x20000))
(delete-char)
(insert (format "\\UCSsip{%X}" ret))
t)
- ((and (or (encode-char chr '=jis-x0213-1-2000)
+ ((and (not ptex-mode)
+ (or (encode-char chr '=jis-x0213-1-2000)
(encode-char chr '=jis-x0213-2-2000))
(setq ret (or (encode-char chr '=ucs@jis/2000)
(encode-char chr '=ucs@jis/fw)))
(t
(forward-char))))))))))
+(defun chise-ptex-encode-region-for-utf-8-jis (start end)
+ (interactive "r")
+ (chise-tex-encode-region-for-utf-8-jis start end 'ptex-mode))
+
(defun chise-xetex-encode-region-for-utf-8-jis (start end)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char start)
- (let (chr ret)
+ (let (chr ret rest spec)
(while (and (skip-chars-forward "\x00-\x7F")
(not (eobp)))
(setq chr (char-after))
))
(make-coding-system
+ 'utf-8-jp-ptex 'utf-8
+ "Coding-system of UTF-8 for pLaTeX with common glyphs used in Japan."
+ '(pre-write-conversion chise-ptex-encode-region-for-utf-8-jis
+ post-read-conversion chise-tex-decode-region
+ charset-g0 =ucs@jp
+ charset-g1 =>ucs-jis
+ charset-g2 =>ucs
+ mnemonic "pTeX(JP)/UTF8"))
+
+(make-coding-system
'utf-8-jp-tex 'utf-8
"Coding-system of UTF-8 for upLaTeX with common glyphs used in Japan."
'(pre-write-conversion chise-tex-encode-region-for-utf-8-jis