For last 30 minutes (and I was lucky today, sometimes I spend 5 times as much time) I have been removing code little by little from my large one cell, (have to be one cell, it is Manipulate demo stylesheet) in order to find where the syntax error is (since Mathematica, with all its might and power, can't tell the user which line number the syntax error is located at). Each time I see the red line show up on the right side of the notebook, indicating a syntax error, I know that I will now waste another hour at least looking for the syntax error.
Why is it that hard for Mathematica to tell the user where the syntax error is?
I zoomed down to this little 5 character code, and I copy it to new notebook to examine it:

So, there is a hidden bad character there. Sometimes, with my big fingers and my small keyboard (can't find big keyboards any more, everything is so tiny), I must have hit wrong key combination, which must have injected some bad character to the notebook, and this happens.
I will keep this cell on its own in order to find what the problem is. I tried to select the cell, and do convert to input form, but nothing happened. no output came of it.
Then I did cell->ShowExpression, and this came up
Cell[BoxData[
RowBox[{"(",
RowBox[{"k", "h"}],
SuperscriptBox[")", "2"]}]], "Input",
CellChangeTimes->{3.536893041212217*^9},
EmphasizeSyntaxErrors->True]
So, what does all this mean? Do you see from the above what is the problem?
I think I entered the superscript as I always do, using Ctrl ^ then 2.
I think the notebook interface is powerful and allows many things not possible otherwise, but because of problems such the above, I wish sometimes I am using plain text editor like emacs, where I can see what I have and not worry about hidden things I do not see, but I tried that once, and it is not practical overall setup to work with.
btw, originally, I had lots of code like the above inside strings, i.e. inside " " for formatting, and now I am removing all the strings to do some other way of formatting. I do not know if this has anything to do with it. But as you can see, now there is no string around the expression. Here is a screen shot of the earlier version of the notebook, from the same location of the code, showing how the above was inside a string, and I simply was removing the outside string quotes, that is all:



HoldForm. – Simon Jan 30 '12 at 7:04ToExpressioncode that your example reveals.ToExpression["(h k)^2"]works fine, but the version with a superscript, $\text{ToExpression["}(h\ k)^2\text{"]}$, produces an error. For reasons very similar to the example that you gave: The string with a superscript is interpretted using the string representation of boxes"(k h\!\(\*SuperscriptBox[\()\), \(2\)]\)"– Simon Jan 30 '12 at 7:11Initializationcell (at the top of the notebook). Instead, I use the Manipulate cell and then typeInitialization:>{....}to add the initialization functions in there. When using the separate initialization cell, one must also add SaveDefinitions->True to Manipulate (it says so in the notebook). This has caused me strange problems when I do that. So that is why just use the Manipulate cell. That works fine and never had problems with that setup. I use the Demonstration stylesheet ofcourse. – Nasser Jan 31 '12 at 10:51