In conjunction with this answer Superscripts and subscripts in graphics causes italics Carl Woll complained about the mess of "\!\(\*SuperscriptBox[\(m\), \2\)]\)". This mess does not appear in my notebook but only when I have posted into Stackexchange using the uploader. Is there a way to avoid this sort of mess? I note that when I copy back into my notebook the mess stays. The suggestion to change to RawInputForm does not seem to help. Am I missing something?

up vote 10 down vote accepted

When you use 2D typesetting inside of a string, you will get linear syntax. Here is an animation showing an example:

enter image description here

It is actually rather non-trivial to convert linear syntax into normal expressions. So, in my opinion, it is preferable to avoid using 2D typesetting inside of a string. Instead use Row or possibly StringForm. For example:

Row[{"m ", s^2}]
StringForm["m `1`", s^2]

enter image description here

  • Thanks for this. The use of StringForm is ingenious. Only must avoid having a prior value for s! – Hugh May 13 at 14:10
  • @Hugh It seems that using HoldForm[s^2] avoids that problem (but I don't know if it causes others). – Bruno Le Floch May 21 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .