I would like to move from p(La)TeX (which was a TeX system specifically tailored to Japanese in a pre-Unicode era) to Xe(La)TeX, and I'm having a problem.

In p(La)TeX, Japanese fonts are only used for non-ASCII characters, and ASCII characters are typeset in Computer Modern, or Times, etc just as in the standard TeX.

I would like to have something similar in Xe(La)TeX. In other words, I would like to have Xe(La)TeX to use different fonts depending on Unicode blocks, say CJK Unified Ideographs or Ethiopic or Cuneiform, see the list here.

Is it possible with XeLaTeX and fontspec? Or do I have to hack the source code of XeTeX to do this?

(A very similar question is asked here, but let me ask it here again, hoping that the situation changed in the last six months.)

2 Answers 2


Just use xeCJK for Japanese. A simple example:

\setCJKmainfont{MS Mincho} % for \rmfamily
おはよう VS Good morning

See also:

How to write Japanese with LaTeX?

xeCJK handles automatic font switching, line breaking, punctuation and spacing between characters. It was originally designed for Chinese typesetting, but works fine for Japanese and Korean as far as I know.

Another package is fontwrap. It uses a Perl script to switch fonts for different Unicode blocks. Personally, I don't like it.

For CJK scripts, xeCJK is suitable. For languages other than east Asian languages, one should use the polyglossia package with XeLaTeX. polyglossia is a babel replacement for XeLaTeX, but font switching is not automatic. Note that xeCJK is not compatible with polyglossia; they both use the \XeTeXinterchartoks mechanism, but it is difficult to make them work together very well now. (At the moment, it doesn't work at all.)

  • @Alan: Thank you very much. Sorry for my poor English.
    – Leo Liu
    Jun 18, 2011 at 7:15
  • 1
    your English is fine. And your answers are great (as is all the work you do on xeCJK) so I'm happy to help out in this way.
    – Alan Munn
    Jun 18, 2011 at 13:50

For the sake of completeness I'd like to add an answer for the more general case of switching not only CJK unicode blocks but also other blocks (as the question implies).

You can use the package ucharclasses that is specifically designed for that. It also allows you to switch other scripts like Arabic, Devanagari or domino pieces. They way it does this also allows you to change typesetting from RTL to LTR and vice versa if one of the other scripts require that.

You can find the package here: http://www.ctan.org/tex-archive/macros/xetex/latex/ucharclasses


You must log in to answer this question.

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