# TeXing special japanese characters

I want to TeX the Japanese characters 因子の部屋 (lit. "factor rooms"). How do I do that with LaTeX?

The simplest way with the pdflatex engine is

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{CJKutf8}
\begin{document}

\begin{CJK}{UTF8}{min}因子の部屋\end{CJK}

\end{document}


If you want an abbreviated command for typesetting Japanese fragments, then put this in the preamble

\newcommand{\textnihon}{\begin{CJK}{UTF8}{min}\nihon}
\newcommand{\nihon}[1]{#1\end{CJK}}


Now

\textnihon{因子の部屋}


will typeset the fragment.

Another way to cope with the problem is to switch to XeLaTeX or LuaLaTeX; with one of these engines, the document

\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\nihon}{Hiragino Mincho Pro}
\newcommand{\textnihon}[1]{{\nihon#1}}

\begin{document}
This is a Japanese fragment: \textnihon{因子の部屋}
\end{document}


In place of "Hiragino Mincho Pro" you'll need to use a Japanese font present on your system.

• inputenc package with utf8 option is not useful. I'm not sure if it is harmful. Oct 16 '11 at 2:41
• I thought if inputenc is used with utf8 option, and the file is saved in UTF8 encoding, then the CJKutf8 package should be loaded instead of CJK. Oct 16 '11 at 6:34