Notes on Japanese input on Linux with mozc

If you decide you want to type in Japanese on your Linux system and look up how to accomplish that, you might find out that you need an "input method editor" to turn typed Latin characters into kana and kanji. And if you do a little research on, say, the Arch wiki, you might notice that the only maintained and full-featured option that seems to exist is mozc. It's open source, but it's basically a somewhat stripped down version of Google's proprietary Japanese input method.

Another fact about it is that the official documentation contains basically no information about how to actually type with it. Really; here it is as of the latest commit at time of writing. See how much you can find out about how to use the thing! (Not much.)

Of course, it's probably obvious that typed rōmaji turns into kana on screen, and then with a bit of trial and error you figure out that space, enter, and the arrow keys all do things. But word processor rōmaji contains various divergences from ordinary romanisation schemes, some of the punctuation you'll need is less than obvious, and there are surprising depths to the whole thing when you go beyond the most basic use cases. So, this is a cheatsheet I would have liked to have a year ago.

(By the way, I'm not going to say anything about the installation process except that you should make sure to get the UT dictionary. Consult your distro's documentation!)

Table of contents

  1. Selecting conversions (space, enter, the arrow keys)
  2. The function keys F6–F10
  3. Essential word processor rōmaji sequences
  4. Punctuation! Spaces!
  5. Archaic kana
  6. Special features
  7. The end

Selecting conversions (space, enter, the arrow keys)

After switching to the mozc input method (typically Ctrl+Space but check your distro docs) you can start typing into any text field. Rōmaji should convert to hiragana, but it will have an underline underneath it to indicate that it's not been finalised; there will also be a box showing various suggested completions. Try typing out a word. If the word in hiragana is what you want, Enter will remove the underline and suggestions box so you can start a new word.

On the other hand, say you wrote おもい, but what you want is its kanji form 思い. Press Space to cycle through forms of a word (kanji, katakana, &c.). The most common will usually be first; further presses convert to other homophonous matches like 重い. When you have the right form, use Enter to lock it in.

If you type in こんに, you should see こんにちは in the suggested completions box. Press the Down arrow to cycle through these suggestions (and the Up arrow to go back), using Enter to accept the selected one as usual.

Rather than going word by word, you could type in a whole phrase or sentence, then press space to convert the whole thing at once. The Left and Right arrow keys let you move to different parts of the sentence to adjust the conversions using the same methods as above, but sometimes the boundaries selected by the software are inconvenient, so ambiguous or complex sentences can be a pain to write this way.

The function keys F6–F10

Sometimes you want to convert the entirety of what you typed to a particular script, such as katakana or Latin characters. The function keys let you do this without messing with the suggested conversions. They are as follows:

Key Function Example
F6 Hiragana (already the default) ひらがな
F7 Katakana カタカナ
F8 Half-width katakana カタカナ
F9 Full-width rōmaji ro−maji
F10 Half-width rōmaji (i.e. normal Latin letters) ro-maji

Here are some questions you may have. "Why would I want to use half-width katakana?" To annoy people online sometimes. "What are full-width rōmaji for?" They have some purposes in vertical writing, among other things.

(Also, you likely need to use the Fn key along with each of these, depending on your configuration.)

Essential word processor rōmaji sequences

There are differences between word processor input such as this and any romanisation scheme intended for presentation, like Hepburn, which is what most learners encounter first. Here are some relevant facts in approximate order of importance:

  • To type ん, you often need to press n twice, since otherwise a sequence like んい is indistinguishable from に. (Technically, n' also works, but this is harder to type. Also, sometimes you don't have to do this at all if it's unambiguous, like んか, but maybe do it consistently to avoid issues.)
  • You must remember to enter は・を・へ as ha, wo, and he respectively, even if they are being used as particles and thus aren't pronounced that way.
  • You can type small kana (ぁぃぅぇぉゃゅょっ) by typing l or x before the regular sequence for the kana, eg. xya for ゃ. But you should usually use the standard sequences, like sha or sya for しゃ.
  • You can use shorter romanisations than Hepburn for several kana, akin to the more regular Nihon-shiki system. As such, si can be used rather than shi for し, tu for つ, and ti for ち.
  • ティ is thi, and ウォ is who. "v" combinations using ゔ are also supported; try va, vu, &c. The less common トゥ is twu.
  • The yen symbol ¥ is \, but you can cycle through the other conversions to get a real backslash.

Punctuation! Spaces!

Firstly: all the punctuation you already type in English can still be typed using the same keys. The Japanese full stop "。" is a bit different from the English one, and the question and exclamation marks are also wider; this is expected in most Japanese text, but if you need the usual ASCII ones you can cycle through the completions or use the function keys. Here is all the other information:

  • The default Japanese space, which you can get by pressing Space when there's no other input waiting, is wide; if you need the normal ASCII space you must use Shift+Space.
  • The long vowel mark ー is typed as -, the hyphen. The Japanese wave dash 〜 that looks like a wide tilde is in fact typed as one, ~.
  • You can get various special brackets using the conversions for ().
  • The interpunct or middle dot ・ is /, but you can get an actual forward slash by cycling through the conversions.
  • The Japanese quotation marks 「」 are [ and ] respectively.
  • The Japanese double quotes 『』 (used for titles of works) are z[ and z] respectively.

Archaic kana

If you need to type the archaic kana ゐ or ゑ or their katakana versions, they are wyi and wye respectively. If you forget that, you can cycle through the conversions for wi or we. These do actually come up occasionally, in proper nouns and usernames, even if you're not writing in the historical kana orthography.

Special features

The IME can do some neat things because of its role intercepting user input, some of which are not even directly connected to typing Japanese. Here are the ones I know of so far:

  • If you type きょう, the conversions will include various ways of representing the current date.
  • If you type a mathematical expression followed by an equals sign, the default conversion will be the resulting value, i.e. it's a textual calculator! 5+3= converts as 8. sqrt(7)= converts as 2.6457513. This is kind of amazing.
  • ba-jonn (that is, バージョン, the Japanese transliteration of "version") will include the mozc version you're using somewhere in its list of completions.

The end

That's all I know so far. I think it covers all the essentials and some extras. Send me an email if you know something that could be here but isn't!