# TeX Live/CJK

A guide for typesetting Chinese, Japanese, and Korean documents with TeX Live.

## Installation

Language-specific fonts and macro packages are made available by installing the appropriate package(s) from the texlive-lang group:

Other fonts can be installed through methods outlined in Fonts#Installation. You may also be interested in making Tex Live fonts available to Fontconfig (but this is not strictly necessary).

Users of poppler-based PDF viewers like Evince should install poppler-data as an additional dependency to properly display PDF documents containing CJK characters. (This appears unnecessary if CJK fonts from noto-fonts-cjk are used.)

Needless to say, your locale should have a character encoding that can deal with special characters (such as UTF-8) and you should also have an input method editor installed. The (Simplified/Traditional) Chinese, Japanese, and Korean subpages of Localization also contain information pertaining to locales and fonts.

## Typesetting

Reason: The texlive-langkorean package provides some of the packages from the ko.TeX bundle, "a comprehensive Korean typesetting system together with packages kotex-oblivoir, kotex-plain, kotex-utils, cjk-ko, xetexko, and luaxexko" [1]. ko.TeX is not mentioned in the Korean Overleaf article, so a section for it here could be nice. It is, however, briefly mentioned by the Wikibooks:LaTeX/Internationalization#Korean link from #See also. (Discuss in Talk:TeX Live/CJK#)

Overleaf's online documentation has articles covering different methods for CJK typesetting that are also applicable to TeX Live installations on Arch Linux:

Warning: The CJK and CJKutf8 macro packages (of which the former provides the latter) are in maintenance mode and obsolete. If possible, use "recent TeX engines like luatex, XeTeX or upTeX (which are all part of TeXLive)" instead.

### Fonts

A table of the font families/files mentioned in the Overleaf articles, and their respective packages can be found below:

Language Font family/file Package
Chinese BabelStone Han ttf-babelstone-hanAUR
Japanese IPAMincho otf-ipafont
IPAGothic
TakaoMincho otf-takaoAUR
TakaoGothic
Komatuna ttf-komatunaAUR
Korean UnGungseo.ttf texlive-langkorean
gulim.ttf

You can set fonts with \setCJKtypefont{font} when using ctex or xeCJK. (\settypejfont{font} can be used with the pTeX engine.) type can take on the values of main, sans, and mono. font is the font family for user/system fonts and the font file for TeX Live fonts.

### pTeX engine

Overleaf's Japanese#The pTeX engine provides a latexmkrc file that is meant to be used with the latemk utility from texlive-core. Running latexmk on Arch Linux without any arguments will only produce a DVI file from the example document. Use the -pdfdvi option to also produce a PDF file from the DVI file. See latexmk(1) or latexmk -help for more information.

As briefly mentioned in the Overleaf article, upLaTeX (similarly to pLaTeX) "provides pLaTeX2ε macros for upTeX", a "Unicode version of pTeX".

## Troubleshooting

### CTeX-kit

Solutions to common problems when using a CTeX-kit collection/package like ctex or xeCJK.

The following error may be encountered when compiling a Japanese or Korean document:

Install the texlive-langchinese package to obtain ctexhook.sty. This is required even for non-Chinese typeset documents.

#### Missing or inconsistent fonts

Japanese or Korean PDF documents may have missing characters or inconsistent font weights. When no CJK font is specified, the default font Fandol will be used. However, Fandol is "designed for Chinese typesetting" and thus unsuitable for Japanese and Korean. Explicitly set a Japanese or Korean font to avoid this issue.

### LuaLaTeX

Solutions to common problems when using LuaLaTeX to compile documents.