How to type special characters

Linux has 3 ways to insert special characters – the ones that aren’t on the keyboard – and I’ll describe the best one last. For anyone who used to type Alt-0189 to get a “½” symbol in Windows, this post will tell you how to achieve the same result in Linux.

The first way is the character map(kcharselect in KDE), an applet that lists every character.Conceptually, this is the easiest, just find the symbol you want,then cut and paste. In practice, if you need to enter a lot of special characters, it’s pretty clunky. (In LibreOffice, as with MS-Office, it’s integrated in the menu as Insert -> Special Character.)

The second way is conceptually similarto Windows, except that you need to memorize unicode instead ofASCII. Hold down Control-Shift while typing the code: The letter “u”followed by 4 hexidecimal digits. For instance, while holding down Shift-Control, type “u222b” and release, to get ∫ (the mathematical operator for integration). The nice thing about unicode is that you can access more symbols than with ASCII, but it’s a lotto memorize. When you look up a symbol on the character map, you’ll see its code displayed, so you can commit it to memory if you’ll be using it a lot.

I mentioned these ways first because they always work. The easy, fun way to enter special characters inlinux is with the compose key, and it works for lots of commonly used symbols but not everything. It’s built into X so it works with every desktop environment, but it’s not enabled by default. You have to decide which key is the compose key, first, and be warned that it will no longer do what it normally does. Some people like CapsLock,because they can get capital letters with the Shift key anyway. I’m experimenting with the Alt key on the right side of the board (leaving the one on the left side to do what Alt usually does). You’ll find the setting near where you determine the keyboard layout in your GUI of choice (Configure Desktop => Input Devices => Keyboard =>Advanced tab, for KDE).

Once you have a compose key, press itand release, then enter 2 to 4 other characters to get the symbol you want. What’s so great about this method is that the characters you enter at this point are way, way easier to remember than unicode or ASCII. For the most commonly used symbols, they’re easy to guess (that’s the fun part).

If a symbol looks like a combination oftwo ordinary letters, then the keys you need are probably those two.For instance, compose-key plus “x” plus “o” yields this: ¤.I’ll use it as a symbol for the compose key in a few more examples:

¤ 1 5 → ⅕
¤ e ’ → é
¤ e ^ → ê
¤ n ~ → ñ
¤ c , → ç
¤ o “ → ö
¤ A E → Æ
¤ t m → ™
¤ o r → ®
¤ L = → ₤
¤ - : → ÷
¤ = / → ≠
¤ % o → ‰
¤ - > → the arrow I’ve been using here. See how intuitive the combinations are? If the symbol you want looks like an ordinary symbol in a different position, try doubling up:

¤ x x → ×
¤ o o → °
¤ s s → ß (OK, that one’s actually the symbol for a double-s in German.)

Try it; it’s easy, much better for yourrhythm than using the character map. You can find cheat sheets of the most commonly used characters, or you can look in/usr/share/X11/locale, find the subdirectory for your language (in my case en-US.UTF-8) and then open the config file named Compose. There are thousands of combos, but not every unicode symbol. For instance,the integral operator I mentioned above isn’t there, but the format is easy to figure out, so I added these lines to the file:


<Multi_key> <i> <n> <t>            : "ʃ"    U222B # INTEGRAL OPERATOR
<Multi_key> <i> <n> <2>            : "∬"    U222C # DOUBLE INTEGRAL OPERATOR
<Multi_key> <i> <n> <3>            : "∭"    U222D # TRIPLE INTEGRAL OPERATOR
<Multi_key> <i> <n> <4>            : "⨌"    U2A0C # QUADRUPLE INTEGRAL OPERATOR

So now, I just remember “int” is short for integral, and type ¤int to get ʃ. Just make sure that any new ones you come up with aren’t already in use. If you have ideas for more, please post them here.

GEF

Moderators: If a “how to” on this subject has already appeared, and I somehow missed it, then I apologize for the duplication and ask you to delete my post.

The subject has been touched a few times in threads where people were asking for this. It may not be easy to find those threads from the past. IMHO, this is a fine description and in the correct place. Thanks for that.

I few additions.

If I am correct, the default Compose key is: Shift-RightCtrl. A bit awkward at first, but it becomes automatic soon.

Of course those combinations are defined somewhere on your system.

