"There are also capabilities that allow packages set up to
correspond to notebooks to be maintained automatically."
N ow, the tutorial "Setting Up Mathematica Packages" gives me a model
or outline or template for a package, which I can use as a guide to
create ("set up?") my own package -- as a notebook, anyway.
But I'll be g-ddamned if I can find anywhere, in that tutorial or
anywhere else in the Mathematica 6 documentation, explicit instructions
on:
* How to then convert that notebook into a package, or
where to save it as such after conversion.
* Where to save the parent notebook itself (or a copy of it),
as an unconverted notebook.
* How to later modify or edit or update the package itself,
as I'm likely to want to do: Update the package itself?
(And if so, how to get at it?) Update the parent notebook
and then convert -- and Install? -- again?
[Note that the word "Install" does not seem to appear anywhere in the
"Setting Up Mathematica Packages" tutorial.]
Do a Save As on the notebook. You will get a pop-up Auto Save Package
dialog window.
Click the Create Auto Save Package button in that window. That will do
it.
Note that if you subsequently move the .m package file and not the
source .nb notebook file, then auto-saving changes will not work. Just
keep the two in the same directory.
--
Murray Eisenberg mur...@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
A package is just a plain text file, with the extension .m, containing
some Mathematica expressions. The expressions are evaluated when you
read in the package.
In[1]:= << "abc.m"
will read in and evaluate the contents of the file abc.m, if abc.m is in
the current directory, Directory[]. (But see the
MathematicaFileOrganization tutorial I mention below!)
> I understand (I
> think) that one can prepare a notebook, and then save (or install?) that
> notebook as a package.
A notebook cannot be used as a package, but (as you note below), it is
possible to maintain .m files based on notebooks.
> And somewhere in the fragmented documentation
> on packages I also found the sentence:
>
> "There are also capabilities that allow packages set up to
> correspond to notebooks to be maintained automatically."
>
> N ow, the tutorial "Setting Up Mathematica Packages" gives me a model
> or outline or template for a package, which I can use as a guide to
> create ("set up?") my own package -- as a notebook, anyway.
>
> But I'll be g-ddamned if I can find anywhere, in that tutorial or
> anywhere else in the Mathematica 6 documentation, explicit instructions
> on:
>
> * How to then convert that notebook into a package, or
> where to save it as such after conversion.
If you have some initialization cells (Cell -> Cell properties) in the
notebook, Mathematica will ask you before saving whether you would like
it to automatically maintain a package (.m) file, with the same content
as the initialization cells. If you enable this, then the .m file will
be automatically updated whenever you save the notebook.
> * Where to save the parent notebook itself (or a copy of it),
> as an unconverted notebook.
The .m file will be in the same directory as the .nb file.
You may want to read these:
tutorial/SettingUpMathematicaPackages
tutorial/MathematicaFileOrganization
tutorial/FilesForPackages
> * How to later modify or edit or update the package itself,
> as I'm likely to want to do: Update the package itself?
> (And if so, how to get at it?) Update the parent notebook
> and then convert -- and Install? -- again?
>
> [Note that the word "Install" does not seem to appear anywhere in the
> "Setting Up Mathematica Packages" tutorial.]
>
--
Szabolcs