UTF8 math symbols & keyboard layout / input
You can define your own table for the Compose key: create a file called .XCompose
in your home directory. You'll need to define the whole table (you can't just add your definitions to the system default, you have to copy the system default into your file if you want it).
You'll find the system default table in /usr/share/X11/locale/en_US.UTF-8/Compose
on Debian and Ubuntu and in a similar location on other unices. The format should be reasonably straightforward; a typical definition looks like these:
<dead_acute> <a> : "á" aacute # a dead key: press Dead_acute then A to insert "á"
<Multi_key> <acute> <a> : "á" aacute # Press Compose, ', A to insert "á"
<Multi_key> <g> <a> : "α" U03B1 # 03B1 is the hexadecimal code of "α"
<Multi_key> <M> <A> : "∀" U2200 # 2200 is the hexadecimal code of "∀"
<Multi_key> <minus> <greater> : "→" U2192
<Multi_key> <bar> <minus> <greater> : "↦" U21A6
ASCII characters and a few others have symbolic names; you'll find these names in /usr/include/X11/keysymdef.h
. For example, -
is minus
because keysymdef.h
contains the line #define XK_minus 0x002d
and 2d is the hexadecimal code of -
.
You can have sequences of more than two characters, like |->
in the example above. Note that if you define a compose sequence for |->
, you can't have another for |-
.
If you prefer AltGr+key₁ʹ, key₂ to Compose, key₁, key₂ then you can bind AltGr+key₁ʹ to a dead key with xmodmap. It's not necessarily a blessing, and note that you are limited to the dead key names listed in /usr/include/X11/keysymdef.h
.
For characters that you don't use often enough to remember a key sequence anyway, you can use KCharSelect (or its Gnome equivalet GUCharMap). Or do what mathematicians are used to doing, which is type in \LaTeX.
I've found interesting tool, for translating xorg events differently, depending on application you are using:
Here: Application-specific keymapping
App: evrouter (with new version coming: evoruter2)
According to this topic, it might be used in order to add specific mapping for math symbols only in math related apps.