3

I want to type guillemets (angle quotes, «») in Ubuntu when using

  1. Russian keyboard mapping
  2. English keyboard mapping

Is it possible (preferably without typing numeric codes)?

There is a discussion here, but it does not mention Linux.

  • Where do you want to enter "guillemets"? In LibreOffice Writer or in TeX? – N0rbert Aug 2 '18 at 8:53
  • @N0rbert Generally in every application, if possible. I usually use LibreOffice Writer and Sublime Text. – rapt Aug 2 '18 at 9:03
  • @rapt LibreOffice convert automatically the " symbol into guillemet, so that's not a problem on this program; but for Sublime Text, I don't know – damadam Aug 2 '18 at 9:11
  • @damadam Is there a setting for that in Writer? When I try, it uses smart quotes e.g. “hello”. – rapt Aug 2 '18 at 9:16
  • @rapt What is your desktop environment? – N0rbert Aug 2 '18 at 9:16
5

Below is list of methods to enable special typographic symbols.
For Russian en English layouts they are defined in /usr/share/X11/xkb/symbols/typo file (mainly based on the layout proposed by Ilya Birman).

As the result you will get the following symbols:

First keyboard row:

  • ~ NoSymbol , Shift+~ approxeq ;
  • 1 onesuperior ¹, Shift+1 exclamdown ¡;
  • 2 twosuperior ², Shift+2 onehalf ½;
  • 3 threesuperior ³, Shift+3 onethird ;
  • 4 dollar* $, Shift+4 onequarter ¼;
  • 5 U2030 (PER MILLE SIGN) , Shift+5 NoSymbol;
  • 6 uparrow , Shift+6 NoSymbol;
  • 7 ampersand &, Shift+7 questiondown ¿;
  • 8 infinity , Shift+8 oneeighth ;
  • 9 leftarrow , Shift+9 NoSymbol;
  • 0 rightarrow , Shift+0 NoSymbol;
  • - emdash , Shift+- endash ;
  • = notequal , Shift+= plusminus ±;

Second keyboard row:

  • e EuroSign , Shift+e NoSymbol;
  • r registered ®, Shift+r NoSymbol;
  • t trademark , Shift+t NoSymbol;
  • y yen ¥, Shift+y NoSymbol;
  • p acute ´, Shift+p doubleacute ˝;
  • [ bracketleft [, Shift+[ braceleft {;
  • ] bracketright ], Shift+] braceright }.

Third keyboard row:

  • a U0301 (COMBINING ACUTE ACCENT) ́, Shift+a NoSymbol;
  • s section §, Shift+s NoSymbol;
  • d degree °, Shift+d division ÷;
  • f sterling £, Shift+f NoSymbol;
  • j doublelowquotemark , Shift+j singlelowquotemark ;
  • k leftdoublequotemark , Shift+k leftsinglequotemark ;
  • l rightdoublequotemark , Shift+l rightsinglequotemark ;
  • ; leftsinglequotemark , Shift+; minutes ;
  • ' rightsinglequotemark , Shift+' seconds .

Fourth keyboard row:

  • x multiply ×, Shift+x U22C5 (DOT OPERATOR) ;
  • c copyright ©, Shift+c cent ¢;
  • v downarrow , Shift+v U25CA (LOZENGE) ;
  • m U2212 (MINUS SIGN) , Shift+m enfilledcircbullet ;
  • , guillemotleft «, Shift+, less <;
  • . guillemotright », Shift+. greater >;
  • / ellipsis , Shift+/ NoSymbol;

Space:

  • Space nobreakspace , Shift+ Space nobreakspace .

For other languages layouts may vary.
Settings for common desktop environments are presented below.


Ubuntu with Unity and GNOME desktop environments

Ubuntu 14.04 LTS and Ubuntu 16.04 LTS

  1. Launch GNOME Tweaks (installable with sudo apt-get install gnome-tweak-tool, run by gnome-tweak-tool)

    1. Go to Typing
    2. In Miscellaneous compatibility options check Enable extra typographic characters
    3. Close GNOME Tweaks.
  2. Open Keyboard preferences (or unity-control-center keyboard)

    1. Click on Text Entry, then on Keyboard Settings...
    2. Select key in Alternative Characters Key (for example, Right Alt) (note: it is 3rd level)
    3. Back to Text Entry section, select Russian keyboard layout and click small keyboard icon keyboard icon to ensure that we have guillemets («елочки»):

      Guillemets or Елочки in GNOME

    4. Close Keyboard windows.

  3. Use guillemets («елочки») in any application by pressing RightAlt with corresponding keys (Б and Ю; , and .).

Ubuntu 18.04 LTS

  1. Launch GNOME Tweaks (installable with sudo apt-get install gnome-tweaks, run by gnome-tweaks)
    1. Go to Keyboard & Mouse
    2. Click on Additional Layout Options
    3. Expand Miscellaneous compatibility options check Enable extra typographic characters
    4. Close GNOME Tweaks.
  2. Use guillemets («елочки») in any application by pressing RightAlt with corresponding keys (Б and Ю; , and .).

