Options for Cells
Mathematica provides a large number of options for cells. All of these options can be accessed through the 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.
This creates a cell with dingbat and background options modified.
| | |
| CellMargins | {{7,0},{4,4}} | outer margins in printer's points to leave around the contents of the cell |
| CellFrameMargins | 8 | margins to leave inside the cell frame |
| CellElementSpacings | list of rules | details of the layout of cell elements |
| CellBaseline | Baseline | how to align the baseline of an inline cell with text around it |
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 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

. 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.
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

. 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

.
| 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
BaselinePosition for a
Grid, 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.
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, which 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.
| | |
| Deletable | True | whether to allow a cell to be deleted interactively with the front end |
| Copyable | True | whether to allow a cell to be copied |
| Selectable | True | whether to allow the contents of a cell to be selected |
| Editable | True | whether to allow the contents of a cell to be edited |
| Deployed | False | whether the user interface in the cell is active |
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.
Deployed allows you to treat the contents of a cell as if they were a user interface. In a user interface, labels are typically not selectable and controls such as buttons can be used, but not modified.
Deployed can also be set on specific elements inside a cell so that, for example, the output of
Manipulate is always deployed even if the cell it is in has the
Deployed option set to
False.
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 or global level, typically using the 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 reevaluate 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 an output or side effect from a kernel evaluation will have
GeneratedCell->True. Cells generated by low-level functions designed to manipulate notebooks directly, such as
NotebookWrite and
NotebookApply, do not have the
GeneratedCell option set.
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.
Page breaks set using the
PageBreakAbove and
PageBreakBelow options also determine the breaks between slides in a slide show. When creating a slide show, you will typically use a cell with a special named style to determine where each slide begins. This named style will have one of the page-breaking options set on it.