Superscript & Subscript for TextArea on Linux?

I‘m using MBS to add superscript and subscript to my TextArea, but MBS only supports it for Mac & Windows.

Does anyone know how to do it for Linux?

Not an answer to your question… Does the MBS plugin let you not super and subscript the same same symbol leading and trailing?

Ans example of trailing (the most common case) would be something like SO**-2**4

Where the 4 is a subscript and -2 as superscript?

A leasing would be 23892U where 238 is a superscript and 92 is a subscript with proper justification (the last digit of both numbers up against the U).

As a chemist I have had write code to handle drawing such things a number of times over the years in line with other text. I don’t think even MS Word handles that outside the equation editor.


Some of there are just utf-8 characters but I dont know if thats sufficient for your needs ?

That is fine for a single super or subscript but not when you have both at the same time for the same symbol.

What happens then is that one or the other is offset from the symbol by the width of the one which comes first

So It fine for polynomials as they only have superscripts, or most uncharged chemical formulas as they only have subscripts, but not the general case when the same symbol can have both.


which is why I said

apparently the answer for writing chemical fomulae its not

Excuse my chemistry but isn’t it SO4 -2?

SO4-2 is easy and works fine with MBS in a TextArea on Mac and Windows.

However Linux is not supported.

And for on here simply use the <sub> and <sup> html codes.

But don’t you see the issue with that? The -2 should be next to the oxygen, not spaced after the subscript… If the subscript was 2 or 3 digits it would be even more obvious… And how it looks depends on if the super or subscript occurs first.

Just for illustration:




No, the SO4 is double negatively charged, not the O, so having both at the O is wrong (logically that should mean four double negative O with an overall charge of -8 which is nonsense).

And yes, I know it has become fashionable to do it but I still think its wrong.

Just because it is used in physics to denote isotopes doesn‘t mean it should be used in chemistry for electric charges.

First I obviously understand delocalization but even going back to the 70’s i have never seen the sulfate anion, outside of acid base calculations, written as [SO4]-2 ) (or as (SO4)-2 )…

It was always understood that charge applied to whole anion in these types of formulas…

But in any case my point was about typography not chemistry… If a symbol has both a super and subscript BOTH should be right up against the symbol… I would have thought my last two examples illustrated that point.


Hmmm, I found


typedef struct {
  GdkColor bg_color;
  GdkColor fg_color;
  GdkBitmap *bg_stipple;
  GdkBitmap *fg_stipple;

  /* super/subscript rise, can be negative */
  gint rise;

  guint underline : 4;          /* PangoUnderline */
  guint strikethrough : 1;

  /* Whether to use background-related values; this is irrelevant for
   * the values struct when in a tag, but is used for the composite
   * values struct; it's true if any of the tags being composited
   * had background stuff set.
  guint draw_bg : 1;
  /* These are only used when we are actually laying out and rendering
   * a paragraph; not when a GtkTextAppearance is part of a
   * GtkTextAttributes.
  guint inside_selection : 1;
  guint is_text : 1;
} GtkTextAppearance;

but that’s where I have to throw the towel.


Hi Karen,
I don’t know whether distributing a special font with the application would be practical or not. If it is, this wouldn’t be hard to do at all. I work with Spanish punctuation and have modified a few fonts to get correct spacing. You can put in characters with a zero width. Simply add 10 glyphs for superscripts with a zero width. Type the superscript first and then the subscript. Some music writing programs do this. I use Fontforge, but there are others.

1 Like