Re: Bug of NotebookRead
- To: mathgroup at smc.vnet.net
- Subject: [mg100189] Re: Bug of NotebookRead
- From: dbreiss at gmail.com
- Date: Wed, 27 May 2009 04:09:34 -0400 (EDT)
- References: <gvdr93$757$1@smc.vnet.net>
P.S. I have added your observation to the bug report that I originally filed with Wolfram. So this is all in the system... Best regards, --David On May 25, 6:18 am, Hannes Kessler <HannesKess... at hushmail.com> wrote: > Hello, > > cell tags could be very useful to extract quickly selected information > from notebooks, see David Reiss presentationhttp://scientificarts.com/wor= klife/conference2008.html > > But be aware of the following bug of NotebookRead applied to tagged > cells in a structured notebook with sections and subsections: > The section cell and the input / output cells in the example are > tagged, but not the subsection cell. The resulting notebook contains > only the section cell. The tagged input/ouput cells are lost as a > consequence of the read notebook data containing a wrong CellGroupData > [[{Cell[..]},Cell[..]] instead of a correct CellGroupData[[{Cell > [..],Cell[..]}]. This could be fixed by a corresponding replacement > rule. But the second input/output cell is missing completely and > cannot be recovered at all. > > notebook1 = Notebook[{ > Cell["Section 1", "Section", CellTags -> "zzz"], > Cell["Subsection 1 (no tag)", "Subsection"], > Cell[BoxData[RowBox[{"x", "=", "1"}]], "Input", CellTags -> > "zzz"], > Cell[BoxData["1"], "Output", CellTags -> "zzz"], > Cell[BoxData[RowBox[{"y", "=", "2"}]], "Input", CellTags -> > "zzz"], > Cell[BoxData["2"], "Output", CellTags -> "zzz"] > }]; > notebookObject = NotebookPut[notebook1, WindowTitle -> "Notebook 1"]; > NotebookFind[notebookObject, "zzz", All, CellTags]; > notebookData = NotebookRead[notebookObject] > notebook2 = Notebook[Flatten[{notebookData}]]; > NotebookPut[notebook2, WindowTitle -> "Notebook 2"]; > > Did anybody encounter this problem, are there workarounds? I am new to > the tagging approach and a bit frustrated as this was my very first > experience with it. > > I am using Mathematica 7.0.1 on Windows XP > > Best regards, > Hannes Kessler