[Tex/LaTex] How to write spaces between Korean words with XeCJK

cjkspacingxecjk

I'm just trying to get LaTeX output spaces between Korean words.
At the moment all it can do is to give long chains of syllables just like
in Chinese or in Japanese, ignoring all the spaces I set.

Here is the code:

\documentclass[12pt]{scrartcl} 
\usepackage[boldfont,slantfont]{xeCJK} 
\usepackage{xunicode,xltxtra}
\usepackage{gb4e}

\setCJKmainfont{Batang} % for \rmfamily 

\begin{document}
좋은 아침입니다! 안녕하세요, 저의 이름은 김 입니다.%"Good Morning! My Name is Kim." in Korean
\end{document}

The text output is just like: 좋은아침입니다! 안녕하세요, 저의이름은김입니다. So, spaces will only be processed after punctuation marks.

I know I'm doing something wrong, but I can't tell what exactly.

Best Answer

Quick fix:

\makeatletter
\let\xeCJK@ignorespaces\relax
\makeatother

In xeCJK 2.4.1 (2011/05/20), you can use:

\usepackage[space]{xeCJK}
\renewcommand\CJKglue{}% get proper linebreaking if spaces are provided

or use \CJKspace to allow spaces between CJK charecters.

Before the new xeCJK updated to CTAN, you can always get the latest code through SVN:

http://code.google.com/p/ctex-kit/source/checkout