How to setup an IPA input method

2022-11-01
2 min read

Use RIME

RIME is an input method engine. It can run different input method schemas, and of course, IPA. There are two schemas which are available in RIME, yunlong and xsampa. To use these schemas, you need to install RIME. It can be installed on Windows, MacOS and Linux. After installation, there are two files you need to modify to complete the configuration. The first is default.custom.yaml. My configurations of this file are as below.

# default.custom.yaml
patch:
  menu/page_size: 8
  schema_list:
    - schema: luna_pinyin          # 朙月拼音
    - schema: luna_pinyin_simp     # 朙月拼音 简化字模式
    - schema: zyenpheng     # 中古漢語全拼
    - schema: ipa_yunlong   # 云龙国际音标输入法
    - schema: ipa_xsampa   # 云龙国际音标输入法
    - schema: japanese   # 日语输入法
    - schema: terra_pinyin  # 地球输入法
  switcher/hotkeys:
    - "F4"
  "ascii_composer/switch_key/Shift_L": commit_code
  key_binder:
    bindings:
    # commonly used paging keys
      - { when: paging, accept: Shift+Tab, send: Page_Up }
      - { when: has_menu, accept: Tab, send: Page_Down }
      - { when: paging, accept: period, send: Page_Up }
      - { when: has_menu, accept: comma, send: Page_Down }
      - { when: has_menu, accept: comma, send: Page_Down }

To install the IPA schemas, type the following code in terminal of MacOS, or use the GUI provided by RIME in Windows. A more detailed tutorial of installing Yunlong on Windows can be found here

# install the package manager of RIME
curl -fsSL https://git.io/rime-install | bash
# change directory to plum and install ipa schemas
cd plum
bash rime-install ipa
# add Yunlong and xsampa to the default configurations.
bash rime-install custom:add:schema=ipa_xsampa
bash rime-install custom:add:schema=ipa_yunlong

After that, deploy RIME, and when it says Squirrel/Weasel is ready. You can use F4 (or other hotkey you defined, e.g., `Ctrl+``) to change the input method.

To input IPA using Xsampa, you can have a look at a guide to Xsampa: https://chromium.googlesource.com/chromiumos/third_party/espeak-ng/+/HEAD/docs/phonemes/xsampa.md

Another file you may want to modify is squirrel.custom.yaml or (weasel.custom.yaml on Windows). Basically, this file can configrue how Squirrel or Weasel look like. My configurations are as below.

#squirrel.custom.yaml
patch:
  style/color_scheme: "simplest"    # Use the scheme defined below
  preset_color_schemes/simplest:
    name: "simplest"
    author: "Chunyu Ge <gechunyu92@hotmail.com>"
    horizontal: false
    inline_preedit: true
    alpha: 0.9
    back_color: 0x000000 # background
    text_color: 0xffffff 
    candidate_text_color: 0xffffff # non-first candidate
    hilited_candidate_back_color: 0xffffff # background of the first candidate
    hilited_candidate_text_color: 0x000000 # first candidate
    comment_text_color: 0xffffff
    label_format: '%s'
    hanb_font: "HanaMinB" # font of uncommon words

Use Yunlong

Alternatively, you can simply use Yunlong, which can be installed separately in Windows. Yunlong can be accessed here

Yunlong is quite straightforward. For example, schwa ə is ed, which means e dao (e 倒). Diacritics can be input with the key f. For example, the nasalized vowel ã is af~.

A main advantage of Yunlong over Xsampa is that it can input apical vowels (ɿ ʅ ʮ ʯ) and other symbols which are used specifically in Chinese.

Type IPA in LaTeX

To input IPA in LaTeX, you can use the tipa package, which can input IPA symbols with ASCII code only. A cheatsheet of the symbols can be found in https://ptmartins.info/tex/tipacheatsheet.pdf

If you have installed Yunlong or Xsampa, you can also simply type IPA in a LaTeX document, but tipa is also very useful. Some conference or journal templates can only be generated with pdflatex, rather than xelatex, and only the latter can handle non-standard symbols, such as IPA. Therefore, if you want to type IPA in your LaTeX document and run it with the pdflatex engine, you can only use tipa.

Online IPA keyboard

Yet another alternative is to use online IPA keyboard, if you do not want all that tinkering. The following are some online IPA keyboards. But if you need to input a lot of IPA, better install one of the input schemas.