5

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

1 Answer 1

8

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.

2
  • inputenc package with utf8 option is not useful. I'm not sure if it is harmful.
    – Leo Liu
    Oct 16, 2011 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.
    – imnothere
    Oct 16, 2011 at 6:34

You must log in to answer this question.

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