2
$\begingroup$

I want to write a comment (text) describing what's happening in my function. I want the text to appear like this:

Note that the ElectronNumberDensity is in units of $cm^{-3}$. Thompson cross section is in units of $cm^2$.

(With no line break). However, as soon as I type the superscript (using ctrl-^), Mathematica inserts a hard line break like there's a new style or something.

Note that the ElectronNumberDensity is in units of

$cm^{-3}$. Thompson cross section is in units of $cm^2$.

What is the proper way to type in comments or helpful text that makes use of typesetting?

$\endgroup$
  • $\begingroup$ Enter in InputForm, e.g., TraditionalForm@Superscript[cm, -3] then highlight and evaluate in place. $\endgroup$ – Bob Hanlon Aug 28 at 14:49
  • $\begingroup$ That appears to be the answer. Please post it as an answer and I'll upvote it. $\endgroup$ – Quarkly Aug 28 at 15:05
3
$\begingroup$

Enter in InputForm, e.g., TraditionalForm@Superscript[cm, -3] then highlight and Evaluate in Place.

$\endgroup$
2
$\begingroup$

Alternatively, you can use CTRL+SHIFT+9 to start an inline cell (see this page for keyboard shortcuts). Oddly, while the shortcut for ending an inline cell is CTRL + ), I need to use CTRL - 0 (i.e. no shift).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.