Re: creating packages
- To: email@example.com
- Subject: [mg12146] Re: creating packages
- From: firstname.lastname@example.org (P.J. Hinton)
- Date: Mon, 27 Apr 1998 01:46:29 -0400
- Organization: Wolfram Research, Inc.
- References: <email@example.com>
In article <firstname.lastname@example.org>, steve <email@example.com> writes: |> I would like to create a package from a notebook. |> I followed the directions in the Mathematica book, but the |> resulting m file was not a package. After applying |> "Save-as-special|package" all the |> expressions appeared to be enclosed in comments. |> |> Could someone explain how to create a package from a |> notebook. When you export the contents of a notebook as a package, only initialization cells are left uncommented. To give a cell the initialization property, select the cell's bracket, and then click on the front end menu command sequence Cell -> Cell Properties -> Initialization Cell Here are some related features that may be of use to you. 1) AutoGeneratedPackage This option will allow you to automatically export only the initialization cells of a notebook into a package file every time that you save the notebook. The package file will have the base file name of the notebook and will have the customary .m extenstion. This option can be set by the Option Inspector with either Global scope (all notebooks that have initialization cells will be exported when they are saved) or at the Notebook scope (only the selected notebook will be exported when saved). The option can take on the following values: Automatic export package file with same base name None no package will be exported <some other string> export package using this base name 2) InitializationCellLoading/InitializationCellWarning The front end has a feature that when the user attempts to evaluate a cell in a notebook with initialization cells, the front end can prompt the user with a dialog box asking him or her whether the initialization cells should be evaluated first. These two options control aspects of this. InitializationCellWarning specifies whether this prompting mechanism should be turned on or off altogether. A value of True turns it on, and a value of False turns it off. InitializationCellLoading specifies whether this prompt should happen at the time the a notebook is loaded rather than when a cell is first evaluated. The default value is False, which means that the prompt only comes up when the first evaluation takes place. The value of True is the behavior that Mathematica version 2.2 users may be familiar with. Again, both these settings are specified through the OptionInspector with the scope set to either Global or Notebook depending on whether you want this setting to apply to just the selected notebook or all notebooks. -- P.J. Hinton Mathematica Programming Group firstname.lastname@example.org Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.