aboutsummaryrefslogtreecommitdiffstats
path: root/doc/user/tbl_mark
blob: fcd4768084b8529131d185d543a977dd8feabbec (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
@Section
    @Title { Vertical alignment of tables }
    @Tag { tbl_mark }
@Begin
@PP
Occasionally the vertical alignment of a table with objects to its left
vertical.alignment @Index { vertical alignment of tables }
and right becomes an issue.  Examples are hard to find, but let's say
that we need to construct a symbol
@ID @AmberLight
and include it in running text.  The obvious first attempt at a table
with three rows produces
#@ID @OneRow @Code @Verbatim {
#@Tbl
#   aformat { @Cell A }
#   margin { 0i }
#   strut { no }
#{
#@Rowa A { @OpenCircle }
#@Rowa A { @ClosedCircle }
#@Rowa A { @OpenCircle }
#}
#}
#where @Code "@OpenCircle" and @Code "@ClosedCircle" produce open and
#closed circles (they may be defined using the @Code "@Diag" package);
#but this produces
@Tbl
   aformat { @Cell A }
   margin { 0i }
   strut { no }
{
@Rowa A { @OpenCircle }
@Rowa A { @ClosedCircle }
@Rowa A { @OpenCircle }
}
in running text, because vertical alignment is by default through the
top boundary of the table.  To make the alignment pass through one of
the rows, replace its @Code "@Row" symbol by a corresponding
@Code "@MarkRow" symbol.  Here is the revised table, enclosed in a
definition for ease of use:
amberlight @Index { @Code "@AmberLight" symbol }
@ID @OneRow @Code @Verbatim {
import @TblSetup
def @AmberLight
{
    @OneRow @Tbl
         aformat { @Cell indentvertical { align } A }
         margin { 0i }
         strut { no }
         paint { no }  rule { no }
     {
         @Rowa A { @OpenCircle }
         @MarkRowa A { @ClosedCircle }
         @Rowa A { @OpenCircle }
     }
}
}
Now when we write
@ID @Code "produces @AmberLight in running text"
we find that this definition produces @AmberLight in running text, as
desired.  We have enclosed the table in @Code "@OneRow" to ensure that
its rows will never become separated, and added some options just in
case the definition is ever used with a setup file (Section
{@NumberOf tbl_setu}) that has default painting or rules.
@End @Section