2
$\begingroup$

When you create a new styled notebook from the Stylesheets chooser dialag, you get a new notebook using the chosen style with some sample content provided.

enter image description here enter image description here


But if you apply styles from the same stylesheet to an open blank notebook, there will be no sample content such as Enter title here


My question is how can I create one new cells with a given style and some sample content already present?

For example: I would like to be able to press Alt+1 to create a Title-style cell with words Enter title here.

$\endgroup$
2
  • $\begingroup$ Why not just create a notebook with what you want. Whenever you want to use it, open that notebook and copy/paste. Or, if you want keyboard shortcuts, just use command-1 for titles, 2 for subtitles etc. $\endgroup$
    – bill s
    Jun 9, 2013 at 8:55
  • $\begingroup$ @bills Yes, I sometimes do that like what you said. But if the question is solvable, that'll be more convinient in some cases. $\endgroup$ Jun 9, 2013 at 10:27

1 Answer 1

3
$\begingroup$

Here's one way to go about this:

NotebookPut[Notebook[{Cell["Edit this", "Title"], 
    Cell["Edit that", "Subtitle"],
    Cell["type here", "Section"]}]];

This will create a new notebook with three cells: the first says "Edit this" in the "Title" style, the next says "Edit that" in the "Subtitle" style and the third says "type here" in the "Section" style.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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