MathGroup Archive 2007

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

Search the Archive

Re: Can you get a package back to a notebook easily?

  • To: mathgroup at
  • Subject: [mg83010] Re: Can you get a package back to a notebook easily?
  • From: David Reiss <dbreiss at>
  • Date: Wed, 7 Nov 2007 06:33:29 -0500 (EST)
  • References: <fgen3e$flh$><fgp9d6$ij1$>

On Nov 6, 3:42 am, David Reiss <dbre... at> wrote:
> On Nov 5, 5:08 am, Szabolcs Horv=E1t <szhor... at> wrote:
> > magma wrote:
> > > On Nov 3, 9:42 am, Szabolcs <szhor... at> wrote:
> > >> On Nov 2, 9:28 am, "aaronhirshb... at"
> > >> <aaronhirshb... at> wrote:
> > >>> I am asking this because I want to know if I need to save my notebook
> > >>> and my package in CVS, or only my package?
> > >>> Aaron Hirshberg
> > >> If you are using an auto-save package, then no, you can't get back the
> > >> notebook from the .m file.  You can look into the .m file (it is just
> > >> a plain-text file, and the front end (or notebooks) are not needed to
> > >> edit it), and see that it contains less information than the notebook.
> > > What exactly gets lost when going from Notebook to package?
> > > I believe only the Initialization cells are transferred to the
> > > package, everything else is lost.
> > > Am I correct?
> > AFAIK, yes.
> > Szabolcs
> Actually, in Version 6+ the answer is no.
> The initialization cells are saved, and some other classes of cells
> are contained as comments with special information that allows them to
> still be viewed when the .m file opened in Mathematica.
> Try it out and then open the .m file in a text editor to see this...
> --David
> A WorkLife FrameWork
> E x t e n d i n g MATHEMATICA's Reach...

Oops, I have to withdraw what I said above.  I goofed.  What I was
remembering (and I should have checked) is how, in version 6+ one can
work directly with just a .m file (that has no .nb file as a parent)
and insert material in it in non-evaluatable cells.  In  such a .m
file, when viewed in a text editor, one sees the special formatting
constructs (within comment brackets) that identify the "cell type" of
the material and the material itself.  Here is an example of the
contents of such a .m file

(* ::Text:: *)
(*This is a comment I think*)


And, when viewed in Mathematica, the first material (that in comments
brackets) appears as in a Text cell, and the second material (the 1+1)
is the executable code.

When creating a .m file as a byproduct of saving a .nb notebook that
has initialization cells and which has AutoGeneratedPackage-
>Automatic, the non initialization cells (such as text cells) are
indeed not saved to the .m file.

  • Prev by Date: Re: Re: Problem with element and Maximize
  • Next by Date: affine transformation to rasters
  • Previous by thread: Re: Can you get a package back to a notebook easily?
  • Next by thread: Re: Re: Can you get a package back to a notebook easily?