BSD 3 development
[unix-history] / usr / doc / trofftut / tt05
CommitLineData
8340f87c
BJ
1.NH
2Tabs
3.PP
4Tabs
5(the \s8ASCII\s0 `horizontal tab' character)
6can be used to produce output in columns,
7or to set the horizontal position of output.
8Typically
9tabs are used only in unfilled text.
10Tab stops are set by default every half inch from the
11current indent,
12but
13can be changed by the
14.BD .ta
15command.
16To set stops every inch, for example,
17.P1
18^ta 1i 2i 3i 4i 5i 6i
19.P2
20.PP
21Unfortunately the stops are left-justified only
22(as on a typewriter),
23so lining up columns of right-justified numbers can be painful.
24If you have many numbers,
25or if you need more complicated table layout,
26.ul
27don't
28use
29.UL troff
30directly;
31use the
32.UL tbl
33program described in [3].
34.PP
35For a handful of numeric columns, you can do it this way:
36Precede every number by enough blanks to make it line up
37when typed.
38.P1
39^nf
40^ta 1i 2i 3i
41\0\01\0\fItab\fR\0\0\02\0\fItab\fR\0\0\03
42\040\0\fItab\fR\0\050\0\fItab\fR\0\060
43700\0\fItab\fR\0800\0\fItab\fR\0900
44^fi
45.P2
46Then change each leading blank into the string
47.BD \e0 .
48This is a character that does not print, but that has
49the same width as a digit.
50When printed, this will produce
51.P1
52.ta 1i 2i 3i
53\0\01 \0\02 \0\03
54\040 \050 \060
55700 800 900
56.P2
57.PP
58It is also possible to fill up tabbed-over space with
59some character other than blanks by setting the `tab replacement character'
60with the
61.BD .tc
62command:
63.P1
64^ta 1.5i 2.5i
65^tc \e(ru (\e(ru is "\(ru")
66Name \fItab\fR Age \fItab\fR
67.P2
68produces
69.P1 3
70.ta 1.5i 2.5i
71.tc \(ru
72Name Age
73.tc
74.P2
75To reset the tab replacement character to a blank, use
76.BD .tc
77with no argument.
78(Lines can also be drawn with the
79.BD \el
80command, described in Section 6.)
81.PP
82.UL troff
83also provides a very general mechanism called `fields'
84for setting up complicated columns.
85(This is used by
86.UL tbl ).
87We will not go into it in this paper.