This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

Styles and the Inheritance of Option SettingsText and Font Options

2.10.9 Options for Cells

Mathematica provides a large number of options for cells. All of these options can be accessed through the Option Inspector menu item in the front end. They can be set either directly at the level of individual cells or at a higher level, to be inherited by individual cells.

Some basic cell display options.

This creates a cell in Section style with default settings for all options.

In[1]:= CellPrint[Cell["A Heading", "Section"]]

This creates a cell with dingbat and background options modified.

In[1]:= CellPrint[Cell["A Heading", "Section",

CellDingbat->"\[FilledCircle]", Background->GrayLevel[.7]]]

Options for cell positioning.

The option CellMargins allows you to specify both horizontal and vertical margins to put around a cell. You can set the horizontal margins interactively by using the margin stops in the ruler displayed when you choose the Show Ruler menu item in the front end.

Whenever an option can refer to all four edges of a cell, Mathematica follows the convention that the setting for the option takes the form left, right, bottom, top. By giving nonzero values for the top and bottom elements, CellMargins can specify gaps to leave above and below a particular cell. The values are always taken to be in printer's points.

This leaves 50 points of space on the left of the cell, and 20 points above and below.

In[1]:= CellPrint[Cell["First text", "Text",

CellMargins->{{50, 0}, {20, 20}}]]

Almost every aspect of Mathematica notebooks can be controlled by some option or another. More detailed aspects are typically handled by "aggregate options" such as CellElementSpacings. The settings for these options are lists of Mathematica rules, which effectively give values for a sequence of suboptions. The names of these suboptions are usually strings rather than symbols.

This shows the settings for all the suboptions associated with CellElementSpacings.

In[1]:= Options[SelectedNotebook[ ], CellElementSpacings]

Out[4]=

Mathematica allows you to embed cells inside pieces of text. The option CellBaseline determines how such "inline cells" will be aligned vertically with respect to the text around them. In direct analogy with the option GridBaseline for a GridBox, the option CellBaseline specifies what aspect of the cell should be considered its baseline.

Here is a cell containing an inline formula. The baseline of the formula is aligned with the baseline of the text around it.

Here is a cell in which the bottom of the formula is aligned with the baseline of the text around it.

This alignment is specified using the CellBaseline->Bottom setting.

Options for ancillary data associated with cells.

In addition to the actual contents of a cell, it is often useful to associate various kinds of ancillary data with cells.

In a standard Mathematica session, cells containing successive lines of kernel input and output are given labels of the form In[n]:= and Out[n]=. The option ShowCellLabel determines whether such labels should be displayed. CellLabelAutoDelete determines whether the label on a cell should be removed if the contents of the cell are modified. Doing this ensures that In[n]:= and Out[n]= labels are only associated with unmodified pieces of kernel input and output.

Cell tags are typically used to associate keywords or other attributes with cells, that can be searched for using functions like NotebookFind. Destinations for hyperlinks in Mathematica notebooks are usually implemented using cell tags.

The option ConversionRules allows you to give a list containing entries such as "TeX" -> data which specify how the contents of a cell should be converted to external formats. This is particularly relevant if you want to keep a copy of the original form of a cell that has been converted in Mathematica notebook format from some external format.

Options for controlling interactive operations on cells.

The options Deletable, Copyable, Selectable and Editable allow you to control what interactive operations should be allowed on cells. By setting these options to False at the notebook level, you can protect all the cells in a notebook.

Even if you allow a particular cell to be edited, you can set CellEditDuplicate->True to get Mathematica to make a copy of the contents of the cell before they are actually changed. Styles for cells that contain output from Mathematica kernel evaluations usually make use of this option.

Options for evaluation.

Mathematica makes it possible to specify a different evaluator for each cell in a notebook. But most often, the Evaluator option is set only at the notebook level, typically using the Kernel menu item in the front end.

The option CellAutoOverwrite is typically set to True for styles that represent Mathematica output. Doing this means that when you re-evaluate a particular piece of input, Mathematica will automatically delete the output that was previously generated from that input, and will overwrite it with new output.

The option GeneratedCell is set whenever a cell is generated by an external request to the front end rather than by an interactive operation within the front end. Thus, for example, any cell obtained as output from a kernel evaluation, or created using a function like CellPrint or NotebookWrite, will have GeneratedCell->True.

Options for controlling page breaks when cells are printed.

When you display a notebook on the screen, you can scroll continuously through it. But if you print the notebook out, you have to decide where page breaks will occur. A setting of Automatic for a page break option tells Mathematica to make a page break if necessary; True specifies that a page break should always be made, while False specifies that it should never be.

Styles and the Inheritance of Option SettingsText and Font Options