Emacs: Xah Math Input Mode
xah-math-input is a emacs minor mode for inputting math symbols, emoji, or any Unicode characters.
[was named: xmsi-mode.el]
Requires Emacs 24.1 or later.
How to Use
global-xah-math-input-modeto toggle on/off for all buffers.
xah-math-input-modeto toggle on/off for current buffer.
In lisp code for your emacs init file:
(global-xah-math-input-mode 1) ; turn on globally (global-xah-math-input-mode 0) ; turn off globally
inf, then press 【Shift+Space】, then it becomes ∞.
- a → α
- b → β
- p → π
- l → λ
- g → γ
- G → Γ
- sum → ∑
- prod → ∏
- cp → ⊕
- rt → √
- and → ∧
- && → ∧
- ne → ≠
- != → ≠
- /= → ≠
- ge → ≥
- >= → ≥
- to → ⇒
- => → ⇒
- -> → →
- R2 → ℝ²
- s2 → ²
- sup2 → ²
- ^2 → ²
- _i → ᵢ
- e' → é
- e` → è
- e" → ë
- e^ → ê
- n~ → ñ
- deg → °
- heart → ♥
For the complete up-to-date list, Alt+x
The mode supports over 600 unique symbols, and you can add your own. Any unicode character, including emoji.
All XML character entity abbrevs are supported. For example
copy → ©
[see HTML XML Entities]
Most Mathematica's abbreviation is also supported. For example:
es → ∅
Unicode by Decimal Number
Unicode by decimal can be entered like this:
945 → α
(Note: alpha has abbrev of “a”. All Greek Alphabet has single letter abbrev.)
Unicode by Hexadecimal
Unicode by hexadecimal can be entered like this:
Unicode Character by Name
Unicode by full name is also supported. For example, type “greek small letter alpha”, select the words, then press activation key, it'll become α.
You can also call emacs's
insert-char for name completion feature. (before emacs 24, the command name is
For example, Alt+x
insert-char 【Ctrl+x 8 Enter】, then type
*arrow then Tab, then emacs will list all Unicode Character names that has “arrow” in it. (this feature is part of Emacs 23)
Change Activation Key
To change the activation key, put this in your init:
(require 'xah-math-input) (define-key xah-math-input-keymap (kbd "S-SPC") nil) ; unset Shift+space (define-key xah-math-input-keymap (kbd "<f8>") 'xah-math-input-change-to-symbol)
Add Abbrev, Add Symbol
To add/change a abbrev, put this in your init:
(require 'xah-math-input) (puthash "floral" "❦" xah-math-input-abrvs)
To find symbols, use Unicode Characters Search ☢ ☯ ☭ ∑ ∞ ♀ ♂ ♥.
Get Unicode Font
For best result, you'll need a font that support Unicode. I recommend DejaVu Sans Mono. [see Best Unicode Fonts for Programer]
- Emacs: Unicode Tutorial
- Emacs File Encoding FAQ
- Unicode Basics: What's Character Set, Character Encoding, UTF-8?
- Emacs: Xah Math Input Mode
- Emacs: Xah Unicode Browser Mode
If you have a question, put $5 at patreon and message me.