MathGroup Archive 2006

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

Search the Archive

RE: Packages--Automated package save

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

Karl,

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.
(Ctrl-CRI).

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

BeginPackage["ProjectX`XRoutines`"]

Then the package can be loaded with

Needs["ProjectX`XRoutines`"]
or
<<ProjectX`XRoutines`

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

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/





From: karl.daggfeldt at gih.se [mailto:karl.daggfeldt at gih.se]
To: mathgroup at smc.vnet.net


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
mousclicks.
Sincerely
Karl Daggfeldt

Link to the forum page for this post:
http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Speci
al:Forum_ViewTopic&pid=12867#p12867
Posted through http://www.mathematica-users.org [[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