Special chracters with compose key.

Discussion in 'all things UNIX' started by Ocky, Feb 8, 2011.

Thread Status:
Not open for further replies.
  1. Ocky

    Ocky Registered Member

    Joined:
    May 6, 2006
    Posts:
    2,677
    Location:
    George, S.Africa
    In the unlikely event that some of you are not familiar with inserting special characters like this.. 23°C or © Ocky :) into your typed documents/emails etc.

    A compose key needs to be selected in Keyboard Preferences>Layouts>Options. Select a 'Compose Key Position' (eg. Right Alt). That's it and here a list of characters (and sequences explained at the end).

    Code:
    The diacritic characters are:
    ' (apostrophe) ⇒ A letter with acute (Áá)
    " (double quote) ⇒ A letter with diaeresis (Ää)
    ` (grave) ⇒ A letter with grave (Àà)
    _ (underscore) ⇒ A letter with macron (Āā)
    ^ (circumflex) ⇒ A letter with circumflex (Ââ)
    ~ (tilde) ⇒ A letter with tilde (Ãã)
    , (comma) ⇒ A letter with cedilla (Çç)
    . (period) ⇒ A letter with dot above (Ȧȧ)
    ! (exclamation) ⇒ A letter with dot below (Ạạ)
    ? (question) ⇒ A letter with hook (Ảả)
    / (slash), - (minus) ⇒ A letter with stroke (Øø, Đđ)
    ; (semicolon) ⇒ A letter with ogonek (Ąą)
    + (plus) ⇒ A letter with horn (Ơơ)
    = (equals) ⇒ A letter with double acute (Őő)
    o ⇒ A letter with ring (Åå)
    c ⇒ A letter with caron (Ǎǎ)
    b ⇒ A letter with breve (Ăă)
    
    Some characters may be combined to create mixed diacritical marks, e.g. Compose _ " a produces ǟ (‘a’ with diaeresis and macron), and so on.
    
    Other letters and ligatures:
    Compose A/a E/e ⇒ Æ/æ
    Compose O/o E/e ⇒ Œ/œ
    Compose T/t H/h ⇒ Þ/þ
    Compose N/n G/g ⇒ Ŋ/ŋ
    Compose s s ⇒ ß
    Compose e e ⇒ ə
    
    Currency symbols:
    Compose c / ⇒ ¢
    Compose C = ⇒ €
    Compose L = ⇒ ₤
    Compose F r ⇒ ₣
    Compose Y = ⇒ ¥
    Compose o x ⇒ ¤
    Punctuation marks and other symbols
    
    Quotation marks:
    Compose , ' ⇒ ‚
    Compose , " ⇒ „
    Compose < ' ⇒ ‘
    Compose > ' ⇒ ’
    Compose < " ⇒ “
    Compose > " ⇒ ”
    Compose < < ⇒ «
    Compose > > ⇒ »
    Compose . < ⇒ ‹
    Compose . > ⇒ ›
    
    Others:
    Compose . . ⇒ ·
    Compose - - - ⇒ — (em-dash)
    Compose - - . ⇒ – (en-dash)
    Compose ? ? ⇒ ¿
    Compose ! ! ⇒ ¡
    Compose + - ⇒ ±
    Compose : - ⇒ ÷
    Compose 1 2 ⇒ ½
    Compose 1 4 ⇒ ¼
    Compose 3 4 ⇒ ¾
    Compose _ 0-9 ⇒ ₀ – ₉ (subscript digit)
    Compose ^ 0-9 ⇒ ⁰ – ⁹ (superscript digit)
    Compose ( 0-9 ) ⇒ ⓪ – ⑨ (circled digit)
    Compose o c ⇒ ©
    Compose o r ⇒ ®
    Compose o o ⇒ °
    Compose o s ⇒ §
    Compose x x ⇒ ×
    Compose P P ⇒ ¶
    Compose T M ⇒ ™
    Compose m u ⇒ µ
    Compose % o ⇒ ‰
    Defining custom Compose sequences
    
    Default Compose sequences are defined in ‘Compose‘ text file in the current locale directory (/usr/share/X11/locale/xxx). This file contains the rules to define Compose keyboard sequences and corresponding Unicode characters:
    # UTF-8 (Unicode) compose sequence
    # David.Monniaux (at) ens.fr
    #
    # $XFree86: xc/nls/Compose/en_US.UTF-8,v 1.11 2004/01/06 13:14:04 pascal Exp $
    ...
    <Multi_key> <less> <less>        	: "«"   guillemotleft # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
    <Multi_key> <greater> <greater>  	: "»"   guillemotright # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
    <Multi_key> <less> <apostrophe>  	: "‘"   U2018 # LEFT SINGLE QUOTATION MARK
    ...
    
    To define new Compose sequence, we should add another rule using the syntax:
    <Multi_key> <key1> [<key2> ...]   	: "character"
    
    For instance, for a smiley character (☺, Unicode 263A), the rule could be
    <Multi_key> <colon> <parenright> : "☺"  # Compose : )
    
    There is a number of utilities (like KCharSelect in KDE) for to select the Unicode characters and insert them into the file via clipboard.
    
    It is possible to add new rules just into this system file (if you are root), but it’s better to create ‘.XCompose‘ file in the user home directory:
    # ~/.XCompose
    # This file defines custom Compose sequence for Unicode characters 
    
    # Import default rules from the system Compose file:
    include "/usr/share/X11/locale/en_US.UTF-8/Compose"
    
    <Multi_key> <colon> <parenright> : "☺" U263A   # Compose : )
    <Multi_key> <minus> <less>   : "←"  U2190 # Compose - <
    <Multi_key> <minus> <greater> : "→" U2192 # Compose ->
    ...
    
    You also can assign whole strings to the Compose sequences — for instance, syntax constructions of your favorite programming language or HTML tags:
    <Multi_key> <less> <p> : "<p></p>" # Compose < p
    <Multi_key> <less> <a> : "<a href=""></a>" # Compose < a
    ...
    In Windows I used to use AllChars http://allchars.zwolnet.com/ but I am not sure whether Vista and Windows 7 are supported yet.
     
  2. katio

    katio Guest

  3. wilbertnl

    wilbertnl Registered Member

    Joined:
    Dec 29, 2004
    Posts:
    1,850
    Location:
    Tulsa, Oklahoma
    Nice, I use the international US keyboard and the accent keys act like a dead key, the character appears after you type the second character.
     
Thread Status:
Not open for further replies.