Difference between revisions of "Chinese Japanese and Korean"

From Wiki
Jump to navigation Jump to search
(Add more regarding the numbers.)
(fix Typo)
Line 9: Line 9:
  
 
# You need some Chinese (TrueType) fonts; you may want to get [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htfs.ttf FangSong], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/hthei.ttf HeiTi], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htkai.ttf KaiTi] and [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htsong.ttf SongTi]. Put those e.g. into $TEXMF/fonts/truetype/chinese/.
 
# You need some Chinese (TrueType) fonts; you may want to get [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htfs.ttf FangSong], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/hthei.ttf HeiTi], [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htkai.ttf KaiTi] and [ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/htsong.ttf SongTi]. Put those e.g. into $TEXMF/fonts/truetype/chinese/.
# Use Hans Hagen's experimental [[http://www.physik.fu-berlin.de/~tburnus/ttf2uni.rb ttf2uni.rb]] script to create .map, .tmf and .enc files. You can then put the files e.g. to $TEXMF/fonts/tfm/chinese/ (*.tmf files), $TEXMF/fonts/enc/chinese/ (*.enc files, they are basically the same for all fonts) and to $TEXMF/fonts/map/chinese/.
+
# Use Hans Hagen's experimental [http://www.physik.fu-berlin.de/~tburnus/ttf2uni.rb ttf2uni.rb] script to create .map, .tmf and .enc files. You can then put the files e.g. to $TEXMF/fonts/tfm/chinese/ (*.tmf files), $TEXMF/fonts/enc/chinese/ (*.enc files, they are basically the same for all fonts) and to $TEXMF/fonts/map/chinese/.
 
# You may now need to update the hash TeX uses to find the files; using teTeX this is done by running <tt>texhash</tt>.
 
# You may now need to update the hash TeX uses to find the files; using teTeX this is done by running <tt>texhash</tt>.
 
# How you can run your Hello World program:
 
# How you can run your Hello World program:
Line 20: Line 20:
 
</texcode>
 
</texcode>
  
If you want to typset vertical text, use <tt>\startvertical ... \stopvertical</tt>, if you want to use Chinese numbers, you can use e.g. <tt>\startitemize[c]</tt>; possible options are <tt>c</tt> or <tt>cn</tt> for normal Chinese numbers (一, 二, 三, 四, 无, 六 etc.), <tt>cc</tt> for the capitalized (or financial) Chinese numbers (壹, 貳, 叄 etc.), <tt>ec</tt> for an extended version which uses 廿 and 卅 (instead of 一十 and 二十), and <tt>ac</tt> for using the Chinese numbers zero (零, 〇) to nine (九) in the same way one does with the Arabical digits 0 to 9.
+
If you want to typset vertical text, use <tt>\startvertical ... \stopvertical</tt>, if you want to use Chinese numbers, you can use e.g. <tt>\startitemize[c]</tt>; possible options are <tt>c</tt> or <tt>cn</tt> for normal Chinese numbers (一, 二, 三, 四, 无, 六 etc.), <tt>cc</tt> for the capitalized (or financial) Chinese numbers (壹, 貳, 叄 etc.), <tt>ec</tt> for an extended version which uses 廿 and 卅 (instead of 一十 and 二十), and <tt>ac</tt> for using the Chinese numbers zero (零, 〇) to nine (九) in the same way one does with the Arabic digits 0 to 9.
  
  

Revision as of 19:12, 20 December 2005

< Fonts | Encodings and Regimes >

Chinese in ConTeXt (ConTeXt 2005.12.19 and newer)

If you have Context 2005.12.19, you only have to get the fonts.

  1. You need some Chinese (TrueType) fonts; you may want to get FangSong, HeiTi, KaiTi and SongTi. Put those e.g. into $TEXMF/fonts/truetype/chinese/.
  2. Use Hans Hagen's experimental ttf2uni.rb script to create .map, .tmf and .enc files. You can then put the files e.g. to $TEXMF/fonts/tfm/chinese/ (*.tmf files), $TEXMF/fonts/enc/chinese/ (*.enc files, they are basically the same for all fonts) and to $TEXMF/fonts/map/chinese/.
  3. You may now need to update the hash TeX uses to find the files; using teTeX this is done by running texhash.
  4. How you can run your Hello World program:
\enableregime[utf]
\usemodule[chi-00]
\starttext
  你好!
\stoptext

If you want to typset vertical text, use \startvertical ... \stopvertical, if you want to use Chinese numbers, you can use e.g. \startitemize[c]; possible options are c or cn for normal Chinese numbers (一, 二, 三, 四, 无, 六 etc.), cc for the capitalized (or financial) Chinese numbers (壹, 貳, 叄 etc.), ec for an extended version which uses 廿 and 卅 (instead of 一十 and 二十), and ac for using the Chinese numbers zero (零, 〇) to nine (九) in the same way one does with the Arabic digits 0 to 9.


Chinese in ConTeXt (before 2005.12.19)

Xiao Jianfeng wrote in a mail to the mailing list on 2005-06-06:

Here is my way of Chinese setup in ConTeXt. I hope this can be of any help to some newbies like me who have problems in processing Chinese.

  1. Get the truetype fonts htfs.ttf, hthei.ttf, htkai.ttf and htsong.ttf from ftp://ftp.ctex.org/pub/tex/fonts/truetype/ttf/
  2. Get corresponding tfm files gbfs.zip, gbhei.zip, gbkai.zip and gbsong.zip from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/tfm/
  3. Get the enc file Gbk.zip from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/enc_map/
  4. Get the map file map.zip from ftp://ftp.ctex.org/pub/tex/fonts/truetype/for_pdftex/enc_map/
  5. Put the ttf font files you got in step 1 to texmf-fonts/fonts/truetype/chinese
  6. Unzip the files you got in step 2 and you get four corresponding directories (which contain tfm files), then put them in texmf-fonts/fonts/tfm/chinese
  7. Unzip Gbk.zip, you will get a directory named Gbk which contains many enc files. Put the directory to texmf-fonts/fonts/enc/chinese
  8. Unzip map.zip, you will get many map files, you need just the gbk.map. You need to edit gbk.map, delete entries of gbli* at the end of the file (lines 505-629). Then, put the modified gbk.map to texmf-fonts/fonts/map/chinese. Note that newer pdfetex don't read pdftex.cfg so better use \loadmapfile[gbk] in your document.
  9. Your document should be compilable now. See sample below.
  10. I haven't tried to compile Traditional Chinese documents. Maybe just get corresponding files for Traditional Chinese and put there to the right location will work. I'm not sure.

Sample Code (save in cp936 encoding):

\loadmapfile[gbk]
\usemodule[chinese]
\setuppagenumbering[state=stop]
 \starttext
 \tfd
这里什么饮料也没有真不像话!
 \stoptext

If you want to use UTF-8, the script by Lutz Haseloff might of interest to you; the needed perl module Encode::HanConvert is available at CPAN. Note, however, that you may only use characters representable in gbk, German umlauts for instance are converted into ??.