Fonts & Character SetsProblems with Japanese Characters

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
yudantaiteki
Posts: 2
Joined: Sat May 19, 2012 4:16 am

Problems with Japanese Characters

Post by yudantaiteki »

Hi all,

I just started using LaTeX; I want to use it for my PhD thesis. I have a programming background so the basics aren't too bad; I've gotten the program configured and I can make basic documents with no problem. But I need to be able to write Japanese characters as well, and I'm having trouble making that work.

I'm using MiKTeX 2.9 on Windows 7. I can use Japanese input and viewing with no problem on Libre Office, Firefox, etc, and I can view PDF files with Japanese characters in Adobe Reader as well. I installed the cjk and cjk-fonts packages via MiKTeX Package Manager.

Here's an example I got from the web that I'm trying to use:

Code: Select all

\documentclass{article}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{mj}

おはよう % "Morning" in Japanese

{\CJKfamily{gbsn}早} % "Morning" in Chinese
\begin{CJK}{UTF8}{min}
露の世は 露の世ながら さりながら
\end{CJK}
\clearpage\end{CJK*}
\end{document}
In PDFLaTeX, this gives an error about not being able to find uwmj.cfg and that it can't find a font:

Code: Select all

! Font C70/mj/m/n/10/30=uwmj30 at 10.0pt not loadable: Metric (TFM) file not found.
In XeTeX, this compiles, but the PDF doesn't show the characters (either in Adobe or the included preview program). The text file seems to be encoded correctly since I can open it in Notepad and see the Japanese characters. I assume this is some sort of font problem; I know I have the MS Mincho font because I use that in Libre Office. Any advice?

(I've tried other text examples from other sites as well and I get the same result. If there are normal ASCII characters in the text they show up fine.)

EDIT: Some additional info that may be of use -- other special characters like accented letters show up fine (although for some reason the bibliography entries from Jabref don't display correctly).
Last edited by localghost on Sat May 19, 2012 10:04 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

yudantaiteki
Posts: 2
Joined: Sat May 19, 2012 4:16 am

Problems with Japanese Characters

Post by yudantaiteki »

OK, I fixed the problem...it was definitely a font problem (checking the log cleared that up). I just had to use fontspec and enter a real name, not just the "min" or "mj" stuff I was finding in the examples. Here's one that actually worked.

Code: Select all

\documentclass{article}
    \usepackage{CJK}
\usepackage{fontspec}
\setmainfont{MS Mincho}
    \begin{document}
    \begin{CJK}{UTF8}{MS Mincho}

    おはよう % "Morning" in Japanese

    \clearpage\end{CJK}
    \end{document}
Last edited by Stefan Kottwitz on Sat May 19, 2012 3:31 pm, edited 1 time in total.
Post Reply