The Compose Key: Typing alternate characters the easy way


2024-05-19 // 412 words // ~3 minutes



Compose key lets you type alternate characters using intuitive ‘compositions’, like <Compose-a-e> for ‘æ’
The compose key on a DEC LK201 keyboard is the leftmost key on the bottom row. <br/> (Public domain image from Wikimedia Commons)
The compose key on a DEC LK201 keyboard is the leftmost key on the bottom row.
(Public domain image from Wikimedia Commons)

(Note: I've mostly used UK/US English keyboards and my article might be biased towards these layouts.)

How do you type the capital letter H?

I think it is safe to assume that you press Shift h, instead of navigating to the Wikipedia page for Horse and copying “H” from there.

How do you type, say, the ñ in España, or the ç in Françoise?

You don't have to visit their respective Wikipedia pages and copy the word from there like I used to do.

Just use the compose key.

Compose key? I can't find that on my keyboard!

You might have to download some additional software to set up compose key on Windows or macOS.

On most Linux desktops, however, it is pretty straightforward. You might find these guides useful: KDE Plasma, GNOME, XFCE.

(For reference, I'm on KDE Plasma and I have my AltGr mapped to Compose.)

With the compose key, ñ becomes Compose n ~, and ç becomes Compose c ,.

Compose key mappings are pretty intuitive. Let's say I want to type this: ø. Now what does that look like? An 'o' with a slash through it? Yep! Compose o / will give you a ø.

Compose key mappings

You can create your own compose key mappings by defining them in the ~/.Xcompose file, but I have personally found this to be a bit finicky.

Some default mappings that I often use

  • Superscript numbers: Compose ^ 8 for ⁸
  • Smart quotes:
    • Compose < " for “
    • Compose > " for ”
    • Compose < ' for ‘
    • Compose > ' for ’
  • Dashes
    • Compose - - - for — (an em dash)
    • Compose - - . for – (an en dash)
  • Compose < 3 for ♥
  • Compose : ) for ☺
  • Compose : ( for ☹

Further reading

Comments

Comment via