aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_widt
blob: b2e39ad86a25e6f4e299d064a3bdd0d0b5e1e3f0 (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
@Section
    @Title { Cell width and height }
    @Tag { tbl_widt }
@Begin
@PP
Lout is quite good a choosing suitable widths for cells.  It leaves
narrow cells at their natural width, then uses paragraph breaking to
reduce the wider cells to a common width which is as large as
the available space allows:
@QD @OneRow @Tbl
    aformat { @Cell @I A | @Cell B | @Cell C }
{
@Rowa
    A { Acacia }
    B {
Shrub or small tree with grey-green foliage and brilliant
yellow blossom in late winter.
}
    C {
Distributed widely throughout Australia except in the most arid
parts; many varieties.
}
}
This usually looks good, but if you need something else, the @Code width
option may be used to give a particular width to a cell:
@ID @OneRow @Code "@Cell width { 3c }"
Here we have asked for a cell width of three centimetres; this includes
the cell margins.  When using @Code width to fine-tune the appearance of
a table wide enough to require paragraph breaking, it is best to use
@Code width to make cells narrower, not wider.
@PP
Regrettably, there is no way to request that several cells in a row be
given a common width equal to the width of the widest.  One simple way to
approximate this is to give these cells the same @Code width value.  The
@Code width option also has a special value, {@Code "expand"}.  All
cells with @Code "width { expand }" are assigned a common width
expand.cell.width @Index { @Code expand cell width in tables }
equal to the maximum amount permitted by the available space.  For example,
@ID @OneRow @Code @Verbatim {
@QuotedDisplay @Tbl
    width { expand }
    paint { lightgrey }
    aformat { @Cell A  |  @Cell B  |  @Cell C }
{
@Rowa
    A { 23.56 }
    B { 98.76 }
    C { 65.00 }
}
}
has result
@QuotedDisplay @Tbl
    width { expand }
    paint { lightgrey }
    aformat { @Cell A  |  @Cell B  |  @Cell C }
{
@Rowa
    A { 23.56 }
    B { 98.76 }
    C { 65.00 }
}
We have used our usual trick of making the option apply to several cells
by moving it to a more general level, in this case to {@Code "@Tbl"}.
The available space can be reduced using the @Code "@Wide" symbol; if
we replace @Code "@QuotedDisplay @Tbl" in the example above with
@ID @OneRow @Code "@CentredDisplay 4i @Wide @Tbl"
the result will be
@CentredDisplay 4i @Wide @Tbl
    width { expand }
    paint { lightgrey }
    aformat { @Cell A  |  @Cell B  |  @Cell C }
{
@Rowa
    A { 23.56 }
    B { 98.76 }
    C { 65.00 }
}
with the total table width reduced to four inches.
@PP
There is an analogous @Code height option which makes a cell take on
a particular fixed height, again including margins.  Make sure there
is enough height in the cell to hold its entry when you use this
option.  The @Code "expand" value is not available for height.
@End @Section