Type Chinese in TeX compiled with LaTeX

Using CJK

If you use CJK package, you can use CJK environment at the beginning and the end of the document only once. So you don't need to worry about where to put the CJK environment when you type the text. Say, you can (and you should) simply use

\documentclass{book}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{gbsn}

\chapter{某章}
内容……

\chapter{某章}
内容……

\clearpage\end{CJK*}
\end{document}

Using xeCJK

As is said before, you should use xelatex command instead of latex command. And furthermore, you must specify a Chinese font installed in your Linux OS which can be listed via fc-list command.

It is typical that a default installation of Ubuntu does not have proper Chinese fonts installed. You can install WenQuanYi(文泉驿) and Arphic(文鼎) free fonts via apt-get, or you can manually install other commercial fonts.

Then use fc-list in a console window to get the font list in your OS. A typical list is like:

AR PL UMing TW:style=Light
AR PL UMing HK:style=Light
AR PL UMing CN:style=Light
AR PL UKai CN:style=Book
AR PL UKai HK:style=Book
AR PL UKai TW:style=Book
......
DejaVu Sans Mono:style=Bold
DejaVu Sans Mono:style=Book
DejaVu Sans:style=Bold
DejaVu Sans:style=Book
DejaVu Serif:style=Bold
DejaVu Serif:style=Book
......
WenQuanYi Zen Hei,文泉驛正黑,文泉驿正黑:style=Regular
WenQuanYi Zen Hei Mono,文泉驛等寬正黑,文泉驿等宽正黑:style=Regular

Some of these are Chinese fonts, some are not. You can choose a font name (before the :) to use, for example

% Compile with xelatex
% UTF-8 encoding
\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{AR PL UMing CN} % may be changed
\begin{document}
文章内容
\end{document}

Note that the Chinese font names in different Linux distribution are quite different, e.g. you may get AR PL SungtiL GB for the same Arphic font. So don't just copy my code.

And you need to configure your Emacs to use xelatex instead of latex or pdflatex.

Tags:

Cjk

Languages