[texhax] Typing Chinese with plain TeX

Rodolfo Medina romeomedina at libero.it
Sun Sep 5 12:39:45 CEST 2004


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
	Tang wrote:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%




"Rodolfo Medina" <romeomedina at libero.it> writes:

Hello Rodolfo:
Configure Emacs to support chinese seems to be a challenging
job. especially for non chinese users. :)

> Now I'm doing other trials.
>
> When Emacs loads a file containig chinese characters,
> e.g. the file 'math1gb.tex' featured in ChiTeX distribution,
> those characters are not displayed, and I get something like:
>
> 简单数学文件
^^^^^^^^^^^^
 To my surprise, I can read these characters, It means "A simple
 mathematic file."

 Make sure your Emacs already has *mule* support!
  
 I wanna know, what exactly did you see in your emacs? Chaos code or
 some hollow squares? Can your Emacs can display chinese characters
 correctly in my email?

 If there are chaos code, you need to configure emacs coding system,
 otherwise, hollow squares indicate that the emacs can't find
 appropriate chinese fonts.

 Secondly, I want to know  what environment does your Emacs runing
 in? In the text console, terminal emulator or X window system?

 In text console and terminal emulator, Emacs can support chinese
 automaticly if the terminal itself support chinese. You should
 install *cce* to support chinese in text console, you can download
 it form:

    http://ftp.cdaan.com/sy/light/cce-0.50-11122003-dist.tgz

 Does your terminal emulator is cxterm? cxterm already support
 chinese well, so you can just try 'emacs -nw' in cxterm.

 If the X window system is your default working enviroment, let's
 make more effort! There are many ways to achieve our goal. I give
 you three *independent* methods:

     1. Does your system have chinese font files already? run:

         $xfontsel

        to find a font and remember its name. If you have no chinese
        font, download it from:
        
          http://ftp.cdaan.com/sy/light/chinese-font1.tar.gz
          
        Install the fonts(add font information to the 'fonts.dir'
        and 'fonts.scale' files).

        Now I suppose that you have a font names 'fangsong ti'.
        Edit your .emacs and add these lines:

          (create-fontset-from-fontset-spec
          "-isas-fangsong
ti-medium-r-normal--16-160-72-72-c-160-gb2312.1980-0" t)

          (set-language-environment "Chinese-GB")
          (set-selection-coding-system 'cn-gb-2312)
          (set-clipboard-coding-system 'cn-gb-2312)
          (set-keyboard-coding-system 'cn-gb-2312)
          (setq locale-coding-system 'cn-gb-2312)
          (set-terminal-coding-system  'chinese-iso-8bit)
          (setq default-input-method 'chinese-py-punct)
          
     2. You can use TrueType chinese fonts in emacs. Download it
        form:

          http://ftp.cdaan.com/sy/light/simsun.ttf
          http://ftp.cdaan.com/sy/light/mingliu.ttf

        Install these two fonts and run 'xfontsel' to check them as above.

        Edit .emacs file add these lines:

           (set-keyboard-coding-system 'cn-gb-2312)
           (set-selection-coding-system 'cn-gb-2312)
           (set-terminal-coding-system  'cn-gb-2312)
           (set-buffer-file-coding-system 'gb2312)
           (setq default-buffer-file-coding-system 'gb2312)
           (setq locale-coding-system 'gb2312)
           (set-language-environment-coding-systems "chinese-gb"  nil)
           (if window-system
               (if (not (member
'("-*-verdana-normal-r-*-*-13-*-*-*-c-*-fontset-chinese"
                       . "fontset-chinese") fontset-alias-alist))
                               (progn
                                 (create-fontset-from-fontset-spec
           "-*-courier new-normal-r-*-*-14-*-*-*-c-*-fontset-chinese,
           chinese-gb2312:-*-simsun-normal-r-*-*-16-*-*-*-c-*-gb2312*-*,
           chinese-big5-1:-*-mingliu-normal-r-*-*-16-*-*-*-c-*-big5*-*,
           chinese-big5-2:-*-mingliu-normal-r-*-*-16-*-*-*-c-*-big5*-*" t)

           (setq default-frame-alist
                (append
                 '((font . "fontset-chinese"))
                 default-frame-alist)))))

     3. You can visit:

         http://mule-gbk.sourceforge.net/

I'm not sure above settings can work perfectly in your system. Maybe
you have to read the Emacs manual or turn to Emacs mail list.

To test your chinese coding system, type:

        M-x describe-language-environment RET Chinese-GB

If the chinese characters are displayed correctly?

CVS Emacs has made many improvements in *mule* support, there is an
useful command in CVS Emacs:

        M-x revert-buffer-with-coding-system

Perhaps you need to try it.

Best Regards!
Tang
 



More information about the texhax mailing list