Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How use sub and superscript in Mathematica text, eg: chemical formulas?

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

like image 520
Rob N Avatar asked Oct 05 '10 03:10

Rob N


People also ask

How do you write subscript and superscript in Mathematica?

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.

How do you write chemical formulas with subscripts?

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.

What is the use of subscript and superscript with example?

Superscripts are characters set above the normal line of type (e.g., in 2ⁿᵈ) and subscripts are characters set below (e.g., in Cᵥₑₓ).

What is superscript and subscript in chemistry?

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.


1 Answers

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: the chemical formula for hydronium is HSubscript[[Null], 3]O[Null]^+

I've placed the Cell Expression in a gist for you.

like image 133
Simon Avatar answered Sep 22 '22 12:09

Simon