# Temporarily changing the spacing between Chinese text and numerals

When mixing Chinese text and non-math mode numbers together within a sentence, narrow numbers are given the same amount of space as characters:

\documentclass{article}
\usepackage{ctexcap}
\usepackage{fontspec}
\usepackage{xeCJK}
\begin{document}
第1号
\end{document}


In most situations, this appearance is probably ideal, however, in my case, I need to temporarily change this spacing, in a small number of instances. How can I force the characters to be printed closer to the "1" one has the same spacing it would have if it were placed among English text (with no spaces on either side)?

-
 – Leo Liu Dec 26 '11 at 15:31

You can use \CJKsetecglue to set the spaces between CJK symbols and western symbols. This is documented in xeCJK.

\documentclass{article}
\usepackage{ctexcap} % it will load xeCJK internally. Or just use ctexart instead of article
\CJKsetecglue{\hskip0.15em plus0.05em minus 0.05em}
\begin{document}
第1号
\end{document}


However, you must be careful when you use a \hskip other than normal inter-word space. \CJKsetecglue only sets the space between the two different character class in XeTeX. There are still many cases xeCJK cannot add sapces automatically.

For example,

汉字\mbox{abc}汉字 % no spaces added


You should add proper spacing (but not a space) yourself these cases.

-
 I don't want to change the spacing for the entire document, just in specific places. Is there a way to do this without changing all of the spacing everywhere? – Village Dec 15 '11 at 11:00 @Village: Just use \CJKsetecglue{...} in the group or envrionment you want. This is basic LaTeX usage like setting \rmfamily or redefining \arraystretch. – Leo Liu Dec 15 '11 at 13:44