More Ways to Typeset CJK

Rather a long time ago, I wrote about how to typeset CJK (Chinese, Japanese and Korean) in pdfLaTeX, using the CJK and ctex packages. However, the font choices are rather limited. With CJK, you have only the wadalab (3 Japanese fonts) and arphic (2 Simplified Chinese fonts, 2 Traditional Chinese fonts) packages and 1 Korean font. If you have access to Windows fonts, the ctex packages further configures 6 Chinese fonts shipped with Windows for use in pdfLaTeX (may also work with dvi output, but I didn’t test).

More Fonts in XƎLaTeX: xeCJK

If you’re willing to use XƎLaTeX, the xeCJK package makes it a breeze to typeset CJK, using any font (TTF or OTF) installed on your operating system. The following uses Chinese fonts typically found on a Mac:

\documentclass{article}
\usepackage{fontspec}
\usepackage{xeCJK}
 
% Sets font for Roman text.
% There are also \setsansfont, \setmonofont.
% See fontspec documentation.
\setmainfont{Baskerville}
 
% Traditional Chinese typesetting has no "bold" nor "italic".
% 黑体 ("blackbody") and 楷体 ("regular script") fonts are
% used instead.
\setCJKmainfont[BoldFont=Hei,ItalicFont=Kai]{STSong}
\setCJKsansfont{Hiragino Sans GB}
\setCJKmonofont{STFangsong}
 
\begin{document}
春眠不觉晓,\emph{处处}\textbf{啼鸟}\textsf{夜来风雨声,}\texttt{花落知多少?}
\end{document}

The fonts are identified by their names as displayed in your OS‘ font manager application. Here’s the output:

More Fonts in pdfLaTeX: zhmCJK

If you absolutely need to use pdfLaTeX instead of XƎLaTeX, the new zhmCJK package is useful for introducing more CJK font choices into you documents. It’s not included in MikTeX nor TeXLive, however; so you will have to download it from CTAN and install manually: read the instructions carefully.

The zhmCJK packages make use of the premise that all CJK fonts share the same metrics (note that this is not true for Japanese half-width characters! Use ptex if you have serious needs for Japanese typesetting), and can therefore create the NFSS font definition and actual font mappings dynamically. The consequence is that zhmCJK can use TrueType CJK fonts to generate PDF output with pdfTeX or with the dvipdfmx driver. Here’s an example:

\documentclass{article}
\usepackage{zhmCJK}
\setCJKmainfont[BoldFont=simhei.ttf, ItalicFont=simkai.ttf]{HanNomA.ttf}
 
\begin{document}
世界,你好!
\end{document}

You will need to pass the file name of the TTF font, which must have no space characters and only ASCII characters. And for LaTeX to find the TTF files, you need to do one of the following:

  • Set OSFONTDIR in texmf.cnf
  • Move or symlink the TTF file in TEXMF/fonts/truetype
  • Move or symlink the TTF file in the same directory as your document.

3 thoughts on “More Ways to Typeset CJK

  1. Here is my way to typesetting in Japanese, using cjk package and Cyberbit TTF font.

    documentclass{article}
    usepackage[encapsulated]{CJK}
    usepackage[utf8]{inputenc}
    newcommand{cjktext}[1]{begin{CJK}{UTF8}{cyberbit}#1end{CJK}}

    begin{document}
    cjktext{日本語}\

    LaTeX CJK using UTF8 (Unicode) and Cyberbit TTF font.
    end{document}

Leave a Reply

Your email address will not be published. Required fields are marked *