How to create lowercase pi (“π”) with compose key?

8,165

Solution 1

The X11 compose list is typically under /usr/share/X11/locale/ (this location may vary between distributions though), but the Compose file is not necessarily in the directory named after your LC_CTYPE setting. There is a stage of translation of locale names via the file /usr/share/X11/locale/compose.dir. This translation allows many locales to share the same compose file. (Symbolic links would have been another way, but a text file is easier to distribute and works on platforms that don't have symbolic links — X11 exists outside of Unix.) Most locales that use the UTF-8 encoding for a language written in the Latin alphabet use the compose file for en_US.UTF-8, located in en_US.UTF-8/Compose.

In en_US.UTF-8/Compose, the only way to generate U03C0 (GREEK SMALL LETTER PI) is <dead_greek> <p>. There is no <Multi_key> (Compose) sequence. Among the keyboard layouts distributed with X.org, the only one that defines a dead_greek key is the BÉPO layout (a French analog of DVORAK). So there's no way to type π using the Compose key with the default configuration. And the default UK layout doesn't include a way to type π, not even in an XKB variant (a US Mac layout (us(mac)) will give you π on AltGr+P however).

As far as I can tell, there's never been a standard Compose sequence to insert π on Xorg. If you remember one, you might have been an input method other than X11's built-in mechanism.

Solution 2

as others remark, there are no standard compose rules in X for π, so if you want to use compose to make the π symbol (as I just did), you could:

  • install uim
  • create ~/.XCompose
  • put there the rules you need
  • do not forget to start the file with include "%L"

mine looks like this:

include "%L"

<Multi_key> <l> <l>                 : "ℓ"   U2113     # litre symbol
<Multi_key> <p> <i>                 : "π"   U03C0     # GREEK SMALL LETTER PI

this works on Debian. it does affect the way Ctrl-Shift-u works.

Solution 3

This isn't super convenient, but it works:

If you look in your Compose file for the 'pi' symbol:

% grep -i greek /usr/share/X11/locale/en_US.UTF-8/Compose | grep -i 'letter pi'
<dead_greek> <P>            : "Π"   U03A0    # GREEK CAPITAL LETTER PI
<dead_greek> <p>            : "π"   U03C0    # GREEK SMALL LETTER PI

You see that the combination for lowercase π is U03C0

So if you press ControlShiftu and then type in 03c0 Space, you are left with a π symbol.

The other way that should work is to define a key with xmodmap, but I have had problems with some applications not responding to that.

Solution 4

One option is to change your keyboard setup to use the Greek language and then press the "p" (lower case, i.e. with Caps lock off)

Solution 5

Use unicode compose [shift]+[control]+U then 03A0

Share:
8,165

Related videos on Youtube

l0b0
Author by

l0b0

Author, The newline Guide to Bash Scripting (https://www.newline.co/courses/newline-guide-to-bash-scripting). Hobby (https://gitlab.com/victor-engmark) &amp; work software developer.

Updated on September 18, 2022

Comments

  • l0b0
    l0b0 over 1 year

    I'm pretty sure I used to be able to create lowercase pi characters using Composepi (as described on for example fsymbols.com), but it no longer works. My compose key works for other characters (like Composeaa for “å”), so what could be wrong?

    I don't have /usr/share/X11/locale/en_GB.utf8/Compose (or ~/.XCompose), is that something which should have been installed/generated? There is a /usr/share/X11/locale/en_US.utf8/Compose; would it be sufficient to symlink that from /usr/share/X11/locale/en_GB.utf8/Compose to fix this?

    $ locale
    LANG=en_GB.utf8
    LC_CTYPE="en_GB.utf8"
    LC_NUMERIC="en_GB.utf8"
    LC_TIME="en_GB.utf8"
    LC_COLLATE="en_GB.utf8"
    LC_MONETARY="en_GB.utf8"
    LC_MESSAGES="en_GB.utf8"
    LC_PAPER="en_GB.utf8"
    LC_NAME="en_GB.utf8"
    LC_ADDRESS="en_GB.utf8"
    LC_TELEPHONE="en_GB.utf8"
    LC_MEASUREMENT="en_GB.utf8"
    LC_IDENTIFICATION="en_GB.utf8"
    LC_ALL=
    

    Spin-off question.

  • l0b0
    l0b0 over 8 years
    Sorry, neither of those work.
  • l0b0
    l0b0 over 8 years
    I'm afraid that keyboard shortcut doesn't work (I tried starting with Compose, Shift, u; Compose+Shift+u; Compose, Shift+u; and Compose+Shift, u), and it would be very difficult to memorise.
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 8 years
    U03c0 means that it's the Unicode character whose code point is 0x03c0. It doesn't mean that the U key is involved in typing it in any way. You can type Control+Shift+U (not Compose+Shift+U) and then enter a hexadecimal code to enter a character by its Unicode code point, but that's a Gnome thing, unrelated to the compose mechanism, and not available outside Gnome applications (except maybe if you're using a Gnome-inspired input method globally, I don't know which ones implement that if any). Cc @l0b0
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' over 8 years
    Not in any of the Compose tables that come with X11. Maybe there's some other input method that offers this combination, but this answer isn't useful if you don't specify which.
  • Klaatu von Schlacker
    Klaatu von Schlacker over 8 years
    Changed the answer to control-shift-u. Did not intend to imply that this has anything to do with Compose; using Compose to get the Unicode number, using that to produce π character. As I said, not convenient and not the "right" way but possibly an option.
  • Pavel Šimerda
    Pavel Šimerda over 7 years
    That doesn't seem to work for me using xorg server 1.17.4 on Gentoo. I used exactly the contents above, started a new terminal, used the compose key, and pi didn't show up.
  • shirish
    shirish about 7 years
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review
  • Chris Tsiakoulas
    Chris Tsiakoulas about 7 years
    I didn't critique. I am Greek and having had the same problem writing up some documentations, i ended up using the easiest way possible.
  • Pavel Šimerda
    Pavel Šimerda over 6 years
    @omninonsense My only problem was that I used .Xcompose instead of .XCompose. Reloading Xorg or WM is not necessary, it's read at the start of a client, i.e. a web browser or a console. Thanks!
  • peterh
    peterh almost 6 years
    Nothing happens on my system, it simply types 03a0.
  • codeshot
    codeshot almost 4 years
    how do you add a dead_greek to your layout?
  • Gilles 'SO- stop being evil'
    Gilles 'SO- stop being evil' almost 4 years
    @codeshot Pick a key and bind it. If you want to change a single key, it's easier to do it with xmodmap than with xkb.
  • mpts.cz
    mpts.cz over 3 years
    @mariotomo: Excellent help, thank you very much.