Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > c8080b7f12a46934b1963577dbfa8942 > files > 28

CJK-4.2.0-5mdk.ppc.rpm

This is the file cjk-enc.doc of the CJK macro package ver. 4.2.0
(13-Dec-1998).

cjk-enc.el
----------

Mule, the multilingual Emacs, is one of the most powerful editors available
for Un*x systems like Linux. It is capable to edit and display texts which
are, among other scripts, written in various CJK languages; as an example
you can have traditional and simplified Chinese at the same time. Mule is
distributed under the GNU Public License; it is now part of emacs 20.

The CJK package enables LaTeX to do the same (with some restrictions, see
below), but the interface is different. Mule has a prefix byte for each
character signaling the encoding which follows (this is called `internal'
encoding), whereas the CJK package needs \CJKenc macros to select encodings.

Now enters cjk-enc.el . This small output filter for Mule (written in Lisp)
converts text represented in Mule's internal encoding into a form TeX can
understand. Double-byte encodings which can be processed by CJK will be
usually converted into EUC form preceded by \CJKenc{...} macros, single-byte
encodings (Latin-1 etc.) into equivalent LaTeX 2e macros (e.g. Latin-1
character 0xC4 (umlaut A) into \"A). Some of these macros are undefined by
default in standard LaTeX 2e because CM or EC fonts have no characters for
it. Vietnamese, Cyrillic scripts, and Thai are also supported (see below).

cjk-enc.el versions are provided for Mule 2.3 and emacs 20.


Installation
------------

To load cjk-enc.el into Mule put the following line into your .emacs file:

    (load-library "cjk-enc")

this assumes that cjk-enc.el is in a directory searched by Mule. A good
place for it is the site-lisp subdirectory.

After loading, a new (output) encoding scheme is defined: `*cjk-coding*'
(resp. `cjk-coding' under emacs 20. Please note further that the prefix for
Mule commands has changed to `C-x RET' for emacs 20 instead of `C-x C-k'. In
the following only `C-x C-k' will be used).


Usage (LaTeX 2e part)
---------------------

A sample of a multilingual document (muletest.{tex,cjk,dvi,ps}) can be
found in the examples subdirectory (only the TEX file is in the src package
of CJK, the other files are in the rest package).

European languages based on the Latin script:

    Simply write your documents! Characters like `u umlaut' or `c hacek'
    will be converted into LaTeX 2e macros. You don't need to write "u or
    something else (nevertheless it's possible). It is recommended to use
    LaTeX 2e's T1 font encoding scheme to have a) most of the European
    diacritics available and b) correct hyphenation for accented characters.

    The lower half of JIS X 0201 will be treated similarly.

    EC fonts are T1 font-encoded.

    Please note that for correct hyphenation you still have to change
    languages, thus a system like Babel should be used additionally.

CJK languages:

    Don't start a CJK (or CJK*) environment! cjk-enc.el does this
    automatically for you. It will also insert \CJKspace and \CJKnospace
    commands (\CJKspace for Korean, \CJKnospace for all other CJK scripts).

    In CJK.enc the default font family for all encodings is `song' (except
    for Korean Hangul where it is `mj'). Two commands are available to
    change the CJK font encoding and family in combination with cjk-enc.el
    (see CJK.doc and commands.doc for a detailed description):

        \CJKencfamily[<fontencoding>]{<encoding>}{<family>}
            Change family for a certain encoding (and fontencoding).

        \CJKfontenc{<encoding>}{<fontencoding>} 
             Change fontencoding for a certain encoding.

    The second command is primarily for users who use Japanese dnp fonts
    (see the Japanese documentation subdirectory for further details) or
    Korean HLaTeX fonts.

    For the upper half of JIS X 0201 encoding, the katakana range of the
    SJIS encoding of the CJK package is used.

Vietnamese:

    Vietnamese uses accented characters not contained in EC or CM fonts. To
    assure proper kerning you must explicitly activate ET5 font encoding
    (this can't be done automatically) to access a Vietnamese font.

    The vncmr-2.2 package contains a Vietnamese font based on CM; it also
    defines ET5 encoding. It is available from CTAN in fonts/vietnamese.

Russian and other languages using the cyrillic script:

    Cyrillic LaTeX encodings (T2A, T2B, T2C, and X2) together with Cyrillic
    fonts supporting these encodings have recently appeared (look at CTAN
    into fonts/cyrillic/lh-test and macros/latex/contrib/supported/t2). Get
    and install these packages before trying cjk-enc.el with Cyrillic.

    The current implemention needs a lot of temporary disk space for
    Cyrillic scripts (e.g. a 100 KByte document written only with Cyrillic
    letters will have an intermediate output file of about 800 KByte). On
    the other hand, it is still possible to recognize the Cyrillic
    characters name macros in the log file in case of error messages---if I
    used the shortest possible representation, only numbers would be
    visible, and the size of the intermediate output file would still have
    500 KByte...

    You must explicitly activate one of the T2* (or X2) encodings for
    Cyrillic. Russian needs T2A.

Thai:

    This is experimental since I have absolutely no knowledge of this
    script. I can give only technical support. It is implemented in the
    emacs 20 version of cjk-enc.el only.

    Basically I've adapted the C-TTeX package version 1.15 written by
    Vuthichai Ampornaramveth <vuthi@ctrl.titech.ac.jp> to the CJK package.
    `thai.sty' is still very rudimentary---any improvements are welcome.

    The used encoding is C90 (this is the only case where you have to
    specify a `C' encoding directly, either by loading thai.sty or by saying
    `\DeclareFontEncoding{C90}{}{}' in the preamble); the default fonts
    specified in c90cmr.fd are taken from the dbtt package (which can be
    found at http://thaigate.rd.nacsis.ac.jp/files/ttex.html). gsftopk and
    dvips will scan psfonts.map for these fonts; add the following lines to
    psfonts.map:

      dbtt     DBThaiText           <dbtt.pfb
      dbttb    DBThaiTextBold       <dbttb.pfb
      dbtti    DBThaiTextItalic     <dbtti.pfb
      dbttbi   DBThaiTextBoldItalic <dbttbi.pfb

    This should be sufficient (for recent web2c versions). Of course, don't
    forget to install the fonts themselves.

    cjk-enc.el assumes that the Thai preprocessor `thaiconv' is in the path;
    this program (in the utils/thaiconv directory) can be simply compiled
    with

        cc -O -s -o thaiconv thaiconv.c

    Use \CJKnospace and \CJKspace to select whether space characters after a
    Thai character are ignored or not. Default is \CJKnospace (this
    behaviour is different to the original cttex preprocessor). Change the
    value of \Thaiglue (which is defined in MULEenc.sty) if you want more
    or less intercharacter glue.


Usage (Mule part)
-----------------

Simply load your document into Mule and call write-cjk-file (which is
defined in cjk-enc.el) to create a preprocessed file. For most files this
file's name is formed by replacing the extension with `.cjk'. However,
BibTeX files are given the extension `-cjk.bib' because the BibTeX program
requires `.bib' as the extension. This also avoids conflicts with the CJK
file produced by a LaTeX file by the same name. Because of this you'll also
need to change the \bibliography{foo} line in your LaTeX source file to
\bibliography{foo-cjk}.

It is recommended that you assign this function to a key (e.g. with
global-set-key) in your .emacs configuration file.


Usage with AUCTeX
-----------------

Append this to your .emacs file to have special CJK support with AUCTeX:

  (defun TeX-run-CJK-LaTeX (name command file)
    "Create a process for NAME using COMMAND to format FILE with CJK/LaTeX."
    (write-cjk-file)
    (TeX-run-LaTeX name command file))

  ;; replace the error source file from *.cjk to *.tex, then C-c ` can
  ;; be used as usual.

  (add-hook 'TeX-translate-location-hook
            '(lambda ()
               (if (string-match "\\(.*\\)\.cjk$" file)
                 (setq file 
                       (concat
                        (substring file 
                                   (match-beginning 1) 
                                   (match-end 1))
                        ".tex")))))

  (defvar TeX-command-list
    (list (list "TeX" "tex '\\nonstopmode\\input %t'" 'TeX-run-TeX nil t)
          (list "TeX Interactive" "tex %t" 'TeX-run-interactive nil t)
          (list "LaTeX" "%l '\\nonstopmode\\input{%t}'"
                'TeX-run-LaTeX nil t)
          (list "LaTeX Interactive" "%l %t" 'TeX-run-interactive nil t)
          (list "LaTeX2e" "latex2e '\\nonstopmode\\input{%t}'"
                'TeX-run-LaTeX nil t)
          (list "CJKLaTeX" "%l '\\nonstopmode\\input{%s.cjk}'"
                'TeX-run-CJK-LaTeX nil t)
          (if (or window-system (getenv "DISPLAY"))
              (list "View" "%v " 'TeX-run-background t nil)
            (list "View" "dvi2tty -q -w 132 %s " 'TeX-run-command t nil))
          (list "Print" "%p " 'TeX-run-command t nil)
          (list "Queue" "%q" 'TeX-run-background nil nil)
          (list "File" "dvips %d -o %f " 'TeX-run-command t nil)
          (list "BibTeX" "bibtex %s" 'TeX-run-BibTeX nil nil)
          (list "Index" "makeindex %s" 'TeX-run-command nil t)
          (list "Check" "lacheck %s" 'TeX-run-compile nil t)
          (list "Spell" "<ignored>" 'TeX-run-ispell nil nil)
          (list "Other" "" 'TeX-run-command t t)
          ;; Not part of standard TeX.
          (list "Makeinfo" "makeinfo %t" 'TeX-run-compile nil t)
          (list "AmSTeX" "amstex '\\nonstopmode\\input %t'"
                'TeX-run-TeX nil t)))


To process a CJK document with AUCTeX use C-c C-c on your LaTeX source file
and select CJKLaTeX as the formatting command.

If you mainly write text in Japanese or Chinese consider the use of
cjkspace.el or cjktilde.el for inserting a tilde character (which has been
redefined to a shibuaki space) if you hit the space key. Please read the
documentation in the two files for differences. cjkspace.el works with
AUCTeX only, cjktilde.el works in every mode.


Technical notes
---------------

cjk-enc.el will load MULEenc.sty in the first output line which contains all
needed definitions for LaTeX 2e. CJK.sty will be loaded only if needed.

To assure working in verbatim environments, \CJKenc and the LaTeX 2e macros
are not output directly. We use the activated character 0x80 to output
\CJKenc, \CJKspace, Latin characters etc.

CNS 1-CNS 7 and JIS2 encoded characters are output as \CJKchar macros
(assigned to the active character 0xA0). The reason for this choice is the
infrequency of CNS and JIS2 characters in normal text. Since \CJKchar does
not select a new binding this macro will be faster executed for single CNS
and JIS2 characters.


---End of cjk-enc.doc---