Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: Re: Viewing packages in mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102812] Re: [mg102736] Re: Viewing packages in mathematica
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Thu, 27 Aug 2009 06:39:32 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

The window size issue is easy to fix.  With any file open, choose File->Save
As... and switch the file filter to "Mathematica Package".  Press the Options... 
button.  In the resulting dialog, check the box to "Save window size and 
position", then press the "Use Settings as Defaults" button.

 From now on, all packages that you save will remember their window size and
position.  You may wonder why we didn't do this by default.  There was some
discussion internally over whether saving the window size/position was more
desirable, or whether it was more desirable to minimize the amount of markup
which is added to package files by default.  The latter position won the day.  
I'm not personally fully convinced by this, but compromise, like sausage, is
never pretty when it's made.

Concerning the line-wrapping issue, it is possible to change this, but 
considerably more difficult.  But here's a canned procedure for you.

* Copy the notebook expression below.  Paste into Mathematica, and choose to
interpret.

Notebook[{
Cell[StyleData[StyleDefinitions -> "Package.nb"]],
Cell[CellGroupData[{
Cell[StyleData["Code"], PageWidth->WindowWidth, LineBreakWithin->Automatic,
 LineIndent->1., LinebreakAdjustments->{0.85, 2, 10, 0, 1}],
Cell[StyleData["Code", "Printout"], PageWidth->PaperWidth]
}, Open  ]]
},StyleDefinitions->"PrivateStylesheetFormatting.nb"]

* Click the "install Stylesheet..." button at the top.  In the "InstallName" 
field, type
=09Package.nb
pressing Enter, then click the Finish button.

* Restart Mathematica.

To undo the effects of this, track down the file pointed to by evaluating this 
expression...

ToFileName[{$UserBaseDirectory, "SystemFiles", "FrontEnd", 
  "StyleSheets"}, "Package.nb"]

and delete it.  Make sure you're not editing any packages when you attempt to 
delete the file.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Mon, 24 Aug 2009 07:55:26 -0400 (EDT), Yves Klett wrote:
> Benjamin,
>
> since Version 6, .m files can be handled quite nicely, including syntax
> highlighting and everything. Also, headings and some other formats are
> retained.
>
> All previous initialization cells have a different cell style if you
> open the .m directly: They are rendered in "Code". This cellstyle
> obviously does no linewrapping. If you format long lines as "Input",
> wrapping is done immediately.
>
> I presume there must be some option to turn linewrapping for certain
> cell style, but I did not find it (not that I've been searching hard).
>
> So the question is: how to turn on linewrapping for cellstyles?
>
> Also, .m files are always opened in a small window and do not remember
> changed window size etc. - also quite annoying.
>
> Any tips would be appreciated.
>
>
> Regards,
> Yves
>
> Benjamin Hell schrieb:
>> 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: Problems with Evaluate[Symbol[xxx]]
  • Next by Date: Re: Viewing packages in mathematica
  • Previous by thread: Re: Viewing packages in mathematica
  • Next by thread: Re: Viewing packages in mathematica