(XeLaTeX + XeCJK)

I am trying to translate an English document. I need to convert all '.' to '。' if the antecedent character is a Chinese character. I am using xstring to accomplish this object but I have no idea of detecting whether a character is Chinese one or not.

How to solve it?

  • Is there a range of code points in Unicode reserved for Chinese characters? (And welcome to TeX.SX!) Jan 31, 2014 at 6:33
  • 2
    The CJK Unified Ideographs -block in Unicode is U+4E00 to U+9FCC (with extension blocks also U+20000-U+2FA10). You could maybe do something simple like \def\isCJK#1{\ifnum`#1>19968 is CJK\else not CJK\fi}.
    – morbusg
    Jan 31, 2014 at 6:41
  • @SeanAllred Yes. But I don't know how to get the unicode of a certain character. Maybe I should edit the question. Jan 31, 2014 at 6:42
  • @morbusg so \ifnum works for a character? Thanks. I am a starter of XeLaTeX. Jan 31, 2014 at 6:43
  • @user1526408: Note the backtick right after \ifnum, that is the thing that converts the character into its code point in base-10.
    – morbusg
    Jan 31, 2014 at 6:52

1 Answer 1


Although it is possible to impletment it in xeCJK, using \XeTeXinterchartoks, I think it is much easier to solve the problem without TeX.

Say, you can search and replace the text in the editor. For example, in VIM, use


to do the trick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .