I have set my main font for xeCJK to HanWangMingMedium, so that I can access old style characters. But, as a result, I no longer have access to Japanese kana: in the MWE, the katakana comes up as white space:

enter image description here

The default xeCJK font doesn’t create this problem, but doesn’t give me certain characters that I need (like 烝). How do I change xeCJK fonts within the body of the document, and what is the default xeCJK font called?

Possibly relevant to an answer: I’m writing about writing systems. So, I only need isolated characters. I don’t have long sections of Chinese text.

% !TEX encoding = UTF-8 Unicode



Update. Here's a hack: pretend the alternative font is the sans serif variant. But I'd still like a proper solution.

% !TEX encoding = UTF-8 Unicode


東風\sf フォント.

  • By the way, \sf is obsolete and will clobber other font settings \sffamily or \textsf are preferable. (You would be better off defining a \newfontfamily or command with a name like \jp even if you did need a hack like this.) – Davislor Mar 18 '19 at 20:50

In babel, you can switch between different ideographic alphabets, including Japanese and traditional Chinese:

\documentclass{standalone} % Replace with the real class.

% A bug in Babel 3.22 requires setting the script= option to CJK and Kana,
% respectively.

\defaultfontfeatures{Scale = MatchUppercase}
\babelfont{rm}[Scale = 1.0,
               Ligatures = {Common, TeX},
               Language = Default
              ]{Latin Modern Roman}
\babelfont{sf}[Ligatures = {Common, TeX},
               Language = Default]{Latin Modern Sans}




Noto font sample

This requires XeLaTeX and babel 3.27 or higher. (With babel 3.22, you must manually set Script=CJK and Script=Kana to work around a bug.) I substituted the Noto CJK fonts.

A simpler option to Babel that doesn’t require you to write \otherlanguage all over the place would be ucharclasses. You could also declare a \newfontfamily, give it the [Script = Kana, Language = Japanese] options, and select that.

| improve this answer | |
  • Thanks for this. I thought that babel was meant for longer texts in foreign languages and that fontspec was meant for shorter script samples. Is that not the case? I see you've used both. – Daniel Harbour Mar 19 '19 at 6:39
  • 1
    You can use babel for short samples, too. The main thing babel provides in addition to fontspec is hyphenation patterns, so you don’t really need it here. I like the semantic markup of babel or polyglossia, and the latter doesn’t support the languages you want.. The \babelfont command is a wrapper for `fontspec. – Davislor Mar 19 '19 at 11:50

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.