MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Notional NotebookOpen Nonplus?

  • To: mathgroup at
  • Subject: [mg22306] Re: [mg22294] Notional NotebookOpen Nonplus?
  • From: Preston Nichols <pnichols at>
  • Date: Thu, 24 Feb 2000 03:01:21 -0500 (EST)
  • Sender: owner-wri-mathgroup at


Although your file "sample.nb" contains a Mathematica expression and has
the .nb extension, it's not a Notebook!

A Notebook is a file, which, as plain text, consists of a "Notebook


and NotebookOpen[] works on files of that form.

One fix might be something like

tmp = Expand[(a + b)^3]; 
Notebook[{Cell[ToString[InputForm[tmp]], "Output"]}] >>"sample.nb"

But I get the impression that code such as the following is even more "in
the correct spirit" for Notebook manipulation, though it is probably not
verbatim what you'll want to do for your project.

tmpnb = NotebookCreate[]; 

NotebookWrite[tmpnb, "Expand[(a+b)^3]"]; 

SelectionMove[tmpnb, Previous, Cell]; 


NotebookSave[tmpnb, "sample.nb"]



I hope this helps a little.

Preston Nichols
Mathematics and Computer Science
Wittenberg University

At 01:01 AM 02/23/2000 -0500, James Fuite and Tania Nordli wrote:
>Dear Advanced Mathematica Users,
>     I am not able to use the function NotebookOpen in Version 3. on
>MacOS 8.1, and after modest investigations, I have to turn to you for
>advice.  What follows is an example.
>Expand[(a+b)^3] >> "sample.nb"
>    $Failed
>   a^3 + 3*a^2*b + 3*a*b^2 +b^3
>So I can look at the file, just not open it.  Yet, further probes
>indicate, at least to me, that everything is in order.
>   Macintosh HD:Mathematica 3.0 Files
>   True
>ToFileName /@ (NotebookPath /. Options[$FrontEnd, NotebookPath])
>   {Macintosh HD:System Folder:
>   etc.,
>    :$HomeDirectory:, :$TopDirectory:}
>   Macintosh HD:Mathematica 3.0 Files
>It seems to me that the notebook "sample.nb" should be found and
>opened.  Suggestions?
>  Sincerely,
>  James J. Fuite.

  • Prev by Date: Re: Getting graphic outputs from background jobs
  • Next by Date: Building lists
  • Previous by thread: Re: Notional NotebookOpen Nonplus?
  • Next by thread: Re: Notional NotebookOpen Nonplus?