How to Create a APL or Math Symbols Keyboard Layout

Perm url with updates: http://xahlee.org/kbd/creating_apl_keyboard_layout.html

How to Create a APL or Math Symbols Keyboard Layout

Xah Lee, 2011-03-04

This page shows you how to create a APL (programming language) keyboard layout, on Windows or Mac OS X. Or, creating a math symbols layout for computer languages such as Fortress, Scheme Lisp, Haskell. (See also: Unicode Support in Ruby, Perl, Python, javascript, Java, Emacs Lisp, Mathematica.)

APL Symbols in Unicode

APL keyboard layout

APL keyboard layout. Source en.wikipedia.org

Unicode has the complete set of APL chars.

' ( ) + , - . / : ; < = > ? [ ]
\ _ ¨ ¯ × ÷ ← ↑ → ↓ ∆ ∇ ∘ ∣ ∧ ∨
∩ ∪ ∼ ≠ ≤ ≥ ≬ ⊂ ⊃ ⌈ ⌊ ⊤ ⊥ ⋆ ⌶ ⌷
⌸ ⌹ ⌺ ⌻ ⌼ ⌽ ⌾ ⌿ ⍀ ⍁ ⍂ ⍃ ⍄ ⍅ ⍆ ⍇
⍈ ⍉ ⍊ ⍋ ⍌ ⍍ ⍎ ⍏ ⍐ ⍑ ⍒ ⍓ ⍔ ⍕ ⍖ ⍗
⍘ ⍙ ⍚ ⍛ ⍜ ⍝ ⍞ ⍟ ⍠ ⍡ ⍢ ⍣ ⍤ ⍥ ⍦ ⍧
⍨ ⍩ ⍪ ⍫ ⍬ ⍭ ⍮ ⍯ ⍰ ⍱ ⍲ ⍳ ⍴ ⍵ ⍶ ⍷
⍸ ⍹ ⍺ ⎕ ○

APL2 keyboard layout

APL2 keyboard layout. Source en.wikipedia.org

For other chars, such as λ ∑ ⊕ ƒ ⇒ ↦ used by APL derivatives, or Fortress, or other languages, see: Math Symbols in UnicodeArrows in UnicodeComputing Symbols in Unicode.

Unicode Font

First you need to have unicode fonts. See: Best Fonts for Unicode.

Emacs

if you are a emacs user, you might use Math Symbols Input Mode (xmsi-mode).

Or, you can create your own rather easily. There are few ways depending on how you want the input to work.

You can insert unicode by abbrev, such as typing “alpha” auto expands to “α” or “rarrow” auto becomes “→”. Sample code at: Using Emacs's Abbrev Mode for Abbreviation. (one flaw with this solution is that emacs abbrev only allow sequence of english letters to be used as input. So, you cannot create “->” as abbrev for “→”.)

Or, you can setup systematic keys in emacs. e.g. hold down Win key and any letter becomes the ones in APL keyboard. See: Emacs: Remapping Keys Using key-translation-map and Emacs Custom Keybinding to Enhance Productivity.

Mac OS X

If you are on OS X, you can also setup system-wide config to enter complete custom designed unicode layout. Super easy too (though there are a few problem with certain key combo, because they are low level that Apple don't want changed). See: Creating Keyboard Layout in Mac OS X and Technical Note TN2056: Installable Keyboard Layouts @ Source developer.apple.com.

Other Solutions for Windows, Mac, Linux

Linux

Here are some linux solutions for APL language. I haven't tried them.

Windows & Mac

Here's a project that has the APL layout made for Mac and Windows, i haven't tried it: http://code.google.com/p/apl-keyboard-layouts/.

On Windows, you might use The Microsoft Keyboard Layout Creator. See: Keyboard Layout & Key Macro tools for Windows. However, i never tried it.

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?