# Quickly editing the stylesheet and saving it

I have a private stylesheet I'm using. I edit it by going to the menu Edit->Edit Stylesheet and then clicking on the private stylesheet cell. I can modify whatever I want but it never gets saved.

The notebook option Saveable can be set to True (is by default False) but that still doesn't change the fact that in order to save it I can only do it by going to Save AS, and making it replace itself. To do that I have to go to the $UserBaseDirectory, SystemFiles, FrontEnd, StyleSheets, not practical... The question is implicit, can you help out? - Can you upload and link this style sheet? – Mr.Wizard Feb 12 '12 at 5:47 @Mr.Wizard, I thought wrongly it was something with all stylesheets but now I see I assumed wrong and the whole question seems stupid, I have. It seemed I had to save the notebook in order for the Saveable option to start working as usual, haha – Rojo Feb 12 '12 at 5:58 I'll leave it... – Rojo Feb 12 '12 at 6:03 The decision to upvote and accept implied I had already decided to leave it – Rojo Feb 12 '12 at 6:18 ## 3 Answers Normal behavior is that simply closing the edited style sheet will transparently save it. If you create a new private style sheet for a new Notebook and you still do not have this behavior then you must have changed a global configuration setting. If this problem is peculiar to a particular private style sheet then I suggest going over the raw file looking for how it differs from the freshly created Notebook described above. Also, you describe having to save this private style sheet with Save As into $UserBaseDirectory; as far as I know this is not how private style sheets work. How did you create this "private" style sheet in the first place?

-
I had edited the private stylesheet of a notebook, and then saved it AS in the \$UserBaseb..... StyleSheets so it got recognised as a regular stylesheet. But it inherited the Saveable->False option and that option's behaviour confused me, as I explained in the comment to my question. Thanks –  Rojo Feb 12 '12 at 6:02

You can do all this programmatically like so:

SetOptions[EvaluationNotebook[],
StyleDefinitions ->
Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["MyStyle",StyleDefinitions -> StyleData["Text"]], Background->RGBColor[1,0,0]]},Saveable -> True,
StyleDefinitions -> "PrivateStylesheetFormatting.nb"]
]


That adds the style "MyStyle" to your stylesheet. The private style sheet is based on Default.nb and MyStyle is based on "Text".

You can create the private style sheet separately:

CreateDocument@
Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]],
Cell[StyleData["MyStyle", StyleDefinitions -> StyleData["Text"]],
Background -> RGBColor[1, 0, 0]]},
StyleDefinitions -> "PrivateStylesheetFormatting.nb"]


This stylesheet can be saved, i.e. File > Save, or saved as a new filename, i.e. File > Save As

-

I have the same problem as well, ie I can modify whatever I want in the private stylesheet but it never gets saved.

I could solve this problem before, by reading this topic. Then after a long while I had this problem again and came back here. It took me a big while to read everything here again and figure out what to do. (I may just be stupid.) Please let me document here just what is to be done.

In brief, the private stylesheet has been set to be unsaveable. This has to be changed.

1. While the Private Style Definitions window is active, choose Format > Option Inspector....
2. In the Scope field, choose Selected Notebook.
3. Search for Saveable
4. Tick the only one checkbox that appears so that its Value is True.
5. Choose File > Save
-