开发者

mathematica does not show the SubsuperscriptBox correctly in the plot label

folks, I met a weird problem while using mathematica. As you can see from the atta开发者_开发百科ched 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...)

mathematica does not show the SubsuperscriptBox correctly in the plot label


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:

mathematica does not show the SubsuperscriptBox correctly in the plot label

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.


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]]]


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

mathematica does not show the SubsuperscriptBox correctly in the plot label

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:

mathematica does not show the SubsuperscriptBox correctly in the plot label

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

mathematica does not show the SubsuperscriptBox correctly in the plot label

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