aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_cell
blob: e68fd0bc8007a9381c7c99ad0d701df23a901c32 (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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
@Section
    @Title { Changing the appearance of cells }
    @Tag { tbl_cell }
@Begin
@PP
The @Code "@Cell" symbol offers a few options for changing the appearance
tables. @RawIndex { tables }
tables.paint @SubIndex { @Code "paint" option }
paint. @RawIndex { @Code "paint" option }
paint.in.tables @SubIndex { in tables }
tables. @RawIndex { tables }
tables.font @SubIndex { @Code "font" option }
font.option. @RawIndex { @Code "font" option }
font.option.in.tables @SubIndex { in tables }
tables. @RawIndex { tables }
tables.break @SubIndex { @Code "break" option }
break. @RawIndex { @Code "break" option }
break.tables @SubIndex { in tables }
of entries placed in it.  Like all options, these
appear immediately after the @Code "@Cell" symbol, with their values in braces:
@ID @OneRow @Code @Verbatim {
@Tbl
   aformat { @Cell paint { lightgrey } font { Italic } break { clines } A }
{
@Rowa A {
IMPORTANT
Do not throw stones at this notice
}
}
}
The result here is
@CD
@Tbl
   aformat { @Cell paint { lightgrey } font { Italic } break { clines } A | @Cell B }
{
@Rowa A {
IMPORTANT
Do not throw stones at this notice
}
}
with a light grey background, Italic font, and
@Code "clines" paragraph breaking style.  The paint colour
may be any colour from Section {@NumberOf colour}.
@PP
Wherever there is a @Code paint option in the standard packages, there
is a neighbouring @Code texture option, which causes the paint to be
tables. @RawIndex { tables }
tables.texture @SubIndex { @Code "texture" option }
texture.option. @RawIndex { @Code "texture" option }
texture.option.in.tables @SubIndex { in tables }
applied according to a given texture.  For a list of available
textures, consult Section {@NumberOf textures}; for how the @Code texture
option works, consult the description of the @Code texture option to the
@Code "@Box" symbol in Section {@NumberOf boxes} (all @Code texture
options work in the same way).  Here's an example:
@ID @OneRow @Code @Verbatim {
@Tbl
    width { 2f }
    height { 2f }
    aformat {
@Cell paint { black } texture { brickwork } A | @Cell B |
@Cell paint { black } texture { brickwork } C | @Cell D }
    bformat {
@Cell A | @Cell paint { black } texture { brickwork } B |
@Cell C | @Cell paint { black } texture { brickwork } D }
{
@Rowa
@Rowb
@Rowa
@Rowb
}
}
produces
@FootNote { If you can't see any textures here, the fault is probably
with your PostScript viewer.  See Section {@NumberOf textures}. }
@CD @OneRow
@Tbl
    width { 2f }
    height { 2f }
    aformat {
@Cell paint { black } texture { brickwork } A | @Cell B |
@Cell paint { black } texture { brickwork } C | @Cell D }
    bformat {
@Cell A | @Cell paint { black } texture { brickwork } B |
@Cell C | @Cell paint { black } texture { brickwork } D }
{
@Rowa
@Rowb
@Rowa
@Rowb
}
Another option, {@Code background}, allows an arbitrary object to be
tables. @RawIndex { tables }
tables.background @SubIndex { @Code "background" option }
background.tables @Index { @Code "background" option (tables) }
placed in the background of the cell, in front of any paint but behind
the entry.
@PP
Later sections introduce other @Code "@Cell" options, for
fixed-width columns, indented entries, margins, and rules.  It is also
possible to combine other symbols from Lout with cell formatting, by
placing them between the @Code "@Cell" symbol and its following letter,
rotated.entries @Index { rotated entries in tables }
like this:
@ID @OneRow @Code @Verbatim {
@Tbl
    aformat { @Cell 90d @Rotate @S A | @Cell @B grey @Colour B }
{
@Rowa
    A { Col A }
    B { Col B }
}
}
Think of the @Code "A" as standing for the value of the @Code "A"
option of the @Code "@Rowa" symbol (which it does), and you'll see
that this is just Lout's usual rule of symbols applying to the
object that follows them.  The result here is
@CD @Tbl
    aformat { @Cell 90d @Rotate @S A | @Cell @B grey @Colour B }
{
@Rowa
    A { Col A }
    B { Col B }
}
In simple cases @Code "@B" is easier than {@Code "font { Bold }"};
the latter is useful as a default value, as we will see in a moment.
Note the difference between a coloured background, obtained with
{@Code "paint"}, and a coloured entry, obtained using the @Code "@Colour"
symbol.
@PP
@Code "@Tbl" offers many places where you can set cell options.  The meaning
of the option is the same wherever you set it;
what changes is the extent of its application.  Taking the @Code "paint"
option as a representative example, the most specific place to set it
is at a @Code "@Cell" symbol as above; then it affects only that cell
in rows formatted using that format.  Alternatively,
@ID @OneRow @Code @Verbatim {
@Tbl
    apaint { lightgrey }
    aformat { @Cell A | @Cell B }
}
will paint every cell in the {@Code "aformat"}.  And
@ID @OneRow @Code @Verbatim {
@Rowa
    paint { lightgrey }
    A { ... }
}
will paint every cell in a particular row.  To paint the entire table, use
@ID @OneRow @Code @Verbatim {
@Tbl
    paint { lightgrey }
}
And finally, there is a @Code "paint" option in the
setup file (Section {@NumberOf tbl_setu}), which if set will paint every
table in the document.  When a more general setting of an option is
contradicted by a more specific setting (e.g. when @Code "@Tbl" has
@Code "paint { lightgrey }" but some cell or row has
{@Code "paint { none }"}), the more specific setting applies.  For a
precise description, see Section {@NumberOf tbl_summ}.
@End @Section