1

It is possible to process Chinese, Japanese and Korean text using the xeCJK package or the xtexart document class, as shown in the Q&A “How does one type Chinese in LaTeX?”.

But why are these steps necessary? That is to say, how is CJK handled differently from the latin alphabet, considering that xetex supports Unicode, and that there are numerous Chinese fonts available?

Given the following example (to be compiled with xelatex), why is there (simplified and traditional) Chinese output, whereas there’s only a blank page when xeCJK is removed?

\documentclass{article}
\usepackage{xeCJK}
\begin{document}
国國
\end{document}
  • 1
    Because the default font (Latin Modern) doesn't have support for Chinese? – Torbjørn T. Aug 22 '17 at 12:54
  • Even the (extended) Latin alphabets don't work out of the box. For example \documentclass{article} \begin{document} château \end{document} misses the Unicode character â. In this case fontspec is required: \documentclass{article} \usepackage{fontspec} \begin{document} château \end{document}. – Nicola Talbot Aug 22 '17 at 13:00
  • 1
    You are both absolutely right. Removing xeCJK and specifying a Chinese font with polyglossia works fine. I didn’t consider that it could simply be a matter of the standard font. – Philipp Aug 22 '17 at 13:03
  • @NicolaTalbot When I compile your example without fontspec, the character â is processed correctly, though. (xelatex on linux). – Philipp Aug 22 '17 at 13:18
  • Okay, I figured out the easiest way to achieve what I’d like to do is to define \newfontfamily\CJK[]{Source Han Sans} and use it by invoking `{\chin my text} inside the document. This is described here. – Philipp Aug 22 '17 at 13:31
4

Without xeCJK, the default Latin Modern font is used, and this does not have support for CJK glyphs. (Unsurprisingly perhaps, given the name.)

Hence, if you set a default font that does have support for these characters (which is part of what xeCJK does), you do get something. For example:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Noto Sans CJK SC}
\begin{document}
国國
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.