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
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
|
\documentstyle[euro92]{article}% 27 Aug 92
%Version 2. Copyright: C.G. van der Laan, cgl@rug.nl, 05941-1525
\textheight23.5cm\textwidth15.5cm\topmargin0cm
\evensidemargin1cm \oddsidemargin1cm
\setlength{\textheight}{23.5cm}\setlength{\textwidth}{15.5cm}
\setlength{\topmargin}{0cm}
\setlength{\evensidemargin}{1cm}\setlength{\oddsidemargin}{1cm}
\begin{document} % Hunzeweg 57, 9893PB, Garnwerd
\textheight23.5cm\textwidth15.5cm\topmargin0cm
\evensidemargin1cm \oddsidemargin1cm
\setlength{\textheight}{23.5cm}\setlength{\textwidth}{15.5cm}
\setlength{\topmargin}{0cm}
\setlength{\evensidemargin}{1cm}\setlength{\oddsidemargin}{1cm}
\title{Table Diversions\thanks{Different from proceedings
Euro\TeX\ 92 in the encoding of FIFO.}}
\titlehead{Table Diversions}
\author{Kees van der Laan}%\thanks{}
\authorhead{Kees van der Laan}
\affiliation{Hunzeweg 57, 9893PB,
Garnwerd, The Netherlands,
05941--1525; cgl@rug.nl.}
\date{}
\maketitle \overfullrule=0pt
\def\dash{--}\def\Dash{---}\def\fiverm{\tiny}\def\sevenrm{\small}
\def\DeK{D\lower.5ex\hbox{E}K}
\catcode`\@=11
\def\@evenfoot{\rm\hfil\thepage}\let\@oddfoot=\@evenfoot
\catcode`\@=12
%\input btable.tex
%btable.tex version 1, 17/7/92 author: cgl@rug.nl
\newbox\tbl\let\ea=\expandafter\let\nx=\noexpand
%Cell vertical size, row height and depth (separation implicit),
\newdimen\cvsize\newdimen\tsht\newdimen\tsdp\newdimen\tvsize\newdimen\thsize
%Parameter setting macros: Rules
\def\hruled{\def\lineglue{\hrulefill}\def\colsep{} \def\rowsep{\hrule}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
\def\vruled{\def\lineglue{\hfil} \def\colsep{\vrule}\def\rowsep{}
\let\rowstbsep=\colsep\let\headersep=\hrule}
\def\ruled {\def\lineglue{\hrulefill}\def\colsep{\vrule}\def\rowsep{\hrule}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
\def\nonruled{\def\lineglue{\hfil} \def\colsep{} \def\rowsep{}
\def\rowstbsep{\vrule}\def\headersep{\hrule}}
\def\dotruled{\def\lineglue{\dotfill}\def\rowsep{\hbox to\thsize{\dotfill}}
\def\colsep{\lower1.5\tsdp\vbox to\cvsize{%
\leaders\hbox to0pt{\vrule height2pt depth2pt width0pt\hss.\hss}\vfil}}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
%Parameter setting macros: Controling positioning
\def\ctr{\def\lft{\hfil}\def\rgt{\hfil}}%Centered
\def\fll{\def\lft{} \def\rgt{\hfil}}%Flushed left
\def\flr{\def\lft{\hfil}\def\rgt{}} %Flushed right
%Parameter setting macros: Framing
\def\framed{\let\frameit=\boxit}
\def\nonframed{\def\frameit##1{##1}}
\def\dotframed{\let\frameit=\dotboxit}
%
\def\btable#1{\vbox{\let\rsl=\rowstblst%Copy
\ifx\empty\template\ifx\empty\rowstblst
\def\template{\colsepsurround\lft####\rgt&&\lft####\rgt\cr}
\else\def\template{\colsepsurround####\hfil&&\lft####\rgt\cr}\fi
\fi
\tsht=.775\cvsize\tsdp=.225\cvsize
\def\tstrut{\vrule height\tsht depth\tsdp width0pt}
%Logical mark up of column and row separators, via use of
\def\cs{&\colsepsurround\colsep\colsepsurround&}
\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
\def\rs{\colsepsurround\tstrut\cr
\ifx\empty\rowsep\else\noalign{\rowsep}\fi
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\def\grs{\colsepsurround\tstrut\cr\ghostrow}
\def\rss{&\colsepsurround\rowstbsep\colsepsurround&}
\def\hs{\colsepsurround\tstrut\cr
\ifx\empty\headersep\else\noalign{\headersep}\fi
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\preinsert
\setbox\tbl=\vbox{\tabskip=0pt\relax\offinterlineskip
\halign{\span\template\ifx\empty\first\ifx\empty\rowstblst\else
\ifx\empty\header\else\ea\rss\fi\fi\else\first\ea\rss\fi
\ifx\empty\header\ifx\empty\first\if\empty\rsl\else\ea\nxtrs\fi
\else\ea\hs\fi
\else\header\ea\hs\fi
#1\colsepsurround\tstrut\crcr} } %end \setbox
\postinsert
\ifx\caption\empty\else\hbox to\thsize{\strut\hfil\caption\hss}\captionsep\fi
\frameit{\copy\tbl}
\ifx\footer\empty\else\footersep\hbox{\vtop{\noindent\hsize=\thsize%
\footer}}\fi }} %end \btable
%Defaults
\cvsize=4ex\tsht=.775\cvsize\tsdp=.225\cvsize\def\colsepsurround{\kern.5em}
\def\caption{}\def\first{}\def\header{}\def\rowstblst{}\def\footer{}\def\data{}
\def\captionsep{\medskip} \def\headersep{\hrule}
\def\footersep{\smallskip} \def\rowstbsep{\vrule}
\def\preinsert{}
\def\postinsert{\global\thsize=\wd\tbl
\global\tvsize=\ht\tbl\global\advance\tvsize by\dp\tbl}
\ctr\nonruled\nonframed\def\template{}\def\ghostrow{} %end Defaults
%Auxiliaries
\def\boxit#1{\vbox{\hrule\hbox{\vrule\vbox{#1}\vrule}\hrule}}
\def\dotboxit#1{\vbox{\offinterlineskip\hbox to\thsize{\dotfill}%
\hbox{\lower\tsdp\vbox to\tvsize{%
\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}%
\vbox{#1}\lower\tsdp\vbox to\tvsize{%
\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}}%
\hbox to\thsize{\dotfill}}}
%And to account for logical columns with \logmsp
\def\spicspan{\span\omit}
\def\logmsp#1{\omit\mscount=#1\multiply\mscount by2 \advance\mscount by-1
\loop\ifnum\mscount>1 \spicspan\advance\mscount by-1 \repeat}
%To process FIFO
\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
%To handle the row stub list: \rsl
\def\nxtrs{\ifx\empty\rsl%\let\nxtel=\relax
\else\def\nxtel{\ea\nrs\rsl\srn}\ea\nxtel\fi}%next Row Stub
\def\nrs#1#2\srn{\gdef\rsl{#2}#1\rss} %end btable.tex
%
\begin{abstract} \noindent
Characteristics of existing table macro collections are given.
A kaleidoscope of tables---as next best to a taxonomy---is presented.
Newly introduced is the class of bordered tables.
Variations in print---ruled, nonruled, framed, nonframed, dotted, centered,
flushed---can be obtained via the invoke of
parameter setting macros; no modification of user mark up.
Simultaneous row and column spans, partial rules, and dotted lines
are dealt with.
The listing of the macro \verb|\btable|, with auxiliaries, is included.
\end{abstract}
\begin{keywords}(Bordered) Tables, framed and non-framed,
ruled and non-ruled, simultaneous row and columns spans, partial rules,
connected cells, plain \TeX, SGML, education.
\end{keywords}
%
\section*{Introduction}
The formatting of tables is considered complex,
time consuming and expensive.
Table making via \TeX, or \LaTeX,
needs too complex descriptions for simple tables, except when the
table can be formatted via \verb|\settabs|.
For \verb|\halign| use,
there is no default template provided by plain.
The $\langle X\rangle$\TeX\ macros
I have seen, don't reflect the logical structure of the table.
An apparently simple change of representation, for example
from a ruled into a non-ruled, or
from a framed into a non-framed table,
requires in \TeX, and \LaTeX, some non-negligible effort.
\\[.5ex]
Therefore, there is a need for an easy to use macro on top of
plain's powerful \verb|\|$\langle X\rangle$\verb|halign|-s,
which accounts for the structure of the table.
\\[.5ex]
Characteristics of existing table macros are given in the Existing \TeX\
Table Packages section.
%\\[.5ex]
In the Kaleidoscope section an anthology of tables is presented.
Peculiar are the deterministic tables, and the tables which update memory.
The section ends with the bordered table model.
%\\[.5ex]
In the Bordered Table section the macro and examples of use are given.
%\\[.5ex]
In the Blocks section %the problems of
blocks and connected cells are dealt with.
\\[.5ex]
No landscape vs.\ portrait issues are
discussed, nor the general use of rotated fonts.
Tables which extend the page will not be discussed either. See for the latter
for example supertabular.sty, \cite{taj}, or longtable.sty, \cite{dc92}.
I also refrained from the issues which come from
mapping the `main vertical list' onto pages, under the restriction not to split
tables over page boundaries.
%
\section{Existing \TeX{} table packages}
Cowan, \cite{rfc85}, provided a nice package
in order to facilitate the formatting of simple tables.
A main feature of his macros is that no template
and no explicit number of columns, have to be provided.
The template is created dynamically from the data and the
`attributes.'
This is powerful and High-\TeX\
on the one hand, but restrictive and time consuming on the other.
The automatism can't be easily
superseded, as opposed to a default repetitive template,
which I have adopted. The functionality as demonstrated by
his examples can be easily obtained via %a stripped version of
the bordered table macro.
\\[.5ex]
Khanh, \cite{khanh90}, introduced table macros which mainly deal with
complex header rows. Because I consider
those complicated header rows the exception rather than the rule,
and because the material is not in the public domain,
I will not consider it further.
\\[.5ex]
Spivak, \cite{mds89}, provided some powerful macros
for formatting tables separately from the main document.
His merging, at the dvi level,
of the formatted table into the main document, is High-\TeX.
He also provided some interesting examples of simultaneous row and column
spans. Good, but complex, and perhaps too advanced for daily use.
It is in the public domain.
\\[.5ex]
Lamport, \cite{lam86},
mainly provided facilities for placing a table
appropriately within the context.\footnote{As floating body, also called
island by Spivak (1989).}
He also developed \verb|\cline|,
for partial horizontal rules, which is a powerful and a handy feature.
I don't consider his way of framing nice, nor his way of
specifying the ruling.
\\[.5ex]
Hendrickson, \cite{ah89}, has an approach
similar to mine. No bordered table model, however,
and less pronunciated `attributes.'
\\[.5ex]
There exist more table macros.
Of those I had access to, the ones discussed above seemed relevant to me.
Now and then visual mark up packages appear, like Type and Set, \cite{ga92}.
With bars and visual mark up the table is specified on the screen,
and from that \TeX\ code is generated.
However useful this might be within the `conversion' of wordwhatever
into \TeX\ area, I don't like the resulting \TeX\ encoding.
It is clumsey. If that simple tables generate such an encoding then we
are lost with really something a little more complex.
Besides, the purpose of this paper is
to introduce some new ways of formatting {\em simple\/} tables, next to
the general accepted formatting \TeX niques.
The \TeX book considers alignment the general issue. I like to approach
the issue from the structure point of view, and to couple it to what is
already available via plain. This work is a continuation
of my earlier work on the SGML-\TeX\ relation, \cite{cgl90a}.
%
\section{Kaleidoscope}
Some examples of special tables are given in order to illustrate the
diversity. With respect to programming, the deterministic tables and
the tables which update the computer memory, deserve special attention.
The latter category is induced by {\em computer\/} typography.
\begin{itemize}
\item Pascal triangle, a deterministic table,
\cite{cgl91}
\par\noindent
{$$\vcenter{\vbox{\small\hsize=.3\hsize
$$\displaylines{1\cr
1\quad1\cr
1\quad2\quad1\cr
1\quad3\quad3\quad1\cr}$$}}
\qquad\vcenter{\hbox{via}}\qquad
\vcenter{\vbox{\hsize=.4\hsize\small
\begin{verbatim}
$$\displaylines{1\cr
1\quad1\cr
1\quad2\quad1\cr
1\quad3\quad3\quad1\cr}$$
\end{verbatim}}}
$$}
\item Tower of Hanoi, deterministic, \cite{cgl92a}.
The process of replacement of the disks will be printed
by the invoke of \verb|\hanoi|$\langle n\rangle$, $n$ an integer.
No user mark up is needed.
%
\item Young tableaux, irregular shape, \cite{dek73}, \cite{pesw}
{\small\newdimen\csize\csize=3ex
\catcode`'=13\relax \newcount\cnt
\def'{\global\advance\cnt1 \the\cnt}
\def\data{'&'&'&'\cr'&'&'\cr'}
\def\young#1{\hbox{\vrule\vtop{\hrule\offinterlineskip%
\halign{&\vbox{\hbox to\csize{\strut\hss##\hss\vrule}\hrule}\cr%template
#1\crcr}}}}%end \young
%
\qquad\young\data\qquad
\def\data{7&8&9&10\cr11&13\cr16\cr}\young\data
}%end scope
\par\noindent via
{\small\begin{verbatim}
\def\young#1{\hbox{\vrule\vtop{\hrule\offinterlineskip\halign
{&\vbox{\hbox to\csize{\strut\hss##\hss\vrule}\hrule}\cr#1\crcr}}}}
%
\def\data{'&'&'&'\cr'&'&'\cr'} \young\data\qquad
\def\data{7&8&9&10\cr11&13\cr16\cr}\young\data
\end{verbatim} }
\noindent with auxiliaries
{\small\begin{verbatim}
\newdimen\csize\csize=3ex \newcount\cnt\catcode`'=13
\def'{\global\advance\cnt1 \the\cnt}
\end{verbatim} }
\item Much alignment
occurs in typesetting mathematics: aligned equations in
display, matrices, and the complex commutative diagrams. This has been dealt
with elsewhere, for example \cite{dek84}, \cite{cgl91}, and
\cite{mds89}.
\item Crosswords: puzzle, clues and solution, \cite{cgl92b} \\
\let\ea=\expandafter
{\newif\ifpuzzle
\newcount\cnt\newdimen\csize\csize=3ex
%
\def\crw#1{\toxit{\offinterlineskip%
\halign{\bcell width0pt%of strut
\prc##\ecell&&\bcell\relax
\prc##\ecell\cr#1}%end \halign
\global\cnt0}}%end \crw
%
\def\toxit#1{\vtop{\hrule
\hbox{\vrule\vbox{#1}\vrule}
\hrule}}%end \toxit (\vtop used)
%
\def\bcell{\hbox to\csize\bgroup\vrule%
height.8\csize depth.2\csize}
\let\ecell=}%TB 385, \egroup
%
\def\prc#1{\if*#1\cc\else\ifx\relax#1%
\cc\else%no crossed out cell
\ifnum`#1=\lccode`#1\low{#1}\else%
\cap{#1}\fi\fi\fi}%end \prc
\def\cc{\leaders\hrule height.8\csize
depth.2\csize\hfill}%end Crossed Cell
\def\low#1{\ifpuzzle\null\else\hfil%
\uppercase{#1}\fi\hfil}%end \low
\def\cap#1{\num\ifpuzzle\null%
\else\hfil#1\fi\hfil}%end \cap
%
\def\num{\global\advance\cnt1\relax%
\vbox to.8\csize{\rlap{\kern1pt%
\fiverm\the\cnt\hss}\vfil}}%end \num
%
%furthermore, in order to omit & and \cr
%in the data (natural input)
\def\markup#1{\ea\xdef\ea#1\ea{\ea%
\fifol#1\ofifl}}%end \markup
%
{\catcode`\^^M=13 %local scope
%Pick up and processing of lines
\gdef\fifol#1^^M#2{\process{#1}%
\ifx\ofifl#2\nx\lr\ofifl
\fi\nx\rs\fifol#2}}
\def\ofifl#1\ofifl{\fi}
%
%FIFO with lok ahead
\def\fifo#1#2{#1\ifx\ofif#2\ofif
\fi\nx\cs\fifo#2}
\def\ofif#1\ofif{\fi}
%
\def\cs{&}\def\rs{\cr\noalign{\hrule}}
\def\lr{\cr}
%
\def\process#1{\fifo#1\ofif}
%
%next is necessary to allow spaces
%for * (except in last column)
\def\bdata{\bgroup\obeylines%
\obeyspaces\store}
\def\store#1\edata{\egroup\def\data
{#1}}
{\obeyspaces\global\let =\relax}
%\endinput %22/8/92 cgl@rug.nl
%
\bdata%
P*On
DEk*
*n*S
Edit
\edata\markup\data
$$\qquad\qquad\qquad\vcenter{\noindent\sevenrm\csize=3ex
\puzzletrue\crw\data\parindent=5ex
\vtop{\hsize=21ex\obeylines Across
2 Switch mode
3 Knuth
6 Prior to \TeX}
\parindent=3ex
\vtop{\hsize=25ex\obeylines Down
1 Public domain
2 All right
4 All comes to it
5 Atari type}
\fiverm\csize=3ex
\puzzlefalse\def\num{}\crw\data}$$
}%end local scope
%
\item Maze \qquad\qquad
\vskip-2\baselineskip
%Labyrinth via TeX, just an experiment feb 92, cgl@rug.nl
%More on it in MAPS to come
%Assumed is a closed rule on top and to the right
%| and _ denote the rules to mark the labyrinth
%Labyrinth proper
\newdimen\csize \csize=3ex
{\small\catcode`|=13 \def|{\vrule}
\catcode`_=13 \def_{\hrulefill}
$$\vcenter{
\hbox{\vtop{\offinterlineskip\hrule
\halign{&\hbox to\csize
{\vrule height\csize width0pt#\hfil}\cr
|&_&|_& \cr
&|&_& \cr
|&|_&_&|\cr
|_& &_&_\cr}%end \halign
}\vrule%end \vbox
}%end \hbox
}\qquad\vcenter{\hbox{via}}\quad%
\vcenter{\vtop{\small\hsize=.5\hsize
\begin{verbatim}
\newdimen\csize \csize=3ex
\catcode`|=13 \def|{\vrule}
\catcode`_=13 \def_{\hrulefill}
\hbox{\vtop{\offinterlineskip\hrule
\halign{&\hbox to\csize
{\vrule height\csize width0pt#\hfil}\cr
|&_&|_& \cr
&|&_& \cr
|&|_&_&|\cr
|_& &_&_\cr}%end \halign
}\vrule%end \vbox
}%end \hbox
\end{verbatim}
}}$$ }%end \small
\par
\item Chart, \TeX book ex22.14 %but elaborated differently.
{\small\newdimen\dist \dist=2\baselineskip
\def\ent#1{\hbox{\vbox to 0pt
{\vss\hbox to10ex{\quad\strut#1\hss}
\hrule}}}
\def\vl#1{\hbox{\vrule height#1\dist
depth0pt}}%Vertical Line of prop. size
\def\bl#1{\kern#1\dist}%BLank of prop. size
%Balanced
$$\qquad\offinterlineskip
\vcenter{\ent{abc}}
\vcenter{\ent{de}
\vl2
\ent{fg}}
\vcenter{\ent{hij}
\vl1
\ent{klm}
\bl1
\ent{nop}
\vl1
\ent{qrs}}
\quad%Nearly balanced tree; pruning a branch
\vcenter{\ent{abc}}
\vcenter{\ent{de}
\vl2
\ent{fg}}
\vcenter{\ent{hij}
\vl{.5} %\bl{.5}<-|
% \ent{klm} |
\bl{1.5}% <-|
\ent{nop}
\vl1
\ent{qrs}}$$ }%end scope
\noindent via the following alternative code without \verb|\halign|
{\small\begin{verbatim}
\newdimen\dist \dist=2\baselineskip
\def\ent#1{\hbox{\vbox to0pt{\vss\hbox to10ex{\quad\strut#1\hss}\hrule}}}
\def\vl#1{\hbox{\vrule height#1\dist depth0pt}}
\def\bl#1{\kern#1\dist}%BLank of proper size
%Balanced
$$\offinterlineskip
\vcenter{\ent{abc}}
\vcenter{\ent{de} \vl2\ent{fg}}
\vcenter{\ent{hij}\vl1\ent{klm}\bl1\ent{nop}\vl1\ent{qrs}}
\quad%Nearly balanced tree; pruning a branch
\vcenter{\ent{abc}}
\vcenter{\ent{de} \vl2\ent{fg}}
\vcenter{\ent{hij}\vl{.5}%\bl{.5}\ent{klm}
\bl{1.5}\ent{nop}\vl1\ent{qrs}}$$
\end{verbatim} }%end small
\noindent There exist some special tree packages, see \cite{abk89}.
%
\item Row and/or column spans, partial horizontal rules%
\footnote{How many rows does the header have? Descriptive 1, visual 2, and for
plain \TeX\ formatting 3? See Mark up of Bridge Form subsection.}
%Fill-in form bridge
\nonruled\ctr\framed \def\rowstblst{}
{\small%\defaults
\newcount\bcnt
\def\lines{\global\advance\bcnt by 1 \ifnum\bcnt=3 et cetera\hidewidth
\senil\fi\the\bcnt.\cs\cs\cs\cs\cs\cs\rs\lines}
\def\senil#1\lines{\fi}
\def\ghostrow{\omit\colsepsurround%
\vbox to 0pt{\vss\hbox to 5ex{\hss Pair\hss}\vskip.5ex
\hbox to 5ex{\hss No\hss}\vss}\prs\logmsp2\lineglue\srp
\vbox to 0pt{\vss\hbox to 5ex{\hss Re-\hss}\vskip.5ex
\hbox to5ex{\hss sults\hss}\vss}\prs\logmsp2\lineglue\srp
\vtop to 0pt{\vss\hbox to 5ex{\hss MP$\,$s\hss}\vss}\colsepsurround\cr}
\def\header{\cs\logmsp2\hfil Contract\hfil\cs
\cs\logmsp2\hfil Scores\hfil\cs\grs
\cs N--S\cs E--W\cs\cs N--S\cs E--W\cs}
\def\data{\lines}
$$ \framed\ruled\btable\data $$
}%end scope
\write16{Bridge form \arabic{page}}
\item Bridge pair match scheme, with special `first' element
\par\noindent
{\small\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{|c|c|c|c|c|c|c|c|}
\hline
\begin{minipage}{10ex}
\setlength{\unitlength}{6ex}
\begin{picture}(1.5, 1)
\put( 0.0, 0.0){\small Ronde}
\put( 1.4, 0.5){\llap{\small Spel}}
\put( 1.4, 0.1){\line(-2, 1){1.4}}
\end{picture}
\vspace*{\medskipamount}
\end{minipage}
& 1--3 & 4--6 & 7--9 & 10--12 & 13--15 & 16--18 & 19--21\\ \hline
1.&1: 1--2& & &2: 3--4& &3: 5--6 &4: 7--8\\ \hline
2.&4: 8--3&1: 1--6& & &2: 5--7 & &3: 2--4\\ \hline
\dots &&&&&&& \\ \hline
\end{tabular}
\end{center} }
\item Alignment at decimal points. Generally this is done by introducing
an extra column for the dot, and flushing right the digits left and
flushing left the digits right of it. It comes from the wishes not to print
non-significant leading zeroes, and to suppress
zeroes behind the point for exact numbers. 3.5 means exactly 3${1\over2}$.
3.500 means accurate to three digits. I would
mark up the numbers separately
and insert Knuth's `?',
\TeX book, p.240\dash241,
for non-signicant zeroes, automatically. The latter can also be done by
programming the editor by a template consisting of sufficient ?-s followed
by the decimal point. The required numbers can be brought in by overtyping
the template. Related to alignment at the decimal point is alignment
at number signs,\footnote{Another column for the signs
offends the structure.
At a lower level one could think of {\tt\char92scs},
a Sign Column Separator, but that is not nice either.} see the AAP table.
%
\item Fill-in forms, especially the registration forms for the various
\write16{Fill-in form: \arabic{page}}
\TeX\ conferences, are captivating. Sometimes I ponder about the
e-mail equivalents of the traditional snail forms, especially what
and how they should be filled in. Redefine a list of empty definitions?
%
\item Time-tables (railway, bus, \dots), and the use of rotated
fonts.
\write16{Time tables: \arabic{page}}
\item Nested, and interrupted\footnote{From the user level one would say:
aligned material connected by text, where the latter
in the case at hand is the status of the play.}
table with updating of memory, \cite{cgl90}
{\small %\input{dec.tex}
%Card definitions
\def\s{$\spadesuit$}
\def\h{$\heartsuit$}
\def\d{$\diamondsuit$}
\def\c{$\clubsuit$}
%(Toks register) control sequences
%for hands used by play macros:
%showgame, pc, strip
\let\NT\newtoks
\NT\hnd%Dynamically one of:
\NT\Ns\NT\Es\NT\Ss\NT\Ws
\NT\Nh\NT\Eh\NT\Sh\NT\Wh
\NT\Nd\NT\Ed\NT\Sd
\NT\Wd %Beware! Already
%in TUGboat.sty in lower case
\NT\Nc\NT\Ec\NT\Sc\NT\Wc
%
\def\english{
%In central figure NESW
\def\N{N}\def\E{E}\def\S{S}\def\W{W}
%In heading bplay
\def\NS{NS}\def\EW{EW}
\def\TRICK{Trick}
%Definition of hands
%used by bbid
\def\FIH{North}\def\SEH{East}
\def\THH{South}\def\FOH{West}
}% end \english
\english%default
%
\def\LEADN{\gdef\FIP{N}\gdef\SEP{E}%
\gdef\THP{S}\gdef\FOP{W}}
\def\LEADE{\gdef\FIP{E}\gdef\SEP{S}%
\gdef\THP{W}\gdef\FOP{N}}
\def\LEADS{\gdef\FIP{S}\gdef\SEP{W}%
\gdef\THP{N}\gdef\FOP{E}}
\def\LEADW{\gdef\FIP{W}\gdef\SEP{N}%
\gdef\THP{E}\gdef\FOP{S}}
%Definition of counters
%used by bplay
\newcount\trno%trick number
%Definition of dimensions
%used in bbid
\newdimen\wr %width column
\wr=7ex \relax
\def\bidwidth{4\wr}
%used in crdima
\newbox\NESW
%
\def\dutch{
\def\FIH{Noord}\def\SEH{Oost}
\def\THH{Zuid}\def\FOH{West}
\def\N{N}\def\E{O}\def\S{Z}
\def\W{W}\def\EW{OW}\def\NS{NZ}
\def\TRICK{Slag}
\setbox\NESW\hbox{\NESWfig}
}%end \dutch
%
\def\french{
\def\FIH{Nord}\def\SEH{Est}
\def\THH{Sud}\def\FOH{Ouest}
\def\N{N}\def\E{E}\def\S{S}
\def\W{O}\def\EW{EO}\def\NS{NS}
\def\TRICK{Lev\'ee}
\setbox\NESW\hbox{\NESWfig}
}%end \french
%end input dec.tex
%\input{bid.tex} %Modified central figure
\def\hand#1#2#3#4{%
%Example: \hand{AKJ765}{AK9}{--}{T983}
\vtop{\hbox{\strut\s\enspace#1}
\hbox{\strut\h\enspace#2}
\hbox{\strut\d\enspace#3}
\hbox{\strut\c\enspace#4}}%end \vtop
}%end \hand
%
\def\crdima#1#2#3#4#5#6{%
%purpose: layout bridge hand
%#1 left upper text
%#2 right upper text
%#3, #4, #5, #6: N, E, S, W hands
\vbox{\halign{ &##\quad\cr
#1& #3& #2\cr
$\vcenter{#6}$&$\vcenter{\copy\NESW}$&
$\vcenter{#4}$\cr
& #5& \cr
}%end \halign
}%end \vbox
}%end \crdima
%
\def\NESWfig{%
\hbox{\vrule%
\vbox{\offinterlineskip\tabskip0pt
\hrule\kern.25ex\halign{\hskip.5ex
##\tabskip.5ex&\hfil##\hfil&
##\hskip.5ex \tabskip0pt\cr
\noalign{\vskip.5ex}
&\hbox to 2ex{\hss\N\hss}& \cr
\W& &\E\cr
&\hbox to 2ex{\hss\S\hss}& \cr
\noalign{\vskip.5ex}
}%end \halign
\kern.25ex\hrule}%end \vbox
\vrule}%end \hbox
}% end \NESWfig
\setbox\NESW\hbox{\NESWfig}
%
\def\ebid{\errormessage{%
bbid command is missing}}
%
\def\bbid{\bgroup%
\def\ebid{\egroup\egroup\egroup}
\def\alert{$^A$}
\def\think{$\ldots$\thinspace}
% etc.
\vtop\bgroup
\halign to\bidwidth\bgroup \tabskip2ex
plus 1ex minus 1ex& ##\hfil\cr
\FIH\hfil& \SEH\hfil&
\THH\hfil&\FOH\hfil\cr
\noalign{\vskip.5ex}
}%end \bbid
%end input bid.tex%
%\input{play.tex} %Modified 11/11/91 Central table \bplay etc
% bplay, showgame, pc, strip
\def\eplay{\errormessage{%
bplay command is missing}}
%
\def\bplay{\bgroup\global\trno=0
\def\eplay{\egroup\egroup}
\def\bintermezzo{\noalign\bgroup
\smallskip\noindent}
\def\eintermezzo{\smallskip\egroup}
\tabskip1ex plus 1fill
\halign to\hsize\bgroup
\tabskip1ex plus 1ex minus 1ex
\global\advance\trno by 1 %
\hbox to.5\wr{\hss\the\trno\hss}%<=!
\hbox to\wr{\pc\FIP##\hss}\hfil&
\hbox to\wr{\pc\SEP##\hss}\hfil&
\hbox to\wr{\pc\THP##\hss}\hfil&
\hbox to\wr{\pc\FOP##\hss}\hfil
\tabskip4ex plus2ex minus1ex&
\hbox to.5\wr{\hss##\hss}
\tabskip1ex plus 1ex minus 1ex&
\hbox to.5\wr{\hss##\hss}
\tabskip1ex plus 1fill\cr
%End template line, next is headline
\omit\hbox to1\wr{\TRICK\hss}\hfil&
\omit\hfil&\omit\hfil&\omit\hfil&
%Note only 3 \omits
\NS&\EW\cr%Headline
}% end \bplay
%
\def\pc#1#2#3{% Version 3/3/90
%Function: prints card #2#3 and
% deletes it from player #1
%#1 the hand N, E, S, W(uppercase)
%#2 colour s, h, d, or c
%#3 card value A K Q ... 2, or x
%(or your (consistent/language) choice)
%%%% 1. Update hand \#1#2; e.g. \Ns %%%
\xdef\hnd{\csname #1#2\endcsname}
\strip{#3}{\hnd}%
%%%% 2. print card in table %%%
\xdef\colour{\csname #2\endcsname}
\colour\thinspace #3%
% %Needed for immediate postfix mark(s)
}% end \pc
%
\def\strip#1#2{% Version 3/3/90
%Function: deletes card value #1
% from #2, i.e., \Ns, or ...
\def\wis##1#1##2\wis{%
%Function: #1 is deleted from argument
% in \wis ... \wis and result
% is assigned to \hnd;
% (last card is replaced by --)
\global\hnd={##1##2}
\xdef\pa{##1} \xdef\pb{##2}
\ifx\pa\empty {\ifx\pb\empty
\global\hnd={--}% void colour
\fi}\fi
}% end \wis
\expandafter\wis\the #2\wis
}% end \strip
%
\def\showgame{
%Purpose: Shows all cards still active
% in the play, via \Ns, ..., \Wc,
% (note use of upper case for players)
%Used: \crdima, \hand, \LFTINF, \RGTINF
% \Ns, ..., \Wc
$$\crdima{\LFTINF}{\RGTINF}%
{\hand{\the\Ns}{\the\Nh}{\the\Nd}%
{\the\Nc}}%
{\hand{\the\Es}{\the\Eh}{\the\Ed}%
{\the\Ec}}%
{\hand{\the\Ss}{\the\Sh}{\the\Sd}%
{\the\Sc}}%
{\hand{\the\Ws}{\the\Wh}{\the\Wd}%
{\the\Wc}}%
$$}% end \showgame
%end input play.tex
%bridge data
\def\LFTINF{Puzzle}
\def\RGTINF{\vtop{\hbox{6NT,}
\hbox{by East}}}
%
\Ns={KQ76}\Es={T9}\Ss={8542}\Ws={AJ3}
\Nh={J98} \Eh={A2}\Sh={QT74}\Wh={K653}
\Nd={J942}\Ed={T5}\Sd={Q876}\Wd={AK3}
\Nc={65}\Ec={KJ9xxxx}\Sc={2}\Wc={AQT}
\showgame
\LEADS\bplay
h4! & hK & h8 & h2 & --& 1\LEADW\cr
cA & c5 & cx & c2 & --& 2\cr
cQ & c6 & cx & s2 & --& 3\cr
cT & h9 & cK & s4 & --& 4\LEADE\cr
cJ & s5 & s3 & s6 & --& 5\cr
c9 & s8 & h5 & s7 & --& 6\cr
cx & d6 & sJ & d2 & --& 7\cr
\bintermezzo
\def\RGTINF{\vtop{\hbox to 0pt{NS squeezed on\hss}
\hbox to 0pt{\c\ continuation?\hss}
\hbox to 7ex{\hss}}} %phantom for alignment
\Ec={{\ooalign{\hfil\raise.07ex%
\hbox{x}\hfil\crcr\mathhexbox20D}}}
\showgame \Ec={x}
\eintermezzo
cx & h7 & h6 & hJ & --& 8\cr
\omit et cetera \hidewidth \cr
\eplay
}%end of scope
\noindent Tables which also require updating of memory
occur with typesetting of chess,
for example \cite{pt92}, or GO, \cite{hk91}.
\write16{Before Bordered: \arabic{page}}
\penalty2000 \relax
%
\end{itemize}
%
\section{Bordered table}%
\write16{Bordered table starts at: \arabic{page}}%
A bordered table consists of a caption, a header, row stubs, a table proper and
a footer, all with appropriate separators. Special cases occur when
some of the elements are absent.
Abstraction from ruled and non-ruled is realized at the user level.
Ruled can be specified either as horizontal, vertical or both.
Dotted rules, also the partial ones, can be specified.\footnote
{The chameleon sized {\tt\char92hrule} and {\tt\char92vrule},
don't have dotted analogons, however.}
No variation in the line thicknesss has been encoded.\footnote{It is
not difficult to introduce a parameter
{\tt\char92linethickness}.}
Framing is treated just as if a general document element has to be framed.
I chose to leave the caption and the footer outside the frame.
The positioning of the elements can be specified as
centered, flushed left, respectively flushed right.
A user may supply his own template.
Caption, border (first, header, row stubs), and footer can be specified;
all mutual orthogonal and independent from \verb|\data|.
%
\begin{itemize}
\item Bordered table model
\write16{Bordered table: \arabic{page}}
{\def\caption{$\leftarrow$\hfill C a p t i o n\hfill$\rightarrow$}
\def\first{\hbox to6ex{\hss First\hss}}
\def\header{\hbox to18ex{\hss Header\hss}}
\def\rowstblst{{\hfil$\vcenter to20ex{\vss\offinterlineskip
\fifo rowstblst\ofif\vss}$}}
\def\data{$\vcenter{\offinterlineskip\hbox{Table}\kern1ex\hbox{Proper}}$}
\def\footer{\hbox to\thsize
{$\leftarrow$\hss{\small F o o t e r}\hss\hss\hss$\rightarrow$}}
\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
\nonframed
$$\vcenter{\btable\data}\qquad\qquad
\vcenter{\framed\btable\data}$$
\immediate\write16{Bordered table}
}%end scope
via
{\small \begin{verbatim}
\def\caption{$\leftarrow$\hfill C a p t i o n\hfill$\rightarrow$}
\def\first{\hbox to6ex{\hss First\hss}}
\def\header{\hbox to18ex{\hss Header\hss}}
\def\rowstblst{{\hfil$\vcenter to20ex{\vss\offinterlineskip
\fifo rowstblst\ofif\vss}$}}
\def\data{$\vcenter{\offinterlineskip\hbox{Table}\kern1ex\hbox{Proper}}$}
\def\footer{\hbox to\thsize
{$\leftarrow$\hss{\small F o o t e r}\hss\hss\hss$\rightarrow$}}
$$\vcenter{\btable\data}\qquad\qquad
\vcenter{\framed\btable\data}$$
\end{verbatim}}%end scope
\noindent with, \cite{cgl92c}, \cite{cgl92d}
{\small \begin{verbatim}
\def\fifo#1{\ifx\ofif#1\ofif\fi\process{#1}\fifo}\def\ofif#1\fifo{\fi}
\def\process#1{\hbox to0pt{\hss#1\hss}\kern.5ex}
\end{verbatim}}%end scope
%
\noindent Rules can be specified via for example
\verb|\ruled|, \verb|\hruled|, \verb|\vruled|, \verb|\nonruled|,
respectively \verb|\dotruled|.\footnote{The latter requires some
extra work: table measurement via 2 passes.}
The rules that
separate the border can be eliminated, by redefinition of the macros
\verb|\headersep| and \verb|\rowstbsep|.
Furthermore, there are \verb|\ctr|, \verb|\fll|, and \verb|\flr|,
for controling the positioning of the elements of the table. The framing
can be controled by \verb|\framed|,
\verb|\dotframed|, or \verb|\nonframed|.
\end{itemize}
%
\subsection{Encoding}
{\small\begin{verbatim}
%btable.tex version 1, 17/7/92 author: cgl@rug.nl
\newbox\tbl\let\ea=\expandafter
%Cell vertical size, row height and depth (separation implicit),
\newdimen\cvsize\newdimen\tsht\newdimen\tsdp\newdimen\tvsize\newdimen\thsize
%Parameter setting macros: Rules
\def\hruled{\def\lineglue{\hrulefill}\def\colsep{} \def\rowsep{\hrule}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
\def\vruled{\def\lineglue{\hfil} \def\colsep{\vrule}\def\rowsep{}
\let\rowstbsep=\colsep\let\headersep=\hrule}
\def\ruled {\def\lineglue{\hrulefill}\def\colsep{\vrule}\def\rowsep{\hrule}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
\def\nonruled{\def\lineglue{\hfil} \def\colsep{} \def\rowsep{}
\def\rowstbsep{\vrule}\def\headersep{\hrule}}
\def\dotruled{\def\lineglue{\dotfill}\def\rowsep{\hbox to\thsize{\dotfill}}
\def\colsep{\lower1.5\tsdp\vbox to\cvsize{%
\leaders\hbox to0pt{\vrule height2pt depth2pt width0pt\hss.\hss}\vfil}}
\let\rowstbsep=\colsep\let\headersep=\rowsep}
%Parameter setting macros: Controling positioning
\def\ctr{\def\lft{\hfil}\def\rgt{\hfil}}%Centered
\def\fll{\def\lft{} \def\rgt{\hfil}}%Flushed left
\def\flr{\def\lft{\hfil}\def\rgt{}} %Flushed right
%Parameter setting macros: Framing
\def\framed{\let\frameit=\boxit}
\def\nonframed{\def\frameit##1{##1}}
\def\dotframed{\let\frameit=\dotboxit}
%
\def\btable#1{\vbox{\let\rsl=\rowstblst%Copy
\ifx\empty\template\ifx\empty\rowstblst
\def\template{\colsepsurround\lft####\rgt&&\lft####\rgt\cr}
\else\def\template{\colsepsurround####\hfil&&\lft####\rgt\cr}\fi
\fi
\tsht=.775\cvsize\tsdp=.225\cvsize
\def\tstrut{\vrule height\tsht depth\tsdp width0pt}
%Logical mark up of column and row separators, via use of
\def\cs{&\colsepsurround\colsep\colsepsurround&}
\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
\def\rs{\colsepsurround\tstrut\cr
\ifx\empty\rowsep\else\noalign{\rowsep}\fi
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\def\grs{\colsepsurround\tstrut\cr\ghostrow}
\def\rss{&\colsepsurround\rowstbsep\colsepsurround&}
\def\hs{\colsepsurround\tstrut\cr
\ifx\empty\headersep\else\noalign{\headersep}\fi
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\preinsert %User action
\setbox\tbl=\vbox{\tabskip=0pt\relax\offinterlineskip
\halign{\span\template\ifx\empty\first\ifx\empty\rowstblst\else
\ifx\empty\header\else\ea\rss\fi\fi\else\first\ea\rss\fi
\ifx\empty\header\ifx\empty\first\if\empty\rsl\else\ea\nxtrs\fi
\else\ea\hs\fi
\else\header\ea\hs\fi
#1\colsepsurround\tstrut\crcr} } %end \setbox
\postinsert%Pick up what is needed, \thsize,...
\ifx\caption\empty\else\hbox to\thsize{\strut\hfil\caption\hss}\captionsep\fi
\frameit{\copy\tbl}
\ifx\footer\empty\else\footersep\hbox{\vtop{\noindent\hsize=\thsize%
\footer}}\fi }} %end \btable
%Defaults
\cvsize=4ex\tsht=.775\cvsize\tsdp=.225\cvsize\def\colsepsurround{\kern.5em}
\def\caption{}\def\first{}\def\header{}\def\rowstblst{}\def\footer{}\def\data{}
\def\captionsep{\medskip} \def\headersep{\hrule}
\def\footersep{\smallskip} \def\rowstbsep{\vrule}
\def\preinsert{}
\def\postinsert{\global\thsize=\wd\tbl
\global\tvsize=\ht\tbl\global\advance\tvsize by\dp\tbl}
\ctr\nonruled\nonframed\def\template{}\def\ghostrow{} %end Defaults
%Auxiliaries
\def\boxit#1{\vbox{\hrule\hbox{\vrule\vbox{#1}\vrule}\hrule}}
\def\dotboxit#1{\vbox{\offinterlineskip\hbox to\thsize{\dotfill}%
\hbox{\lower\tsdp\vbox to\tvsize{%
\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}%
\vbox{#1}\lower\tsdp\vbox to\tvsize{%
\leaders\hbox to0pt{\hss\vrule height2pt depth2pt width0pt.\hss}\vfil}}%
\hbox to\thsize{\dotfill}}}
%And to account for logical columns with \logmsp
\def\spicspan{\span\omit}
\def\logmsp#1{\omit\mscount=#1\multiply\mscount by2 \advance\mscount by-1
\loop\ifnum\mscount>1 \spicspan\advance\mscount by-1 \repeat}
%To handle the row stub list: \rsl
\def\nxtrs{\ifx\empty\rsl\else\def\nxtel{\ea\nrs\rsl\srn}\ea\nxtel\fi}
\def\nrs#1#2\srn{\gdef\rsl{#2}#1\rss} %end btable.tex
\end{verbatim} }
\par\noindent
\verb|\btable|\quad Implements the bordered table model. Note that
the table is measured in order to set the width of the header and the footer.
The measurement is also useful for dotted horizontal lines.
When no template is provided,
then a default will be created, automatically.
\\[.5ex]
{\tt\char92}$\langle X\rangle$\verb|sep|\quad Parameters
which govern the kind of separators.
\par\noindent
\verb|\nxtrs| \quad Yields the next element of the row stub list.
{\em The last element
of the list has to be enclosed by an extra pair of braces.\/}
I could have introduced an explicit list terminator instead, but that would
have created incompatibilities with the termination in other defs. Weird?
\\[.5ex]
\verb|\cvsize, \tsht, \tsdp, \thsize, \tvsize|\quad
These dimension variables stand for vertical
cell size, table strut height, table strut depth, table horizontal size,
and table vertical size.
\\[.5ex]
\verb|\preinsert, \postinsert|\quad For flexibility.
Default \verb|\preinsert| is empty.
\verb|\postinsert| delivers by default the table
sizes globally into \verb|\thsize|, and \verb|\tvsize|. %
%
\def\rowstblst{}\def\caption{}\def\header{}\def\footer{}
%
\subsection{Examples of use}
Before the invoke of \verb|\btable\data| do \\
Redefine \verb|\data| with column and row separators, \verb|\cs|,
respectively \verb|\rs|.
\\
Choose from the `attributes'\\
-- \verb|\ruled|, \verb|\hruled|, \verb|\vruled|, \verb|\dotruled| \hfill
Default:\hbox to13ex{\hfil\verb|\nonruled|}\\
-- \verb|\framed|, \verb|\dotframed| \hfill
Default:\hbox to13ex{\hfil\verb|\nonframed|}\\
-- \verb|\fll|, \verb|\flr| \hfill
Default:\hbox to13ex{\hfil\verb|\ctr|}\\
Suplly the caption, header, first element, row stubs, or footer via
redefinitions of the corresponding macros.
\nonruled\nonframed\ctr %Defaults
\penalty-250
\begin{itemize}
\item Just data, \cite{cgl91}
\write16{Just data: \arabic{page}}
{\small
$$\def\data{2\cs7\cs6\rs 9\cs5\cs1\rs 4\cs3\cs8}
\vcenter{\framed\ruled\btable\data}\qquad\qquad\qquad
\immediate\write16{
Size 3-3 Magic Sq: \the\thsize, \the\tvsize, page: \arabic{page}}
\def\data{16\cs 3\cs 2\cs13\rs
5\cs10\cs11\cs 8\rs
9\cs 6\cs 7\cs12\rs
4\cs\bf15\cs\bf14\cs 1}
\ruled\framed\setbox0=\btable\data%for measuring sizes
\write16{
Size 4-4 Magic Sq: \the\thsize, \the\tvsize, page: \arabic{page}}
\vcenter{\dotruled\dotframed\btable\data}\qquad$$
}%end scope
\noindent via
{\small\begin{verbatim}
$$\def\data{2\cs7\cs6\rs 9\cs5\cs1\rs 4\cs3\cs8}
\vcenter{\framed\ruled\btable\data}\qquad\qquad\qquad
\def\data{16\cs 3\cs 2\cs13\rs
5\cs 10\cs 11\cs 8\rs
9\cs 6\cs 7\cs12\rs
4\cs\bf15\cs\bf14\cs 1}
\ruled\framed\setbox0=\btable\data%for measuring sizes
\vcenter{\dotruled\dotframed\btable\data}\qquad$$
\end{verbatim}
}%end scope
\item Data plus header, \TeX book p.246
{\small
$$\def\header{\hfill Year\hfill\cs\hfill World Population\hfill}
\def\data{8000 B.C.\cs5,000,000\rs50 A.D.\cs200,000,000}
\flr\vruled\vcenter{\btable\data}\qquad
\ruled\framed\vcenter{\btable\data}$$
}
via the simpler nearly descriptive mark up
{\small\begin{verbatim}
\def\header{\hfill Year\hfill\cs\hfill World Population\hfill}
\def\data{8000 B.C.\cs 5,000,000\rs 50 A.D.\cs200,000,000}
$$\flr\vruled\vcenter{\btable\data}\qquad
\ruled\framed\vcenter{\btable\data}$$
\end{verbatim} }
%
\item Data with row stubs, \TeX book p.232
\par\noindent
\nonruled\nonframed\ctr
$$\def\rowstblst{{Horizontal lists}{Vertical lists}{{Math lists}}}
\def\rowstbsep{}\def\data{Chapter 14\rs Chapter 15\rs Chapter 17}
\vcenter{\vbox{\small{\btable\data}}}
\qquad\vcenter{\hbox{via}}\
\vcenter{\vbox{\small\hsize=.45\hsize\parindent=0pt
\begin{verbatim}
\def\rowstblst{{Horizontal lists}
{Vertical lists}{{Math lists}}}
\def\rowstbsep{}%Default a \vrule
\def\data{Chapter 14\rs
Chapter 15\rs Chapter 17}
$$\btable\data$$
\end{verbatim}
}}$$
\item Data, row stubs, header, caption and footer
\write16{Data row stubs etc. \arabic{page}}
\par\noindent
{\small\nonruled\nonframed
$$\def\data{11\cs12\rs21\cs22}
\vcenter{\framed\btable\data} \qquad
\def\header{\logmsp2\hfill Header\hfill}
\def\rowstblst{{$1^{st}$ row}{{$2^{nd}$ row}}}
\vcenter{\btable\data} \qquad
\def\caption{Caption}\def\footer{Footer}
\vcenter{\dotruled\btable\data} \qquad
\vcenter{\ruled\framed\btable\data}$$
}%
\par\noindent
after data definition, \verb|\def\data{11\cs12\rs21\cs22}|,
via\footnote{Note the invariance of the
{\tt\char92data} specification.}
{\small\begin{verbatim}
$$\vcenter{\framed\btable\data} \qquad
\def\header{\logmsp2\hfill Header\hfill}
\def\rowstblst{{$1^{st}$ row}{{$2^{nd}$ row}}}
\vcenter{\btable\data} \qquad
\def\caption{Caption}\def\footer{Footer}
\vcenter{\dotruled\btable\data} \qquad
\vcenter{\ruled\framed\btable\data}$$
\end{verbatim} }
\item Walter's spreadsheet, \TeX book, p.244. No preamble has to be defined.
It makes ex22.10 superfluous. How about that?
{\small$$
\def\data{1\cs\logmsp2Adjusted gross income \dotfill\cs\$4,000\rs
2\cs Zero bracket amount for \rs
\cs a single individual \dotfill\cs\hfill\$2,300\cs \rs
3\cs Earned income \dotfill\cs
\hfill\underbar{ 1,500}\cs \rs
4\cs\logmsp2Substract line 3 from line 2
\dotfill\cs\hfill\underbar{ 800}\rs
5\cs Add lines 1 and 4. Enter here \rs
\cs\logmsp2and on Form 1040, line 35 \dotfill\cs\$4,800}
\def\colsepsurround{\kern.5ex}\cvsize=3ex
\fll\btable\data
$$}
\par\noindent
The above is encoded, as a 4-column table, via
{\small
\begin{verbatim}
\def\data{1\cs\logmsp2Adjusted gross income \dotfill\cs\$4,000\rs
2\cs Zero bracket amount for \rs
\cs a single individual \dotfill\cs\hfill\$2,300\cs \rs
3\cs Earned income \dotfill\cs
\hfill\underbar{ 1,500}\cs \rs
4\cs\logmsp2Substract line 3 from line 2
\dotfill\cs\hfill\underbar{ 800}\rs
5\cs Add lines 1 and 4. Enter here \rs
\cs\logmsp2and on Form 1040, line 35 \dotfill\cs\$4,800}
\def\colsepsurround{\kern.5ex}\cvsize=3ex
$$\fll\btable\data$$
\end{verbatim} }
%
\item Part of AAP's table, \cite{AAP89}, or \cite{cgl90a}
\immediate\write16{AAP table}
{\small\nonframed\nonruled\ctr
\def\nl{\hfil\strut\break\strut}\catcode`?=\active \def?{\kern1.1ex}
\def\caption{AAP's table:\qquad Job Changes 1973--1980\hfill}
\def\rowstblst{{Texas}{{Maryland}}}
\def\header{\copy1\cs\copy2\cs\copy3}
\def\data{$+20$\cs---\cs22\%\rs
$+?5$\cs 42\cs24\%}
\def\footer{Source: David Kinzer, `Turnover Of Hospital Chief
Executive Officers: A Hospital Association Perspective,'
Hospital and health Services Administration May-June 1982.}
\setbox1=\vtop{\noindent\hsize14ex
Gain/Loss of\nl hospitals \nl since 1973}
\setbox2=\vtop{\noindent\hsize13ex
Total No\nl of CEO Job\nl Changes\nl 1973--90}
\setbox3=\vtop{\noindent\hsize10ex
Survival\nl Rate of\nl CEO's}
$$\btable\data$$ }
obtained via
{\small\begin{verbatim}
\def\caption{AAP's table:\qquad Job Changes 1973--1980\hfill}
\def\rowstblst{{Texas}{{Maryland}}}
\def\header{\copy1\cs\copy2\cs\copy3}
\def\data{$+20$\cs---\cs22\%\rs
$+?5$\cs 42\cs24\%}
\def\footer{Source: David Kinzer, `Turnover Of Hospital Chief
Executive Officers: A Hospital Association Perspective,'
Hospital and health Services Administration May-June 1982.}
$$\btable\data$$
\end{verbatim} }
\noindent with auxiliaries
{\small\begin{verbatim}
\def\nl{\hfil\strut\break\strut}\catcode`?=\active \def?{\kern1.1ex}
\setbox1=\vtop{\noindent\hsize14ex
Gain/Loss of\nl hospitals\nl since 1973}
\setbox2=\vtop{\noindent\hsize13ex
Total No\nl of CEO Job\nl Changes\nl 1973--90}
\setbox3=\vtop{\noindent\hsize10ex
Survival\nl Rate of\nl CEO's}
\end{verbatim} }
%
\item AT\&T table diversions, \TeX book p.247, \cite{lesk79}
{\small\begin{verbatim}
\def\caption{AT\&T Common Stock}
\def\header{Year\cs Price\cs Dividend}
\catcode`?=\active \def?{\kern1.1ex}
\def\data{1971\cs41--54\cs\llap{\$}2.60\rs
2\cs41--54\cs 2.70\rs
3\cs46--55\cs 2.87\rs
4\cs40--53\cs 3.24\rs
5\cs45--52\cs 3.40\rs
6\cs51--59\cs ?.95\rlap*}
\def\footer{* (first quarter only)}
\def\caption{}\def\header{\logmsp3 \hfil AT\&T Common Stock\hfil\rs
\hfill Year\hfill\cs\hfill Price\hfill\cs \hfill Dividend\hfill}
\vcenter{\flr\ruled\btable\data}$$
\end{verbatim} }
\noindent yields
\def\rowstblst{}
{\def\caption{AT\&T Common Stock\hfill}
\def\header{Year\cs Price\cs Dividend}
\catcode`?=\active \def?{\kern1.1ex}
\def\data{1971\cs41--54\cs\llap{\$}2.60\rs
2\cs41--54\cs 2.70\rs
3\cs46--55\cs 2.87\rs
4\cs40--53\cs 3.24\rs
5\cs45--52\cs 3.40\rs
6\cs51--59\cs ?.95\rlap*}
\def\footer{* (first quarter only)}
$$\framed\vcenter{\vbox{\small\btable\data}}\qquad\qquad
\def\caption{}\def\header{\logmsp3 \hfil AT\&T Common Stock\hfil\rs
\hfill Year\hfill\cs\hfill Price\hfill\cs \hfill Dividend\hfill}
\vcenter{\flr\ruled\btable\data}$$
}
\noindent It remains a matter of choice what should be considered as header
and what as caption. A footnote facility, which will append the footnote
to a footnote list similar to the row stub list, could have been
implemented.
% Because table footnotes are the exception rather than the rule,
I refrained from implementing it, for the moment.
%
\item Pittman's, \cite{jep88},
deterministic multiplication table.
Typographically and in other programming languages a trifle.
In \TeX\ the encoding matters.
\def\header{}\def\rowstblst{}\def\caption{}\def\first{}\def\footer{}
\let\nx=\noexpand \let\ea=\expandafter
\newcount\rcnt \newcount\ccnt \newcount\tnum
\newcount\mrow \newcount\mcol
\rcnt1 \ccnt1 \mrow2 \mcol3
\def\rows{\global\ccnt1 \cols \global\advance\rcnt1
\ifnum\rcnt>\mrow\swor\fi\rs\rows}
\def\swor#1\rows{\fi}
\def\cols{\tnum\rcnt \multiply\tnum\ccnt \the\tnum
\global\advance\ccnt1 \ifnum\ccnt>\mcol\sloc\fi\cs\cols}
\def\sloc#1\cols{\fi}
%
$$\nonruled\nonframed
\vcenter{\btable\rows}\qquad\qquad
\global\ccnt=1 \global\rcnt=1 \mrow2 \mcol3
\def\first{$\times$} \def\header{\row}
\def\row{\the\ccnt\global\advance\ccnt1
\ifnum\ccnt>\mcol\wor\fi\cs\row}
\def\wor#1\row{\fi}
\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
\def\nxtrs{\the\rcnt\rss}
\vcenter{\btable\rows}\qquad\qquad
%
\global\ccnt=1 \global\rcnt=1 \mrow3 \mcol4
\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
\framed\vcenter{\btable\rows}
$$
via
{\small\begin{verbatim}
\let\nx=\noexpand \let\ea=\expandafter
\newcount\rcnt \newcount\ccnt \newcount\tnum
\newcount\mrow \newcount\mcol
\rcnt1 \ccnt1 \mrow2 \mcol3
\def\rows{\global\ccnt1 \cols \global\advance\rcnt1
\ifnum\rcnt>\mrow\swor\fi\rs\rows}
\def\swor#1\rows{\fi}
\def\cols{\tnum\rcnt \multiply\tnum\ccnt \the\tnum
\global\advance\ccnt1 \ifnum\ccnt>\mcol\sloc\fi\cs\cols}
\def\sloc#1\cols{\fi}
\vcenter{\btable\rows}\qquad\qquad
%
\global\ccnt=1 \global\rcnt=1 \mrow2 \mcol3
\def\first{$\times$} \def\header{\row}
\def\row{\the\ccnt\global\advance\ccnt1
\ifnum\ccnt>\mcol\wor\fi\cs\row}
\def\wor#1\row{\fi}
\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
\def\nxtrs{\the\rcnt\rss}
\vcenter{\btable\rows}\qquad\qquad
%
\global\ccnt=1 \global\rcnt=1 \mrow3 \mcol4
\def\rowstblst{\ifnum\rcnt=\mrow\gdef\rowstblst{}\fi}
\framed\vcenter{\btable\rows}$$
\end{verbatim} }
\end{itemize}
\def\header{}\def\rowstblst{}\def\caption{}\def\first{}\def\footer{}
%
\subsection{No mark up}
\write16{No mark up. \arabic{page}}
For simple tables the data can be specified without
\verb|\cs|-s, and \verb|\rs|-s,
that is without explicit markers for column
and row separators. These can be inserted by \TeX, see
\TeX book p.249, \cite{cgl92c}, or \cite{ds92}.
For special cases, for example crosswords, \cite{cgl92b}, this is handy.
\\
Pondering about lists, make you realize that the table proper data forms
a nested list with \verb|\rs| and \verb|\cs|, respectively first level
and second level separators. One could also adopt $\langle cr\rangle$
and {\tt\char32} for that, in other words allow natural data provision.
%
\section{Simultaneous row and column spans}
When one kind of spans is the issue one can use
\verb|\logmsp|---for logical columns,
as an extension to \verb|\multispan|---
either within \verb|\halign|, for column spans,
or within \verb|\valign|, for row spans.
Simultaneous row and column spans require more work.
\\
First, we have to account for the blocks proper. This is done via
leaving space open, overprinting the left open space,
and the use of a {\it Ghost Row Separator}.
For a block of even {\em row\/}
size, I chose to insert lines of height zero. I call these ghost lines.
For a block with an odd number of rows,
I chose to modify the middle line.
\\
Next, when we are dealing with
{\em ruled\/} tables we have to hide the rules that
should otherwise traverse the block. This can be done for
partial vertical rules via \verb|\logmsp{n}\hfil|, with n an integer.
For partial horizontal
rules there are two aspects. First,
the table wide rules are not typeset,
and second,
partial horizontal rules have to be typeset around the blocks.
I supplied
the macros \verb|\prs|, Partial Rule Separator,
and \verb|\srp|,
{\em mirror\/} Separator Rule Partial,
to enclose a partial rule.
The kind of partial rule is determined by
the replacement text of \verb|\lineglue|.
\\[.5ex]
Row spans in the row stub list can be handled similarly.
For even spans define an appropriate \verb|\ghostrow|, with a copy of
the block in it.
For odd spans provide a copy of the block in the row stub list.
Provide suitable empty row stub elements, $\{\,\}$, in both cases.
%
\subsection{Partial rules}
For a horizontal rule over one (logical) column use\\
\verb|...\prs\lineglue\srp...|\quad
instead of \quad\verb|...\cs...\cs...|.\\
\verb|\lineglue| is defined by the $\langle X\rangle$\verb|ruled| macros.
\\[.5ex]
The \verb|\prs|, Partial Rule Separator, accounts for
that part of the rule,
which extends into the hidden column for the separator. \verb|\srp|
is its mirror terminator.
At the line-ends of the table one can simply use \verb|\cr|,
as mirror terminator. The respective (symmetric) definitions are
{\small\begin{verbatim}
\def\prs{&\colsepsurround\lineglue&} \def\srp{&\lineglue\colsepsurround&}
\end{verbatim} }
\noindent For a horizontal rule over $\langle n\rangle$ (logical) columns use
{\small\begin{verbatim}
...\prs\logmsp{n}\lineglue\srp...%n logical columns
\end{verbatim}}
%\noindent If we define \verb|\def\lineglue{\dotfill}|, then we
%have dotted partial horizontal rules.
%
\subsection{Mark up bridge form}
The header row of the bridge form can be characterized by:
one 3-row span,
two 2-column spans,
and two 2-column partial horizontal rules. Furthermore, the repetition
of the number of rows is interesting.
{\small\begin{verbatim}
\def\header{\cs\logmsp2\hfil Contract\hfil\cs
\cs\logmsp2\hfil Scores\hfil\cs\grs
\cs N--S\cs E--W\cs\cs N--S\cs E--W\cs}
\def\data{\lines} \framed\ruled\btable\data
\end{verbatim} }
\noindent with auxiliaries
{\small\begin{verbatim}
\newcount\bcnt
\def\lines{\global\advance\bcnt by 1 \ifnum\bcnt=3 et cetera\hidewidth
\senil\fi\the\bcnt.\cs\cs\cs\cs\cs\cs\rs\lines}
\def\senil#1\lines{\fi}
%
\def\ghostrow{\omit\colsepsurround%
\vbox to 0pt{\vss\hbox to 5ex{\hss Pair\hss}\vskip.5ex
\hbox to 5ex{\hss No\hss}\vss}\prs\logmsp2\lineglue\srp
\vbox to 0pt{\vss\hbox to 5ex{\hss Re-\hss}\vskip.5ex
\hbox to5ex{\hss sults\hss}\vss}\prs\logmsp2\lineglue\srp
\vtop to 0pt{\vss\hbox to 5ex{\hss MP$\,$s\hss}\vss}\colsepsurround\cr}
\end{verbatim} }
\par\noindent The row span extends implicitly
into the first and third row. The last row of the data does not take
vertical rules, automatically.\footnote{For a real form---24 or more
rows---just modify {\tt\char92lines}.}
\subsection{Blocks; connected cells}
\write16{Blocks: \arabic{page}}
In order to specify spans of {\em logical\/} columns, we need
an adapted version of \verb|\multispan|, \TeX book p.354,
as given in the Encoding subsection.
\\ Spans form a block.
Around the blocks partial rules emerge.
% How to cope with those is explained in the Partial Rule section.
%
\newbox\block\def\rowstblst{}\def\header{}\def\footer{}
%
\begin{itemize}
\item{\bf Odd blocks}, 1-by-2 etc.\quad Use \verb|\logmsp|,
\verb|\srp|, \verb|\lineglue| and the like.
Define appropriate \verb|\ghostrow|-s.
\par\noindent
{\small
\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
$$\setbox\block=\hbox{$1*2$}
\def\data{\logmsp2\colsepsurround\hfil\copy\block\hfil\cs13\rs
21\cs22\cs23\rs
31\cs32\cs33}
{\ruled\setbox0=\btable\data}
\vcenter{\dotruled\btable\data}\qquad\qquad
%
%3-by-2, and connected cells
\setbox\block=\hbox{{\large A}\enspace%
$\left\{\vrule height3ex depth3ex width0pt\right.$}
\def\data{\logmsp2\hfil\cs13\grs
\logmsp2\colsepsurround\hfil\vbox to 0pt{\vss
\copy\block\vss}\hfil\cs23\grs
\logmsp2\hfil\cs33\rs
41\cs42\cs43}
\def\ghostrow{\logmsp2\hfil\prs\lineglue\cr
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\vcenter{\ruled\btable\data} \qquad\qquad
%
%3-by-3 block and all around
\setbox\block=\hbox{\Large$3*3$}
\def\data{\logmsp3\hfil\cs14\grs
\logmsp3\hfil\vbox to 0pt
{\vss\copy\block\vss}\hfil\cs24\grs
\logmsp3\hfil\cs34\rs
41\cs42\cs43\cs44}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp3\hfil\prs\lineglue\cr
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\def\caption{{\Large Caption}}
\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
\def\rowstblst{{row 1}{row 2}{row 3}{{\hfil$\Rightarrow$}}}
\def\footer{Footer}
\vcenter{\ruled\framed\btable\data}$$
}
\par\noindent can be obtained via
{\small\begin{verbatim}
$$\setbox\block=\hbox{$1*2$}
\def\data{\logmsp2\colsepsurround\hfil\copy\block\hfil\cs13\rs
21\cs22\cs23\rs
31\cs32\cs33} %end \data
{\ruled\setbox0=\btable\data}%For measurement
\vcenter{\dotruled\btable\data}\qquad\qquad
%
%3-by-2, and connected cells
\def\data{\logmsp2\hfil\cs13\grs
\logmsp2\colsepsurround\hfil\vbox to0pt{\vss
\copy\block\vss}\hfil\cs23\grs
\logmsp2\hfil\cs33\rs
41\cs42\cs43} %end \data
\setbox\block=\hbox{{\large A}\enspace%
$\left\{\vrule height3ex depth3ex width0pt\right.$}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp2\hfil\prs\lineglue\cr
\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\vcenter{\ruled\btable\data}\qquad\qquad
%
%3-by-3 block and all around
\def\data{\logmsp3\hfil\cs14\grs
\logmsp3\hfil\vbox to 0pt{\vss\copy\block\vss}\hfil\cs24\grs
\logmsp3\hfil\cs34\rs
41\cs42\cs43\cs44} %end \data
\setbox\block=\hbox{\Large$3*3$}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp3\hfil\prs\lineglue\cr\ifx\empty\rowstblst\else\ea\nxtrs\fi}
\def\caption{{\Large Caption}}
\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
\def\rowstblst{{row 1}{row 2}{row 3}{{\hfil$\Rightarrow$}}}
\def\footer{Footer}
\vcenter{\ruled\framed\btable\data}$$
\end{verbatim} }
\penalty-250
\item{\bf Even blocks}, 2-by-1 etc.\quad
Leave the cells for the block open in \verb|\data|.
Use \verb|\grs|, \verb|\prs|, \verb|\lineglue|,
and the like. Define \verb|\ghostrow|.
\par\noindent
{\small
\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
$$%2-by-1
\setbox\block=\hbox{A}
\def\data{\cs12\cs13\grs
\cs22\cs23\rs
31\cs32\cs33}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\hfil\vbox to0pt{\vss\copy\block\vss}\hfil\prs
\logmsp2\lineglue\cr\nxtrs}
{\ruled\framed\setbox0=\btable\data}%for measurement
\vcenter{\dotruled\btable\data} \qquad\qquad
%
\setbox\block=\hbox{\large$2*2$}
\def\data{\logmsp2\hfil\cs13\grs
\logmsp2\hfil\cs23\rs
31\cs32\cs33}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp2\colsepsurround\hfil%
\vbox to0pt{\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
\vcenter{\framed\btable\data} \qquad\qquad
%
\setbox\block=\hbox{\large$2*3$}
\def\data{\logmsp3\cs14\grs
\logmsp3\cs24\rs
31\cs32\cs33\cs34}
\def\caption{{\Large Caption}}
\def\rowstblst{{row 1}{row 2}{{\hfil$\Rightarrow$}}}
\def\header{\logmsp4 Header\hfil$\Downarrow$}
\def\footer{Footer}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp3\hfil%
\vbox to0pt{\vss\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
\vcenter{\framed\ruled\btable\data}$$
}
\par\noindent can be obtained via
{\small\begin{verbatim}
$$\setbox\block=\hbox{\large A}%2-by-1 block
\def\data{\cs12\cs13\grs
\cs22\cs23\rs
31\cs32\cs33} %end \data
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi%
\hfil\vbox to0pt{\vss\copy\block\vss}\hfil\prs
\logmsp2\lineglue\cr\nxtrs}
{\ruled\framed\setbox0=\btable\data}%for measurement
\vcenter{\dotruled\btable\data} \qquad\qquad
%
\setbox\block=\hbox{\large$2*2$}
\def\data{\logmsp2\hfil\cs13\grs
\logmsp2\hfil\cs23\rs
31\cs32\cs33} %end \data
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi%
\logmsp2\colsepsurround\hfil%
\vbox to0pt{\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
\vcenter{\framed\btable\data} \qquad\qquad
%
\setbox\block=\hbox{\large$2*3$}
\def\data{\logmsp3\cs14\grs
\logmsp3\cs24\rs
31\cs32\cs33\cs34} %end \data
\def\caption{{\Large Caption}}
\def\rowstblst{{row 1}{row 2}{{\hfil$\Rightarrow$}}}
\def\header{\logmsp4 Header\hfil$\Downarrow$\ }
\def\footer{Footer}
\def\ghostrow{\ifx\empty\rowstblst\else\omit\lineglue\ea\srp\fi
\logmsp3\hfil%
\vbox to0pt{\vss\copy\block\vss}\hfil\prs\lineglue\cr\nxtrs}
\vcenter{\framed\ruled\btable\data}$$
\end{verbatim} }
\penalty-250
\item {\bf Multiple blocks}: in row stub \`and table proper
\write16{Multiple blocks: \arabic{page}}
{\small
\def\rowstblst{}\def\header{}\def\footer{}\def\caption{}
$$
\setbox\block=\vbox{\hbox{\large A}\kern3ex\hbox{\large B}}
\def\data{\cs12\cs13\grs
$\vcenter to0pt{\vss\copy\block\vss}$\cs22\cs23\grs
\cs32\cs33\lr}
\def\ghostrow{\rss\prs\logmsp2\lineglue\cr\nxtrs}
\def\lr{\tstrut\colsepsurround\cr
\prs\logmsp3\lineglue\gobble}
\def\gobble#1#2{}%kludge to undo \tstrut, \colsepsurround
\def\preinsert{\def\rss{&\colsepsurround\hfil\colsepsurround&}
\def\hs{\colsepsurround\tstrut\cr\prs\logmsp3\lineglue\cr\nxtrs}}
\vcenter{\btable\data}\qquad\qquad\qquad
\def\header{\logmsp3\hfill Header\hfill}
\def\footer{Footer}
\def\caption{{\Large Caption}}
\def\rowstblst{{}{$\vcenter to0pt{\vss\Bigg\{\vss}$}{{}}}
\vcenter{\ruled\btable\data}
$$
}
\noindent via
{\small\begin{verbatim}
$$\setbox\block=\vbox{\hbox{\large A}\kern3ex\hbox{\large B}}
\def\data{ \cs12\cs13\grs
$\vcenter to0pt{\vss\copy\block\vss}$\cs22\cs23\grs
\cs32\cs33\lr}
\vcenter{\btable\data}\qquad\qquad\qquad
\def\caption{{\Large Caption}}
\def\header{\logmsp3\hfill Header\hfill}
\def\rowstblst{{}{$\vcenter to0pt{\vss\Bigg\{\vss}$}{{}}} $$
\def\footer{Footer}
\vcenter{\ruled\btable\data}
\end{verbatim}
}
\noindent with
{\small\begin{verbatim}
\def\ghostrow{\rss\prs\logmsp2\lineglue\cr\nxtrs}
\def\lr{\tstrut\colsepsurround\cr\prs\logmsp3\lineglue\gobble}
\def\gobble#1#2{}%kludge to undo \tstrut, \colsepsurround
\def\preinsert{\def\rss{&\colsepsurround\hfil\colsepsurround&}
\def\hs{\colsepsurround\tstrut\cr\prs\logmsp3\lineglue\cr\nxtrs}}
\end{verbatim} }
\noindent Not much is gained in clarity for complicated tables.
The logical structure at the top level is there, however.
\end{itemize}
%
\section*{Conclusions}
Tables are diverse, and a variety of tools is needed.
\\[.5ex]
Some (deterministic) tables can be generated completely by computer,
no detailed user mark up is needed, just the invoke of the macro.
\\[.5ex]
Mark up of bordered scientific tables can be done
via the provided bordered table macro \verb|\btable|, in the SGML spirit.
\\[.5ex]
Complex tables need detailed formatting commands
and \TeX nowledge, in agreement with \DeK, \TeX book p.245
\begin{quote}`People who know how to make
ruled tables are generally known as \TeX\ masters. Are you ready?'
\end{quote}
\noindent
Hard things: not to introduce parameters which are already
available, and to avoid redundancy.
However, I could not get around
\verb|\colsepsurround|, because of the impossibility to control the kind
of glue inserted by \verb|\tabskip|. \\
I pity the lack of dotted equivalents of \verb|\hrule|, and \verb|\vrule|,
as \TeX\ primitives.
%I nearly succeeded, because I could not extend the
%partial horizontal rules to the frame.
%It was hard to prevent
%improper use of \verb|\omit|.\\[.5ex]
\\[.5ex]
Typesetting tables requires a discipline to be adhered to. What about a
discipline of \TeX ing?
%
%\section*{References}\vspace{.5cm}
\begin{thebibliography}{Schneiderman 87}
\bibitem{AAP89} {\sc Association of American Publishers}, ``Markup of
Tabular Material'', Version 2.0 AAP Inc., 1989.
\bibitem{ga92}{} Asher, ``Inside Type \& Set'', TUGboat, 13.1, 1992,
pp.~13--22.
\bibitem{abk89}{} Anne {\sc Br\"uggeman-Klein}, D. {\sc Wood}, ``Drawing
Trees nicely with \TeX'', EP-ODD, 2, 2, 1989, pp.101\dash115.
\bibitem{dc92}{} David {\sc Carlisle}, ``longtable.sty'', from the fileserver,
1992.
\bibitem{rfc85}{} Ray F. {\sc Cowan}, ``tables.tex'', from the fileserver,
1985. 7p.
\bibitem{ah89}{} Amy {\sc Hendrickson},
{\em Macro\TeX}, version 0, 1989.
\bibitem{taj}{} Theo A. {\sc Jurriens},
``supertabular.sty'', from the fileserver, 1989.
\bibitem{khanh90}{} Khanh {\sc Ha}, ``Easy Table'', TUGboat, 11.2, 1990,
pp.~250--264.
\bibitem{dek73}{} Donald E. {\sc Knuth},
{\em The Art of Computer Programming, 3. Sorting and Searching},
Addison-Wesley, Reading Mass., 1973.
\bibitem{dek84}{} Donald E. {\sc Knuth},
{\em The \TeX book}, Addison-Wesley, Reading Mass., 1984.
\bibitem{hk91} Hanna {\sc Ko{\l}odziejska},
``Go diagrams with \TeX'', MAPS 91.2, 1991, pp.~63--68.
%\bibitem{cgl89}{} Kees {\sc van der Laan},
%``Typesetting Bridge via \LaTeX'', TUGboat, 10.1, 1989, pp.~113--116.
\bibitem{cgl90}{} Kees {\sc van der Laan},
``Typesetting Bridge via \TeX'', TUGboat, 11.2, 1990, pp.~265--276.
(An earlier \LaTeX\ set-up appeared in TUGboat, 10.1, 1989, pp.~113--116.)
\bibitem{cgl90a}{} Kees {\sc van der Laan},
``SGML(, \TeX\ and \dots)'', TUGboat, 12.1, 1991, pp.~90--104.
Proceedings Euro\TeX{} 90. Also MAPS 90.1.
\bibitem{cgl91}{} Kees {\sc van der Laan},
``Math into BLUes, Part I'', TUGboat, 12.4, 1991, pp.~485--501. (Part II
has appeared in GUTenberg Cahiers 10\&11, Proceedings Euro\TeX{} 91.)
Also MAPS 90.2.
\bibitem{cgl92a}{} Kees {\sc van der Laan},
``Tower of Hanoi, revisited'', TUGboat, 13.1, 1992, pp.~91--94.
Also MAPS 92.1, pp.~125\dash127.
\bibitem{cgl92b}{} Kees {\sc van der Laan},
``Typsetting Crosswords via \TeX'', This proceedings. Also MAPS 92.1,
pp.~128\dash131.
\bibitem{cgl92c}{} Kees {\sc van der Laan},
``FIFO and LIFO incognito'',
This proceedings. Also MAPS, 92.1, pp.~121\dash124.
\bibitem{cgl92d}{} Kees {\sc van der Laan},
``FIFO and LIFO sing the BLUes'', MAPS, 92.2.
\bibitem{lam86}{} Leslie {\sc Lamport},
{\em \LaTeX{} user's guide and reference manual}, Addison-Wesley, Reading,
Mass., 1986.
\bibitem{lesk79}{} M. E. {\sc Lesk}, ``Tbl -- a program to format tables'',
UNIX manual, pp.~157--174, 1979.
\bibitem{jep88} J.E {\sc Pittman},
``Loopy.\TeX'', TUGboat, 9.3, 1988, pp.~289--291.
\bibitem{ds92}David {\sc Salomon}, ``Advanced \TeX\ course: Insights \&
Hindsights,'' MAPS Special, 1992, 252p.
\bibitem{mds89}{} Michael D. {\sc Spivak},
{\em LAmS\TeX---The Synthesis}. \TeX plorators.
\bibitem{pt92} Piet {\sc Tutelaers},
``A font and a style for typesetting chess using \LaTeX\ or \TeX'',
TUGboat, 13.1, 1992, pp.~85--90.
\bibitem{pesw}{} Paul E. S. {\sc Wormer}, ``Young tableaux'',
from the listserver tex-nl@hearn.
\end{thebibliography}
\end{document}
|