TeX Live/CJK - ArchWiki

Jump to content

# TeX Live/CJK

From ArchWiki
< TeX Live

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:

- texlive-langchinese
- texlive-langjapanese
- texlive-langkorean

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

This article or section needs expansion.

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:

- https://overleaf.com/learn/latex/Chinese
- https://overleaf.com/learn/latex/Japanese
- https://overleaf.com/learn/latex/Korean

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 some 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
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-doc. 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`.

#### ctexhook.sty not found

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

    ! LaTeX Error: File `ctexhook.sty' not found.

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.

#### luatexja.sty not found

The following error may be encountered when compiling a Chinese or Korean document with a `ctex` document class:

    ! LaTeX Error: File `luatexja.sty' not found.

Install the texlive-langjapanese package to obtain `luatexja.sty`. This is required even for non-Japanese typeset documents.

#### Resource problems with large fonts

When using large fonts like those from noto-fonts-cjk, document compilation can be resource intensive and time consuming due to font cache generation. Subsequent compilations should be much quicker though. One possible workaround (besides using a smaller font) is to trim the font by removing glyph names. Bear in mind that doing this may have consequences.

## See also

- Wikibooks:LaTeX/Special Characters
- Wikibooks:LaTeX/Internationalization#Chinese
- Wikibooks:LaTeX/Internationalization#Japanese
- Wikibooks:LaTeX/Internationalization#Korean

Category:

- TeX

Hidden category:

- Pages or sections flagged with Template:Expansion

TeX Live/CJK
Add topic