Tables

A Grafstate code for a table is introduced with the :fig table instruction and concluded with the done. instruction. Each line of the body of a table describes one row. Cells in a row are separated by the # sign. The first row of a table is interpreted as the row of column titles, unless specified otherwise using a table option.

The # separator should be surrounded by spaces.

The following Grafstate code generates a table (shown below)∶
Code
:fig table
Heading 1 # Heading 2
Column 1, row 1 # Column 2, row 1
Column 1, row 2 # Column 2, row 2
done.
Heading 1
Heading 2
Column 1, row 1
Column 2, row 1
Column 1, row 2
Column 2, row 2

Formatting options

Formatting options apply to all figures and all computational structures. To apply a list of formatting options to a table, add a colon to the end of the :fig table instruction (surrounded by spaces), followed by the list of options (separated by a space.

The following options are available for a table∶
Description
Grafstate code
Center the table
><
Set the table width
w=n , where n represents a percentage of the width of the screen.
General options

Table options

The following options are specific to tables. They may be applied in the same way as formatting options.
Description
Grafstate code
Center every cell
cell><
Do not draw a border around the table or around individual cells
noborder
Do not format a title or a row of headings
nohead
Add a title
title
Add a caption
cap
Options specific to tables

Adding a title

To add a title to a table, apply the title option (see above). Begin the table description with a line that starts with the instruction title and is followed by the text of the title.

If a title is added to a table, then the first line of the table contents will not be interpreted as a row of column headings. If you want the cells on the first row to be bolded or centered, then see the cell options below.

Adding a caption

To add a caption to a table, apply the cap option (see above). Begin the table description with a line that starts with the instruction cap and is followed by the text of the caption.

If your table has both a title and a caption, then it does not matter whether the title line or the cap line is first; they must be lines 1 and 2 of of the table body code.

The following code creates a table using options (shown below)∶
Code
:fig table : >< cell>< title cap w=60 noborder
title This is a title
cap This is a caption
x # y # z
a # b # c
done.
This is a title
x
y
z
a
b
c
This is a caption

Cell options

To apply a list of options to a cell, place the :() command at the beginning of the cell, and include the list of options (separated by a space) inside the parentheses.

The following options are available for individual cells∶
Description
Grafstate code
Center text in the cell
><
Set the background color of the cell
bg=color , where color is one of the predefined colors (see below).
Set the width of the bottom border
bbw=n , where n is the width of the bottom border of the cell.
Set the width of the left border
blw=n , where n is the width of the left border of the cell.
Set the width of the right border
brw=n , where n is the width of the right border of the cell.
Set the width of the top border
btw=n , where n is the width of the top border of the cell.
Set the number of columns to span
cs=n , where n is the number of columns to be spanned by this cell.
Options for formatting a cell
The following predefined colors are available∶
Red
orange
yellow
green
blue
Predefined colors
The following code creates a table using options and text formatting for individual cells (shown below)∶
Code
:fig table : nohead >< w=60 cap
cap Formatting cells
**{Bold} # ::(bg=green) *{Italics} # !{Highlight}
::(cs=2) >< Wide # ::(bbw=.2 btw=.2 brw=.2 blw=.2) Border
done.
Bold
Italics
Highlight
Wide
Border
Formatting cells