How to make LaTeX (teTeX) handle unicode and CJK (in MacOS X)

The latest version of LaTeX (TexLive 2013 as of this writing) includes full support for unicode. You just need to use a few packages and macros and it will work. If you are running an older version, however, you may have to do a few tricks. They are included here for legacy purposes.

TeXLive 2013

here is what you can do:





\newcommand{\myfont}{bsmi} % or {stheiti}, etc



Your CJK text here



Before TeXLive 2013 (or 2011)

If you have an older version of TeX distribution that does not support
Unicode or CJK, I recommend XeTeX, which is more robust than many other
hacks, including some in the second half of this page. I would not recommend
the hacks unless (1) you have no choice but to run an even older version of
LaTex that needs to be retrofitted (2) you need to typeset CJK text
vertically. In these cases, you can follow the instructions below after the
XeTeX section.


XeTeX works with unicode and the PDF fonts on your system. If you use one of the existing setups, it is usually pretty easy, but you need to define the font name that is available on your system.



  • Depending on your platform, you need to set the main font names. For Roman text, you can do
    • \setmainfont{Times}
  • For CJK Text, you should pick a font name that is present on your system. This may lose cross-platform compatiblity but is easy to fix.
    • For Windows, you can use, for example,

      % for brush stroke on Windows

    • For MacOSX, the equivalent one would be

      % for brush stroke on MacOSX

    • Note: if you use STKaiti, some of your traditional characters (e.g., 角) might look wrong (i.e, with a 用 below)
  • For line breaking, do
    \XeTeXlinebreaklocale "zh"

    \XeTeXlinebreakskip = 0pt plus 1pt


This document assumes you know what LaTeX, pdflatex, etc. are, and want to typeset non-Roman text by hacking your existing installation without XeTeX. Another possible use is if you want to typeset CJK text vertically, XeTeX currently does not quite work, but the hacks here supports the CJKvert package. The steps here works on MacOSX and should work for other platforms, though I have no tested them.

  1. Installation of UCS Package
    • Download “ucs” package from :


      (actually you’ll get unicode.gtar)

    • uncompress/untar the file
    • move the whole “ucs” directory to an appropriate directory on your local

      TeX-tree (I move it to the path



    • Pai’s note: most of the time you need to sudo the
      command, if part of the path does not exist. for example, if you don’t have a “latex” directory along the path, then you may have to do this:

      sudo mkdir

      sudo mv
      ucs /usr/local/teTeX/share/texmf.local/tex/latex

  2. Installation of CJK Package
    • download “cjk” package from :


      (previously, it was http://cjk.ffii.org/cjk-4.5.2.tar.gz)

    • uncompress/untar the “cjk-4.8.1.tar.gz” file
    • move the whole directory to an appropriate directory on your local TeX-tree (I move it to the path



  3. Installation of Unicode True Type font (Cyberbit).
    1. download “Cyberbit.ZIP” file from :


      Actually there are several .zip files in that directory. uncompress them and you’ll get .ttf fonts. But I think all you need is just one.

      • Rename
        to lower case (cyberbit.ttf) or else LaTeX might get confused because it is case sensitive.
    2. Install the

      1. There are two ways to get those files:
        1. Generate the file yourself:
          • download “Unicode.sfd” file from :


          • make sure “Cyberbit.ttf” file and “Unicode.sfd” files are in the same directory
          • from the terminal, go to that directory and run

            -w [email protected]@

            , in order to create “.tfm” and “.enc” files.

        2. Download: If you cannot run

          you can download the




          files that I generated.
      2. move all the “.tfm” files to an appropriate directory on your local TeX-tree (I put them in I-



      3. move all the “.enc” files to an appropriate directory on your local

        TeX-tree (I put them in



    3. Install “cyberbit.map” file
      1. download from :
      2. move it to an appropriate directory on your local TeX-tree (I put it in



    4. Install “c70cyberbit.fd” (and optionally

      1. file from :


        Pai’s comment: If you want vertical typesetting, you need a file named
        — use this at your own risk! I basically pasted
        into the
        file to create it.

      2. move it (or both) to an appropriate directory on your local TeX-tree (I put it in



    5. move the “Cyberbit.ttf” (should be renamed
      — lower case!!) to an appropriate directory on your local TeX-tree

      (I put it in I-Installer:
      or Fink:

      Pai’s comment: The following should not be a concern, but if it doesn’t work:

      (check in your



      file the “%TrueType outline fonts” line and the “TTFONTS” value to make sure it includes the path where your
      file is located.)

  4. Declaration of the new font to pdfTeX
    1. open the “pdftex.cfg” file


      — though I think if you use Fink, you should use the alternative instruction in part
      instead) and add this line

      map +cyberbit.map

      at the end of the file.

      Note: You may have permission problems saving this file. If you know how to use the



      probably easier, or

      text editor from the command line, your best bet is to


      into that directory and

      sudo vi

      Otherwise, copy this file to a directory you can save, edit, and

      sudo mv

      it back to its directory.

    2. If you are running TeXLive 2004, you might have to do the following step:
      • (sudo) edit the file

        • add the following line

          Map cyberbit.map

          to the end of the file, save;

          If you are running Fink’s distribution, add
          Map Cyberbit.map
          to the file


      • type the command

        sudo updmap

        This should re-read all the map files and generate the output files for ps2pk, dvips, pdftex, dvipdfm and run texhash for you. (so you can skip step 4.c)

    3. Update the
      files by the command

      sudo mktexlsr

  5. Using the new environment in LaTeX

    You just need to include the three following lines in the preamble :




    TexLive 2004, use
    instead of

    It may also be convenient to create a new command :


    Now, when you want to type CJK text, you just have to use the command :

    \cntext{enter your CJK text here}

    To do vertical typesetting, just do


    and CJK characters will be rotated 90 degrees for the vertical orientation.

Pai’s comment: Make sure you use an editor such as TeXShop which can save in UTF-8 encoding. Vim also works if you do
:set encoding=utf-8
inside vim or in the file “.vimrc” (without colon).

The TrueType unicode font will be embedded for a very smooth looking PDF document.



  • Q:
    I get the error

    “mktexpk: don’t know how to create bitmap font for cyberbit59.” (or something like that)

    what do I do?

  • A:
    It is most likely your

    file was not
    correctly, or your


    file is not there. If you have another stale copy of
    in your current directory (or another directory searched before this one), then pdfTeX looks at it instead. To fix it, remove all stale copies of
    pdftex.cfg.By the way, “pk” files are for bitmap fonts, but cyberbit is a TrueType font. This is an indication that your TrueType font file was not found.

  • Q:
    I am running TeXLive 2004 but the truetype font can no longer be found, so it keeps trying to make pk font. How do I fix it?
  • A: You probably skipped the new step (4.b) above.
  • Then, just run xelatex instead of pdflatex and it will generate the PDF file.