I am having rather unpleasant issues with parenthesis. Sometimes, when I change some part of the code that does not relate to a line with parenthesis, this line suddenly turns red and mathematica claims that there is no closing parenthesis: The code looks like:

mAtm = 5.148*10^18;(* kg *)
rE = 6.378*10^6; (* m *)
hEq = (mAtm/(4/3 π*ρGas) + rE^3 )^(1/3) - rE;
sMin = 0;
sMax = QuantityMagnitude[hEq];
ns = 6;
s = Range[sMin, sMax, (sMax - sMin)/(ns - 1)];

But Mathematica shows this:


Unfortunately I cannot give exact steps to reproduce the problem. It was ok, when I typep it, then I changed the first two lines (they used to be:

mAtm = Quantity[5.148*10^18,"Kilograms"];
rE = Quantity[6.378*10^6,"Meters"];

and once they are changed the error appears. The only way out is to retype the third line, not even copy to notepad and then back helps.

Another annoyance is that if I type a string with " after e.g. third character the cursor jumps one line down. Again, not always but sometimes. Can someone reproduce the problem or tell me what error am I doing so that these problems occur?

  • 4
    $\begingroup$ Duplicate and/or related: (89648), (58416), (95351), etc. Part of the issue is associated with displayed SuperscriptBoxes. $\endgroup$
    – march
    Feb 26 '16 at 22:45

Here is a simplier example that reproduce the problem :

type :

enter image description here

then remove the doublequote. Immediatly it becomes :

enter image description here

But there is no problem to replace the large parenthesis by a normal one.

You can also insert a blank after the large parenthesis and all become normal. (You can remove the blank after that)


I tried your example of "(x^2) , but I did not reproduce the problem. Still, use CTRL-SHIFT-E to exam the Cell[ ] in detail. You will undoubtedly see how Mathematica has parsed the entry, and then you can manually remove the problem.

Overall, you might want to consider putting everything inside CompoundExpression[... , ..., ...] instead of separating lines with " ; ".

  • $\begingroup$ Why do you expect CompoundExpression to be better than (or, in fact, any different from) using ;? $\endgroup$
    – MarcoB
    Feb 27 '16 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.