Re: Problems with packages

*To*: mathgroup at smc.vnet.net*Subject*: [mg13710] Re: Problems with packages*From*: "P.J. Hinton" <paulh>*Date*: Wed, 19 Aug 1998 01:38:05 -0400*Organization*: "Wolfram Research, Inc."*References*: <6r10aj$fil@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

On 14 Aug 1998, Silvia Heubach wrote: > I have a curious problem with packages (when using Mathematica 3.0 for > IBM compatible machines). For example, I have created a package ( or > received a package created by somebody else), and now want to modify > the package. Sometimes, the package itself does not open, but an > untitiled notebook displaying the package content. In this case, I have > tried to make my modifications within the notebook, then use Save AS > Special -> package to save my modifications. Furthermore, every time I > open a package in this manner (not getting the package, but a > notebook), Empty lines are inserted after every single line of code. > After a few modifiations, the package contains mostly empty lines > (exponential growth of these). > > What can I do??? Can you please send a copy of your answer to me > directly, as I canot always access the newsgroup. If you plan to use the notebook front end as a package editor, be sure to do the following: 1) When you first load the raw .m file into the notebook, select the cell bracket that contains the pakcage code and peform the following front end menu command sequence: Cell -> Cell Properties -> Initialization Cell 2) Perform the following menu command sequence: Edit -> Preferences... 3) On the resulting dialog box, set the scope list box to "notebook". It may read "global", "selection", or "selection's style". 4) In the text field adjacent to the Lookup button, enter AutoG This will expose an option named AutoGeneratedPackage. Set it to Automatic. 5) Now enter the following text in the Lookup field: InitializationCellL This should expose two adjacent options named: InitializationCellLoading InitializationCellWarning Set both of these options to have the False value. 6) Close the dialog box. 7) Save the notebook with the same base name as you want the package to be (e.g. MyPackage.m -> MyPackage.nb). Now whenever you save the notebook, the changes you made to any initialization cells are also exported out to a companion package with the same base name. Doing a File -> Save As Special -> Package Format saves out initialization cell contents and other cell contents commented out. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. http://www.wolfram.com/~paulh/ Disclaimer: Opinions expressed herein are those of the author alone.