Re: notebooks default context
- To: mathgroup at smc.vnet.net
- Subject: [mg112322] Re: notebooks default context
- From: David Reiss <dbreiss at gmail.com>
- Date: Thu, 9 Sep 2010 04:23:19 -0400 (EDT)
- References: <i64kfg$39a$1@smc.vnet.net> <i6756o$88g$1@smc.vnet.net>
Imagine my surprise when looking at this to realize that I don't remember writing it! ...must be something in the water. :-) --David On Sep 8, 12:59 am, Chris Degnen <deg... at cwgsy.net> wrote: > You may find this post from David Reiss helpful: > > http://forums.wolfram.com/mathgroup/archive/2009/Jul/msg00530.html > > On Sep 7, 7:01 am, apjs64 <apj... at gmail.com> wrote: > > > > > Firstly a problem, my packages (.m) keep having their context reset > > to global every time I open them to edit rather than "unique to each > > cell" to which I have previously set them to. > > > THIS IS THE QUESTION (rest waffle) > > I would like to set a notebooks default context to "Unique to each > > cell" in a notebook initialisation cell. Usually I use "Unique to this > > notebook" from the menu (which is fine and persists), however on > > occasion I would like to tighten things up. > > > ------------ > > WAFFLE > > ------------ > > I think I don't clearly understand the use of the Package` context > > instructions. My basic package setup is as follows (which works): > > > BeginPackage[ "Package`"] > > Begin[ "Public`"] > > preProcess`outNB[nb_] = "something"; > > End[]; > > Begin[ "Private`"] > > End[] > > End[] > > > so this is could be one source of the problem. > > > This is part of a general question on good programming technique in > > mathematica. My instinct is that for non-trivial notebooks and > > packages "unique to cell" is the best method and the results should > > then be put into a context for the notebook to make them available to > > other cells. > > ------------------------------------------------- > > eg Notebook : aParabola.nb > > ---------------- > > cell: > > a = 132 > > t = .5 > > aParabola`arcLength = a * (t * Sqrt[1 + t^2] + Log[t + Sqrt[1 + > > t^2]]); > > ------------------ > > > Is there a best practice? I know this is a messy question, I hope it > > is clear. > > > Regards, > > > Jeremy Duncan > > > Regarding a previous post on fonts I now use: > > > SetOptions[$FrontEnd, FontFamily->"Arial"]; > > SetOptions[$FrontEnd, FontSize->10]; > > > as soon as you ask the question, the solution suddenly becomes clear!