MathGroup Archive 2009

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

Search the Archive

Re: two questions

First load the package:


Then to obtain the exported names in the package use:


That will list all the names and when you click on one of the names it will
display the corresponding usage message.

For example, to obtain the names in one of the standard extra packages that
come with Mathematica (these don't have their own folder):



The Presentations package distribution has a small sample package notebook
with detailed commentary on how to write and set up you own package. The
entire process is quite easy.

Basically you set up your package as follows:
1) Find, or create, an Applications folder in your $UserBaseDirectory
2) In this private Applications folder create a folder packagefolder
(whatever name you choose) to contain your package.
3) Write a notebook, packagename.nb (whatever name you choose), that will be
your package definition notebook. It will contain all the Package
statements, usage statements and routine definitions. Make these
Initializations cells.
4) When you first save (in the regular way) the packagename.nb it will ask
you if it to be saved as an Auto Generated Package. Answer yes. This will
create a packagename.m package file. Every time you update packagename.nb,
packagename.m will also be automatically updated. You should never have to
look at the contents of packagename.m.
5) You load the package as above. 

Probably the best book on programming and writing packages is "Programming
in Mathematica: Third Edition" by Roman Maeder. But this was written for
Version 3 and contains no information on where to put packages. This was
quite unsettled at the time. The question of where to put and how to load
packages is confusing to most users first writing packages because I don't
know of any easily accessible place where it is discussed in the Mathematica

You can also import you package code into Workbench and then write Version 6
style documentation. This is not too difficult either, once you learn the
tricks, but the documentation and convenience of Workbench is very poor at
the present time. This is a shame because Workbench could be great for
writing interactive electronic books, or courseware or doing major research
projects that contained notebooks, packages and documentation. But this is a
whole different topic.

David Park
djmpark at  

From: Francisco Gutierrez [mailto:fgutiers2002 at] 

Dear list members:
a. I made a package and I want to retrieve the functions it has. What I
would want is:
Output: functions for the user contained in myg package
How can I do this? Somehow, I have failed to find this in the documentation.
b.  According to you what are the best references to study the theme of
packages in Mathematica?

  • Prev by Date: Re: Image[], Graphics[Raster[]]
  • Next by Date: Re: RandomReal gets stuck
  • Previous by thread: Re: two questions
  • Next by thread: Re: two questions