# UTF8 math symbols & keyboard layout / input

I'd like to use UTF8 math symbols, when typing one list, another list.

I've found sth called ComposeKey. Unfortunately it's not covering omega, theta, rightarrow etc.

I am using KDE, I've tried global shortcuts, but does not seem to work.

How to setup typing utf8 symbols (like: Θ, Ω,∃, ∀,⇒,→) with keyboard combinations (like Meta+S) ?

-
Other than some very short math formula, this approach cannot handle many common situations, like fraction, pedices, exponents, and so on. A more structured approach is to prefer, as for example latex, mathml, mathjax, etc. –  enzotib Oct 4 '11 at 9:13
A simple way for just Greek letters: add Greek keyboard layout and switch to and from it while typing (may be not too comfortable). –  rozcietrzewiacz Oct 4 '11 at 9:49
For those interested : there are situations where you want just to type simple formulas in UTF8 - for example -> when you are a academia teacher, and answer student's e-mail. Sometimes you like to write formula on IM, when discussing sth. –  Grzegorz Wierzowiecki Oct 4 '11 at 17:35
@rozcietrzewiacz, good idea, the switch might be <kbd>Caps Lock</kbd>. –  JMCF125 Jan 26 at 17:40

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.

-
Even in LaTeX, maths are much more legible using unicode characters instead of macros. –  Evpok Sep 21 '12 at 13:08
It is worth to mention that the math unicode(partial table on wiki) have anyway some characters that is deserve to be on separate layout, i.e.: «𝕬 𝕭 𝕮 𝕯 … 𝖘 𝖙 𝖚 𝖛 𝖜 𝖝 𝖞 𝖟». –  Hi-Angel yesterday

I've found interesting tool, for translating xorg events differently, depending on application you are using:

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.

-
That's interesting. Of course, another way of having application-specific key bindings is to use a windows manager that supports this (I use sawfish). Unfortunately it's not a common feature. –  Gilles Nov 12 '11 at 23:52
I agree with you. I've saw on sawfish screenshots "sawfish combination with KDE", I hope such combinations will popularize, such less popular WM managers. (btw. I have to checkout sawfish). What's a pity that I am so weak in Lisp, to do what I'd like. –  Grzegorz Wierzowiecki Nov 14 '11 at 21:05