How to read and write in Japanese

= Introduction = This guide aims at explaining how to read and write in Japanese on a non-Japanese system. Please feel free to amend it based on your own knowledge or experience.

= What is needed? =

Japanese fonts
If you are not using a Japanese system, you probably have no such fonts installed and if you try to enter Japanese characters from your keyboard, you will only see small rectangle boxes in place of the characters on the screen.

Input method
To read and write in Japanese, the first thing you need is a way to enter Japanese characters with your usual keyboard. This is done via a piece of software usually called an input method. At the moment, for the Japanese language, there are 2 such common methods: anthy and mozc.

With such a software component typing ta on your keyboard will input the kana た into your word processor. Some simple manipulation that is relevant to the way your input method works, will permit you to easily switch from the hiragana た to the katakana タ.

In a similar way typing nihon will input にほん and an other simple manipulation will permit you to turn this to the kanji version of this word 日本.

IME
On top of this you also need a way to switch from the input method you normally use for your own language to the one you need for the Japanese language. This functionality is provided by another piece of software called an IME for Input Method Editor such as, or.

Once installed, you will be able to switch from your own language's input method to the Japanese input method using a key combination or using your mouse to select a relevant icon in the icon tray.

= Installing the software components =

Japanese fonts
As a minimum, install the package.

As extra, are also available:

Installing
You are advised to prefer ibus to scim. To install the previous, you need:

anthy


Normally installing ibus-anthy should pull in ibus and anthy (if not emerge them separately).

Launching the ibus daemon at logging time
Add these lines to your  file and reboot.

Configuring
To configure the Input Method Editor, use the following command as a standard user

Alternatively, if you are a gnome user, type ibus in the search bar and launch ibus-preferences.

In the dialog box that appears, click on the Input method tab and add the japanese-anthy method. Then return to the General tab and define a key combination as a keyboard short cut for switching the input method.

Latex
Here are some additional requirements to write Latex files in Japanese

ibus-qt
When using editor aiming at writing Latex files such as TexMaker or TexStudio, ibus crashes each time you enter a Latex command (specially after entering the { char. To solve this kind of malfunctioning you have to install ibus-qt.

CJK and xetex support
In order to write Japanese chunks in Latex files you need to add support for CJK languages and for [xetex] in Texlive. To do so in the add or modify the following lines : Then reinstall the packages :
 * app-text/texlive ... cjk xetex ...
 * app-text/texlive-core ... cjk xetex ...

Here is a working short sample:

Editor configuration
To compile and visualize the output of the sample above you have to set up some parameters in you Texmaker or Texstudio editor. Open Texmaker, and go in Options --> Configure Texmaker, under the Commands tab change this : Then go under the Fast compile tab and chose Latex + Dvipdfm + View PDF. Finally go under the Editor tab, chose UTF8 encoding and uncheck the "On the fly" on the dictionary line.
 * At the LaTeX, change latex with platex.
 * At the line Dvipdfm, change divipdfm with dvipdfmx.

= Related Pages =
 * Ibus
 * Tex Live