henk@boven:~> cd /usr/share/X11/locale
henk@boven:/usr/share/X11/locale> ls
am_ET.UTF-8       ibm-cp1133  iso8859-2   ja           ko_KR.UTF-8       ru_RU.UTF-8   zh_CN.gb18030
armscii-8         iscii-dev   iso8859-3   ja.JIS       locale.alias      sr_CS.UTF-8   zh_CN.gbk
C                 isiri-3342  iso8859-4   ja_JP.UTF-8  locale.dir        tatar-cyr     zh_CN.UTF-8
compose.dir       iso8859-1   iso8859-5   ja.SJIS      microsoft-cp1251  th_TH         zh_HK.big5
el_GR.UTF-8       iso8859-10  iso8859-6   km_KH.UTF-8  microsoft-cp1255  th_TH.UTF-8   zh_HK.big5hkscs
en_US.UTF-8       iso8859-11  iso8859-7   ko           microsoft-cp1256  tscii-0       zh_HK.UTF-8
fi_FI.UTF-8       iso8859-13  iso8859-8   koi8-c       mulelao-1         vi_VN.tcvn    zh_TW
georgian-academy  iso8859-14  iso8859-9   koi8-r       nokhchi-1         vi_VN.viscii  zh_TW.big5
georgian-ps       iso8859-15  iso8859-9e  koi8-u       pt_BR.UTF-8       zh_CN         zh_TW.UTF-8
henk@boven:/usr/share/X11/locale>

Then look into the directory with the name of your locale:

henk@boven:/usr/share/X11/locale> cd en_US.UTF-8/
henk@boven:/usr/share/X11/locale/en_US.UTF-8> ls
Compose  XI18N_OBJS  XLC_LOCALE
henk@boven:/usr/share/X11/locale/en_US.UTF-8>

The file Compose contains the definitions. A snippet:

# Spaces
<Multi_key> <space> <space>             : " "   nobreakspace # NO-BREAK SPACE
<Multi_key> <space> <period>            : " "   U2008 # PUNCTUATION SPACE

<Multi_key> <o> <c>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <o> <C>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <O> <c>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <O> <C>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <C> <o>                     : "©"   copyright # COPYRIGHT SIGN
<Multi_key> <C> <O>                     : "©"   copyright # COPYRIGHT SIGN

<Multi_key> <o> <r>                     : "®"   registered # REGISTERED SIGN
<Multi_key> <o> <R>                     : "®"   registered # REGISTERED SIGN
<Multi_key> <O> <r>                     : "®"   registered # REGISTERED SIGN
<Multi_key> <O> <R>                     : "®"   registered # REGISTERED SIGN
<Multi_key> <R> <O>                     : "®"   registered # REGISTERED SIGN

<Multi_key> <period> <greater>          : "›"   U203a # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
<Multi_key> <period> <less>             : "‹"   U2039 # SINGLE LEFT-POINTING ANGLE QUOTATION MARK
<Multi_key> <period> <period>           : "…"   ellipsis # HORIZONTAL ELLIPSIS
<Multi_key> <period> <minus>            : "·"   periodcentered # MIDDLE DOT
<Multi_key> <period> <asciicircum>      : "·"   periodcentered # MIDDLE DOT
<Multi_key> <asciicircum> <period>      : "·"   periodcentered # MIDDLE DOT
<Multi_key> <period> <equal>            : "•"   enfilledcircbullet # BULLET

This snippet shows also that there may be several combinations to reach the same result, which adds much to make this intuitive.

More information about Unicode at http://www.unicode.org/

And to go directly to the Unicode Code Charts where you can search for the graphical appearance of characters (the glyph) to find the Unicode point that represents it: Unicode 15.1 Character Code Charts

While the methods entering characters by clicking them from a pop-up window (as in LibreOffice) will show you from the start how a glyph looks like, entering using the Compose Key may produce characters that show as open squares (or upside down ? in a black square on its point) on the screen. That only means that you do not have a font installed that contains that particular glyph. Not that the Unicode is wrong.

And about the method using downholding Shift-Ctrl and typing u<hex-Unicode-point>, I can’t get it working. Do not know why.

O yes, and take care.
¤ o o → °
is the DEGREE SIGN and is different from
¤ ^ 0 → ⁰
The SUPERSCRIPT ZERO.
And there are more of those lookalikes. Try to use the correct one for the text you are making.