Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When considering this question about re-formatting Cell (also this one), I encountered an issue which confuses me. I'll let the code itself speak:

Consider the following simple Cell expression, which contains a comment line:

cellexpr = 
  Cell[BoxData[{RowBox[{RowBox[{"a", ";"}], "\[IndentingNewLine]", 
       RowBox[{"(*", RowBox[{"b", ";"}], "*)"}]}], 
     "\[IndentingNewLine]", "c"}], "Input"];

Write it to a Notebook:

testnb = NotebookCreate[];
NotebookWrite[testnb, cellexpr];

It looks like the following, which is what one would expect:

enter image description here

Now read the Cell expression back from testnb:

SelectionMove[testnb, Before, Notebook];
SelectionMove[testnb, Next, Cell];
NotebookRead[testnb]

Mathematica graphics

Note the first RowBox, it has a structure as RowBox[ item1, item2, ...], which is ill-posed since the first argument to RowBox must be a list. And the obtained Cell expression is therefor ill-posed, which can be seen by CellPrint-ing it:

enter image description here

I noticed that if the comment-line part is removed (e.g. by deleting "(*" and "*)" in cellexpr), everything works fine. And for the example in this question, the second comment is correctly obtained:

Mathematica graphics

My question:

Did I miss something? Or is this a bug?

My system: Mathematica 9.0.0.0 on Windows 7 32-bit

share|improve this question
    
This may have been fixed in 9.0.1. Please take a look at what I got with 9.0.1 on OS X: i.stack.imgur.com/8J6Oy.png –  Szabolcs Feb 25 '13 at 19:13
    
@Szabolcs Thanks for the information! Now I begin to wonder when and why this wired bug.. –  Silvia Feb 25 '13 at 19:19
    
This is very similar to a bug I encountered with Mathematica version 5 on windowsXP. The problem was : when I had a comment at the end of a cell, the cell became sometimes corrupted. A look inside the cell with ctrl-shift-E reveals a Row without List inside. –  andre Feb 25 '13 at 21:43
    
(follow the last comment) Maybe this problem has something to do with the fact there are two different characters * (see doc or ask details). These characters are very similar, but I saw at screen that the * in the (* was not the same as in *) (depending on system?) –  andre Feb 25 '13 at 21:46
3  
It was a bug, newly introduced to 9.0.0, and subsequently fixed in 9.0.1. The same problem led to the oft-reported corruption of certain cells when you tired to merge them. –  John Fultz Feb 27 '13 at 10:46

1 Answer 1

up vote 2 down vote accepted

According to John Fultz's comment, this was a bug:

It was a bug, newly introduced to 9.0.0, and subsequently fixed in 9.0.1. The same problem led to the oft-reported corruption of certain cells when you tried to merge them.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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