3

I am using xeCJK for Chinese document typefacing on Ubuntu 14.04. I use: texmaker 4.4.1, included fontspec package. I complied using XeLatex and in general have little problem over the last 2-3 years.

Problem compiling a small number of chinese characters. Example: 為 complies fine but 爲 will give me a  in the pdf. Any advice?

Currently, I have to do a search for 爲 through my various tex documents to replace it with 為 to ensure that I do not get a  in my pdf output.

Does anyone has any clue why this is so? How could I overcome the problem?

\documentclass[a4paper, 11pt]{memoir}
%**********************SUPPRESS PAGE NBR
%\pagenumbering{gobble}
\renewcommand{\contentsname}{目錄}
\renewcommand{\chaptername}{章}
\newcommand{\CCC}[1]{天主教教理, {#1}}
\newcommand{\DV}[1]{『天主的啟示』教義憲章, {#1}}
\newcommand{\STH}[3]{『神學大全』,第{#1}冊,第{#2}題,第{#3}節}
%**********************
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{url}
%\usepackage{qtree}
\usepackage[framemethod=default]{mdframed}
\usepackage{pdfpages}
\usepackage{xcolor}
\usepackage{fontspec}
\usepackage{textcomp}
\usepackage{bbding}
\usepackage{dingbat}
\usepackage{tabularx}
\usepackage{centernot}
%\usepackage{endnotes}
%\let\footnote=\endnote
\usepackage[backend=biber,backref=true,hyperref=true,citestyle=numeric,bibstyle=authortitle]{biblatex}
%****************************************
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%check mark; right 
\newcommand{\xmark}{\ding{55}}%cross mark; wrong
%****************************************
%**************************************INSERT COMMENT NOTES
%\usepackage[disable]{todonotes} %HIDE REMARKS
\usepackage[draft,linecolor=green!70!white, backgroundcolor=blue!20!white, bordercolor=red]{todonotes} %SHOW REMARKS
%YOU CAN INSERT A LAST LINE AT THE END OF THE DOCUMENT \listoftodos
%**************************************
\usepackage[BoldFont,SlantFont,CJKnumber,fallback]{xeCJK}
\usepackage{soul, color}
\setmainfont{Ubuntu}
\setromanfont{Liberation Sans}
\setmonofont{Liberation Mono}
%\chapterstyle{section} 
\chapterstyle{demo} 
%% list Chinese fonts: "fc-list :lang=zh"
%\setCJKmainfont{WenQuanYi Zen Hei}
%\setCJKmainfont{AR PL UMing TW}
%\setCJKsansfont{AR PL UKai TW}
%\setCJKmainfont{PMingLiU}
\setCJKmainfont{AR PL UKai TW}
%\setCJKmainfont{AR PL KaitiM Big5}
\setlength{\textheight}{8.5in} %A4
\setlength{\textwidth}{5.8in} %A4
%\setlength{\textheight}{5.75in} %A5
%\setlength{\textwidth}{4.2in} %A5
\CJKsetecglue{\hspace{2mm}}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

\newcommand{\notarrow}{$\centernot\Longrightarrow$}

\mdfdefinestyle{textbox01}{%
rightline=true,innerleftmargin=10,innerrightmargin=10,
frametitlerule=true,linecolor=blue, linewidth=3pt, frametitlerulecolor=blue,
frametitlebackgroundcolor=white,
frametitlerulewidth=3pt}

%****************************************
%****************************************

%***********************************************
\begin{document}
%***********************************************
\author{林微微}
\title{2015-6進修班}
\date{2013年9月30日}
\maketitle
%**********************************************
為 % ok -- properly compiled

爲 % NOT ok -- render a  in the pdf
%**********************************************
\end{document}
0

1 Answer 1

2

The character is not in AR PL UKai TW and indeed xeCJK warns you about it:

*************************************************
* xeCJK warning: "missing-glyph"
* 
* CJKfamily `\CJKrmdefault' (AR PL UKai TW) does not contain glyph `爲'
* (U+7232).
* 
*************************************************

If you want to automatically substitute the missing character with , you can use newunicodechar:

\documentclass[a4paper, 11pt]{memoir}

\usepackage[BoldFont,SlantFont,CJKnumber,fallback]{xeCJK}
\usepackage{newunicodechar}

\setCJKmainfont{AR PL UKai TW}
\CJKsetecglue{\hspace{2mm}}

\newunicodechar{爲}{為}

\XeTeXlinebreaklocale "zh"
\XeTeXlinebreakskip = 0pt plus 1pt

\begin{document}
為 % ok -- properly compiled

爲 % ok -- renders 為 in the pdf
\end{document}

enter image description here

1
  • 1
    There should be a better method, but unfortunately the documentation of xeCJK is only in Chinese.
    – egreg
    Aug 17, 2015 at 10:21

You must log in to answer this question.

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