1
0

tbl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. .TH TBL 1
  2. .SH NAME
  3. tbl \- format tables for nroff or troff
  4. .SH SYNOPSIS
  5. .B tbl
  6. [
  7. .I file ...
  8. ]
  9. .SH DESCRIPTION
  10. .I Tbl
  11. is a preprocessor for formatting tables for
  12. .I nroff
  13. or
  14. .IR troff (1).
  15. The input
  16. .I files
  17. are copied to the standard output,
  18. except for segments of the form
  19. .IP
  20. .nf
  21. .B .TS
  22. .IB options " ;
  23. .IB format " .
  24. .I data
  25. .B .T&
  26. .IB format " .
  27. .I data
  28. \&. . .
  29. .B .TE
  30. .fi
  31. .LP
  32. which describe tables
  33. and are replaced by
  34. .I troff
  35. requests to lay out the tables.
  36. If no arguments are given,
  37. .I tbl
  38. reads the standard input.
  39. .PP
  40. The (optional)
  41. .I options
  42. line is terminated by a semicolon and contains one or more
  43. of
  44. .RS
  45. .TF linesize(n)
  46. .TP
  47. .B center
  48. center the table; default is left-adjust
  49. .TP
  50. .B expand
  51. make table as wide as current line length
  52. .TP
  53. .B box
  54. .TP
  55. .B doublebox
  56. enclose the table in a box or double box
  57. .TP
  58. .B allbox
  59. enclose every item in a box
  60. .TP
  61. .BI tab( x )
  62. use
  63. .I x
  64. to separate input items; default is tab
  65. .TP
  66. .BI linesize( n )
  67. set rules in
  68. .IR n -point
  69. type
  70. .TP
  71. .BI delim( xy )
  72. recognize
  73. .I x
  74. and
  75. .I y
  76. as
  77. .IR eqn (1)
  78. delimiters
  79. .PD
  80. .RE
  81. .PP
  82. Each line, except the last, of the obligatory
  83. .I format
  84. describes one row of the table.
  85. The last line describes all rows until the next
  86. .BR .T& ,
  87. where the format changes,
  88. or the end of the table at
  89. .BR .TE .
  90. A format is specified by key letters, one per column, either upper or lower case:
  91. .RS
  92. .TP 0
  93. .B L
  94. Left justify: the default for
  95. columns without format keys.
  96. .PD0
  97. .TP
  98. .B R
  99. Right justify.
  100. .TP
  101. .B C
  102. Center.
  103. .TP
  104. .B N
  105. Numeric: align at decimal point (inferred for integers) or at
  106. .LR \e& .
  107. .TP
  108. .B S
  109. Span: extend previous column across this one.
  110. .TP
  111. .B A
  112. Alphabetic: left-aligned within column, widest item centered, indented relative to
  113. .B L
  114. rows.
  115. .TP
  116. .B ^
  117. Vertical span: continue item from previous row into this row.
  118. .TP
  119. .B -
  120. Draw a horizontal rule in this column.
  121. .TP
  122. .B =
  123. Draw a double horizontal rule in this column.
  124. .PD
  125. .RE
  126. .PP
  127. Key letters may be followed by modifiers, also either case:
  128. .RS
  129. .TP \w'\fLF\fIfont\fLXX'u
  130. .B |
  131. Draw vertical rule between columns.
  132. .PD0
  133. .TP
  134. .B ||
  135. Draw a double vertical rule between columns.
  136. .TP
  137. .I n
  138. Gap between column is
  139. .I n
  140. ens wide.
  141. Default is 3.
  142. .TP
  143. .BI F font
  144. Use specified
  145. .IR font .
  146. .B B
  147. and
  148. .B I
  149. mean
  150. .B FB
  151. and
  152. .BR FI .
  153. .TP
  154. .B T
  155. Begin vertically-spanned item at top row of range; default is
  156. vertical centering (with
  157. .LR ^ ).
  158. .TP
  159. .BI P n
  160. Use point size
  161. .IR n .
  162. .TP
  163. .BI V n
  164. Use
  165. .IR n -point
  166. vertical spacing in text block; signed
  167. .I n
  168. means relative change.
  169. .TP
  170. .BI W( n )
  171. Column width as a
  172. .I troff
  173. width specification.
  174. Parens are optional if
  175. .I n
  176. is a simple integer.
  177. .TP
  178. .B E
  179. Equalize the widths of all columns marked
  180. .BR E .
  181. .PD
  182. .RE
  183. .PP
  184. Each line of
  185. .I data
  186. becomes one row of the table; tabs separate items.
  187. Lines beginning with
  188. .L .
  189. are
  190. .I troff
  191. requests.
  192. Certain special data items are recognized:
  193. .RS
  194. .TP 0
  195. .B _
  196. Draw a horizontal rule in this column.
  197. .PD0
  198. .TP
  199. .B =
  200. Draw a double horizontal rule in this column.
  201. A data line consisting of a single
  202. .L _
  203. or
  204. .L =
  205. draws the rule across the whole table.
  206. .TP
  207. .B \e_
  208. Draw a rule only as wide as the contents of the column.
  209. .TP
  210. .BI \eR x
  211. Repeat character
  212. .I x
  213. across the column.
  214. .TP
  215. .B \e^
  216. Span the previous item in this column down into this row.
  217. .TP
  218. .B T{
  219. The item is a text block to be separately formatted
  220. by
  221. .I troff
  222. and placed in the table.
  223. The block continues to the next line beginning with
  224. .BR T} .
  225. The remainder of the data line follows at that point.
  226. .PD
  227. .RE
  228. .PP
  229. When it is used in a pipeline with
  230. .IR eqn ,
  231. the
  232. .I tbl
  233. command should be first, to minimize the volume
  234. of data passed through
  235. pipes.
  236. .SH EXAMPLES
  237. .ds tb \fR<tab>\fP
  238. Let \*(tb
  239. represent a tab (which should
  240. be typed as a genuine tab).
  241. .if t .2C
  242. .EX
  243. \&.TS
  244. c s s
  245. c c s
  246. c c c
  247. l n n.
  248. Household Population
  249. Town\*(tbHouseholds
  250. \*(tbNumber\*(tbSize
  251. Bedminster\*(tb789\*(tb3.26
  252. Bernards Twp.\*(tb3087\*(tb3.74
  253. Bernardsville\*(tb2018\*(tb3.30
  254. \&.TE
  255. .if t \{\0
  256. \0
  257. \0\}
  258. .if n .PP
  259. .TS
  260. c s s
  261. c c s
  262. c c c
  263. l n n.
  264. Household Population
  265. Town Households
  266. Number Size
  267. Bedminster 789 3.26
  268. Bernards Twp. 3087 3.74
  269. Bernardsville 2018 3.30
  270. .TE
  271. .EE
  272. .if t \{.sp3
  273. .1C\}
  274. .SH SOURCE
  275. .B /sys/src/cmd/tbl
  276. .SH SEE ALSO
  277. .IR troff (1),
  278. .IR eqn (1),
  279. .IR doctype (1)
  280. .br
  281. M. E. Lesk and L. L. Cherry,
  282. ``TBL\(ema Program to Format Tables'',
  283. .I
  284. Unix Research System Programmer's Manual,
  285. Tenth Edition, Volume 2.