non-English characters in Linux

It’s easy to make accented characters (e.g. é and ü) in Linux. Easier than in Windows, actually, because in Windows you have to remember all those crazy Alt codes, and in Linux, it’s logical combinations of accents and letters.

  1. You need a command-line program called xmodmap. If you’re not sure you have this, run the following command in a term/console: which xmodmap. You’ll probably get something like the following:
    sarah@imp:~$ which xmodmap
    /usr/bin/X11/xmodmap
    This shows that you have xmodmap installed, and it happens to be located at /usr/bin/X11/xmodmap. Peachy.
  2. Run the following command in a term:
    xmodmap -e "keysym Alt_R = Multi_key"
    This assigns your right Alt to be your “multi-key.” Your multi-key is the key you’ll press to tell the computer you’re about to make an accented character.
  3. Now you’re all set! The basic idea is to hit a key sequence, beginning with your multi-key, and then two characters you wish to combine. For example, to make an é, you would hit Alt ' e. That’s right-Alt, release, apostrophe, release, e. Or, you can hold down all the keys at once (i.e. right-Alt + apostrophe + e). You can also produce é if you hit the e before the apostrophe, as long as you begin the sequence with your multi-key.

    Note that your term might not recognize the accented characters, and so you should probably do your testing in some place like a browser or text editor.

Voilà. Now you can type your French papers much more quickly, because you won’t have to select individual characters from some symbol chart in your word processor, and you can correspond with your German friends on gaim just as quickly, because you won’t have to copy and paste accented characters from some site.

A note: if you like writing your documents in OpenOffice, you may have some trouble with entering accented characters because OpenOffice always seemed to ignore the Alt key sequences, at least for me with version 1.1.0. I recommend instead, if you’re going to be writing something that involves non-English characters, a word processor called AbiWord. It’s simpler than OpenOffice and it lets you type in the accented characters.

Sample Key Combinations

For these sample sequences, I assume that your multi-key is Alt.

Combination Result
Alt s s ß
Alt ? ? ¿
Alt ! ! ¡
Alt ` o (that’s a back tick) ò
Alt ^ a â
Alt " u (those are quotes, not two apostrophes) ü
This entry was posted in Linux and tagged , | Current music Stone Temple Pilots - Wonderful. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

12 Comments

  1. Posted 29 December 2005 at 1:02 AM | Permalink

    I’Ve got one problem regarding this… I assigned my left alt key to do this, as you know, but upon rebooting my computer, the left alt doesn’t work in that way anymore. Shouldn’t assigning this key mean it STAYS assigned? I shouldn’t have to reassign it ever time I reboot, should I?

  2. Posted 29 December 2005 at 10:47 AM | Permalink

    Actually… Yes, that’s the way it works. You can put the xmodmap command in a script that gets executed every time you reboot back into Linux. For example, my window manager IceWM has a “startup” file that is executed as soon as I load IceWM. Or, a ghetto solution if you don’t mind receiving an error message every time you open a term, is to put the command in a file called .bashrc in your home directory. Assuming you use bash as your shell, and not something like csh or zsh. To test and see which shell you use, do the command echo $SHELL in a term.

  3. Posted 29 December 2005 at 12:22 PM | Permalink

    Thanks! I am using bash, so I’ll just throw that command in a file and deal with the error for now :D

    Man, that rhymes!

  4. Posted 10 January 2006 at 1:49 AM | Permalink

    I know this is kinda late, but an easy way to get this to work at startup (in Ubuntu at least) is to do a sudo nano /etc/init.d/bootmisc.sh and insert the xmodmap command that you use at the bottom of the file (but before the : exit 0 line, be sure of that ;)), save it, reboot, and it still works! Far easier than doing .bashrc editing, IMO. :D

  5. Posted 27 January 2006 at 11:34 AM | Permalink

    I’ve actually put this in my ~/.bash_profile which is only run on invoking non-interactive sessions (e.g. logging in). So it won’t be run every time you open a terminal. I think some distros handle this differently, but this is the gist.

    Also, to avoid the error printing, just add ‘&> /dev/null’ to the end. Be warned, though; this will not print anything, even something that may be useful. So only add it after you’re sure it’s working as it should.

    But let me say, ït îs for me! :)

  6. Posted 8 January 2007 at 9:02 AM | Permalink
  7. Theo
    Posted 12 January 2007 at 1:38 AM | Permalink

    Hello from Belgium !
    i am a Ubuntu newbie and have a Qwerty
    Keyboard ,choose Dutch as Keyboard layout
    but @ doesnot show up .Copy and pasting it does work, but thats not the way….
    Thanks

  8. Art
    Posted 23 January 2007 at 12:42 AM | Permalink

    Use the Windows key instead of Alt It works in OOo and you aren’t using it for anything else anyway.

  9. Posted 25 January 2007 at 11:57 PM | Permalink

    Just add the special character applet to the taskbar. Lol.

  10. Posted 26 January 2007 at 8:37 AM | Permalink

    Not all people are using window managers that have taskbars, or that offer such features. I know for a long time I used Blackbox due to its simplicity, and I never found a ’special character applet’ that I could’ve put on my taskbar. Before that was fvwm2, which didn’t even have a taskbar in my setup.

  11. Posted 2 April 2007 at 9:48 AM | Permalink

    Hi! Thanks a lot for your tip! Just the line i’m going to add to my ion3 scripts :-)

  12. Sam Korn
    Posted 4 May 2007 at 3:12 PM | Permalink

    I find the best key to use with this is the right Windows key. This, for anyone who doesn’t know, is Super_R.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>