Fonts & Character SetsChinese Characters

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
mdk31
Posts: 20
Joined: Wed Mar 11, 2009 4:38 am

Chinese Characters

Post by mdk31 »

Hi,

I'm compiling on MacTex and I'm having a terrible time trying to get Chinese characters to display.

I have:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{bsmi}
\end{CJK}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
But when I run pdflatex, I just get question marks in the pdf.

Thanks in advance for any assistance.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Chinese Characters

Post by shadgrind »

I copied and pasted your code into Emacs then ran pdflatex on it, and the Chinese characters displayed correctly in Acrobat Reader. This was using TeX Live 2010 in Linux.

The only thing I can think of is that perhaps your source file is not being saved with UTF-8 encoding. This is what I get when running the 'file' command on the source file:

Code: Select all

$ file chinese.tex
chinese.tex: LaTeX 2e document, UTF-8 Unicode text
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
You should be able to do that in OS X. If it shows some other encoding besides UTF-8, then there's your problem. Some text editors have a hard time with Unicode, but Emacs handles it just fine.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
mdk31
Posts: 20
Joined: Wed Mar 11, 2009 4:38 am

Re: Chinese Characters

Post by mdk31 »

I wonder if the problem is with TeXShop. Whenever I type in Chinese characters and save the file, when I try to open it up again, question marks appear. Do you know away around this, other than just using a different editor?
mdk31
Posts: 20
Joined: Wed Mar 11, 2009 4:38 am

Re: Chinese Characters

Post by mdk31 »

Yeah, it's just TeXShop, since it compiles fine in TexWorks.

This may seem like a trivial point, but does anyone know why this is? I like using TeXShop more. :)
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Re: Chinese Characters

Post by shadgrind »

There should be a setting in the Preferences menu in TeXShop that sets the default save/read for new files as UTF-8.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
mdk31
Posts: 20
Joined: Wed Mar 11, 2009 4:38 am

Chinese Characters

Post by mdk31 »

Now I'm having a new issue. Certain characters won't display. Here is my code:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK}{UTF8}{bsmi}
\end{CJK}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
But only the first two characters appear in the pdf file.
User avatar
shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

Re: Chinese Characters

Post by shadgrind »

I got the same thing. Looking in the log file I saw two messages about missing characters in the bsmi fonts. So in the \begin{CJK} command I changed the {bsmi} option to {gbsn}, and then all the characters showed up in the PDF file.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
Post Reply