8

In an article mostly in English in one quotation there are a few words in Chinese characters. Using the xecjk package for xelatex they mostly get displayed, but two of the word contain characters getting replaced by an F in a box. Now not knowing Chinese I don't really understand how to proceed, maybe change the font, or maybe do something about the characters? The default font seems to be Fandol, but I'm getting a message of it missing CJK script, although I'd guess that's not really related to my problem:

*************************************************
* fontspec warning: "script-not-exist"
* 
* Font 'FandolSong-Regular' does not contain script 'CJK'.
*************************************************

Anyway, here my example:

\documentclass{article}
\usepackage{fontspec}
\usepackage{xeCJK}
%\setCJKmainfont{SimSun}%this font is not installed, but it seems xeCJK happily uses a default.
\begin{document}
This is a document mostly in English, but containing a few words in Chinese characters.

大豊饒諸衆善法

瞋怒
\end{document}

Compiling to:

Chinese characters sample

2
  • I cannot tell why the default font misses that two characters. If there are less than, say, 100 characters, use CJK package with LaTeX is good enough. By good enough I mean that it is packed with several default font for traditional and simplified characters.
    – Symbol 1
    Oct 13, 2015 at 11:12
  • If it really is a matter of a few charackter, you might consider just including a screenshot of the word. Not really pretty, but it might do.
    – Johannes_B
    Oct 13, 2015 at 11:21

1 Answer 1

8

The characters 豊 and 瞋 are rather uncommon in everyday use so I guess that's why they are not included in the default font. You need to pick a font that has these two characters. Personally I prefer Microsoft JhengHei for traditional Chinese and Microsoft YaHei for simplified, these two fonts should be available if you are using Windows.

\documentclass{article}
\usepackage{fontspec}
\usepackage{xeCJK}

\setCJKmainfont{Microsoft JhengHei UI}

\setCJKfamilyfont{YaHei}{Microsoft YaHei UI}

\begin{document}
    This is a document mostly in English, but containing a few words in Chinese characters.

    大豊饒諸衆善法

    瞋怒

\CJKfamily{YaHei}

    大豊饒諸衆善法

    瞋怒
\end{document}

enter image description here

8
  • I'm on Ubuntu. I'd like to use a font under a free license, preferably included with TeX Live or Ubuntu. Any suggestion?
    – muk.li
    Oct 13, 2015 at 12:07
  • @muk.li I don't use Ubuntu so I am not sure what fonts are available. From a quick search it seems WenQuanYi Micro Hei should work. See: en.wikipedia.org/wiki/WenQuanYi
    – Francis
    Oct 13, 2015 at 12:09
  • 2
    @muk.li BTW, the sentence you used seems from 大藏經, in that case 豊饒 should actually be 豐饒. Note 豊 and 豐 are not the same.
    – Francis
    Oct 13, 2015 at 12:16
  • Wiktionary tells me it's a simplified Japanese character, which indeed seems strange for an 8th century Buddhist text. I'll check that, thanks.
    – muk.li
    Oct 13, 2015 at 12:30
  • 2
    Looks like \setCJKmainfont{AR PL UMing CN} gives good results.
    – muk.li
    Oct 13, 2015 at 15:48

You must log in to answer this question.

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