MathGroup Archive 2006

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

Search the Archive

RE: Packages--Automated package save

  • To: mathgroup at
  • Subject: [mg68893] RE: [mg68835] Packages--Automated package save
  • From: "David Park" <djmp at>
  • Date: Tue, 22 Aug 2006 05:20:35 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


The easiest, and I think standard, way is to write your package statements
in a regular Mathematica notebook, packagenotebook.nb. Use a separate cell
for each statement. Make all the Input cells Initialization cells.

Then when you first Save the notebook Mathematica will bring up a box that
asks if you want to make an AutoGenerated Package. Answer yes. Mathematica
will then automatically create a packagenotebook.m file, which is the actual
package. Every time you modify the .nb notebook and save it, the .m package
file will also be automatically updated. You should never have to actually
look at the .m file.

If you have already created and saved the notebook without the
AutoGeneratedPackage feature you can change this by using the Option
Inspector. Show option values for notebook, Select Notebook Options, File
Options and AutoGeneratedPackage.

The other question is where to put the package. The method I like best, and
also fairly standard I think, is to create a folder in your private
Mathematica/Applications folder and put the package there. Suppose you are
working on ProjectX and you want to call you package XRoutines. Then create
a folder ProjectX in the Applications folder, name your package notebook
XRoutines.nb and save it in the ProjectX folder. When you do so there will
also be a XRoutines.m file there.

Write your BeginPackage statement as


Then the package can be loaded with


You could store your notebooks for the project in the same folder or

David Park
djmp at

From: karl.daggfeldt at [mailto:karl.daggfeldt at]
To: mathgroup at

Can I save a notebook as a package using front end commands (like
NotebookSave) and in that case how? This would save me many menue
Karl Daggfeldt

Link to the forum page for this post:
Posted through [[postId=12867]]

  • Prev by Date: RE: "Freezing" evaluation Output?
  • Next by Date: Re: Re: Re: too many special linear matrices
  • Previous by thread: Packages--Automated package save
  • Next by thread: Re: RE: Packages--Automated package save