Re: notebooks default context
- To: mathgroup at smc.vnet.net
- Subject: [mg112309] Re: notebooks default context
- From: apjs64 <apjs64 at gmail.com>
- Date: Thu, 9 Sep 2010 04:20:58 -0400 (EDT)
- References: <i64kfg$39a$1@smc.vnet.net>
On Sep 7, 4:01 pm, 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! Many thanks Albert. I am trying to model a complex system so I will indeed be building many notebooks and packages. I scrounged the package format from somewhere on the internet and then misunderstood it. So I have a few changes to make! I take your point on "best practice". Thanks once again your reply will help get a number of problems sorted out. regards, Jeremy