MathGroup Archive 2009

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

Search the Archive

Re: Viewing packages in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102728] Re: [mg102716] Viewing packages in mathematica
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sat, 22 Aug 2009 03:37:17 -0400 (EDT)
  • References: <14615608.1250844953672.JavaMail.root@n11>

The basic answer is: Don't look at the package.m file at all.

To make a package:

1) Create a folder, Subject say, in your $UserBaseDirectory/Applications
folder.

2) Write a package.nb notebook and put it in the Subject folder. Make the
Input cells Initialization cells. Save as an Autogenerated package. This
will be the package notebook that you edit. When it is saved, it will create
a package.m file - but you never have to look at it. Each time you update
package.nb and save, Mathematica will update package.m.

3) Use BeginPackage["Subject`package`",...] in the package notebook.

4) Load the package with Needs["Subject`package`"]

That is the easiest method for working with simple packages.

There are other ways of making packages, and in Workbench you do have to
look at a package.m file. I don't know what is the best method for working
with paclet documented packages, whether it is worthwhile keeping parallel
notebook copies of the code. Can the process described above be used within
Workbench? I don't know if autogenerated packages can be copied into
Workbench, or how they would format in Workbench. So I would be glad to see
more discussion of this.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: Benjamin Hell [mailto:hell at exoneon.de] 

Hi,
this is a real beginner question for packages in mathematica. When I 
view a package (.m) file in mathematica, the mathematica editor doesn't 
show any indentation nor does any automatic line breaks when scaling the 
window. So whereas my code can be read quite well in a standard 
mathematica notebook, it looks ugly in a package file. Is there any way 
to setup some viewing options to change that behaviour?

Thanks in advance,
Benjamin




  • Prev by Date: Re: Re: Incongruence? hmm...
  • Next by Date: Re: Re: Select text with keyboard?
  • Previous by thread: Re: Viewing packages in mathematica
  • Next by thread: RE: Re: Viewing packages in mathematica