Monday, June 15, 2009

How to get the degree symbol (°) in Ubuntu

This is unlikely to be a mind-wrenching problem for many people but I'm annoyed at how difficult it is.
This thread post seemed offer some hope,
And, indeed it does work fine in, for example, Gedit. So, holding down Left Ctrl+Shift and tapping, in sequence, u b 0 gives rise to ° when all keys are released.
However, in Opera it seems to cause shortcut launches of many things and just does not at all produce the required, but curiously elusive, symbol.
The same happens in Gmail and even in writing this blog. To get the symbol printed here, I was forced to write it first in gedit and then copy and paste to the blog.
I'll keep searching.

[Edit: Some progress, but this is just a little complicated.
Just looking at two of my computers here; the Mac where,in Ubuntu, the keyboard layouts I use are USA Macintosh and Brazil. On the EeePC 901, in Ubuntu, I use USA and Brazil.
So, here's what I found after much trial and error.
To get ° or € on the Mac, I need (USAMac) Alt+8 and Alt+Shift+2. These work either in Opera or in Gedit.
With the Brazil layout on the Mac, to get ?, ° or €, I use Alt+w, Alt+Shift+0 and Alt+e.
On the EeePC 901, using USA layout, to get € I use AltGr+e. I was unable to find a combination for ° in the USA layout.
In the Brazil layout to get ?, ° and € I use AltGr+w, AltGr+Shift+0 and AltGr+e.
Interestingly, in this layout, while AltGr+Shift+0 gives ° in Opera, in Gedit the same combo gives an underlined degree symbol which I can't seem to reproduce here in this blog. Nevertheless, to get ° in Gedit, type AltGr+Shift+# (the key just above -to the right- of the Return key).]

8 comments:

  1. It's much easier than you think. I had to get to grips with all this as a prerequisite to switching to Ubuntu, since I do a lot of typing in foreign.

    Method 1:
    First, make sure the 'Compose Key' is set up (System > Preferences > Keyboard > Layouts > Other Options > Compose Key Position: I use Right Alt, as it was used for the same purpose in a Windows app I bought ages ago)

    Now, typing a logical sequence of keys allows you to create foreign and other odd characters very easily. The idea is that after the Compose Key, you enter a simple character (punctuation mark, another letter etc.) which reflects how you wish to modify the 'base' letter, then the letter itself. For example:

    Compose Key ' e = é
    Compose Key ^ o = ô
    Compose Key s s = ß
    Compose Key , c = ç

    Just guessing, I typed...

    Compose Key o o, and instantly got your elusive °.

    Method 2:
    Another dead easy way is to install the 'Character Palette' applet to the panel. I hardly ever use it now (Compose Key method is much quicker, unless you can't remember the sequence), but as it happens, ° is staring at me right now.

    Hope that helps.

    Peter

    ReplyDelete
  2. Thanks for that information. I wasn't aware of the Character Palette thing but that could certainly be useful now and again.
    However, I had indeed tried the Compose key (using Caps Lock) but my first attempt was to try to print €. However, in spite of selecting the 2 key to print € when used with the Compose key, it just didn't work. So, I gave up on this.
    But, you are quite correct that it does indeed produce ° as you describe.
    Best wishes

    ReplyDelete
  3. Strange - I have just tried out using Caps Lock as the Compose Key (I presume you don't value Caps lock!), and it worked fine for me (caps lock, =, e (or E), makes €). I don't have the knowledge to say why it would not for you. Did you try a different Compose key? Maybe your keyboard does not allow Caps lock to be 'hijacked'.

    Best, Peter

    ReplyDelete
  4. Thanks for that info which is indeed interesting. However, I just cannot replicate your success in getting the € symbol with the Compose key on any of my three computers (the third is an old Dell Desktop with a conventional Windows type kbd -- although of course I don't use Windows).
    On all three of the comps (in either USA or Brazil layouts), Compose+e gives ə which I'm not sure I'll ever need.
    As I see you're in the UK, I tried a UK layout for these tests with the Compose key, but this made no difference.
    I also tried different Compose keys but with no change in behaviour.
    Most mysterious.
    Thanks for alerting me to this. For the moment though, it'll just have to go in my "Things I don't understand" list.
    Paul

    ReplyDelete
  5. One very last thought, before putting this mystery to bed...

    I found that using Caps Lock as the Compose key (for testing purposes) had 'stuck', even after I had gone back to my usual Right Alt (so that I had two Compose Keys for a while). I could only get my normal Caps Lock back by clicking the 'reset' button on the Layouts tab. This suggests a problem somewhere, so maybe the reset button will enable you to re-assign Compose to Right Alt, for instance. (It's perfectly possible that a re-boot might have fixed the duplicate Compose Key, but I didn't try it.) Best of luck!

    P

    ReplyDelete
  6. Thanks for the interest in this.
    OK, I changed the Compose key, after resetting, to Menu key on the EeePC (note that the MacBook actually only has the CapsLock key of all those listed as potential candidates for the Compose key - no Win, no left Alt, left Ctrl etc).
    However, although the new Compose (Menu key) allowed me to get °, č, ə, ŭ, ß, ô, é, á and maybe some others, € just wasn't available.
    Perhaps it has something to do with dead-key mapping being different in whatever layout option you chose. But, quite honestly, as I basically have all the characters I need, I'm unlikely to investigate this any further.....unless I find myself at a completely loose end some day (hehe).
    Best wishes and thanks for your stimulating input
    Paul

    ReplyDelete
  7. I am using ubuntu 12.04, keyboard layout English International AltGr dead keys. Shit+AltGr+; ° works in this comment.

    ReplyDelete
  8. I forgot talk about my hardware, I use a hp dv6810us laptop with standard USA keyboard for windows.

    ReplyDelete