summaryrefslogtreecommitdiff
path: root/elpa/auctex-13.1.3/style/CJK.el
blob: baee5d93c9b326d8b79d60f103a3b24417e7e0e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
;;; CJK.el --- AUCTeX style for the CJK package.  -*- lexical-binding: t; -*-

;; Copyright (C) 2009-2021  Free Software Foundation, Inc.

;; Author: Ralf Angeli <angeli@caeruleus.net>
;; Maintainer: auctex-devel@gnu.org
;; Created: 2009-01-04
;; Keywords: tex

;; This file is part of AUCTeX.

;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.

;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING.  If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.

;;; Commentary:

;; This file adds support for the CJK package, version 4.8.0
;; (22-May-2008).

;;; Code:

(require 'tex)
(require 'latex)

(defvar LaTeX-CJK-package-options
  '("lowercase" "global" "local" "active" "encapsulated")
  "Package options for the CJK package.")

(defvar LaTeX-CJK-enc-list
  '("Bg5" "Bg5+" "HK" "GB" "GBt" "GBK" "JIS" "JIS2" "SJIS" "KS" "UTF8" "CNS1"
    "CNS2" "CNS3" "CNS4" "CNS5" "CNS6" "CNS7" "CEFX" "CEFY")
  "List of encodings supported by the CJK package.")

(defun LaTeX-env-CJK (env)
  "Prompt for the arguments of ENV and insert it.
The function can be used for CJK and CJK* environments."
  (LaTeX-insert-environment
   env
   (concat
    (let ((font-enc (TeX-read-string "(Optional) Font encoding: ")))
      (unless (zerop (length font-enc)) (format "[%s]" font-enc)))
    (format "{%s}" (completing-read "Encoding: "
                                    (mapcar #'list LaTeX-CJK-enc-list)))
    (format "{%s}" (TeX-read-string "Font family: ")))))

(TeX-add-style-hook
 "CJK"
 (lambda ()
   ;; New symbols
   (TeX-add-symbols
    '("CJKencfamily" ["Font encoding"] "Encoding" "Font family")
    '("CJKchar" ["Encoding"] "First byte" "Second byte")
    '("CJKcaption" 1)
    '("CJKfamily" 1)
    '("CJKfontenc" "Encoding" "Font encoding")
    '("CJKenc" 1)
    '("Unicode" "First byte" "Second byte")
    '("CJKsymbols" 2)
    '("CJKsymbol" 1)
    "CJKbold"
    "CJKnormal"
    "CJKboldshift"
    "CJKCJKchar"
    "CJKhangulchar"
    "CJKlatinchar"
    "CJKhwkatakana"
    "CJKnohwkatakana"
    "CJKglue"
    "CJKtolerance"
    "CJKtilde"
    "nbs"
    "standardtilde"
    "CJKspace"
    "CJKnospace"
    "CJKindent"
    '("CJKaddEncHook" 2)
    "CJKkern"
    "CJKverbatim")
   ;; New environments
   (LaTeX-add-environments
    '("CJK" LaTeX-env-CJK)
    '("CJK*" LaTeX-env-CJK)))
 TeX-dialect)

;;; CJK.el ends here