# Include Chinese characters into article in Xelatex

when I try to incorporate some Chinese characters into an article complied by Xelatex, something goes wrong. The Chinese characters don't show up. My code is as below,

\documentclass[12pt,a4paper]{article}
\usepackage{microtype}
\usepackage{sectsty}
\allsectionsfont{\centering}
\usepackage[english]{babel}
\usepackage{CJKutf8}
\usepackage{fontspec}

\begin{document}
\begin{CJK}{UTF8}{bkai}
\begin{titlepage}
\centering
{\Large  經濟系  \\
Department
\centering
\thispagestyle{empty}
\end{titlepage}
\end{CJK}
\end{document}


Thanks for any help!

• Missing character: There is no 經 in font [lmroman17-regular]:mapping=tex-text;!. (It's a bug / design flaw in (Xe)TeX that this is only logged to the log file, and cannot be made an error: see Getting xetex to complain when a character is missing.) You need to specify a font for those characters. (Also btw you have a missing }) – ShreevatsaR Jun 23 '17 at 6:19
• But how can I specify a font? – Carl Jun 23 '17 at 6:23
• Basically the CJKutf8 package is not meant for XeLaTeX. Either you can remove \fontspec and compile with pdflatex, or remove the CJKutf8 package and maybe use xeCJK. I can post an answer that seems to work for me, but as I can't read Chinese I'm not sure if it's right :-) Have you seen this question? – ShreevatsaR Jun 23 '17 at 6:41

The main problem in the above is that the CJKutf8 package (and babel) are meant for pdflatex, not xelatex. Here is an absolutely minimal way of using (occasional) Chinese characters in XeLaTeX:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\cjkfont{Noto Sans CJK SC} % Or any appropriate font you have
\begin{document}
{\cjkfont 經濟系} Department
\end{document}


This produces:

But if you're going to be writing a lot of Chinese you probably want to do a lot more, for which you can use the more sophisticated approaches described at the question How does one type Chinese in LaTeX?

• Thanks for your help. But it return an error, Undefined control sequence. \newfontfamily\cjkfont – Carl Jun 23 '17 at 7:12
• @ChYh Are you sure you compiled the same file as above, and with xelatex? The command \newfontfamily is defined by the package fontspec, so after \usepackage{fontspec} you shouldn't have any problem using it. – ShreevatsaR Jun 23 '17 at 15:22
• @ChYh Did it work? (If the above file doesn't compile you can edit the full output into the question.) – ShreevatsaR Jun 26 '17 at 3:23