Unicode provides many useful characters for mathematics. If you've studied the traditional notation, an expression like « Γ ⊢ Λt.λ(x:t).x : ∀t. t → t » is much more readable than an ASCII equivalent. However, most systems don't provide an easy way to enter these characters.
The compose key feature of X Windows provides a nice solution on Linux and other UNIX systems. Compose combinations are easy-to-remember mnemonics, like
-> for →, and an enormous number of characters are available with just a few keystrokes.
Setting it up
I cooked up a config file with my most-used mathematical symbols. With recent Xorg, you can drop this file in
~/.XCompose, restart X, and you should be good to go.
include line will pull in your system-wide configuration, e.g.
/usr/share/X11/locale/en_US.UTF-8/Compose. This already contains many useful characters. I was going to add
<3 for ♥ and
CCCP for ☭, but I found that Debian already provides these.
GTK has its own input handling. To make it defer to X, I had to add an environment variable in
The "Fn" key on recent ThinkPads makes a good compose key. It normally acts as a modifier key in hardware, but will send a keycode to X when pressed and released by itself. I used this
Tweaking the codes
Obviously, not everyone will like my choice of key combinations. If you tweak the file and come up with something particularly nice, I'd like to see it. If you can't run Haskell code for whatever reason, it's not too hard to edit the generated
Though my use of Haskell here may seem gratuitous, I actually started writing this script in Python, but ran into trouble with Python 2's inconsistent treatment of Unicode text. Using Haskell's
String type with GHC ≥ 6.12 will Just Work, at least until you care about performance.