Tables are defined by the means of the table
function.
prototype |
(table [:ident] [:class] [:border] [:width] [:frame 'none ] [:rules 'none ] [:cellstyle 'collapse ] [:cellpadding] [:cellspacing] row... ) |
ident | html latex xml | The node identifier. |
class | html latex xml | The node class. |
border | html | The table border thickness. |
width | html latex | The width of the table. |
frame | html latex | Which parts of frame to render. Must be one of
none , above , below ,
hsides , vsides , lhs ,
rhs , box , border . |
rules | html latex | Rulings between rows and cols, Must be one of
none , rows , cols , header ,
all . |
cellstyle | html latex | The style of cells border. Must be either
collapse , separate , or a length representing
the horizontal and vertical space separating the cells. |
cellpadding | html | A number of pixels around each cell. |
cellspacing | html | An optional number of pixels used to separate each
cell of the table. A negative uses the target default. |
row... | The rows of the table. Each row must be
constructed by the trtr function. |
Note: Tables rendering may be only
partially supported by graphical agents. For instance, the cellstyle
attribute is only supported by HTML engines supporting
CSS2.
Table rows are defined by the tr
function.
prototype |
(tr [:ident] [:class] [:bg] cell... ) |
ident | html latex xml | The node identifier. |
class | html latex xml | The node class. |
bg | html | The background color of the row. |
cell... | The row cells. |
Two functions define table cells: th
for header cells and
td
for plain cells.
prototype |
(th [:ident] [:class] [:width] [:align 'center ] [:valign] [:colspan 1 ] [:bg] node ) |
(td [:ident] [:class] [:width] [:align 'center ] [:valign] [:colspan 1 ] [:bg] node ) |
ident | html latex xml | The node identifier. |
class | html latex xml | The node class. |
bg | html | The background color of the cell. |
width | html latex | The width of the table. |
align | html latex | The horizontal alignment of the table cell
(left, right, or center. Some
engines, such as the HTML engine, also supports a
character for the alignment.) |
valign | html latex | The vertical alignment of the cell. The value can
be top, center, bottom. |
colspan | html latex | The number of columns that the cell expands to. |
node | The value of the cell. |
Example:
(center
(table :border 1 :width 50. :frame 'hsides :cellstyle 'collapse
(tr :bg "#cccccc" (th :align 'center :colspan 3 "A table"))
(tr (th "Col 1") (th "Col 2") (th "Col 3"))
(tr (td :align 'center "10") (td "-20") (td "30"))
(tr (td :align 'right :rowspan 2 :valign 'center "12") (td "21"))
(tr (td :align 'center :colspan 2 "1234"))
(tr (td :align 'center :colspan 2 "1234") (td :align 'right "5"))
(tr (td :align 'center :colspan 1 "1") (td :colspan 2 "2345"))))
|
|
Ex. 16: A table
Produces:
A table |
Col 1 | Col 2 | Col 3 |
10 | -20 | 30 |
12 | 21 |
1234 |
1234 | 5 |
1 | 2345 |
|
|