1

How do I write a superscript text standalone, without implying power? E.g.

ToExpression[25]<>"CNTRL+^oC"

doesn't format well, italicizing o and leaving whitespace in-between the number and Centigrade symbol.

How do I in general write text which is superscripted?

Al Guy
  • 1,610
  • 1
  • 10
  • 15

2 Answers2

3

If it is this specific example you are interested in, you could have found it out yourself by evaluating

Quantity[25, "DegreesCelsius"]

and then pressing Ctrl+Shift+E when the cursor is in the output cell. There, you would have found

Cell[BoxData[
 TemplateBox[{"25","\"\[Degree]C\"","degrees Celsius","\"DegreesCelsius\""},
...]

which would have given you the hint that xzczd gave you. Therefore, you can use

"25\[Degree]C"
halirutan
  • 112,764
  • 7
  • 263
  • 474
1

How do I write a superscript text standalone, without implying power?

Like this

Superscript["", "more text"]

enter image description here

As pointed out by MikeLimaOscar, Superscript[\[Null], "more text"] will produce something similar without a string in the main part of the text.

If you need to put text after the subscript rather than before, you can follow the directions here or do something like this

Row[{Superscript["", "more text"], "text"}]

enter image description here

Jason B.
  • 68,381
  • 3
  • 139
  • 286
  • but how to do superscript without the "text" part, so it will output "more text" superscript, without any white spaces before it? – Al Guy Jan 15 '16 at 08:22
  • Sorry, misunderstood your question, I think you can just use a blank string there – Jason B. Jan 15 '16 at 08:24
  • There is also the invisible character, \[Null], that can be used as the base of super/subscripts. – MikeLimaOscar Jan 15 '16 at 09:28
  • Thanks, that's even better. I was trying Null but it would actually print Null – Jason B. Jan 15 '16 at 09:29
  • Can I put superscript preceding the "text"? – Al Guy Jan 15 '16 at 10:11
  • @AlGuy yes, I believe you then use the \[InvisiblePrefixScriptBase] character. These forms are available in the Typesetting palettes. – MikeLimaOscar Jan 15 '16 at 10:25
  • 1
    @AlGuy, that isn't what you mentioned in the first post. Try to describe exactly what you are looking for from the get go. A "standalone superscript" is much different than a superscript on the left. – Jason B. Jan 15 '16 at 10:27