aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_rule
blob: 25858dfd4e2373417c2d59f46c0c19865a22ca64 (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
@Section
    @Title { Rules }
    @Tag { tbl_rule }
@Begin
@PP
There is a @Code "rule" option for drawing a rule around a cell:
@ID @OneRow @Code "@Cell rule { yes }"
Other values are {@Code no} (the default),
{@Code single} (the same as {@Code yes}), and {@Code double} (for a
double rule).
@PP
There are @Code "rulehorizontal" and @Code "rulevertical" options which
draw only horizontal or vertical rules, and also {@Code "ruleabove"},
{@Code "rulebelow"}, {@Code "ruleleft"}, and {@Code "ruleright"} options:
@ID @OneRow @Code @Verbatim {
@Tbl
    aformat { @Cell A | @Cell B }
{
@Rowa
    ruleabove { yes }
    A { Commercial property }
    B { 10% }
@Rowa
    A { Stock market }
    B { 15% }
    rulebelow { yes }
}
}
produces
@CD @OneRow @Tbl
    aformat { @Cell A | @Cell B }
{
@Rowa
    ruleabove { yes }
    A { Commercial property  }
    B { 10% }
@Rowa
    A { Stock market }
    B { 15% }
    rulebelow { yes }
}
These options take the same values as {@Code "rule"}, but draw
along only one or two of the four edges.
@PP
Other options control the appearance of rules.  Here they are with their
default values:
@ID @OneRow @Code @Verbatim {
@Tbl
    rulewidth { 0.05f }
    rulegap { 0.15f }
    rulecolour { black }
}
These say that rules are to be @Code "0.05f" wide (thick), double rules
are to appear @Code "0.15f" apart, and the colour of rules is to be black.
Once again, more specific versions of these symbols exist for controlling
above, below, left, and right rules:
@ID @OneRow @Code @Tbl
    aformat { @Cell ml { 0i } A | @Cell B | @Cell C }
    marginvertical { 0.5vx }
{
@Rowa
    A { rulehorizontalwidth }
    B { rulehorizontalgap }
    C { rulehorizontalcolour }
@Rowa
    A { ruleabovewidth }
    B { ruleabovegap }
    C { ruleabovecolour }
@Rowa
    A { rulebelowwidth }
    B { rulebelowgap }
    C { rulebelowcolour }
@Rowa
    A { ruleverticalwidth }
    B { ruleverticalgap }
    C { ruleverticalcolour }
@Rowa
    A { ruleleftwidth }
    B { ruleleftgap }
    C { ruleleftcolour }
@Rowa
    A { rulerightwidth }
    B { rulerightgap }
    C { rulerightcolour }
}
All these options have alternative, abbreviated names; and @Code { colour }
may be spelt @Code { color } wherever it appears.  Section
{@NumberOf tbl_summ} has a complete summary of all spellings of all
options.
@PP
To clarify exactly where the rules are drawn, let's start with
a cell with no rules at all:
@CD @Tbl
    mv { 0i }
    aformat { @Cell width { 3c } height { 1.2c } paint { lightgrey } A }
{
@Rowa
}
Above rules and left rules are drawn within the cell boundary, just
touching it, with any above rule overstriking any left rule:
@CD { @Tbl
    mv { 0i }
    aformat { @Cell width { 3c } height { 1.2c } paint { lightgrey } A }
{
@Rowa
}
@Background @Tbl
    mv { 0i }
    aformat { @Cell width { 3c } height { 1.2c } A }
    ruleleft { yes }
    ruleabove { yes }
    rulehorizontalwidth { 0.8v }
    ruleverticalwidth { 0.5v }
    ruleverticalcolour { grey }
    rulehorizontalcolour { black }
{
@Rowa
}
}
Below and right rules are drawn just outside the boundary of the
cell, also touching it:
@CD @Tbl mv { 0i } aformat { @Cell A | @Cell | @Cell B }
{
@Rowa
    A {
        @Tbl
            mv { 0i }
            aformat { @Cell width { 3c } height { 1.2c } paint { lightgrey } A }
        {
        @Rowa
        }
        @Background
        @Tbl
            mv { 0i }
            aformat { @Cell width { 3c } height { 1.2c } A }
            rulebelow { yes }
	    rulehorizontalwidth { 0.8v }
	    ruleverticalwidth { 0.5v }
	    ruleverticalcolour { grey }
	    rulehorizontalcolour { black }
        {
        @Rowa
        }
      }
    B {
        @Tbl
            mv { 0i }
            aformat { @Cell width { 3c } height { 1.2c } paint { lightgrey } A }
        {
        @Rowa
        }
        @Background
        @Tbl
            mv { 0i }
            aformat { @Cell width { 3c } height { 1.2c } A }
            ruleright { yes }
	    rulehorizontalwidth { 0.8v }
	    ruleverticalwidth { 0.5v }
	    ruleverticalcolour { grey }
	    rulehorizontalcolour { black }
        {
        @Rowa
        }
      }
}
@DP
When a right rule is present, any above and below rules are extended
by the width of the right rule, and they overstrike it:
@CD {
@Tbl
    mv { 0i }
    aformat { @Cell width { 3c } height { 1.2c } paint { lightgrey } A }
{
@Rowa
}
@Background
@Tbl
    mv { 0i }
    aformat { @Cell width { 3c } height { 1.2c } A }
    ruleabove { yes }
    ruleright { yes }
    rulebelow { yes }
    rulehorizontalwidth { 0.8v }
    ruleverticalwidth { 0.5v }
    ruleverticalcolour { grey }
    rulehorizontalcolour { black }
{
@Rowa
}
}
@DP
(These diagrams were produced by @Code "@Tbl" itself, using horizontal
rules of width @Code 0.8v drawn in black, and vertical rules of width
@Code 0.5v drawn in grey.)  These arrangements ensure that even thick
rules produce clean corners, and also that a right rule and a neighbouring
left rule exactly overstrike each other, as do a below rule and its
neighbouring above rule.
# @PP
# For information about rules in plain text tables, consult Section
# {@NumberOf tbl_plai}.
@End @Section