1

A few weeks ago, I switched from Windows to Linux, and one thing I'm missing is Altnnnn keyboard shortcuts to insert an em dash and other things. Is there any way to get them working under Linux? I'm using Arch Linux and KDE, if that matters.

2 Answers 2

4

Using numeric code points

In Tobu's answer, I believe the keystroke combination on US or UK keyboards would be called Ctrl+Shift as in "Ctrl-Shift-2702 is for the scissors character (✂)".

Personally I find it much easier to remember digraphs.

Digraphs / Compose-Key / Multi-Key

X11 Modmap

The X Window system (X11) provides for what is sometimes called a compose key which allows the entry of special characters by using digraphs.

Keying the combination Shift+AltGr (in that order), releasing these keys, then entering two other keys will produce a special character. Many of these will be the reasonable result of overtyping the character keys, eg.

Shift+AltGr  ~  a -->  ã  (ã in HTML)
Shift+AltGr  /  o -->  ø  (ø in HTML)
Shift+AltGr  o  c -->  ©  (© in HTML)
Shift+AltGr  c  o -->  ǒ  (Ŏ in HTML)

How to

There is an article at linuxquestions.org that describes how to set this up.

first you need to choose which key you want to be the Compose key. Then, open a terminal and enter the command xev. A window called "Event Tester" will pop up. Make sure that it's focused by clicking on it and leaving the mouse cursor in it.

Now press and release the key that you want to become the Compose key. Remember or write down the number after the word "keycode" in the output

Now open the file ".Xmodmap" (the name begins with a dot) in your home directory (create it if it isn't there already) with a text editor and type in the following line, replacing with the number you got in xev.

keycode <keycode number> = Multi_key Now, open the file .xinitrc (it's in your home directory, and it's a hidden file) in a text editor. Insert this line in the beginning of the file:

xmodmap ~/.Xmodmap And next time you log in the Compose key should work! To start using the Compose key right now, enter the command xmodmap ~/.Xmodmap in a terminal.

Wikipedia

The howto article refers to a wikepdia article which says

The compose key is known as "Multi_key" in the X Window System, and must be interpreted by the client program (typically Xlib), not the server. In XFree86 and X.Org Server, many keyboard layouts have a variant that maps Multi_key to some key, usually (on PC keyboards) to either of the Windows keys, or sometimes ⇧ Shift+AltGr[1] or ⇧ Shift+Right-Ctrl. It can also be specified in XkbOptions (for example, "compose:rwin"). Multi_key can also be assigned with the xmodmap(1) utility.

3
  • I'm using KDE, but I found this based on your answer (compose key in Ubuntu link), and also this, which tells how to get em dash with the compose key. Thank you! Jul 17, 2011 at 18:04
  • The compose key is an X11 feature, not distro-specific. Jul 17, 2011 at 19:57
  • @grawity: Updated answer to make this clearer. Jul 17, 2011 at 20:08
1

Gtk/Gnome has Ctrl-Shift-U, followed by the digits of the unicode character, then enter. Additionally “—” may be available in the standard keyboard layout for your language, or an alternative one. Mine is at AltGr-Shift-4 for example; gnome-keyboard-properties can display the layout so you can look for keys.

1
  • Only one problem with that... I'm using KDE, not Gnome. Jul 17, 2011 at 17:57

You must log in to answer this question.

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