summaryrefslogtreecommitdiffstats
path: root/contrib/hdtbl/groff_hdtbl.7.man
blob: 23ae381d887968c3b17c878c1b4d04e264775063 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
.TH groff_hdtbl @MAN7EXT@ "@MDATE@" "groff @VERSION@"
.SH Name
groff_hdtbl \- Heidelberger table macros for GNU roff
.
.
.\" ====================================================================
.\" Legal Terms
.\" ====================================================================
.\"
.\" Copyright (C) 2005-2018 Free Software Foundation, Inc.
.\"
.\" This file is part of groff, the GNU roff type-setting system.
.\"
.\" Permission is granted to copy, distribute and/or modify this
.\" document under the terms of the GNU Free Documentation License,
.\" Version 1.3 or any later version published by the Free Software
.\" Foundation; with no Invariant Sections, with no Front-Cover Texts,
.\" and with no Back-Cover Texts.
.\"
.\" A copy of the Free Documentation License is included as a file
.\" called FDL in the main directory of the groff source package.
.
.
.\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
.do nr *groff_groff_hdtbl_7_man_C \n[.cp]
.cp 0
.
.
.ig
  Some simple formatting macros.  Note that we use '.ig' here and not a
  comment to make 'mandb' 2.4.1 (and probably more recent versions also)
  happy; otherwise the '.char' lines and the stuff which follows is
  included in the 'whatis' database.
