2

I posted this question in stack overflow, but didn't get an answer, I'm trying here to see if I have better luck.

I'm trying to include some Chinese characters in a LaTeX document. I've tried several methods suggested on the web (CJK, XeLaTeX, etc.) and the best results are that some characters are correctly displayed whereas others are replaced by symbols. This is a minimal working example:

% !TEX program = XeLaTeX
% !TEX encoding = UTF-16
\documentclass[UTF8,nofonts]{ctexart}
\setCJKmainfont[BoldFont=FandolSong-Bold.otf,ItalicFont=FandolKai-Regular.otf]{FandolSong-Regular.otf}
\setCJKsansfont[BoldFont=FandolHei-Bold.otf]{FandolHei-Regular.otf}
\setCJKmonofont{FandolFang-Regular.otf}

\begin{document} 
 Honshu He (红水河) 
 Yongbei (邕北) 
\end{document}

This yields this output (copied from the resulting PDF file):

Honshu He (7EA2??) Yongbei (9095?)

Another minimal example with xeCJK (the results ore similar to those using CJK):

\documentclass[UTF8, nofonts, mathptmx, 12pt, onecolumn]{article}
\usepackage{xeCJK}
\setCJKmainfont{SimSun}
\begin{document} 
 Honshu He (红水河) 
 Yongbei (邕北) 
\end{document}

This time the output is better:

Honshu He (7EA2 水河) Yongbei (9095 北)

I'm in a Mac OS 10.9.5, running TeXLive2-14 (Intel 64), and using TeXShop Version 3.48.1 as the editor. I'm running out of ideas on how to make this work, and your help is greatly appreciated.

  • Welcome to TeX.SX! Does tex.stackexchange.com/q/53599/15925 help? – Andrew Swann Dec 11 '14 at 11:27
  • Both examples work fine on my computer, except that I don't use %!TEX encoding = UTF-16 but UTF-8 encoding. – Leo Liu Dec 11 '14 at 14:19
  • Hi Andrew, thank you. I tried that too but I got the same result. – julovi Dec 12 '14 at 3:29
  • Leo, thank you for your answer, may I ask you if you're on a Mac box? if so, did you install any fonts? – julovi Dec 12 '14 at 3:30
  • @julovi: I don't use Mac, sorry. – Leo Liu Dec 15 '14 at 9:35
1

This is OS X 10.9.5, MacTeX 2014, TeXshop 3.36.1.

I tested both of your MEW, and both of them worked well on my Mac. Please check the following list:

  • Your manuscript is stored as UTF-8 encoding;
  • You are using XeLaTeX as compiler;
  • Fandol series and SimSun could be found in the Font Book (字体册).

Be aware that fonts that were installed by MacTeX are not loaded by the Font Book automatically. That is, if you want to use these fonts, for example the Fandol series, you'll have to make hard links for those fonts to ~/Library/Fonts/font-filename.

  • The problem was that the manuscript wasn't being saved in UTF-8, although the Texshop settings were saying so, I openend the file in textwrangler and found that it was being saved as Western (Mac OS Roman). Thank you Ch'en Meng for your answer! – julovi Jan 9 '15 at 5:54
  • @julovi That's my pleasure. Congs and happy TeXing! – Ch'en Meng Jan 9 '15 at 7:32

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.