Adding support for ideographic languages is quite tricky. However, once you are done with it, it will work quite well. Other than installing packages, there is some extra configuration work to do.
Tip
Your Linux® distribution might already have a CJK (Chinese, Japanese, Korean) package ready for you, so you might be saved the hassle of manually installing everything. Do check before going forward!
There is the possibility of using the ucs package in order to write short snippets of CJK text, but that option is seriously limited as it does not handle, among other things, newlines. Instead, we will install the complete CJK-LATEX package and make it work for both LATEX and PDFLATEX. A lot of this material has been inspired by Pai H. Chou's page about how to setup PDFLATEX.
Download the CJK package. Copy its unpacked files to an appropriate subfolder of $
TEXMF, just like you did with the ucs package before (see The ucs Package). The files will be unpacked in aCJK/X_Y.Zfolder; it is not important that you take them out, though it will probably be tidier and easier for you to maintain.Now you have to download a font that supports all the CJK characters you need. You can choose any
*.ttffile that covers them, but in this walkthrough we will use Cyberbit. Unzip the file and renameCyberbit.ttftocyberbit.ttf, since uppercase might confuse your system.Place
cyberbit.ttfin a folder together withUnicode.sfd, and generate the*.tfmand*.encfiles with the command$ ttf2tfm cyberbit.ttf -w cyberbit@Unicode@. For some reasons, sometimes this does not produce the hundreds of files it should. Should that be your case, you can download both*.tfmand*.encfiles.Place the
*.tfmfiles in an appropriate folder, say$; theTEXMF/fonts/tfm/bitstream/cyberbit/*.encfiles may be installed in$.TEXMF/pdftex/enc/cyberbit/Now we need a map file to connect the
*.encfiles to the font. Downloadcyberbit.mapand install it in$.TEXMF/pdftex/config/Download another file,
c70cyberbit.fd, and place it in an appropriate folder. You may choose, for example,$.TEXMF/tex/misc/The last file we have to generate is a PostScript® Type 1 font, necessary to read DVI files generated with LATEX. Run the command
$ ttf2pfb cyberbit.ttf -o cyberbit.pfb, and copy the resultingcyberbit.pfbin a folder like$.TEXMF/fonts/type1/cyberbit/Let's now place
cyberbit.ttfamong the fonts where LATEX can find it. You could place it in a folder named$.TEXMF/fonts/truetype/Check the configuration file you find at
$, and make sure that the line mentioningTEXMF/web2c/texmf.cnfTTFONTSis uncommented and points to the folder where you savedcyberbit.ttf.To make it possible for PDFLATEX to use your CJK fonts, it is necessary that you add a line in configuration file
$. AddTEXMF/pdftex/config/pdftex.cfgmap +cyberbit.mapin the file to complete the configuration for PDFLATEX.To configure LATEX so that you can produce DVI files with CJK characters, you have to add a line in file
ttfonts.map. The file might be in a folder named$, but you will probably have to look for it. Append the lineTEXMF/ttf2pk/cyberbit@Unicode@ cyberbit.ttfto it.Now, you only have to run
texhashand the system should be ready.
To test whether your configuration is correct, you can try to compile this test file.
There are many things that can go wrong when setting CJK support manually. If something seems not to work, the following checklist might help you.
Obviously, since you run LATEX as a user and not as root, you must allow ordinary users to access the new files. Make sure all folders and files are accessible using the chmod command.
If LATEX writes a DVI without problems, but you cannot view it, it is almost certainly because of some problems in the automatic generation of
*.pkfonts. They are supposed to be generated on the fly when viewing a DVI file, but this might fail for a number of reasons: double-checkttfonts.mapfor your custom line first. However, it might happen that your ttf2pk command, which is usually invoked by the DVI viewer, has been compiled without support for the kpathsea libraries. If this is the case,ttf2pkwill make no mention of kpathsea. As support for these libraries is necessary, you might have to find a new package, or recompile FreeType 1 by yourself.--version
There are a number of different input engines, and the choice can
depend also on personal preference. The author uses Skim,
a port to KDE of the Scim
engine. Refer to your distribution's documentation to learn how to
install these programs. Configuration of such programs can be tricky
too, in the case of Skim you will have to
define an environment variable
before starting X.XMODIFIERS="@im=SCIM"