Ubuntu with MATE Desktop Environment (any version)

GUI way

  1. Open System -> Preferences -> Hardware -> Keyboard (or mate-keyboard-properties).
  2. Go to Layouts tab
    1. Click Options
    2. In Key to choose 3rd level choose needed key (for example Right Alt)
    3. In Miscellaneous compatibility options check Enable extra typographic characters
    4. Click Close
  3. Select Russian keyboard layout and click Show to ensure that we have guillemets («елочки»):

    Guillemets or Елочки in MATE

  4. Use guillemets («елочки») in any application by pressing RightAlt with corresponding keys (Б and Ю; , and .).

Terminal way

Use GSettings to set two layouts (us and ru) using Alt+Shift as layout switcher, typographic symbols are enabled RightAlt as 3rd level switch::

gsettings set org.mate.peripherals-keyboard-xkb.kbd layouts "['us', 'ru']"
gsettings set org.mate.peripherals-keyboard-xkb.kbd model "''"
gsettings set org.mate.peripherals-keyboard-xkb.kbd options \
"['grp\tgrp:alt_shift_toggle', 'lv3\tlv3:ralt_switch', 'compat\tmisc:typo']"

Other GUI sessions and terminal

Edit /etc/default/keyboard and add here two parameters as described in man xkeyboard-config:

  • misc:typo to enable extra typographic characters and
  • lv3:ralt_switch to choose typographic symbols with Right Alt:

    XKBOPTIONS="grp:alt_shift_toggle,lv3:ralt_switch"
    

After editing you should update initramfs images to include the new version of configuration file

sudo update-initramfs -k all -u
  • I use the Unity desktop. I tried your "Ubuntu 14.04 LTS and Ubuntu 16.04 LTS" way and nothing happens. When I am in Russian keyboard and do AltRight+<, it prints б. – rapt Aug 5 '18 at 20:26
  • Very strange. Just tested this method again on clean Ubuntu 16.04 LTS VM with Unity desktop (followed my guide above line-by-line). With "RightAlt" + "ю" or "RightAlt" + "." it prints ». Do you see 3rd level on the image of keyboard layout chart (accessible from keyboard indicator in right top corner of the screen)? – N0rbert Aug 5 '18 at 20:48
  • I forgot mentioning: in the tweak tool the option is called "Key to choose 5th level" (not 3rd level). I used this option. What does "level" mean? You did not explain this term. Other than this I think I could follow precisely the instructions you had listed. I can open the image of keyboard layout chart, but I do not understand what you mean by "3rd level on the image"? – rapt Aug 5 '18 at 21:02
  • 1
    Thank you, it works, I use it. I think they could have done it better by allowing to override the 3rd level by the regular shortcuts such as the ones I have already defined. But generally it's useful to have access to the 3rd level of the keyboard. – rapt Aug 15 '18 at 22:51
  • 1
    Holy Moly! All that work, clearly formatted, pictures added and still only 1 upvote? +1 Also, you can do keyboards the hard way – Fabby Aug 16 '18 at 21:24
4

On the English keyboard the simplest way I have found is this...
Tap Compose then >> (2x > in succession) which gives »
Tap Compose then << (2x < in succession) which gives «

  • does it work with others language keyboard mapping? – damadam Aug 2 '18 at 8:24
  • Works on my English UK keyboard so US probably so but I don't have a Russian keyboard... Does the Russian keyboard have the > char? If so, I don't see a reason not to. – Graham Aug 2 '18 at 8:38
  • @Graham I do not have that AltGr key in my physical Keyboard. Is there a way to work around this? Did they not take it into account? What do you mean by not having a Russian keyboard? You can add the Russian keyboard mapping, no? – rapt Aug 2 '18 at 8:57
  • 1
    @N0rbert Please see my additional response to rapt. I confused the "Super" and "Compose" key terminology. I've amended my answer accordingly. – Graham Aug 8 '18 at 12:39
  • 1
    Edited to show abbreviated method using only Compose key and right/left angle brackets – Graham Aug 9 '18 at 8:47
2

Apparently having an AltGr (Alternate Graphics) key on your keyboard where the Right Alt resides on US style keyboards is helpful for « and » simulation key strokes.

From this French article, translated by google below, it says:

  • Under X11 (GNU / Linux) :

    • AltGr w (oss variant) or AltGr z (fr variant) and AltGr x give the left and right quotation marks "and"

Further discussion can be found in Wikipedia:

AltGr (also Alt Graph, or Right Alt1) is a modifier key found on some computer keyboards and is primarily used to type characters that are unusual for the locale of the keyboard layout, such as currency symbols and accented letters. On a typical, IBM-compatible PC keyboard, the AltGr key, when present, takes the place of the right-hand Alt key. In macOS, the Option key has functions similar to the AltGr key.

There is a lot more to read in the link!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.