Emacs: Xah Math Input Mode

By Xah Lee. Date: . Last updated: .

xah-math-input is a emacs minor mode for inputting math symbols, emoji, or any Unicode characters. 〔old name: xmsi-mode.el〕

xah math input mode 2017 07 08
xah math input mode

Download

https://github.com/xahlee/xah-math-input

Also on MELPA. http://melpa.org/#/xah-math-input [see Emacs: How to Install Packages Using ELPA, MELPA]

Requires Emacs 24.1 or later.

How to Use

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

(xah-math-input-mode-on) ; turn on for current buffer
(xah-math-input-mode-off) ; turn off for current buffer
;; or
(xah-math-input-mode 1) ; turn on for current buffer
(xah-math-input-mode 0) ; turn off for current buffer

Type inf, then press 【Shift+Space】, then it becomes .

abbrevsymbol
aα
bβ
pπ
lλ
gγ
GΓ
sum
prod
c+
rt
and
!=
>=
=>
->
abbrevsymbol
R2ℝ²
^2²
_i
e'é
e`è
e"ë
e^ê
n~ñ
deg°
heart

The abbreviations are based on HTML/XML entity names and Mathematica's 【Escape abbrev Escape】.

For the complete up-to-date list, Alt+x xah-math-input-list-math-symbols.

The mode supports over 640 unique symbols. (Any other Unicode character can be entered by the character's unicode codepoint in decimal or hexadecimal or by the character's Unicode name.)

XML Abbreviations

All XML character entity abbrevs are supported. For example, copy becomes ©.

[see HTML XML Entities]

Mathematica Abbrev

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.)

[see Unicode: Greek Alphabet α β γ δ ε ζ η]

Unicode by Hexadecimal

Unicode by hexadecimal can be entered like this: x3b1α

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 ucs-insert)

For example, Alt+x insert-charCtrl+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)

Customization

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]

Font/Unicode Topic

  1. Emacs: Unicode Tutorial
  2. Emacs File Encoding FAQ
  3. Unicode Basics: What's Character Set, Character Encoding, UTF-8?
  4. Emacs: Xah Math Input Mode
  5. Emacs: Xah Unicode Browser Mode

  1. Best Unicode Fonts for Programer
  2. Emacs: Font Setup
  3. Emacs: Proportional Font
  4. Emacs: Cycle Fonts by Command
  5. Emacs: Set Line Spacing
  6. Emacs: toggle-word-wrap
  7. Elisp: Unicode Representation in String
Like my tutorial? Put $5 at patreon

Or Buy Xah Emacs Tutorial

Or buy a nice keyboard: Best Keyboard for Emacs