Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

  1. I get some error when compiling;
  2. I get question marks where Japanese stuff should appear;
  3. 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?

share|improve this question
@Leo Liu, @Nyiti, @Bob BeckettGuys, I found out that probably it's a matter of encoding. If I write 丸 (example) I'll get nothing like I said but if I write ¥›, it will appear properly on pdf! :| – Alenanno Apr 13 '11 at 10:02

3 Answers

up vote 6 down vote accepted

This blog post outlines Chinese-Japanese-Korean support in LaTeX: link

This is a minimal working example:

\documentclass{memoir}

\usepackage{CJKutf8}

\begin{document}

\begin{CJK}{UTF8}{min}未練なく散も桜はさくら哉\end{CJK} \\
without regret \\
they fall and scatter\ldots \\
cherry blossoms

\end{document}

You can compile it with the latex, dvips, ps2pdf combo or with pdflatex as well.

share|improve this answer
Thanks for the link, the site is loading so slow though :D I'll wait until it's done... Hopefully. :) – Alenanno Apr 11 '11 at 18:07
Sorry, it took quite some time, honestly I left it lol... I chose you because your example worked. :) – Alenanno May 8 '11 at 18:00
I hope it works out, good luck with your project! – Nyiti May 9 '11 at 6:45
Characters are working, I have some new problems sometimes (things like size, font choice, etc) but there is plenty of material... I might be able to solve it by myself :D – Alenanno May 9 '11 at 8:02
Note that this example only works on Ubuntu Quetzal if you install the package latex-cjk-japanese-wadalab (via blog.mindfall.net/?p=221). – Reid Mar 18 at 23:12

You might also try XeteX with the genzi.sty package, which is specifically for Japanese.

If you read Japanese well, Google "luajalayout" and "LuaTeX-ja." A pdf sample of the output looks very good. It appears to require a separate installation from the standard LuaTeX, but I'm not sure.

share|improve this answer

I advice you to use XeLaTeX with package xeCJK. An example:

\documentclass{article}
\usepackage{xeCJK}
\setCJKmainfont{MS Mincho} % for \rmfamily
\setCJKfamilyfont{songti}{SimSun} % used as \CJKfamily{songti}
\begin{document}
おはよう % "Morning" in Japanese

{\CJKfamily{songti}早} % "Morning" in Chinese
\end{document}

See manual of xeCJK and fontspec 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.pdf
fontspec: http://mirrors.ctan.org/macros/latex/contrib/fontspec/fontspec.pdf


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 good 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 a cjk-fonts package, install it. Then you can use:

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

おはよう % "Morning" in Japanese

{\CJKfamily{gbsn}早} % "Morning" in Chinese

\clearpage\end{CJK*}
\end{document}

See $TEXMF/tex/latex/cjk/texinput/UTF8/c70*.fd 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.

For Chinese, you can also use TrueType fonts on Windows platform with CJK package. zhwinfonts.tex has all necessary font mappings for PDFLaTeX and dvipdfmx. Example:

\documentclass{article}
\usepackage{ifpdf}
\AtBeginDvi{\input{zhwinfonts}}
\usepackage{CJKutf8}
\begin{document}
\begin{CJK*}{UTF8}{zhsong}

早上好。 % Good morning.

{\CJKfamily{zhhei}晚安。} % Good night.

\clearpage\end{CJK*}
\end{document}

For Japanese, you can also use PTeX. But I'm not an expert for that.

share|improve this answer
Thanks a lot! I'll give this all a try... It might take some time though, due to my noobness :) I'll let you know. – Alenanno Apr 11 '11 at 10:58
If we use XeLaTeX instead of PDFLaTeX, do we lose features provided by microtype? – Click Me Mar 6 '12 at 1:10
@Damien: Develop version of microtype partly support XeTeX. – Leo Liu Mar 6 '12 at 4:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.