Re: Exporting the Notebook expression corresponding to a DocumentNotebook
- To: mathgroup at smc.vnet.net
- Subject: [mg81630] Re: Exporting the Notebook expression corresponding to a DocumentNotebook
- From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
- Date: Sat, 29 Sep 2007 06:29:27 -0400 (EDT)
- References: <fdi716$rte$1@smc.vnet.net>
You could create a notebook with an invisible window. CreateDocument[DocumentNotebook[{x+y,1/x+1/y}],Visible->False] -- Steve Luttrell West Malvern, UK "David Reiss" <dbreiss at gmail.com> wrote in message news:fdi716$rte$1 at smc.vnet.net... > Hello Men and Women... > > Here is something that is perhaps a useful thing to include in a > future version of Mathematica. Does anyone know how to do this with > the current functionality of Mathematica 6? > > I'd like a function called ToNotebookExpression that takes the results > of a DocumentNotebook, for example > > docnb=DocumentNotebook[{x + y, 1/x + 1/y}]; > > and returns the Notebook expression corresponding to it. > > The following does do this, but it has to display the notebook in the > front end first: > > Module[{nb,nbg}, > > nb=CreateDocument[ docnb]] > nbg=NotebookGet[nb]; > NotebookClose[nb]; > nbg > ] > > One reason for wanting this, is that I'd like to create a > DocumentNotebook inside of a program and then use Export to write the > Notebook out to a .nb file. (Of course I can create the > NotebookExpressoin using lower-level constructs, but I want to take at > more Mathematica 6-ish path to this.) If one does Export["file.nb", > docnb,"NB"] then the resulting saved notebook has the embedded > DocumentNotebook expression, rather than what is generated when acting > with CreateDocument[docnb]. > > Any thoughts, or is this what I need to do for now? > > Either way, I pass this on to WRI as a suggestion for a > ToNotebookExpression-like function. > > --David > > http://scientificarts.com/worklife > A WorkLife FrameWork > E x t e n d i n g MATHEMATICA's Reach... > >