Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I build a lot of presentations and custom notebooks with very different stylesheets, and use Button and CreateDocument quite often to accommodate optional/procedurally generated content. For instance,

Map[Button[Style[ToString[#] <> " random images", "Text"], 
          {Cell["Here are " <> ToString[#] <> " random image(s)", "Title"],             
           ExpressionCell[Column@Table[RandomImage[2, {200, 200}], {#}],
           "Output"]}]] &,

What I'd like to do is specify that the notebook generated by CreateDocument inherits the StyleSheet from the parent notebook, without having to save the StyleSheet and provide the StyleSheetPath Option in the CreateDocument function each time I change a style.

I imagine there's an undocumented feature, but haven't found it in my brief searches of StackExchange.

share|improve this question
up vote 12 down vote accepted

Add the following option to your CreateDocument call:

StyleDefinitions -> 
 CurrentValue[EvaluationNotebook[], StyleDefinitions]

This works for both embedded stylesheets and stylesheets on the StyleSheetPath. In this case, I use EvaluationNotebook to refer to the notebook containing the button but it could, of course, be whatever NotebookObject you wish to refer to.

share|improve this answer
Well, I should've thought of that. Thanks, John! – Martin John Hadley Jan 8 '13 at 12:20

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.