In TEAPOT, a collection of all of the attributes that can affect the visual or formatted text of the value of a cell is called a “style.” The possble attributes in such a collection are enumerated in the following items. There are options in the menu systems of both teapot and fteapot to set each of these attributes for a cell. Some parts of the style can also be affected by command keys (see 3).
However, TEAPOT's power to manipulate styles goes well beyond these menu items. Every cell in fact has a third associated expression, the style expression. This is accessed with Shift-Meta-Enter in fteapot and Esc-s in teapot. Any valid expression which returns a style may be entered, and then the expression will be evaluated whenever the cell needs to be displayed, and the computed result used to control the display of the cell. So for example, you can easily make the background color of a cell depend on its value; try setting the style expression for a cell to be background(13+int(@>0)) and then making the contents of the cell either a positive or negative number. (Here @ is a convenient abbreviation for @(), the value of the current cell.) Note that you can combine different styles by adding them with the usual + operator; in case of conflict between attributes, the left style takes precedence. So bold() + underline() produces a bold, underlined style, whereas floatfmt(scientific) + floatfmt(decimal) will display non-integer numerical values in scientific format.
In fact, the menu functions to set items operate simply by adding terms to the style expression for the cell(s) being changed, to force the corresponding attribute of the style to have the spcecified values. You can always see the current style expression for a cell by using the proper key to edit its style expression, and then escaping the editor if you don't want to change it.
A detailed discussion of each style attribute follows.
Cell values may be aligned to the left, the right, or the center. If the justification property of the style is not set to one of these three values (using the justify() function), then number values will be right-aligned and all other values will be left-aligned.
Floating-point (non-integer) numerical values in a cell may be displayed in one of four possible formats. Namely, they are decimal (12.34), scientific (1.234e1), compact (a mix of these to produce the shorter notation depending on the magnitude of the value; this is the default), or hexact (a specialized hexadecimal format used for exact round trips to text representation and back, rarely used for display.) This property is set with the floatfmt() function.
This attribute, set with the precision() function and defaulting to 3, is an integer determining the number of digits used in the display of floating point values. Exactly how it affects the display depends on the floating-point format. For decimal and scientific, the precision specifies the maximum number of digits after the decimal point. For compact, it determines the maximum total number of digits, before and after the decimal point. Precision has no effect on the hexact format. A negative precision value subtracts from the maximum number of digits that could be meaningful given the limited accuracy of the computer's internal representation of floating point numbers, with -1 representing the maximum meaningful precision. (Very large precision values may produce more digits, but the trailing digits become meaningless as the computer cannot record variation on this tiny scale.) Note that this attribute only changes what is displayed; TEAPOT always uses the maximum precision internally for calculations.
This attribute is a simple true-false flag set with dim() that determines whether the cell value will be displayed with dim characters, if possible. It defaults to false.
This attribute is a simple true-false flag set with bold() that determines whether the cell value will be displayed in a bold font, if possible. It defaults to false.
This attribute is a simple true-false flag set with italic() that determines whether the cell value will be displayed in an italic font, if possible. It defaults to false.
This attribute is a simple true-false flag set with underline() that determines whether the cell value will be underlined when displayed. It defaults to false.
This attribute is a s simple true-false flag set with shadowed(), defaulting to false. When true, it means that the left neighbour cell will additionally use the display room of this cell (and all following shadowed cells to the immediate right as well). Thus, the shadowed cell becomes invisible “underneath” the cell to the left, although it retains its contents and its value will be computed, simply not displayed unless/until the shadowing is removed. You may think of shadowing as a way to get multi-column cells, for formatting purposes or so that longer text may be displayed. This mechanism is provided in TEAPOT in place of a general “merge cells” feature as in other spreadsheets.
Usually, values are quoted as needed so that you get the exact same output in whatever display format is being used as on screen. That can be overridden with this true-false flag set with transparent(), defaulting to false. Transparent cells will be exported as-is into display-oriented file formats (html, LATEX, etc.) so that you can embed commands for subsequent processing in cell values. When it is false, those special characters are quoted so they appear as-is. Not quoting them allows special effects (if you know html, roff, or LATEX), but of course will cause the cell contents to look odd in formats other than the one for which the special values were designed.
The foreground() and background() colors used to display a cell may be set. (Currently this only affects screen display.) The value of these attributes is a positive integer which acts as an index into the “palette” of colors for the display device being used. Currently, each of teapot and fteapot set up a default palette appropriate for their respective capabilities. Hopefully, a future enhancement will allow one to display, edit, save, and restore the palette.