This is not a bug.
xeCJK
treats ambigious punctuations as CJK punctuations. The ellipsis is treated as CJK punctuation thus it uses STSong font (华文宋体) and the following spaces are ignored.
You can use \ldots
, \dots
or \textellipsis
to get the proper ellipsis for western languages. (In fact xeCJK
patches theses macros specially using \makexeCJKinactive
.) Any of these should work well with xeCJK
:
This\dots that This, that
This\ldots that This, that
This\textellipsis that This, that
Alan's solution is also advisable, if you use only a small amount of CJK materials. It works, but the drawback is that you must specify a chinese
environment manually everywhere you use Chinese. And it also disables some functions of polyglossia
.
If you use only a few words of Chinese without long sentences, you don't need xeCJK
package. The special progress for CJK punctuations and spacing is overkill. xeCJK
is mainly designed for CJK documents with small amounts of other languages.
Similar punctuations includes the quotes “ ”
and ‘ ’
, you are supposed to use tradational TeX form `foo'
and ``foo''
.
Warning: xeCJK
is NOT supposed to be used together with polyglossia
. xeCJK
conflicts with polyglossia
since they both use \XeTeXinterchartoks
heavily, and I can't find a good way to let them work together.
xeCJK
has a \makexeCJKinactive
, but it does not help here. \makexeCJKinactive
simply sets \XeTeXinterchartokenstate=0
and then many of the functions of polyglossia
are also disabled. You should choose one of xeCJK
and polyglossia
.
If you decide to not to use xeCJK
, you can set:
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
and set the Chinese font manually everytime you use Chinese. It is very suitable for temporaryly typesetting a few Chinese words. And it is very safe. For example:
\documentclass{memoir}
\usepackage{polyglossia}
\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt minus 0.1pt
\newfontfamily\stsong{STSong}
\newcommand\chinese[1]{{\stsong #1}}
\setmainlanguage{french}
\setmainfont{TeX Gyre Pagella}
\begin{document}
This… that This,
that «Chinese» % automatic spacing after « and before » obtained by polyglossia
\chinese{汉字}. % Chinese as normal text
\end{document}
However, if you have some long Chinese texts, you should use xeCJK
for easier font switching and better puncuations. And if you use polyglossia
for French, punctuation progress by \french@punctuation
will be broken if you are not carefully. If you insist on using xeCJK
and polyglossia
together, use xeCJK
before polyglossia
. This might produce less errors, but I didn't make enough test, use it at your own risk.
\documentclass{memoir}
\usepackage{xeCJK}
\setCJKmainfont{STSong}
\usepackage{polyglossia} % It works fine only for simple text, but still dangerous
\setmainlanguage{french}
\setmainfont{TeX Gyre Pagella}
\begin{document}
This\ldots that This,
that «Chinese» % automatic spacing after « and before » obtained by polyglossia
文字. % Chinese handled by xeCJK
%%% Never use special puctuations handled by polyglossia together with CJK symbols!
%%% This shows a WRONG result, "文" is missing because of the « before it:
«文字»
\end{document}
Currently I am the active maintainer of xeCJK
. For any question about xeCJK
, you can email to me (leoliu.pku at gmail dot com) directly.
I'm sorry for the incompatibility of xeCJK
and polyglossia
. Maybe I'll add some commands to disable xeCJK
safely in future versions.
Well, you can freely use \setCJKfamilyfont
to define as many fonts as you need. And you can use \CJKfamily
to change the font. This is quite similar to the way you have used.
On the other hand, current xeCJK
does not have the ability to define different fonts for Chinese, Japanese and Korean individually. In fact, the three languages shares a lot of characters, and it is impossilbe to distinguish which language it is automatically.
An alternative solution is, use fallback
option of xeCJK
to define a main font (for Chinese & Japanese) and its fallback font (for Korean). For example,
\documentclass{article}
\usepackage[fallback]{xeCJK}[2011/05/01 v2.3.19]
% Fonts available on windows
\setCJKmainfont{SimSun}
\setCJKfallbackfamilyfont{\CJKrmdefault}{Batang}
\begin{document}
你好
こんにちは
여보세요
\end{document}
However, for serious typesetting, the result using fallback
font option is questionable. Some glyphs looks quite different among the three countries. A glyph in a Chinese font may be wrong in Korean or Japanese, and vice versa. Thus, a proper way is still change the font manually:
\documentclass{article}
\usepackage{xeCJK}[2011/05/20 v2.4.1]
\setCJKfamilyfont{zhrm}{SimSun}
\setCJKfamilyfont{jarm}{MS Mincho}
\setCJKfamilyfont{korm}{Batang}
\newcommand\Chinese{\CJKfamily{zhrm}\CJKnospace}
\newcommand\Japanese{\CJKfamily{jarm}\CJKnospace}
\newcommand\Korean{\CJKfamily{korm}\CJKspace}
\begin{document}
{\Chinese 你好}
{\Japanese こんにちは}
{\Korean 여보세요}
\end{document}
Update
For newer xeCJK
(ver 3.x), you can set different fonts for different sub CJK blocks:
\documentclass{article}
\usepackage{xeCJK}[2012/04/08 v3.0.0]
\xeCJKDeclareSubCJKBlock{Kana}{"3040 -> "309F, "30A0 -> "30FF, "31F0 -> "31FF, "1B000 -> "1B0FF}
\xeCJKDeclareSubCJKBlock{Hangul}{"1100 -> "11FF, "3130 -> "318F, "A960 -> "A97F, "AC00 -> "D7AF, "D7B0 -> "D7FF}
\setCJKmainfont{SimSun}
\setCJKmainfont[Kana]{MS Mincho}
\setCJKmainfont[Hangul]{Batang}
\begin{document}
你好
こんにちは
여보세요
\end{document}
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