How to | Create a New Style in a Stylesheet
Stylesheets define the appearance and behavior of notebooks and their content. Every document created by the document interface includes a reference to a stylesheet, and the process is simple for creating a new style or making changes to an existing style via the Format menu.
Begin by selecting Format ▶ Edit Stylesheet. This immediately embeds a fresh stylesheet into your document if it does not already contain one. The style changes made here will only affect the notebook containing this private stylesheet. The following image shows the stylesheet, its toolbar, and the main editing area below it (the editing area begins with a cell referencing an existing stylesheet called Default.nb and must remain in place).
A stylesheet is essentially just another notebook containing cells of a special type recognized by the system as style definitions. Any cells of that type added here affect the appearance or behavior of cells in the actual document that are set to the same style name. Edited in this example is Section, a common style available in the Choose a style pop-up menu. Select Section from the menu and the style cell for it is inserted into the main editing area, where it is labeled "Local definition for style Section".
Another way to insert a style definition cell is by entering the name in the toolbar field. It must be entered precisely the same as any existing style name, or it can also be a new style name of your choosing. Press the key for it to be inserted into the editing area.
With the cell bracket selected, any settings available through the document interface menus can be directly applied and will affect any cells of that style the same way. Use Format ▶ Text Color ▶ Black to change the text color:
This method will not work on any cells in your document that already have custom formatting of a similar type applied to them. The reason is because of inheritance, a concept related to cascading stylesheets—formatting settings that are acquired through various levels of reference. The first cell in this stylesheet makes reference to Default.nb, and by clicking on that you can see it makes reference to Core.nb. The chain of references positions your new local stylesheet between Default and your actual document content, so any changes to cells in your document will override the same type of settings in the stylesheet.
Besides the document interface menus, another more detailed method for changing settings is to use the Option Inspector. This is the only available interface for modifying the line above the Section cell. With the style cell still selected, choose Format ▶ Option Inspector to access Cell Options and CellFrame:
The CellFrame option takes a list of lists, and in this case the last value is set to 1, which means the frame side that is above the cell will be 1 pixel:
Change that value to zero and press to remove the line above the cell. Note that this option is now marked with an "x" out to the left to indicate it has been altered from the default settings (refer to "The Option Inspector" to learn more about this feature and the settings it can control).
With the new settings for Section applied, close the stylesheet window, begin a new Section cell in your document using its shortcut or the Format ▶ Style ▶ Section menu, and begin typing in it to see that the color is now black and the line above is gone.
Stylesheets are extremely powerful and can have a substantial impact on your documents. See "Working with Stylesheets" to learn more about the richness and complexity of stylesheet editing and creation.