Skip to main content
Tweeted twitter.com/StackMma/status/1220134179804979206
deleted 256 characters in body
Source Link

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

Edit: In response to the below, I have tried using putting my desired functions/variables in a separation package and importing it. However, when putting Needs["MyPackage`"], those functions are not available when I set CellContext to Notebook only.

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

Edit: In response to the below, I have tried using putting my desired functions/variables in a separation package and importing it. However, when putting Needs["MyPackage`"], those functions are not available when I set CellContext to Notebook only.

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

added 258 characters in body
Source Link

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

Edit: In response to the below, I have tried using putting my desired functions/variables in a separation package and importing it. However, when putting Needs["MyPackage`"], those functions are not available when I set CellContext to Notebook only.

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.

Edit: In response to the below, I have tried using putting my desired functions/variables in a separation package and importing it. However, when putting Needs["MyPackage`"], those functions are not available when I set CellContext to Notebook only.

Source Link

Automatically load init.m without sharing CellContext

I'm trying to set up Mathematica such that all functions/variables defined in my init.m are automatically loaded into any new notebook I open. This works as a default, but I would also ideally like to set my CellContext to Notebook, such that notebook-specific functions/variables are not shared. However, doing this also makes init.m functions not work across new notebooks. I've tried figuring out how to do this with packages, but I haven't been able to find a clear resource on how I would set this up for my purposes.

To be succinct, what is the best way to set up a central file like init.m that is automatically loaded with each new notebook, but such that notebooks have their own context? Thanks for any advice/guidance you can give.