13

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

I've found something called ComposeKey. Unfortunately it's not covering omega, theta, right arrow 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) ?

4
  • 1
    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, 2011 at 9:13
  • 4
    A simple way for just Greek letters: add Greek keyboard layout and switch to and from it while typing (may be not too comfortable). Oct 4, 2011 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. Oct 4, 2011 at 17:35
  • @rozcietrzewiacz, good idea, the switch might be <kbd>Caps Lock</kbd>.
    – JMCF125
    Jan 26, 2014 at 17:40

2 Answers 2

11

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.

2
  • Even in LaTeX, maths are much more legible using unicode characters instead of macros.
    – Evpok
    Sep 21, 2012 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
    Aug 21, 2014 at 9:02
2

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.

2
  • 2
    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. Nov 12, 2011 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. Nov 14, 2011 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .