[Tex/LaTex] Getting xeCJK package to work with MikTeX

cjkxecjkxetex

I am trying to write Chinese in LaTeX with MikTeX 2.9, and at the moment I am using fontspec, something like the below. However, I have heard good things about xeCJK, and I am considering switching to it instead (not least to improve the looks of punctuation), however, I can't get it to work.

This is a document that works right now

   \documentclass[12pt]{scrartcl}

    \usepackage{fontspec}
    \setmainfont{SimSun}
    %\usepackage{xeCJK}

    \begin{document}
    %\begin{CJK}{UTF8}{SimSun}
    你好
    %\end{CJK}
    \end{document}

, however this document

\documentclass[12pt]{scrartcl}

%\usepackage{fontspec}
%\setmainfont{SimSun}
\usepackage{xeCJK}

\begin{document}
\begin{CJK}{UTF8}{SimSun}
你好
\end{CJK}
\end{document}

gives an ! Undefined control sequence <argument> \tipaencoding error.

Can anyone help me figure out what I am doing wrong?

Best Answer

\begin{CJK}{UTF8}{SimSun} \end{CJK} is CJK, which is not inherited by xeCJK(see bilingual documentation). More better way to handle Chinese is using ctex

Try

% !TEX program = xelatex
% !Mode:: "TeX:UTF-8"
%Save as UTF-8, run xelatex.

\documentclass[12pt]{scrartcl}

\usepackage{xeCJK}
\setmainfont{Calibri}
\setCJKmainfont{宋体}

\begin{document}
Hello, 你好。

\end{document} 
Related Question