aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_cell
blob: 159372e22cb723403fa364ec3d687fda6f9126f3 (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
@Section
    @Title { Changing the appearance of cells }
    @Tag { tbl_cell }
@Begin
@PP
The @Code "@Cell" symbol offers a few options for changing the appearance
cell.option @Index { cell options 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}.  Another option,
{@Code background}, allows an arbitrary object to be 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 { nopaint }"}), the more specific setting applies.  For a
precise description, see Section {@NumberOf tbl_summ}.
@End @Section