Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have my own stylesheet that I like using so much I change all my documents to it almost immediately, but as I demo Mathematica to people I cannot use DefaultStyleDefinitions as it unnecessarily confuses people. I therefore have a function (typed verbatim, not loaded) in my init.m file that pastes the definitions from a stylesheet into the EvaluationNotebook[]

pasteStyleSheet::usage="pasteStyleSheet[stylesheet, \"Admin\"] pastes the style definitions provided by stylesheet located in $BaseDirectory (etc)"; Begin["`Private`"]

I have an issue in that I use options for cells such as WholeCellGroupOpener and ReturnCreatesNewCell that Mathematica doesn't seem to know anything about when my function is evaluated. I found this out because I used to find $CellContext throughout my pasted style definitions.

Currently, I have shoved the following lines into the package to make sure it works.


My questions are:

  • Why do I get $CellContext for some functions that should be on `System?
  • How do I ensure my function works as intended? Does it need to live somewhere else?


  • I need to paste the styles, as I email the notebooks out.
  • I spend most of my time making fun things in the front end, I'm expecting this stylesheet to eventually become something that no one else will ever want to use.
share|improve this question
Not an answer to your question, but here's a related question that solves the same problem with using & sharing custom stylesheets (i.e. embed in notebook instead of linking to style file). – R. M. May 27 '13 at 15:09
@rm-rf thanks! Changing styles with Mike's stylesheetChanger will definitely be useful for other things I'm trying to do. – Martin John Hadley May 27 '13 at 15:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.