Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loading packages in a clean session in tutorial and symbol pages with Mathematica Workbench 2.0

I am developing documentation for a package with Workbench. So far I have used

Quit[]
Needs["mypackage`"]

at the beginning of each Tutorial. This is because I want a clean global environment and package loading at the same time.

I ran some builds and everything worked as expected, but I wonder: is there a better way to have a clean global context and the package context load "automatically" each time a launch a tutorial for my package with MMA?

In other words: going from one tutorial to the next, or from a tutorial back to a regular MMA notebook, is it possible that all symbols defined in the tutorial examples be "forgotten"? In the standard MMA tutorial pages, this is what seems to happen.

I suppose this could be done this a local/notebook context.

But how would this work in practice?

Thank you for your help

like image 903
magma Avatar asked Oct 23 '11 14:10

magma


1 Answers

For each tutorial, choose the menu item Evaluation > Notebook's Default Context > Unique to this Notebook. This will make each notebook have a new, unique, context. So then you don't need the Quit[] (which seems like a pretty drastic method.) There are probably a few ways you could make sure the Needs cell is run, but making it an initialization cell is probably the easiest.

like image 107
Brett Champion Avatar answered Nov 10 '22 04:11

Brett Champion