Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Previous section-----Next section

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

option typical default value
CellDingbat "" a dingbat to use to emphasize the cell
CellFrame False whether to draw a frame around the cell
Background GrayLevel[1] the background color for the cell
ShowCellBracket True whether to display the cell bracket
Magnification 1 the magnification at which to display the cell
CellOpen True whether to display the contents of the cell

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[2]:=  CellPrint[Cell["A Heading", "Section",
CellDingbat->"\[FilledCircle]", Background->GrayLevel[.7]]]


option typical default value
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 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 non-zero 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[3]:=  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[4]:=  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.

option typical default value
CellLabel "" a label for a cell
ShowCellLabel True whether to show the label for a cell
CellLabelAutoDelete True whether to delete the label if the cell is modified
CellTags { } tags for a cell
ShowCellTags False whether to show tags for a cell
ConversionRules { } rules for external conversions

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.

option typical default value
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
CellEditDuplicate False whether to make a copy of a cell if its contents are edited
Active False whether buttons in the cell are 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.

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.

option typical default value
Evaluator "Local" the name of the kernel to use for evaluations
Evaluatable False whether to allow the contents of a cell to be evaluated
CellEvaluationDuplicate False whether to make a copy of a cell if it is evaluated
CellAutoOverwrite False whether to overwrite previous output when new output is generated
GeneratedCell False whether this cell was generated from the kernel
InitializationCell False whether this cell should automatically be evaluated when the notebook is opened

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.

option typical default value
PageBreakAbove Automatic whether to put a page break just above a particular cell
PageBreakWithin False whether to allow a page break within a particular cell
PageBreakBelow Automatic whether to put a page break just below a particular cell
GroupPageBreakWithin False whether to allow a page break within a particular group of cells

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.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2009 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: