I've recently started to use LaTeX but I've just encountered a problem, I tried searching it, although apparently no-one asked it before.
I'd like to write using Japanese input, but when I typeset, there can happen 3 things:
- I get some error when compiling;
- I get question marks where Japanese stuff should appear;
- Nothing appears.
For example I had an example .tex file, compiled it and it worked, so I added some japanese in order to see "The author is [Japanese here]", but what I could see was "The author is [blank space]".
I've tried checking some guides, but I haven't found anything that could solve my problem (they are too old, or they don't talk about this at all).
Some minutes ago I tried compiling this:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8}
\usepackage[romanian]{babel}
\usepackage[overlap, CJK]{ruby}
\usepackage{CJKulem}
\renewcommand{\rubysep}{-0.2ex}
\newenvironment{Japanese}{%
\CJKfamily{min}%
\CJKtilde
\CJKnospace}{}
\begin{document}
\parskip 3ex
\parindent 0pt
\begin{CJK}{UTF8}{}
\begin{Japanese}
ねこ
\end{Japanese}
\end{CJK}
\end{document}
It compiles fine but, still same problem, nothing appears when typeset, even if I should see "ねこ". There are many Linux guides, but I have a Mac and apparently, there aren't a lot around…
EDIT: A small add, if I get this to work, is the solution related to other asian languages such as Korean or Chinese?
Best Answer
1. XeLaTeX
For XeLaTeX, the document should be saved in UTF-8 encoding.
1.1.
xeCJK
packageI advice you to use XeLaTeX with package
xeCJK
. An example:See manual of
xeCJK
andfontspec
for more information.Chinese and Korean work the same. In fact,
xeCJK
is originally designed for Chinese by Prof. 孙文昌.xeCJK
: http://mirrors.ctan.org/macros/xetex/latex/xecjk/xeCJK.pdffontspec
: http://mirrors.ctan.org/macros/latex/contrib/fontspec/fontspec.pdf1.2.
zxjatype
packagezxjatype
internally callsxeCJK
, with some configurations for Japanese. You can also usezxjafont
package to use some predefined fonts. It is easier to use compared to rawxeCJK
. An example:zxjatype
: http://zrbabbler.sp.land.to/zxjatype.html1.3.
bxjsclasses
withzxjatype
bxjsclasses
bundle provides some Japanese local classes. It can be used with different TeX engines.2. LuaLaTeX
For LuaLaTeX, the document should be saved in UTF-8 encoding.
2.1.
luatexja-fontspec
package inluatexja
bundleluatexja
bundle provides Japanese support for LuaTeX. A simple LaTeX example:2.2.
ltjsclasses
classes inluatexja
bundleltjsclasses
provides some Japanese document classes for convenience. An example:3. upLaTeX +
ujclasses
upLaTeX is a Japanese TeX format. It needs UTF-8 encoding.
An example:
Compile with
4. pLaTeX +
jsclasses
(Relatively Old)pLaTeX is a Japanese TeX format. Documents should be saved in SJIS encoding. Documentation in English is available here.
An example:
Compile with
or
5.
CJK
package (Obsolete)Older
CJK
package is still useful. It works well with PDFLaTeX and LaTeX (Dvips, dvipdfmx). If the document has only a few wide characters,CJK
package may be a reasonable choice with better compatibility.Be sure you have installed the proper CJK fonts for
CJK
package. Typically, this is not done. TeX Live and MiKTeX have awadalab
package, install it when necessary. (Alsoipaex
andipaex-type1
) Then you can use:See
$TEXMF/tex/latex/cjk/texinput/UTF8/c70*.fd
,$TEXMF/tex/latex/cjk/contrib/wadalab/c70*.fd
, etc. for pre-installed CJK font families. Frankly speaking, these free Type1 CJK fonts are not very good. It is better to install the fonts yourself.