Announcement

Collapse
No announcement yet.

superscripting and subscripting of numbers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    superscripting and subscripting of numbers

    Hey there,

    is there a possibility to superscript or subscript numbers in a text in any program by keyboard? Like this: x2 or H2O.

    #2
    Maybe you're asking for a compose key? In system settings, input devices, keyboard, advanced tab, position of compose key, I have it set to "Pause", as I don't otherwise use it. Then, if I type
    pause, ^, 7 I get ⁷, and pause, _, 8 I get ₈

    I'm not sure the best place to f8ind the sequences, but I look at /usr/share/X11/locale/en_US.UTF-8/Compose.
    Regards, John Little

    Comment


      #3
      In what context are you doing this? I know it can be done in LibreOffice Writer, but I'm not sure about elsewhere. In LO Writer, you can type "H2O" and then highlight the 2 and hit Ctrl+Shift+B to make the 2 a subscript. Then for X squared, you can write "X2" and then highlight the 2 and hit Ctrl+Shift+P to make that 2 a superscript. It sometimes works if you cut and paste that elsewhere. I'll do it here: H2O. X2

      However, it does not work to cut and paste it everywhere. I looked around in Kubuntu's settings at System Settings ===> Input Devices ===> Keyboard ===> Advanced, which is where I set up a system of putting accent marks on characters, as in "Café", but I'm not finding a way to do superscripts and subscripts. Maybe it's there and I'm just not finding it.
      Kubuntu 22.04 (desktop & laptop), Windows 7 &2K (via VirtualBox on desktop PC)
      ================================

      Comment


        #4
        Originally posted by Tom_ZeCat View Post
        In what context are you doing this?
        Possibly excepting input methods (I know nothing about them), any keyboard input. As long as the font has the characters, the compose key makes them. I tried lots, LibreOffice, konsole, dolphin (typing a new file name), kate, knotes... Only kcalc didn't work (but Qalculate! does, 22² = 484).
        Regards, John Little

        Comment


          #5
          Thanks for your answers.

          LO is not the problem, I'm looking for something not being dependant of the program used. So the thing with the compose key sounds good.​

          Originally posted by jlittle View Post
          Maybe you're asking for a compose key? In system settings, input devices, keyboard, advanced tab, position of compose key, I have it set to "Pause", as I don't otherwise use it. Then, if I type
          pause, ^, 7 I get ⁷, and pause, _, 8 I get ₈
          I tried to use caps lock as compose key. Your code for "⁷" is working but the one for subscripting does not. I use a german keyboard and layout, so the "_" isn't reachable without using caps.
          I couldn't figure out yet how the working of the compose key is configured, is there a list of codes or can I edit this?
          Last edited by sebigbos; Aug 27, 2024, 12:42 AM.

          Comment


            #6
            I'm confused by the fact that /usr/share/X11/locale/en_US.UTF-8/ exists, but /usr/share/X11/locale/de_DE.UTF-8/ does not.

            However, maybe a ~/.XCompose will do the job. I have compose t u to give me 👍:
            Code:
            include "%S/en_US.UTF-8/Compose"
            <Multi_key> <t> <u>    : "👍" U1F44D # THUMBS UP SIGN​
            I just added
            Code:
            <Multi_key> <s> <2> : "₂"
            ​
            logged out and in, to restart X11, and compose s 2 gives me ₂. ("s2" is the RFC1345 mnemonic for subscript 2, or so the vim help tells me.) To get the appropriate characters in the first place, you could copy lines from /usr/share/X11/locale/en_US.UTF-8/Compose, from the "Superscripts and Subscripts" section.
            Regards, John Little

            Comment


              #7
              Hm, I'm not sure wether I got that right. I copied my /usr/share/X11/locale/en_US.UTF-8/compose to ~/.XCompose​ . Then I tried to change the entries there, So for example

              Code:
              <Multi_key> <underscore> <0>            : "₀"    U2080 # SUBSCRIPT ZERO
              to

              Code:
              <Multi_key> <SOMETHING ELSE> <0>            : "₀"    U2080 # SUBSCRIPT ZERO
              For <SOMETHING ELSE> I tried <q> (because it's nearby the ^), <dash> or <hyphen> or <-> (because this is the key where caps _ is located) and some other letters but nothing happens. Superscripting with compose ^ ² is still working though.

              Do I have to activate or load the ~/.XCompose somehow?

              Comment


                #8
                Originally posted by sebigbos View Post
                Do I have to activate or load the ~/.XCompose somehow?
                It is read at the DE startup, so you have to log out.

                Regards, John Little

                Comment


                  #9
                  so I did but nothing happens

                  Comment

                  Working...
                  X