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