..
.
.
.char \[lB] \F[\n[.fam]]\f[R][
.char \[rB] \F[\n[.fam]]\f[R]]
.
.char \[or] \F[\n[.fam]]\f[R]\||\|
.char \[ell] \F[\n[.fam]]\f[R].\|.\|.
.
.char \[oq] \F[\n[.fam]]\f[R]\[oq]
.char \[cq] \F[\n[.fam]]\f[R]\[cq]
.
.
.ie F CR \{\
.
.  \" We have to solve the following problem.  In this code
.  \"
.  \"   foo
.  \"   .CR bar
.  \"   foo
.  \"
.  \" the space immediately after 'bar' should not be taken from the 'C'
.  \" family.  At the same time, this
.  \"
.  \"   foo
.  \"   .CR bar\c
.  \"   foo
.  \"
.  \" should work also.  To fulfill both constraints we emit the
.  \" family changing commands both as escapes and macro calls.
.
.  de make-C-macro
.    de C\\$1
.      ds old-fam \\\\n[.fam]
.      fam C
.      \\$2 \&\\\\$*\F[]\F[\\\\*[old-fam]]
.      fam
\\..
.  .
.
.  make-C-macro R nop
.  make-C-macro B B
.  make-C-macro I I
.
.  de make-C-macro
.    de C\\$1
.      ds old-fam \\\\n[.fam]
.      fam C
.      \\$1 \\\\$@ \F[]\F[\\\\*[old-fam]]
.      fam
\\..
.  .
.
.  make-C-macro BI
.  make-C-macro IB
.  make-C-macro RI
.  make-C-macro IR
.  make-C-macro BR
.  make-C-macro RB
.\}
.el \{\
.  ftr CR R
.  ftr CI I
.  ftr CB B
.  ftr CBI BI
.
.  de CR
.    nop \&\\$*
.  .
.  als CB B
.  als CI I
.
.  als CBI BI
.  als CIB IB
.  als CRI RI
.  als CIR IR
.  als CBR BR
.  als CRB RB
.\}
.
.
.
.de XB
.  B "\\$1"
.  shift
.  CR "\\$1\c"
.  shift
.  while \\n[.$] \{\
.    nop ,
.    CR "\\$1\c"
.    shift
.  \}
.  br
..
.
.
.de XAA
.  TQ
.  CRI \\$@
..
.
.
.de XDEF
.  br
.  B Default:
.  if !\\n[.$] \
.    return
.  CRI "\\$1" "\\$2"
..
.
.
.de XDEFR
.  br
.  B Default:
.  CR "\[oq]\\$1\[cq]"
.  nop (register
.  CR "\[oq]\\$2\[cq]\c"
.  nop ).
..
.
.
.de XDEFS
.  br
.  B Default:
.  CR "\[oq]\\$1\[cq]"
.  nop (string
.  CR "\[oq]\\$2\[cq]\c"
.  nop ).
..
.
.\" ====================================================================
.SH Description
.\" ====================================================================
.
The
.I hdtbl
macros consist of four base and three optional macros,
controlled by about twenty arguments.
.
The syntax is simple and similar to the HTML table model and nearly as
flexible:
you can write sequences of tokens
(macro calls with their arguments and content data),
separated by blanks and beginning with a macro call,
into the same line to get compact and cleanly arrranged input.
.
An advantage of
.I hdtbl
is that the tables are constructed without calling a preprocessor;
this means that
.IR groff (@MAN7EXT@)'s
full macro capabilities are available.
.
On the other hand,
table processing with
.I hdtbl
is much slower than using the
.IR \%@g@tbl (@MAN1EXT@)
preprocessor.
.
A further advantage is that the HTML-like syntax of
.I hdtbl
will be easily converted to HTML;
this is not implemented yet.
.
.
.\" ====================================================================
.SH Usage
.\" ====================================================================
.
In this and the next section, we present examples to help users
understand the basic workflow of
.IR hdtbl .
.
First of all, you must load the
.I hdtbl.tmac
file.
.
As with nearly all other
.I groff
macro packages,
there are two possibilities to do so:
.
Either add the line
.
.
.PP
.RS
.EX
\&.mso hdtbl.tmac
.EE
.RE
.
.
.PP
to your
.I roff
file before using any macros of the
.I hdtbl
package, or add the option
.
.PP
.RS
.EX
\-m hdtbl
.EE
.RE
.
.
.PP
to the command line of groff (before the document file which contains
.I hdtbl
macros).
.
Then you can include on or more tables in your document, where each one
must be started and ended with the
.CR .TBL
and
.CR .ETB
macros, respectively.
.
.
.PP
In this man page,
we approximate the result of each example as terminal ouput to be as
generic as possible since
.I hdtbl
currently only supports the
.B ps
and
.B pdf
output drivers.
.
.
.PP
The simplest well-formed table consists of just single calls to the
four base table macros in the right order.
.
Here we construct a table with only one cell.
.
.
.PP
.RS
.EX
\&.TBL
\&.TR
\&.TD
.I contents of the table cell
\&.ETB
.EE
.RE
.
.
.PP
A terminal representation is
.
.
.PP
.if t .ne 3v
.RS
.EX
+------------------------------------------------------+
.\" That's 27 spaces below.
.RI "| " contents-of-the-table-cell "                           |"
+------------------------------------------------------+
.EE
.RE
.
.
.PP
Equivalent to the above is the following notation.
.
.
.PP
.RS
.EX
.RI ".TBL .TR .TD \[dq]" "contents of the table cell" "\[dq] .ETB"
.EE
.RE
.
.
.PP
By default, the formatted table is inserted into the surrounding text
at the place of its definition.
.
If the vertical space isn't sufficient, it is placed at the top of
the next page.
.
Tables can also be stored for later insertion.
.
.
.PP
Using
.CIR \[oq]row-number * column-number\[cq]
as the data for the table cells, a table with two rows and two columns
can be written as
.
.
.PP
.RS
.EX
\&.TBL cols=2
\&.  TR .TD 1*1 .TD 1*2
\&.  TR .TD 2*1 .TD 2*2
\&.ETB
.EE
.RE
.
.
.PP
A terminal representation is
.
.
.PP
.if t .ne 5v
.RS
.EX
+--------------------------+---------------------------+
| 1*1                      | 1*2                       |
+--------------------------+---------------------------+
| 2*1                      | 2*2                       |
+--------------------------+---------------------------+
.EE
.RE
.
.
.PP
Here we see a difference from HTML tables: The number of columns must be
explicitly specified using the
.CRI \[oq]cols= m\[cq]
argument (or indirectly via the
.CR \[oq]width\[cq]
argument, see below).
.
.
.PP
The contents of a table cell is arbitrary;
for example,
it can be another table,
without restriction to the nesting depth.
.
A given table layout can be either constructed with suitably nested
tables or with proper arguments to
.CR .TD
and
.CR .TH\c
, controlling column and row spanning.
.
Note, however, that this table
.
.
.PP
.RS
.EX
\&.TBL
\&.  TR
\&.    TD
\&.      nop 1*1 1*2
\&.  TR
\&.    TD
\&.      TBL cols=2 border=
\&.        TR
\&.          TD
\&.            nop 2*1
\&.          TD
\&.            nop 2*2
\&.      ETB
\&.ETB
.EE
.RE
.
.
.PP
and this table
.
.
.PP
.RS
.EX
\&.TBL cols=2
\&.  TR
\&.    TD colspan=2
\&.      nop 1*1 1*2
\&.  TR
\&.    TD
\&.      nop 2*1
\&.    TD
\&.      nop 2*2
\&.ETB
.EE
.RE
.
.
.PP
are similar but not identical (the use of
.CR .nop
is purely cosmetic to get proper indentation).
.
.
.PP
The first table looks like
.
.PP
.if t .ne 7v
.RS
.EX
+------------------------------------------------------+
| 1*1 1*2                                              |
+------------------------------------------------------+
|                                                      |
| 2*1                         2*2                      |
|                                                      |
+------------------------------------------------------+
.EE
.RE
.
.
.PP
and the second one like
.
.
.PP
.if t .ne 5v
.RS
.EX
+------------------------------------------------------+
| 1*1 1*2                                              |
+---------------------------+--------------------------+
| 2*1                       | 2*2                      |
+---------------------------+--------------------------+
.EE
.RE
.
.
.PP
Here is the latter table in a more compact form.
.
.PP
.RS
.EX
\&.TBL cols=2 .TR \[dq].TD colspan=2\[dq] 1*1 1*2
\&.            TR .TD 2*1 .TD 2*2 .ETB
.EE
.RE
.
.
.PP
If a macro has one or more arguments
(see below),
and it is not starting a line,
everything belonging to this macro including the macro itself must be
enclosed in double quotes.
.
.
.\" ====================================================================
.SH "Macros and Arguments"
.\" ====================================================================
.
The order of macro calls and other tokens follows the HTML model.
.
In the following list, valid predecessors and successors of all
.I hdtbl
macros are given, together with the possible arguments.
.
.PP
Macro arguments are separated by blanks.
.
The order of arguments is arbitrary; they are of the form
.
.PP
.RS
.CRI key= value
.RE
.
.PP
or
.
.PP
.RS
.CRI key=\[aq] "value1 \[lB]value2 \[lB]\[ell]\[rB]\[rB]" \[aq]
.RE
.
.PP
with the only exception of the optional argument of the macro
.CR .ETB\c
, which is the string
.CR \[oq]hold\[cq]\c
\&.
.
Another possible form is
.
.PP
.RS
.CRI \[dq]key= "value1 \[lB]value2 \[lB]\[ell]\[rB]\[rB]" \[dq]
.RE
.
.
.PP
However,
this is limited to the case where the macro is the first one in the line
and not already enclosed in double quotes.
.
.
.PP
Argument values specified below as\~\c
.CI c
are colors predefined by
.I groff
or colors defined by the user with the
.CR .defcolor
request.
.
Argument values\~\c
.CI d
are decimal numbers with or without decimal point.
.
Argument values\~\c
.CI m
are natural numbers.
.
Argument values\~\c
.CI n
are numerical values with the usual
.I groff
scaling indicators.
.
Some of the arguments are specific to one or two macros, but most of
them can be specified with
.CR .TBL\c
,
.CR .TR\c
,
.CR .TD\c
, and
.CR .TH\
\&.
.
These common arguments are explained in the next subsection.
.
.
.PP
Most of the argument default values can be changed by the user by
setting corresponding default registers or strings, as listed below.
.
.\"==================================================================
.
.TP
.CBI ".TBL " \[lB]args\[rB]
Begin a new table.
.
.IP
.RS
.XB predecessor: .TD .TH .ETB "cell contents"
.XB successor: .CPTN .TR
.XB arguments:
.
.RS
.XAA border= \[lB]n\[rB]
Thickness of the surrounding box border.
.
.CR \%\[oq]border=\[cq]
(no value) means neither a surrounding box border nor any horizontal or
vertical separator lines between the table rows and cells.
.
.CR \%\[oq]border=0\[cq]
suppresses the surrounding box border, but still allows separator lines
between cells and rows.
.
.XDEFR border=.1n t*b
.
.XAA bc= c
Border color.
.
.XDEFS bc=red4 t*bc
.
.XAA cols= m
Number of table columns.
.
This argument is necessary if more than one column is in the table and
no
.CR \[oq]width\[cq]
arguments are present.
.
.XDEFR cols=1 t*cols
.
.XAA cpd= n
Cell padding, i.e., the extra space between the cell space border and
the cell contents.
.
.XDEFR cpd=.5n t*cpd
.
.XAA csp= n
Cell spacing, i.e., the extra space between the table border or
vertical or horizontal lines between cells and the cellspace.
.
.XDEFR csp=.5n t*csp
.
.XAA tal=l\[or]c\[or]r
Horizontal alignment of the table, if it is smaller than the line width.
.
.CR \[oq]tal=l\[cq]\c
: left alignment.
.
.CR \[oq]tal=c\[cq]\c
: centered alignment.
.
.CR \[oq]tal=r\[cq]\c
: right alignment.
.
.XDEFR tal=l t*tal
.
.XAA "width=\[aq]" "w1 \[lB]w2 \[lB]\[ell]\[rB]\[rB]" \[aq]
Widths of table cells.
.
.CI w1\c
.RI , ""
.CI w2\c
.RI , ""
\[ell] are either numbers of type\~\c
.CI n
or natural numbers with the pseudo-scaling indicator
.CR \[oq]%\[cq]\c
, with the meaning \[lq]percent of the actual line length
(or column length for inner tables,
respectively)\[rq].
.
If there are less width values than table columns,
the last width value is used for the remaining cells.
.
The argument
.
.RS
.IP
.CR width=\[aq]1.5i 10%\[aq]
.RE
.
.IP
for example indicates that the first column is 1.5\~inches wide; the
remaining columns take 1/10 of the column length each.
.
.XDEF
The table width equals the outer line length or column length;
the columns have equal widths.
.
.XAA height= n
Height of the table.
.
If the table with its contents is lower than\~\c
.CI n\c
.RI , ""
the last row is stretched to this value.
.RE
.RE
.
.\"==================================================================
.
.TP
.CBI ".CPTN " \[lB]args\[rB]
Text of caption.
.
.IP
The (optionally numbered) table caption.
.
.CR .CPTN
is optional.
.
.IP
.RS
.XB predecessor: .TBL
.XB successor: .TR
.XB arguments:
.
.RS
.XAA val=t\[or]b
Vertical alignment of the table caption.
.
.CR \[oq]val=t\[cq]\c
: The caption is placed above the table.
.
.CR \[oq]val=b\[cq]\c
: The caption is placed below the table.
.
.XDEFS val=t t*cptn
.RE
.RE
.
.\"==================================================================
.
.TP
.CBI ".TR " \[lB]args\[rB]
Begin a new table row.
.
.IP
.RS
.XB predecessor: .TBL .CPTN .TD .TH .ETB "cell contents"
.XB successor: .TD .TH
.XB arguments:
.
.RS
.XAA height= n
The height of the row.
.
If a cell in the row is higher than\~\c
.CI n\c
.RI , ""
this value is ignored;
otherwise the row height is stretched to\~\c
.CI n\c
.RI . ""
.RE
.RE
.
.\"==================================================================
.
.TP
.CBI ".TD " "\[lB]args \[lB]cell contents\[rB]\[rB]"
Begin a table data cell.
.TQ
.CBI ".TH " "\[lB]args \[lB]cell contents\[rB]\[rB]"
Begin a table header cell.
.
.IP
Arguments and cell contents can be mixed.
.
The macro
.CR .TH
is not really necessary and differs from
.CR .TD
only in three default settings, similar to the
.CR <TH>
and
.CR <TD>
HTML tags: The contents of
.CR .TH
is horizontally and vertically centered and typeset in boldface.
.
.IP
.RS
.XB predecessor: .TR .TD .TH .ETB "cell contents"
.XB successor: .TD .TH .TR .ETB "cell contents"
.XB arguments:
.
.RS
.XAA colspan= m
The width of this cell is the sum of the widths of the\~\c
.CI m
cells above and below this row.
.
.XAA rowspan= m
The height of this cell is the sum of the heights of the
.CI m
cells left and right of this column.
.
.IP
.B Remark:
Overlapping of column and row spanning,
as in the following table fragment
(the overlapping happens in the second cell in the second row),
is invalid and causes incorrect results.
.
.
.RS
.IP
.EX
\&.TR .TD 1*1 \[dq].TD 1*2 rowspan=2\[dq] .TD 1*3
\&.TR \[dq].TD 2*1 colspan=2\[dq]         .TD 2*3
.EE
.RE
.
.
.PP
A working example for headers and cells with
.B colspan
is
.
.
.PP
.RS
.EX
\&.TBL cols=3
\&.  TR \[dq].TH colspan=2\[dq] header1+2 .TH header3
\&.  TR .TD 1*1 .TD 1*2 .TD 1*3
\&.  TR .TD 2*1 \[dq].TD colspan=2\[dq] 2*2+3
\&.ETB
.EE
.RE
.
.
.PP
This looks like
.
.
.PP
.if t .ne 7v
.RS
.EX
+------------------------------+---------------+
|          header1+2           |    header3    |
+--------------+---------------+---------------+
| 1*1          | 1*2           | 1*3           |
+--------------+---------------+---------------+
| 2*1          | 2*2+3                         |
+--------------+-------------------------------+
.EE
.RE
.
.
.PP
A working example with
.B rowspan
is
.
.
.PP
.RS
.EX
\&.TBL cols=3
\&.  TR
\&.  TD 1*1
\&.  TD rowspan=2 1+2*2
\&.  TD 1*3
\&.
\&.  TR
\&.  TD 2*1
\&.  TD 2*3
\&.ETB
.EE
.RE
.
.
.PP
which looks like
.
.
.PP
.if t .ne 5v
.RS
.EX
+--------------+---------------+---------------+
| 1*1          | 1+2*2         | 1*3           |
+--------------+               +---------------+
| 2*1          |               | 2*3           |
+--------------+---------------+---------------+
.EE
.RE
.RE
.RE
.
.\"==================================================================
.
.
.TP
.CB ".ETB \[lB]hold\[rB]"
End of the table.
.
.IP
This macro finishes a table.
.
It causes one of the following actions.
.
.RS
.IP \[bu] 3
If the argument
.CR \[oq]hold\[cq]
is given, the table is held until it is freed by calling the macro
.CR .t*free\c
, which in turn prints the table immediately,
either at the current position or at the top of the next page if its
height is larger than the remaining space on the page.
.
.IP \[bu] 3
Otherwise, if the table is higher than the remaining space on the page,
it is printed at the top of the next page.
.
.IP \[bu] 3
If neither of the two above constraints hold, the table is printed
immediately at the place of its definition.
.RE
.
.IP
.RS
.XB predecessor: .TD .TH .ETB "cell contents"
.XB successor: .TBL .TR .TD .TH .ETB "cell contents"
.XB arguments:
.
.RS
.XAA hold
Prevent the table from being printed until it is freed by calling the
macro
.CR .t*free\c
\&.
.
This argument is ignored for inner (nested) tables.
.RE
.RE
.
.\"==================================================================
.
.TP
.CBI ".t*free " \[lB]n\[rB]
Free the next held table or
.CI n\~\c
.RI held ""
tables.
.
Call this utility macro to print tables which are held by using the
.CR \[oq]hold\[cq]
argument of the
.CR .ETB
macro.
.
.
.\" ====================================================================
.SS "Arguments common to \f[CB].TBL\f[], \f[CB].TR\f[], \f[CB].TD\f[], \
and \f[CB].TH\f[]"
.\" ====================================================================
.
The arguments described in this section can be specified with the
.CR .TBL
and
.CR .TR
macros, but they are eventually passed on to the table cells.
.
If omitted,
the defaults take place,
which the user can change by setting the corresponding default registers
or strings,
as documented below.
.
Setting an argument with the
.CR .TBL
macro has the same effect as setting it for all rows in the table.
.
Setting an argument with a
.CR .TR
macro has the same effect as setting it for all the
.CR .TH
or
.CR .TD
macro in this row.
.
.IP
.XAA bgc= \[lB]c\[rB]
The background color of the table cells.
.
This includes the area specified with the
.CR \[oq]csp\[cq]
argument.
.
The argument
.CR \[oq]bgc=\[cq]
(no value) suppresses a background color; this makes the background
transparent.
.
.XDEFS bgc=bisque t*bgc
.
.XAA fgc= c
The foreground color of the cell contents.
.
.XDEFS fgc=red4 t*fgc
.
.XAA ff= name
The font family for the table.
.
.CI name
is one of the groff font families, for example
.CR A
for the AvantGarde fonts or
.CR HN
for Helvetica-Narrow.
.
.XDEF
The font family found before the table (string
.CR \[oq]t*ff\[cq]\c
).
.
.XAA fst= style
The font style for the table.
.
One of
.CR R\c
,
.CR B\c
,
.CR I\c
, or
.CR BI
for roman,
.BR bold ,
.IR italic ,
or \f[BI]bold italic\f[], \" \f[BI] is not portable man(7)
respectively.
.
As with
.IR roff 's
.B .ft
request,
the
.CR \[oq]fst\[cq]
argument can be used to specify the font family and font style together,
for example
.CR \[oq]fst=HNBI\[cq]
instead of
.CR \[oq]ff=HN\[cq]
and
.CR \[oq]fst=BI\[cq]\c
\&.
.
.XDEF
The font style in use right before the table (string
.CR \[oq]t*fst\[cq]\c
).
.
.XAA "fsz=\[aq]" "d1 \[lB]d2\[rB]" \[aq]
A decimal or fractional factor
.CI d1\c
.RI , ""
by which the point size for the table is changed, and
.CI d2\c
.RI , ""
by which the vertical line spacing is changed.
.
If
.CI d2
is omitted, value
.CI d1
is taken for both.
.
.XDEFS "fsz=\[aq]1.0 1.0\[aq]" t*fsz
.
.XAA hal=l\[or]c\[or]b\[or]r
Horizontal alignment of the cell contents in the table.
.
.CR \[oq]hal=l\[cq]\c
: left alignment.
.
.CR \[oq]hal=c\[cq]\c
: centered alignment.
.
.CR \[oq]hal=b\[cq]\c
: both (left and right) alignment.
.
.CR \[oq]hal=r\[cq]\c
: right alignment.
.
.XDEFS hal=b t*hal
.
.XAA val=t\[or]m\[or]b
Vertical alignment of the cell contents in the table for cells lower
than the current row.
.
.CR \[oq]val=t\[cq]\c
: alignment below the top of the cell.
.
.CR \[oq]val=m\[cq]\c
: alignment in the middle of the cell.
.
.CR \[oq]val=b\[cq]\c
: alignment above the cell bottom.
.
.XDEFS val=t t*val
.
.XAA hl=\[lB]s\[or]d\[rB]
Horizontal line between the rows.
.
If specified with
.CR .TD
or
.CR .TH
this is a separator line to the cell below.
.
.CR \[oq]hl=\[cq]
(no value): no separator line.
.
.CR \[oq]hl=s\[cq]\c
: a single separator line between the rows.
.
.CR \[oq]hl=d\[cq]\c
: a double separator line.
.
.IP
The thickness of the separator lines is the half of the border
thickness,
but at least 0.1\~inches.
.
The distance between the double lines is equal to the line thickness.
.
.IP
.B Remark:
Together with
.CR \[oq]border=0\[cq]
for proper formatting the value of
.CR \[oq]csp\[cq]
must be at least .05\~inches for single separator lines and .15\~inches
for double separator lines.
.
.XDEFS hl=s t*hl
.
.XAA vl=\[lB]s\[or]d\[rB]
Vertical separator line between the cells.
.
If specified with
.CR .TD
or
.CR .TH
this is a separator line to the cell on the right.
.
.CR \[oq]vl=s\[cq]\c
: a single separator line between the cells.
.
.CR \[oq]vl=d\[cq]\c
: a double separator line.
.
.CR \[oq]vl=\[cq]
(no value): no vertical cell separator lines.
.
For more information see the documentation of the
.CR \[oq]hl\[cq]
argument above.
.
.XDEFS vl=s t*vl
.
.
.\" ====================================================================
.SH "hdtbl Customization"
.\" ====================================================================
.
.PP
Before creating the first table, you should configure default values
to minimize the markup needed in each table.
.
The following example sets up defaults suitable for typical papers:
.
.
.PP
.RS
.EX
\&.ds t*bgc white\[rs]\[dq] background color
\&.ds t*fgc black\[rs]\[dq] foreground color
\&.ds t*bc black\[rs]\[dq]  border color
\&.nr t*cpd 0.1n\[rs]\[dq]  cell padding
.EE
.RE
.
.
.PP
The file
.I \%@EXAMPLEDIR@/\:hdtbl/\:\%common\:.roff
provides another example setup
in the \[lq]minimal Page setup\[rq] section.
.
.
.PP
A table which does not fit on a partially filled page is printed
automatically on the top of the next page if you append the little
utility macro
.CR t*hm
to the page header macro of your document's main macro package.
.
For example, say
.
.
.PP
.RS
.EX
\&.am pg@top
\&.  t*hm
\&..
.EE
.RE
.
.
.PP
if you use the
.I ms
macro package.
.
.
.PP
The macro
.CR t*EM
checks for held or kept tables,
and for missing
.CR ETB
macros (table not closed).
.
You can append this macro
to the \[lq]end\[rq] macro of your document's main macro package.
.
For example:
.
.
.PP
.RS
.EX
\&.am pg@end-text
\&.  t*EM
\&..
.EE
.RE
.
.
.PP
If you use the
.I ms
macro package.
.
.
.\" ====================================================================
.SH "Bugs and Suggestions"
.\" ====================================================================
.
Please send your comments to the
.MT groff@\:gnu\:.org
.I groff
mailing list
.ME
or directly to the author.
.
.
.\" ====================================================================
.SH Authors
.\" ====================================================================
.
The
.I hdtbl
macro package was written by
.MT Joachim\:.Walsdorff@\:urz\:.uni\-heidelberg\:.de
Joachim Walsdorff
.ME .
.
.
.\" ====================================================================
.SH "See also"
.\" ====================================================================
.
.TP
.IR groff (@MAN1EXT@)
provides an overview of GNU
.I roff
and details how to invoke
.I groff
at the command line.
.
.
.TP
.IR groff (@MAN7EXT@)
summarizes the
.I roff
language and GNU extensions to it.
.
.
.TP
.IR \%@g@tbl (@MAN1EXT@)
describes the traditional
.I roff
preprocessor for tables.
.
.
.\" Restore compatibility mode (for, e.g., Solaris 10/11).
.cp \n[*groff_groff_hdtbl_7_man_C]
.
.
.\" Local Variables:
.\" fill-column: 72
.\" mode: nroff
.\" End:
.\" vim: set filetype=groff textwidth=72: