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.
  • 1
    $\begingroup$ 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). $\endgroup$
    – rm -rf
    Commented May 27, 2013 at 15:09
  • $\begingroup$ @rm-rf thanks! Changing styles with Mike's stylesheetChanger will definitely be useful for other things I'm trying to do. $\endgroup$ Commented May 27, 2013 at 15:53
  • $\begingroup$ @Kuba thanks for reviving this! I think that should be considered a duplicate, yes. Should I close this as duplicate? Not sure of procedure. $\endgroup$ Commented Dec 19, 2015 at 8:42
  • $\begingroup$ @MartinJohnHadley The question isn't exactly the same but the answer is the answer. If you agree with closing it will be automatically closed as a duplicate an stay here as a road sign for future visitors. $\endgroup$
    – Kuba
    Commented Dec 19, 2015 at 8:44
  • $\begingroup$ Which was my intention but it's your call :) $\endgroup$
    – Kuba
    Commented Dec 19, 2015 at 8:44


Browse other questions tagged or ask your own question.