Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
\setCJKmainfont{Adobe Heiti Std}
\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)?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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
\setCJKmainfont{Adobe Heiti Std}
\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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.