This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Documentation / Mathematica / The Mathematica Book / Principles of Mathematica / Manipulating Notebooks /

2.11.8 Styles and the Inheritance of Option Settings

The hierarchy of levels at which options can be set.

Here is a notebook containing three cells.

This is what happens when the setting CellFrame->True is made specifically for the third cell.

This is what happens when the setting CellFrame->True is made globally for the whole notebook.

This is what happens when the setting is made for the "Section" style.

In the standard notebook front end, you can check and set options at any level by using the Option Inspector menu item. If you do not set an option at a particular level, then its value will always be inherited from the level above. Thus, for example, if a particular cell does not set the CellFrame option, then the value used will be inherited from its setting for the style of the cell or for the whole notebook that contains the cell.

As a result, if you set CellFrame->True at the level of a whole notebook, then all the cells in the notebook will have frames drawn around them—unless the style of a particular cell, or the cell itself, explicitly overrides this setting.

Ways to set up styles in a notebook.

Depending on what you intend to use your Mathematica notebook for, you may want to choose different basic default styles for the notebook. In the standard notebook front end, you can do this using the Edit Style Sheet menu item.

Some typical choices of basic default styles.

With each choice of basic default styles, the styles that are provided will change. Thus, for example, only in the Book default styles is there a Box style which sets up the gray boxes used in this book.

Here is a notebook that uses Book default styles.

Options for specifying style environments.

Within a particular set of basic default styles, Mathematica allows for two different style environments: one for display on the screen, and another for output to a printer. The existence of separate screen and printing style environments allows you to set up styles which are separately optimized both for low-resolution display on a screen, and high-resolution printing.

Some typical settings for style environments.

Here is a notebook with the usual Working screen style environment.

Here is the same notebook with the Condensed screen style environment.

The way that Mathematica actually sets up the definitions for styles is by using style definition cells. These cells can either be given in separate style definition notebooks, or can be included in the options of a specific notebook. In either case, you can access style definitions by using the Edit Style Sheet menu item in the standard notebook front end.

Settings for the StyleDefinitions option for a Notebook.

Here is an example of a typical style definition cell.

This is the expression corresponding to the cell. Any cell in Section style will inherit the option settings given here.

Expressions corresponding to style definition cells.