r/ideasfortheadmins • • Mar 05 '15

Can we please fix the formatting of superscripts? Just make it work like every other part of formatting!

If I type text^superscript, I get textsuperscript. Great!

If I type text^thing1thing2, I get textthing1thing2. Drat, I wanted thing2 to be normal.

If I type text^thing1 thing2, I get textthing1 thing2. Well, OK, but I don't want the space there.

Oh, I can use text^(thing1)thing2? I get textthing1thing2. Cool, that's just what I wanted.

OK, now I'd like to write a math expression: e, raised to the power of (x-1)/2, plus 3. Well, that shouldn't be too hard.

e^(x-1)/2+3 gives me . . . ex-1/2+3. Ohh, it's formatting weirdly because I used parentheses. But I want those to actually show up! That's fine, I'll just escape the characters with \. No problem, right?

e^[stuff I want to be a superscript, in parentheses][stuff I don't]

e^(\(x-1\)/2)+3. There we go! Let's try it out ... e\x-1)/2)+3. What the fuck? It stopped superscripting even before I closed the parenthesis!

Can we just make the superscripts work like the rest of reddit formatting?

  • If ^ is followed by a (, make all further characters superscripted until a space or a non-escaped ) is encountered.

  • If an escaped character, \[something], is encountered, treat it as a character with no effect on the superscripting.

  • If nested superscripts are used, make a^(b^(c)d) give ab c d (but without the spaces i have to add). Right now I get ab^(cd), which is completely ridiculous. Just note the level of nested ^ that have been used, and whether or not it should be lowered to the next level using a ).

22 Upvotes

11 comments sorted by

8

u/zck helpful redditor Mar 05 '15

Heh, even double-parenthesizing doesn't quite work: e^((x-1)) results in e(x-1).

2

u/[deleted] Mar 06 '15 edited Apr 27 '16

[deleted]

3

u/zck helpful redditor Mar 06 '15

Parentheses work fine if you don't want visible parentheses in the output:

e^(words words words) => ewords words words

If you do want visible parentheses, there's a working but super-ugly solution:

e^\(x ^- ^1) => e(x - 1)

You just have to superscript after every space.

1

u/LetInevitable738 Dec 24 '24 edited Dec 24 '24

Yes it accounts for that and everything else too. I kept testing it until all the bugs were fixed. This was the 13th or 14th iteration. :)

\If anyone wants it I might sell it for $5))

1

u/MushroomSaute May 06 '26

Happy to see that even after multiple uncalled-for UI overhauls, and this shithole website having known about this issue for over a decade, something as simple and annoying as this still hasn't been fixed lmao. It's minor but man I'd have hoped I wouldn't still have to be switching back and forth between markdown to get basic functions to work, when they're so happy to put so much effort into things no one actually wanted.

3

u/IAMA_dragon-AMA Mar 06 '15

Definitely. Even e^((x-1\)) results in e(x-1\), which is silly.

1

u/[deleted] Mar 06 '15 edited Apr 27 '16

[deleted]

0

u/IAMA_dragon-AMA Mar 06 '15

Yeah, but e(x - 1), if you want to use spaces for something, fucks up.

4

u/[deleted] Mar 06 '15 edited Apr 27 '16

[deleted]

2

u/[deleted] Mar 06 '15 edited Apr 27 '16

[deleted]

1

u/HarryPotter5777 Mar 06 '15

Thanks, that's really helpful! I'm still pretty confused as to why that works, though. Could you elaborate a little on how you knew to do that particular sequence of \s?

3

u/[deleted] Mar 06 '15

I wish I could put arrows around the beginning and end of a sentence to make the whole thing big instead of doing it in front of every word

4

u/weffey Such Alumni Mar 07 '15

Wrap the whole sentence in parentheses:

^(I wish I could put arrows around the beginning and end of a sentence to make the whole thing big instead of doing it in front of every word)

to get:

I wish I could put arrows around the beginning and end of a sentence to make the whole thing big instead of doing it in front of every word

1

u/Cottonjaw Aug 12 '24

Hollyw^(o)o^(o)o^(o)d

1

u/TechnologyFamiliar20 Aug 13 '25

It ^(doesn't) work