This is not quite a programming question, but it's about a programming environment, so hopefully not too out of place. I need to be able to write chemical formulas in Mathematica text (this is specifically about text, not input/code). Something like: H3O+. But Mathematica can't seem to do this. If you use the normal sub/superscript functions, or hit Cntl-_ or Cntl-6, it puts you in "math mode" even when you are in text, and so the letters become italic, and it puts a space between the 3 and the O. Like this: H3O+. Ugly, especially with longer chemicals.
Other things in Mathematica work like normal word processors -- you can style fonts as italic, bold, big, small, colored -- but the subscript and superscript functions common in word processors seems to be missing.
Am I missing something? I hope so...
thanks,
Rob
Type a subscript with (Insert ▶ Typesetting ▶ Subscript). Exit from typing math with : Exit from a subscript but continue typing math with (Insert ▶ Typesetting ▶ End Subexpression): Typing a subscript in text automatically enters math mode.
For formula writing, use _ (underscore) for subscripts and ^ (carat) for superscripts. If there is more than one character in the subscript or superscript, wrap the characters with braces { }. If you'd like your chemical formulas without the italics, use advanced view and \text{ } to enclose the elements.
Superscripts are characters set above the normal line of type (e.g., in 2ⁿᵈ) and subscripts are characters set below (e.g., in Cᵥₑₓ).
Subscripts appear at or below the baseline, while superscripts are above. Subscripts and superscripts are perhaps most often used in formulas, mathematical expressions, and specifications of chemical compounds and isotopes, but have many other uses as well.
You could use a trick similar to that used in LaTeX for printing subscripts on the left. That is place the subscript on an object with no width.
To enter math mode type Cntl-( and to exit type Cntl-) .
Attach the sub and superscripts to ⋮null⋮ or ⋮ ⋮ or ⋮- ⋮ (where ⋮ = escape)
Here's how it displays - compared to some expressions in mathmode:
I've placed the Cell Expression in a gist for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With