mathematica does not show the SubsuperscriptBox correctly in the plot label

741 views Asked by At

folks, I met a weird problem while using mathematica. As you can see from the attached screenshot, the typesetting is somehow interpreted as plain text.

Is there a way to fix this?

Thanks very much! (I am so confused. It actually shows the correct thing sometimes...)

enter image description here

3

There are 3 answers

3
Simon On BEST ANSWER

Unlike Brett, I was unable to reproduce the bug in either version 7 or 8.

However, if you're using mathematics in the PlotLabel, it is probably better to let Mathematica render it using its own typesetting. The trick is HoldForm

For example:

Plot[x, {x, 0, 1}, 
  PlotLabel -> HoldForm[\[Eta][T]/Subsuperscript[\[Epsilon], 0,2][T]]]

will produce

a plot

irrespective of any definitions for Eta or Epsilon.


As pointed out by Brett, this actually doesn't work in version 7.0.1, since it appears that there is a bug in TraditionalForm, that puts square brackets in the construction
Power[f,i][x]//TraditionalForm.
The work around for this is to use Superscript instead of Power:

Power vs Subscript

Similarly for the denominator in the above plot, instead of using
Power[Subscript[...]][T], use Subsuperscript[...][T]:

Subsuperscript

This means that you can not use the standard (keyboard shortcuts or palette for) 2D input, because the SubsuperscriptBox that is produced using this is interpreted as Power[Subscript[...]]. I've fixed the code for the graphics above to reflect this.

Note that this TraditionalForm bug has been fixed in Mathematica version 8.

0
Brett Champion On

I can reproduce this with V7.0.1, but not with V8.0.1.

The simplest workaround I've found is to structure the fraction using separate strings for the numerator and denominator.

You could also take a typesetting approach to things instead of using strings at all:

Format[\[Epsilon][x_, sub_, sup_], TraditionalForm] := 
 Subsuperscript[\[Epsilon], sub, sup][x]

Graphics[{}, PlotLabel -> Style[Gamma[T]/\[Epsilon][T, 0, 2]]]
10
Mr.Wizard On

One can observe that this problem extends beyond the scope of PlotLabel. It also affects superscripts and subscripts. One way to avoid the problem is to insert a space between the sub/superscript object, and the adjacent symbol.

I tried to post an example, but the error is low level enough that it is impossible to paste the expression in its original form. I will have to resort to merely including a picture of what I see. Although the two lines appear similar, there is a space between "e2" and "(T)" in the second one.

In Mathematica 7.0.1:

enter image description here

This is somewhat similar to Known issues with copying code from Mathematica to other platforms? in that both bugs deal with "2D" objects inside of a FractionBox.