Design of Math Symbols Input System
This article discuss some of my thoughts about the problem of a input system for entering math symbols and special characters.
In the past few years, i need to type math symbols a lot in Emacs. In some hodgepodge way, i created several custom ways to enter special chars i need in emacs, such as: “” 【】〈 〉 「」 © • ◇ ◆ ★ × α θ λ ← → ⇒ ≠ ∞ etc. The system is nowhere consistent or comprehensive. In the back of my mind, i thought that someday i'll think about it and find a way that's efficient and comprehensive for inputting hundreds of math chars. When you need to type a lot special chars, there's a interface design issue, because there are so many ways to do it.
AltGraph Key System vs Abbrev System
AltGraph Key System
For example, first is a simple method of using a modifier key (usually called AltGr) to insert special chars.
[see Mac Keyboard Viewer and Unicode]
In this method, you press a key combination to insert a char. This is great solution if you just need a few chars that's frequently used. If you need more than say 50 chars, you need to add more modifier key combinations, it quickly become a problem of remembering which chars are what key. So, this method isn't good if you need to input a lot math for example, because there are few hundreds of math symbols, and different people have different set of chars that's frequently used for them.
(For how to do this on Mac, see: Creating Keyboard Layout in Mac OS X.)
See also
Abbrev System
Other solution is to use abbreviation. For example, you type “a”, then press a hotkey, and it becomes α, and “inf” becomes ∞, “ne” becomes ≠, etc. While studying How Mathematica does Unicode?, i realized that this is the most practical, efficient, method, to input large number of chars. Math symbols, and also common chars such as ‹ › « » ¢ € £ ¥ © ® ™ § ¶ † ‡ ※ ● ■ ◆ ↑ ↓ → ← ◀ ▶ ▲ ▼ etc. This way, you don't have to remember hundreds of key combination for each char. You just type the name of the symbol, using full name or short abbrevs (1 to 5 letters).
The advantage of this method are:
 Good for large number of chars. (For example, more than 100)
 This is much easier to remember.
 There's just one hotkey to remember.
The disadvantage is that it's slower. If you need let's say only 10 to 30 chars that you need to type every few minutes, for example, say the acute e é in some language, then the 2keys by AltGraph+e is faster.
However, the 2 methods can both be used. That is, have a AltGraph layout, but also have the abbrev system.
When is Hotkey Pressed
The hotkey can be pressed before you type the abbrev, or, it can be pressed after. Or, it can be completely eliminated by a automatic change.
For example, in emacs, you press Ctrl+x 8, then type ' e then you get é. This is a example of hotkey first. [see Emacs and Unicode Tips]
The emacs Ctrl+x 8 act as compose key.
[see Alt Graph Key, Compose Key, Dead Key]
In Mathematica, you press Escape abbrev Escape to insert a special char. [see How Mathematica does Unicode?]
For automatic abbrev expansion, both emacs and Microsoft Word and many editors support that. For example, in Word, typing (c)
automatically becomes “©”. The automatic change method is great, but the problem is that if you have hundreds of abbrevs, often some of them are common words too, which you do not want to automatically become a special char. For example, you don't want “not” to always automatically become the logic symbol ¬, or this “>=” becoming ≥ in programing source code.
Changes to my Emacs Elisp Code
So, yesterday, i started to organize my several elisp code related to inputting special math symbols to a unified minor mode. For example, i had the following code that sets up a emacs hyper key to insert chars:
(globalsetkey (kbd "Hy <up>") (lambda () (interactive) (insert "↑"))) ; up arrow (globalsetkey (kbd "Hy <down>") (lambda () (interactive) (insert "↓"))) ; down arrow (globalsetkey (kbd "Hy <left>") (lambda () (interactive) (insert "←"))) ; left arrow (globalsetkey (kbd "Hy <right>") (lambda () (interactive) (insert "→"))) ; right arrow (globalsetkey (kbd "Hy <kp6>") (lambda () (interactive) (insert "⇒"))) ; RIGHTWARDS DOUBLE ARROW (globalsetkey (kbd "Hy <kpadd>") (lambda () (interactive) (insert "⊕"))) ; CIRCLED PLUS (globalsetkey (kbd "Hy *") (lambda () (interactive) (insert "⊗"))) ; CIRCLED TIMES (globalsetkey (kbd "Hy <kpmultiply>") (lambda () (interactive) (insert "×"))) ; MULTIPLICATION SIGN (globalsetkey (kbd "Hy <") (lambda () (interactive) (insert "≤"))) ; greater htan (globalsetkey (kbd "Hy >") (lambda () (interactive) (insert "≥"))) ; less than (globalsetkey (kbd "Hy Z") (lambda () (interactive) (insert "ℤ"))) ; integer (globalsetkey (kbd "Hy Q") (lambda () (interactive) (insert "ℚ"))) ; rational (globalsetkey (kbd "Hy R") (lambda () (interactive) (insert "ℝ"))) ; real (globalsetkey (kbd "Hy C") (lambda () (interactive) (insert "ℂ"))) ; complex (globalsetkey (kbd "Hy a") (lambda () (interactive) (insert "α"))) ; alpha (globalsetkey (kbd "Hy b") (lambda () (interactive) (insert "β"))) ; beta (globalsetkey (kbd "Hy g") (lambda () (interactive) (insert "γ"))) ; gamma (globalsetkey (kbd "Hy t") (lambda () (interactive) (insert "θ"))) ; theta (globalsetkey (kbd "Hy l") (lambda () (interactive) (insert "λ"))) ; lambda (globalsetkey (kbd "Hy p") (lambda () (interactive) (insert "π"))) ; pi (globalsetkey (kbd "Hy A") (lambda () (interactive) (insert "∀"))) ; FOR ALL (globalsetkey (kbd "Hy E") (lambda () (interactive) (insert "∃"))) ; THERE EXISTS (globalsetkey (kbd "Hy ^") (lambda () (interactive) (insert "∧"))) ; and (globalsetkey (kbd "Hy 6") (lambda () (interactive) (insert "∨"))) ; or (globalsetkey (kbd "Hy !") (lambda () (interactive) (insert "¬"))) ; not (globalsetkey (kbd "Hy =") (lambda () (interactive) (insert "≡"))) ; equivalent (globalsetkey (kbd "Hy +") (lambda () (interactive) (insert "≠"))) ; not equal (globalsetkey (kbd "H*") (lambda () (interactive) (insert "°"))) ; degree
[see Emacs: How to Bind Super Hyper Keys]
I also had Emacs Abbrev:
[see Emacs: Abbrev Mode]
(defineabbrevtable 'globalabbrevtable '( ;; math/unicode symbols ("tin" "∈") ("nin" "∉") ("inf" "∞") ("luv" "♥") ("smly" "☺") ;;… ))
Note, now i replacement them all in a emacs package Emacs: xahmathinput.el
Keyboard Shortcut Design
 How Many Shortcuts Are There
 Emacs vs vim, Keybinding Efficiency
 vim HJKL vs IJKL
 Design of vim Mode Activation Key
 History of emacs/vi Keys

Ban Key Combos  Ban Shift Key
 Function Key vs Key Chord
 Fastrepeat vs Nonfastrepeat Keys
 Modifier Keys Usage Frequency

Keyboard Shortcut vs Launch Buttons  Best Way to Type/Insert Parenthesis, Brackets

Math Input Design 
Create APL/Math Layout  Linux Mac Windows, Which is Best for Keybinding?
 patreon me $5
 amazon egift card to xah@xahlee.org , $20 is nice.
 paypal to xah@xahlee.org , $20 is nice.
 bitcoin me 19dfoa3Q7oehm9MwCULQzBG8vqfCaeMazH
If you have a question, put $5 at patreon and message me.