aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_intr
blob: bb0727c2a98275a38a00eab18bfe4387e2406557 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
@Section
    @Title { Getting started }
    @Tag { tbl_intr }
@Begin
@PP
The Lout definitions for table formatting
@FootNote {
The @Code "tbl" package described here replaces the @Code "tab"
package of Version 3.12 and earlier.  For backward compatibility
the @Code "tab" package is still available and still works as
described in older versions of this documentation.  Users of
@Code "tab" will find simple uses of @Code "tbl" to be very similar,
replacing @Code "@Tab" by {@Code "@Tbl"}, @Code "@Fmta" by
{@Code "aformat"}, @Code "@Col" by {@Code "@Cell"}, and
@Code "!" by {@Code "|"}.
}
are kept in a file called {@Code "tbl"}, which you must include at
the start of your document if
tbl.file @Index { @Code "tbl" file }
you want tables, like this:
@ID @OneRow @Code {
"@SysInclude { tbl }"
"@SysInclude { doc }"
"@Doc @Text @Begin"
"..."
"@End @Text"
}
Specialized setup files, like {@Code "tbl"}, are included before the main
setup file (@Code "doc" in this case).  Alternatively, if you are using
your own setup file, you may place the include commands within it, near the
start.
@PP
To begin with a very simple example, the table
tables. @RawIndex { tables }
tables.tbl @SubIndex { @Code "@Tbl" }
tbl.tables @Index { @Code "@Tbl" (tables) }
@CD
@Tbl
    aformat { @Cell A  |  @Cell B  |  @Cell C }
{
@Rowa
    A { Austen }
    B { Chaucer }
    C { Donne }
@Rowa
    A { Balzac }
    B { Darwin }
    C { Goethe }
@Rowa
    A { Byron }
    B { Dickens }
    C { Homer }
}
is produced by the following input:
@ID @OneRow @Code @Verbatim {
@Tbl
    aformat { @Cell A  |  @Cell B  |  @Cell C }
{
@Rowa
    A { Austen }
    B { Chaucer }
    C { Donne }
@Rowa
    A { Balzac }
    B { Darwin }
    C { Goethe }
@Rowa
    A { Byron }
    B { Dickens }
    C { Homer }
}
}
Immediately after the @Code "@Tbl" symbol, which introduces the table,
comes a @I { format option }, {@Code "aformat"}, describing the format of
tables. @RawIndex { tables }
tables.aformat @SubIndex { @Code "aformat" option }
aformat.tables @Index { @Code "aformat" option (tables) }
tables. @RawIndex { tables }
tables.format @SubIndex { format of }
format.tables @Index { format of tables }
each row.  It says that each row contains three cells:  {@Code "@Cell A"},
tables. @RawIndex { tables }
tables.cell @SubIndex { @Code "@Cell" }
cell.tables @Index { @Code "@Cell" (tables) }
{@Code "@Cell B"}, and {@Code "@Cell C"}.  The format option may have up
to 26 cells, with names chosen freely from the upper-case letters from
@Code A to {@Code Z}.  The symbol @Code "|" separates each cell from the next.
@PP
After the format option comes the body of the table, enclosed in
braces.  It consists entirely of a sequence of rows, each introduced by
a @Code "@Rowa" symbol and containing one entry for each cell of the
tables. @RawIndex { tables }
tables.rowa @SubIndex { @Code "@Rowa" }
rowa.tables @Index { @Code "@Rowa" (tables) }
format option, as shown (the row may occupy any number of lines of the
input file).  The entries may be arbitrary Lout objects, such as words,
paragraphs, equations, figures, and so on without restriction.  An entry
may be omitted altogether if it is empty.  Lout will choose suitable widths
for the cells, and break paragraphs in the entries to the right widths.
@PP
The result of the @Code "@Tbl" symbol is an object.  As usual with
Lout, this object may appear at any point in the document,
@FootNote {
In rare cases, when the table occupies an entire paragraph but is not
displayed, a bug in Basser Lout causes the second column to appear much
too far to the right.  If this occurs, replace
the very first row symbol ({@Code "@Row"}, {@Code "@Rowa"}, {@Code "@Rowb"},
etc.) by {@Code "@FirstRow"}, {@Code "@FirstRowa"}, {@Code "@FirstRowb"},
etc.  There are also {@Code "@HeaderFirstRow"}, {@Code "@HeaderFirstRowa"},
{@Code "@HeaderFirstRowb"} etc. symbols for replacing {@Code "@HeaderRow"},
{@Code "@HeaderRowa"}, {@Code "@HeaderRowb"}, etc., if required.
# That should work, but if it doesn't, replacing
# @Code "@Tbl" by @Code "@OneCol @Tbl" certainly will, although it also
# prevents the table from breaking across page boundaries.
}
even within a paragraph or another table.  Most commonly, though, tables
are displayed using the @Code "@IndentedDisplay" and @Code "@CentredDisplay"
symbols (Section {@NumberOf displays}):
@ID @Code "@CentredDisplay @Tbl ..."
or else they go into the @Code "@Table" symbol (Section {@NumberOf figures}):
@ID @OneRow @Code {
"@Table"
"    @Caption { ... }"
"@Tbl ..."
}
which centres them at the top of the following page and adds a
caption.  Note the difference between {@Code "@Tbl"}, which builds a
table, and {@Code "@Table"}, which places an arbitrary object in an
appropriate place.  It's important to remember that the result
is an object like any other, because from time to time one wants such
things as rotated tables whose entire contents are to be italicised:
@ID @Code "90d @Rotate @I @Tbl ..."
and it helps to remember that the full power of Lout can be
brought to bear on the @I entire table.
@End @Section