很高兴!Chinese in TeX

Recently, good things have kept on coming my ways (see my previous posts).

One issue that’s been nagging me for quite a while is outputting simplifed Chinese in .tex files. Given all the information I had collected I knew I was really close but it never completely worked… until I got Japanese working in TeX.

From then on, it was a matter of changing some fonts and trying.

In the end, I found even two ways to produce Chinese in tex files:

The first:

1) Download this template for Japanese in TeX:
http://pastebin.com/tasDkhZ3

2) Replace the following lines:
\newenvironment{Japanese}{%
with
\newenvironment{Chinese}{%

and
\CJKfamily{min}%
with
\CJKfamily{gkai}%

and the tags \begin{Japanese} and \end{Japanese} must also be
replaced with \begin{Chinese} and \end{Chinese}

3) Install the following packages:
latex-cjk-common
latex-cjk-chinese
latex-cjk-chinese-arphic-gkai00mp

4) Compile using pdflatex <file.tex>

Then, compiling with pdflatex works provided you have the packages

Note:
For some reasons, the CJKfamily “bkai” does not contain all the
simplified Chinese characters, so “gkai” (or an equivalent font
alternative) is required.

The second:

1) Download this sample file:
http://scripts.sil.org/cms/scripts/render_download.php?&format=file&media_id=xetex_chinese_sample&filename=xetex_chinese_sample.zip

Unfortunately, the uploader created it on a mac where the fonts are
different. However, in XeTeX you can specify fonts that are available in
other programs and system-wide so you can just pick a nice font in
LibreOffice and specify that one.

2) Change the fonts in the .tex file to some different font. Use the complete name of the font as you can see it in LibreOffice’s font selection e.g. “AR PL UKai CN”.

3) Compile using “xetex <file>.tex”

4) Rejoice!

To be honest, this second template file is most likely a total overkill for a simple papers or some exercices as the output comes in vertical columns and must be read from right to left. But it’s awesome to see that such a thing is even possible in TeX!

Tags: , , , ,

Comments are closed.