Spanish accents on US keyboard

You can also use the compose key.

This is a good option if you do not want to change your keyboard layout, which can bring other complications to your keybindings in various settings.

Setting the compose key in 12.04:

  1. Go to System Settings >> Keyboard Layout >> Options.
  2. Click Compose key position to expand the list of choices and select an option. A common selection is right alt.

Using the compose key:

compose key+'+a = á
compose key+-+n = ñ (that's a dash or minus)

The keys following the compose key can be in either orders, so you can also use the the following.

compose key+a+' = á
compose key+n+- = ñ

For keys requiring shift, you use shift as normal, but it is only needed once.

compose key+shift+?+? = ¿
compose key+shift+!+! = ¡

See the full Gtk compose table.


Go to System->Preferences->Keyboard and chose the layout tab. Now add a new keyboard layout: Country: USA / Variants : USA International (with dead keys). Set this layout as default.

enter image description here

You should now be able to use dead keys for accents.


Best answer or your money back!:
- Updated 28 Feb. 2020 to include Ubuntu 18.04 instructions.

How to set up & use the "international with dead keys" keyboard in Ubuntu to type international characters and accents for any language, including French, Spanish, German, etc.

1. How to Install:

A. Ubuntu 14.04, 16.04 (Unity-based):

Click the Unity Search button (Ubuntu logo) and type in "Text Entry".

Click the little + button and add a new keyboard called "English (US, international with dead keys)". It will now look like this:

enter image description here

B. Ubuntu 18.04 (Gnome-based):

Go to Settings --> Region & Language --> click the "+" button under "Input Sources", as shown here: enter image description here Next, in the window that pops up --> click "English (United States)" --> "English (US, intl., with dead keys)" (as shown below) --> click "Add". enter image description here

NOW REBOOT YOUR COMPUTER! If you don't reboot now to finalize this change, the special accents and key sequences described below may not work.

2. How to Use:

Click this little button in the top right of your desktop task bar to select your keyboard now:

enter image description here OR enter image description here

OR use these keyboard shortcuts to change keyboards:

  1. Windows Key + Space bar = next source
  2. Shift + Windows Key + Space bar = previous source

(You'll see the little number in the bottom right of the image above change when you do this to indicate which keyboard is selected).

Make sure you have your new "English (US, international with dead keys)" (or in Ubuntu 18.04: "English (US, intl., with dead keys)") keyboard layout selected.

All of your accents can now be typed according to Microsoft's document here: https://support.microsoft.com/en-us/help/97738/using-us-int-l-keyboard-layout-to-type-accented-characters

Special keys to instigate accents and special characters now include the following 6 keys:

  1. ' (single quote)
  2. " (double quote)
  3. ` (back-tick)
  4. ~ (tilde)
  5. ^ (carat), and
  6. Right Alt

Here are some examples:

  1. Single quote:
    ' then e = é
    ' then i = í
    ' then o = ó
    ' then Space = '
  2. Double quote:
    " then u = ü
    " then o = ö
    " then Space = "
  3. Back-tick:
    ` then e = è
    ` then i = ì
    ` then Space = `
  4. Tilde:
    ~ then n = ñ
    ~ then Space = ~
  5. Carat:
    ^ then e = ê
    ^ then i = î
    ^ then Space = ^
  6. Right Alt (hold Right Alt while pressing the other key, rather than pressing then releasing as with the other special keys above):
    -See this site for additional characters typed this way, except when they say to use Ctrl + Alt realize you only need to use Right Alt.
    Right Alt + ! = ¡ (Spanish inverted/leading exclamation point)
    Right Alt + ? = ¿ (Spanish inverted/leading question mark)
    Right Alt + , = ç (French c-cedilla which makes a soft "s" sound)
    Right Alt + [ = « (French left quote, "guillemet gauche", left guillemet, "left-pointing double angle quotation mark", left sideways double chevrons)
    Right Alt + ] = » (French right quote, "guillemet droit", right guillemet, "right-pointing double angle quotation mark", right sideways double chevrons)
    Right Alt + z = æ
    Right Alt + w = å
    Right Alt + - = ¥
    Right Alt + s = ß (German Esszet, or "sharp s", which is identical to a German double s ["ss"])
    Right Alt + c = © (copyright symbol)
    Right Alt + r = ® (registered trademark symbol)
    Right Alt + 5 = € (Euro money symbol)
    Right Alt + 6 = ¼ (quarter fraction symbol)
    Right Alt + 7 = ½ (half fraction symbol)
    Right Alt + 8 = ¾ (three-quarters fraction symbol)

Etc etc. See the Microsoft link above (as well as this site) for full details on how to use this AMAZING new way to type accents and special characters.

Note that to type a regular single quote ' or tilde symbol, etc, you now have to either press the key once followed by Space bar OR switch back to your normal keyboard mode then press the key once. For some keys, pressing the key twice in a row also works, but for other keys, like single quote, it produces a different version of the single quote, ex: ' then ' = ´ instead of '.

References:

  1. https://linuxconfig.org/how-to-add-and-switch-keyboard-layout-on-ubuntu-18-04-bionic-beaver-linux