UTF-8 encoded CJK and MiKTex/pdflatex

by Johannes Goller (jogojapan at gmail)

This document describes how to enable CJK (Chinese, Japanese, Korean) support in MiKTex 2.6, assuming that CJK text is encoded in UTF-8.

The procedure has been tested for Japanese on MiKTex 2.6, using "pdflatex" (not "latex" or "dvips"). I expect it to be working with different versions of MiKTex, as well as for Korean and Chinese, too.

Overview

Basic CJK support in Latex is best provided by Werner Lemberg's CJK package. It defines a Latex "CJK" environment which can be used to include CJK text in any .tex file:

\usepackage{CJK}

\begin{CJK}{UTF8}{cyberb}
...
\end{CJK}
It has two arguments: the encoding and the font name.

Most standard examples for the usage of the CJK package use CJK-specific encodings such as Big-5. For me it was important to use a Unicode-based encoding so as to be able to include non-CJK special characters (such as German umlauts) in the same document. Note the correct spelling of the encoding specifier in the above example: "UTF8" (uppercase and no hyphen).

Most standard examples for the CJK package use the "imap" or "song" fonts, which are not available in MiKTex (in the case of imap), or do not work properly (in the case of song). This is why it is necessary to install and use a different font, and I recommend the freely available Cyberbit font.

The following describes how to install the CJK package, the Cyberbit font, and which configuration files to change in order to enable it. It is assumed that MikTex has been installed previously and is working for ordinary English documents.

The package

Installing the package is very easy. Just use the "Update" function in the MikTex folder under the Start menu, and select the CJK package.

The Cyberbit font

Most of the following steps are basically the same as given on this very helpful document by Helmer Aslaksen published in the PracTex Journal. I have only made a few adjustments to the path names (such that they fit into MiKTex's directory structure), and added step 9.
  1. Download the Cyberbit font ZIP file, e.g. from ftp://ftp.netscape.com/pub/communicator/extras/fonts/windows/Cyberbit.ZIP
    Unpack it and put the resulting .ttf file into the fonts\truetype\bitstream directory, under the main MiKTex directory (usually something like C:\Program Files\MiKTex 2.6).
  2. Rename it to cyberbit.ttf (i.e. lowercase it).
  3. Run
    ttf2tfm cyberbit.ttf -w cyberb@Unicode.sfd@ > cyberbit.log
    
    This will result in 165 newly created .enc and .tfm files.
  4. Put the .tfm files in fonts\tfm\bitstream\cyberb (create this folder if necessary)
  5. Put the .enc files in pdftex/cyerb (create if necessary)
  6. Make sure the file ttf2tfm/base/ttfonts.map contains this line:
    cyberb@Unicode@ cyberbit.ttf
    
    (It does by default. If you cannot find the line in the file, add it at the end.)
  7. Download delloye.free.fr/cyberbit.map, rename it cyberb.map, replace cyberbit with cyberb, throughout the file, except for cyberbit.ttf, and place it in pdftex\cyberb
  8. Edit the file miktex\config\updmap.cfg and add the line
    Map cyberb.map
    
  9. Download c70cyberb.fd and put it in tex\latex\cjk\UTF8
  10. Run mkfntmap
  11. Run initexmf --update-fndb