I followed the answers given in various related questions but none of them solve the problem of adding spaces in xeCJK package.

\int_step_inline:nnnn { "AC00 } {1} { "D7A3 } { \char_set_catcode_letter:n {#1} }


一 二 三 四 五


あ い う え お


일 이 삼 사 오


cjk.pdf output

None of the Chinese, Japanese, or Korean add any spaces.

the output is as follows:

xelatex cjk.tex
This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016) (preloaded format=xelatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 3 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
*** Reloading Xunicode for encoding 'EU1' ***
) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def)
* fontspec warning: "script-not-exist"
* Font 'Batang' does not contain script 'CJK'.
(./cjk.aux) (/usr/share/texlive/texmf-dist/tex/latex/tipa/t3cmr.fd) [1]
(./cjk.aux) )
Output written on cjk.pdf (1 page).
Transcript written on cjk.log.

Here are what I think are some relevant lines from cjk.log:

. Defining command \xeCJKShipoutHook with sig. '' on line 148.
. Defining command \normalspacedchars with sig. 'm' on line 618.
. Defining command \xeCJKOffVerbAddon with sig. '' on line 3443.
. Defining command \CJKspace with sig. '' on line 3753.
. Defining command \CJKnospace with sig. '' on line 3754.
. Redefining command \nobreakspace with sig. '' on line 3910.

I am using Fedora 27 texlive-2016 and other stock packages that come with the repo. What am I missing?

  • Have you tried with a different font? If I run your code I see spaces, but I don't have the Batang font so I have to comment out the \setCJKmainfont line. – erik Mar 29 '18 at 14:46
  • I just tried with the Batang font and I see spaces in the output. Can you post an image of your output? – erik Mar 29 '18 at 14:59
  • I tried all different combinations of the preamble lines to no avail. I haven't touched anything except US letter instead of A4 using texconfig-sys paper letter. – Yusuf N Mar 29 '18 at 15:39
  • Sorry but I can't reproduce the problem. My output has spaces. It also has spaces if I remove everything in the preamble except \usepackage[CJKspace]{xeCJK} and \setCJKmainfont{Batang}. Is your package up to date? – erik Mar 29 '18 at 15:52
  • Thank you erik for the informative answer. It definitely points to my own setup somehow. Now I have to figure out what is causing this. And it is up to date as of last night. – Yusuf N Mar 29 '18 at 16:02

I finally found an alternate solution: use kotex package instead of xeCJK. It works perfectly for all Chinese, Japanese, and Korean. How do I get Korean (Hangul) characters to typeset in LaTeX ?

It also works perfectly in lyx.

Here is an example how to do all CJK with spacing. I changed the last character of Chinese to show that it works with Chinese too. That character doesn't seem to exist in Korean hanja, so I just set its font to Chinese, and now it shows.


一 二 三 四 教


あ い う え お


일 이 삼 사 오


a b c d e
  • Wow, I didn't know Japanese also had characters that Korean and Chinese fonts don't include. I ended up mixing both xeCJK and kotex and now spacing works. I think it is a hack, but at least it works. – Yusuf N Mar 30 '18 at 0:11

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.