3

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

Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
nos
  • 19,875
  • 27
  • 98
  • 134

3 Answers3

7

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.

Community
  • 1
  • 1
Mr.Wizard
  • 24,179
  • 5
  • 44
  • 125
  • Which version of Mma is this? – Simon Oct 08 '11 at 06:49
  • @Simon 7.0.1 -- sorry, I included that in my original post, but I left it out in the revision. – Mr.Wizard Oct 08 '11 at 07:04
  • @Simon I know there was a question about a similar problem with nested fractions not parsing correctly. Can you find it? – Mr.Wizard Oct 08 '11 at 07:06
  • I just spent ~10 minutes looking and couldn't find it... sorry! – Simon Oct 08 '11 at 07:16
  • @Simon and Mr. I think a bugs collection could be appended to the Toolbag post. What do you think? – Dr. belisarius Oct 08 '11 at 10:08
  • @belisarius I don't think bugs are really tools, so just a list, I'd say no. However, if each bug was matched with a fix or work-around, I'd say yes. BTW, the question above did not have the "bugs" tag so I added it. Do you agree with this? If so, we could retroactively tag any other questions that relate to actual bugs this way. – Mr.Wizard Oct 08 '11 at 10:17
  • @Mr. Posting a question for each known bug does not seem a good path ... I think your proposal covers another expectations. Anyway, let's retag those questions :) – Dr. belisarius Oct 08 '11 at 15:58
  • @Mr. Instead of separating by a space, I'd probably separate by a `\[VeryThinSpace]` or a `\[NegativeVeryThinSpace]`, since it makes the expression look more like a function - the parentheses are closer to right position. Note the same behaviour happens with Subscripts and Subsuperscripts... – Simon Oct 09 '11 at 00:19
  • @Simon there is no difference in appearance between the form with, and without the added space, at least on my system. Please reference the image above. – Mr.Wizard Oct 09 '11 at 07:16
  • @Mr.Wizard: Fair enough, but a negative or thin space will be a smaller space than "no space". – Simon Oct 09 '11 at 07:25
6

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]]]
Brett Champion
  • 8,497
  • 1
  • 27
  • 44
5

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.

Simon
  • 14,631
  • 4
  • 41
  • 101
  • 2
    That reminds me what my little nephew, with his eyes full of tears, told his mother the other day, returning from the kindergarten: - I feel frustrated! I was unable to misbehave well enough!- :) – Dr. belisarius Oct 08 '11 at 05:17
  • 2
    When I try this in V7.0.1, I get square brackets instead of parentheses in the denominator. – Brett Champion Oct 08 '11 at 14:54
  • @Brett: True! I didn't notice that... That's actually a bug in `TraditionalForm` in version 7.0.1 (it's fixed in version 8) - see edit – Simon Oct 08 '11 at 23:43