# After editing a file Mathematica 10 interprets [...]^2 as [...(])^2

Bug introduced in 10.0 and persisting through 10.2 or later

This is a very weird bug and I don't really know how to reproduce it, so I'll just copy-paste the whole code

Manipulate[Row[{DensityPlot[
Cos[k Norm[{x, y} - d {0, 2}] - f Pi t]/Norm[{x, y} - d {0, 2}] +
Cos[k Norm[{x, y} - d {0, -2}] - f Pi t]/
Norm[{x, y} - d {0, -2}], {x, 0, 10}, {y, -5, 5},
PlotPoints -> 50, ImageSize -> 300, PlotTheme -> "Minimal"],
Rotate[Plot[(200 + Abs[-2 d + y]^2 + Abs[2 d + y]^2 + 2 Sqrt[(100 + Abs[-2 d + y]^2) (100 + Abs[2 d + y]^2)]Cos[k (Sqrt[100 + Abs[-2 d + y]^2] - Sqrt[100 + Abs[2 d + y]^2])])/(2 f (100 + Abs[-2 d + y]^2) (100 + Abs[2 d + y]^2)), {y, -5, 5}, ImageSize -> 280], -Pi/2]}], {t, 0, 15}, {{f, 5}, 1, 10}, {{k, 5}, 1, 10}, {{d, 1}, 0.5, 3}]


Basically this is a simulation of the double-slit interference experiment with a plot of the intensity to the right. Note that all the squares have to be written by Ctrl-6 so that they are superscript! So, the code looks like this when I open the notebook Now try changing the PlotTheme by adding a second name, like "Monochrome". Suddenly, all brackets and parentheses go red. Upon evaluation, Mathematica spits out errors as if there are no closing brackets. It seems like everything breaks down the moment I enter the quotation marks "". It is possible that this is a Mac-only bug. • I can't reproduce it. V10 on windows. Screen shot. !Mathematica graphics may be you have some hidden char inserted by mistake. If you post the notebook somewhere may be someone can better help you. Aug 29, 2014 at 7:18
• This happens every time for me, if I (1) paste your code, (2) select it, (3) Cell > Convert To > StandardForm, (4) select the whole string, and (5) type two double quotes. The first double quote causes the code following it to be interpreted as a string with some SuperscriptBoxes misplaced, and the second quote causes it to be reinterpreted as code. Seems like a bug. Try using ^ instead of superscripts. Report it to Wolfram. (Caveat: I have the last beta V10, Mac OSX 10.9.4.) Aug 29, 2014 at 10:18
• I just want to add that entering quotes before a block of code when I use superscripts very frequently causes the formatting to screw up and for parentheses to no longer be recognized as matching. Often times, deleting the quotes and retyping them causes Mathematica to retry the formatting and that can often times fix the issue. It is very frustrating though and has existed since at least Mathematica 7. Aug 29, 2014 at 16:34
• According to Nasser this is not an issue on Windows, but no on has commented on Linux. It's still happens for me on Mac OSX and Mathematica 10.2. Aug 1, 2015 at 2:40
• @JessRiedel The link in your comment that is supposed to link to another question is actually to the one you're commenting to. Perhaps you were referring to this one? Dec 16, 2015 at 14:19