summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/lextex/lextex.tex
blob: e6c82ec13465a5ad29f4b8ec4e5c4ebff134c122 (plain)
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
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
%$Log:	TeX $
%Revision 1.1  91/10/30  15:08:24  RC-HH
%Initial revision
% Amendments made 08/11/91
% \colsref amended (/ deleted)
% \getaddress amended (/ added)
% \bsdft altered by adding conditionals (ifx sols, sref, cref)
% \nsnbp changed to \nsnbps (\space added) and \nsn added
% The names of these should, perhaps be changed to include @
% Alterations to \xref and \newxref to ensure correct updating
% Alteration to \arrangement
% \global added in \party in one place. May need adding in others
% Alterations to \chittitle (for use in \faxsheet)
% Minor alteration to \advising
% Alteration to \familydivision and to \family and assoc macros
% \pleadingtrue added to \ch etc, \pleading false as default
% Alteration to affidavit to correct error
% \clientpltrue added in \specialwrit
% \sjsummons altered: do same to others
% \origprocess : \par added after #2
% \widowpenalty added to \pageparameters and \draftparameters
% \string added in \write statement in \schedule
% Alterations to \schedref and \appendref to deal with singles
% Added \pararef = to \clref
% Minor alterations to correct pagenumbering---check
% Duplicate definition of \faxsheet removed
% \everyjob added
% Minor alterations re \workdone
% Minor alteration to \plainoutput. \count1 & 2 swapped
% 12 Nov 91 Alteration made to \maxpartywidth 
% and to \resetpleadingdefaults
% Many %% removed
% 20 Nov 1991
% Minor alterations to \today and \everyjob
% \makeatletter \makeatother added
% time macros (taken from gentle.tex) added
% 21 Nov 1991
% TUBboat.sty macros added to remove spaces
% \oldquotes and ancilliary macros added
% \futureday etc and \dayofweek added


% This is LeXTeX, by Roger C-H. Horne.
% Some of it is original, and some is not.
% e.g., it takes chunks from manmac.tex relating to font sizing
% and amends those to include poundsigns
% It also takes footnotes from AMSptt.sty
% And uses a number of macros that have appeared in TUGboat
%
% The present version is an amalgamation of two files---and it shows.
%
% Last modified 21th November 1991

% Introduction (ie general purpose stuff) 
% 
\newif\ifdebugging
\def\dbhelp#1{\ifdebugging\inform{#1}\fi} 
\debuggingfalse

\ifx\lextexisloaded\relax\message{ - already loaded}
  \afterassignment\endinput
  \else\let\lextexisloaded=\relax
  \fi

\def\fmtname{LeXTeX}\def\fmtversion{1.005}
\message{Version \fmtversion}

\catcode`@=11 % Turn the `at' sign into a letter.
\catcode`\^=7 % Ensure that ^ is superscript.
%\catcode`\|=12% Ensure that | is `other'.

% time macros
\newcount\hour \newcount\minute
\def\mm@{\ifnum \minute<10 0\fi\number\minute}
\def\writetime{\hh@\mm@\space\am@pm}

\everyjob{%
  \hour=\time  \divide \hour by 60
  \minute=\time
  \loop  \ifnum \minute > 59 \advance \minute by -60 \repeat
  \ifnum \hour<13 
    \def\hh@{\number\hour:}%  % supresses leading 0's
    \def\am@pm{\ifnum \hour < 12 a.m.\else p.m.\fi}
  \else \advance \hour by -12 
    \def\hh@{\number\hour:}%  % supresses leading 0's                    \fi
    \def\am@pm{\ifnum \hour > 11 a.m.\else p.m.\fi}
  \fi
  \inform{}%
  \inform{This is LeXTeX, Version \fmtversion, running at \writetime}%
  \inform{\space\space on the \today.}%
  \inform{}%
  \inform{Comments and bug reports to}%
  \inform{}%
  \inform{\space\space Roger Horne}%
  \inform{\space\space 7 New Square}%
  \inform{\space\space Lincoln's Inn}%
  \inform{\space\space London WC2A 3QS}%
  \inform{\space\space rhorne@cix.compulink.co.uk}%
  \inform{}%
  }

% LeX TeX logo---looking distinctly similar to \LaTeX...
%
\def\LeXTeX{L\kern-.25em\raise.5ex\hbox{ex}T\kern-.1667em\lower
   .5ex\hbox{E}\kern-.125emX}
% The LaTeX logo sometimes looks like this (it varies a little)
\def\LaTeX{{\rm L\kern-.36em\raise.3ex\hbox{\scaps a}\kern-.15em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}


% Part 1 - Fonts etc---

% Main maths + roman---

\font\tentex=cmtex10
\font\twelverm=cmr12
\font\ninerm=cmr9
\font\eightrm=cmr8
\font\sixrm=cmr6
\font\fiverm=cmr5

% Maths italic---

\font\twelvei=cmmi12
\font\ninei=cmmi9
\font\eighti=cmmi8 % This is used as a scriptfont
\font\sixi=cmmi6 % reinstated for the time being
\skewchar\twelvei='177
\skewchar\ninei='177 \skewchar\eighti='177
\skewchar\sixi='177

% Math symbols---

\font\twelvesy=cmsy10 scaled \magstep1
\font\ninesy=cmsy9
\font\eightsy=cmsy8 % used as a scriptfont
\font\sixsy=cmsy6 % reinstated
\skewchar\twelvesy='60
\skewchar\ninesy='60
\skewchar\eightsy='60
\skewchar\sixsy='60

% Bold extended---

\font\twelvebf=cmbx12
\font\ninebf=cmbx9

% Typewriter style---

\font\twelvett=cmtt12 % Now not using proportional version
%\font\twelvett=cmvtt10 scaled \magstep1
%\font\tentt=cmvtt10
\font\tentt=cmtt10
\font\ninett=cmtt9

% Slanted type---

\font\twelvesl=cmsl12
\font\ninesl=cmsl9

% Italic---

\font\twelveit=cmti12
\font\nineit=cmti9

% Odd fonts---

\font\headerfont=cmr12 scaled \magstep1
\font\titlefont=cmr12 scaled \magstephalf

% Now the poundsign fonts:

\font\tenu=cmu10 % unslanted text italic
\font\twelveu=cmu10 scaled \magstep1
\font\tentiit=cmitt10

% And the caps and small caps fonts:

\font\fourteencaps=cmcsc10 scaled \magstep2
\font\twelvecaps=cmcsc10 scaled \magstep1
\font\tencaps=cmcsc10          

% The underline and cross-out macros

\def\gobble#1{}

\def\changefont#1{%
  \edef\testfontname{#1\fontname\font}%
  \edef\testfont{\expandafter\string\the\font}%
  \edef\testtwo{#1\expandafter\gobble\testfont}%
  \edef\testthree{\csname\testtwo\endcsname}%
  \expandafter\ifx\csname\testtwo\endcsname\relax
  \global\expandafter\font\testthree\expandafter=\testfontname
  \fi\ignorespaces
  \let\temppounds=\pounds
  \testthree\ignorespaces}

\gdef\ul{\changefont{u}
      \def\pounds{%
         \setbox1\hbox{\temppounds}%
         \setbox2\hbox{p}%
         \copy1\kern-\wd1
         \vrule depth .6\dp2 height -.45\dp2 width\wd1
         \relax}%
       }

\gdef\xo{\changefont{x}
       \def\pounds{%
         \setbox1\hbox{\temppounds}%
         \setbox2\hbox{p}%
         \copy1\kern-\wd1
         \vrule depth -.35ex height .45ex width\wd1
         \relax}%
       }

\def\xu{\changefont{xu}}
\let\xul\xu

% The next ones are at present somewhat abbreviated
% ie, poundsigns will not be crossed-out or underlined properly

\gdef\uul{\changefont{uu}}
\gdef\xxo{\changefont{xx}}
\gdef\uuul{\changefont{uuu}}
\gdef\xxxo{\changefont{xxx}}

% It will also be necessary in due course to define
% \def\xxu - inserted by am1, deleted by am2
% \def\xxxu - inserted by am1, deleted by am3
% \def\xxxuu - inserted by am2, deleted by am3

% Part 2 - Dimensions, etc.

\newdimen\footindent % fn indentation
\newdimen\clindent % clause indentation
\newdimen\sclindent % sub-clause indentation
\newdimen\ssclindent
\newdimen\sssclindent
\newdimen\ssssclindent
\newdimen\sssssclindent
\newdimen\cnindent % "computer-numbering" indentation
\newdimen\hclindent % hanging indentation
\newdimen\hsclindent
\newdimen\hssclindent
\newdimen\hsssclindent
\newdimen\hssssclindent
\newdimen\hsssssclindent
\newdimen\quoteindent % indentation of quotations
\newdimen\quoteparindent % \parindent in quotes
\newdimen\clbox % box holding \cl in \clcont
%\newdimen\sclbox % not used yet
%\newdimen\ssclbox
%\newdimen\sssclbox
%\newdimen\ssssclbox
%\newdimen\sssssclbox 
\newdimen\signindent % indentation of signature
\newdimen\rbracketsize % size of brackets round sworn, etc
\newdimen\lbracketsize
\newdimen\brackdepth % Depth of space in sworn etc
\newdimen\notespace % space marginal notes--text
\newdimen\maxnote % width of marginal note
\newdimen\clnamelength % length of "clause" in contents macros
\newdimen\pagewidth % alternative name for \hsize
\newdimen\pageheight % alternative name for \vsize

\newcount\footmarkcount@ % No. of footnotes
\newcount\recno % recitals
\newcount\clno % clauses and sub-clauses
\newcount\sclno
\newcount\ssclno % sub-sub etc
\newcount\sssclno
\newcount\ssssclno
\newcount\sssssclno
\newcount\greekno % see \ssscl & \sssscl
\newcount\cardno % see \sssscl & \ssssscl
\newcount\exno % Exhibits in affidavits
\newcount\clauselevel
\newcount\ssdcount \ssdcount=0 % new
\newcount\schedcount \schedcount=0
\newcount\partcount \partcount=0

\newskip\quoteparskip %parskip in quotes
\newskip\ttglue
\newskip\blankskip % Used in \noaddr etc
\newskip\twelvebase % \normalbaselines (12pt type)
\newskip\tenbase % \normalbaselines (10pt type)
\newskip\ninebase % \normalbaselines (9pt type)
\newskip\twelvesmallskipamount % TB p. 349
\newskip\tensmallskipamount
\newskip\ninesmallskipamount
\newskip\twelvemedskipamount
\newskip\tenmedskipamount
\newskip\ninemedskipamount
\newskip\twelvebigskipamount
\newskip\tenbigskipamount
\newskip\ninebigskipamount
\newskip\settledgap % distance between settled & sig.
\newskip\clskip % vskip for clauses
\newskip\sclskip % vskip for sub-clauses
\newskip\ssclskip % ditto ss-clauses
\newskip\sssclskip % ditto sss-clauses

\newif\ifgreek % see \sssscl
\newif\ifcard % see \ssssscl
\newif\ifclind % hanging indentation in clauses
\newif\ifcontents % table of contents produced
\newif\ifnocommaindate % used in \today
\newif\ifq % Used (?) in the quote macros
\newif\ifxrfmissing % cross-refs file
\newif\ifvisible % used in contents
\newif\ifmarginalnotes % if true, notes in margin
\newif\ifxrefs % check this
\newif\ifoldxrffile % 
\newif\ifindex
\newif\iffullsize \fullsizefalse% Whether fullsize backsheet
\newif\ifdraft \drafttrue% Draft or engrossment
\newif\ifpleading % No date req'd for pleadings
\newif\ifucfirstline % \ucfirstlinetrue
\newif\ifchit % print a fee chit
\newif\ifendorsement \endorsementfalse

\newread\xrf
\newread\inx

\newwrite\cont 
\newwrite\inx
\newwrite\xrf


% Part 3 - Now add the poundsign macros:

\def\rmpo{\leavevmode\lower.055ex\hbox{\$}\kern-.0em}
\def\itpo{\leavevmode\lower.055ex\hbox{\$}\kern-.09em}
\def\slpo{\leavevmode\lower.055ex\hbox{\$}\kern-.07em}
\def\bfpo{\leavevmode\pmb{\lower.025ex\hbox{\$}\kern-.04em}}
\def\ttpo{\leavevmode\lower.0ex\hbox{\$}\kern0em}
\def\ttkludgepo{\leavevmode\epmb{\lower.0ex\hbox{\$}\kern-.0em}}

\def\pmb#1{\setbox0=\hbox{#1}% Poor man's bold
  \kern-.025em\copy0\kern-\wd0
  \kern.05em\copy0\kern-\wd0
  \kern-.025em\raise.0003em\box0 }

\def\epmb#1{\setbox0=\hbox{#1}% Extremely poor man's bold
  \kern-.005em\copy0\kern-\wd0
  \raise.015em\copy0\kern-\wd0
  \kern.01em\copy0\kern-\wd0
  \kern-.005em\raise.015em\box0 }


% Part 4 - The size-changing macros

% These are adapted from the 10-point manmac macros
% Script and scriptscrip removed except in \rm

\def\twelvepoint{\def\rm{\def\pounds{{\twelveu\rmpo}}\fam0\twelverm}%
  \textfont0=\twelverm \scriptfont0=\eightrm \scriptscriptfont0=\sixrm
  \textfont1=\twelvei \scriptfont1=\eighti \scriptscriptfont1=\sixi
  \textfont2=\twelvesy \scriptfont2=\eightsy \scriptscriptfont2=\sixsy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\itpo}}\fam\itfam\twelveit}%
  \textfont\itfam=\twelveit
  \def\sl{\def\pounds{{\twelveit\slpo}}\fam\slfam\twelvesl}%
  \textfont\slfam=\twelvesl
  \def\bf{\def\pounds{{\twelveu\bfpo}}\fam\bffam\twelvebf}% pmb poundsign
  \textfont\bffam=\twelvebf
  \def\tt{\def\pounds{{\tenu\ttkludgepo}}\fam\ttfam\twelvett}% ! poundsign
  \textfont\ttfam=\twelvett
  \tt \ttglue=.5em plus.25em minus.15em % not needed for cmvtt fonts
  \normalbaselineskip=\twelvebase
  \smallskipamount=\twelvesmallskipamount
  \medskipamount=\twelvemedskipamount
  \bigskipamount=\twelvebigskipamount
  \def\caps{\def\pounds{~}\fourteencaps}% don't use the pound sign
  \def\scaps{\def\pounds{{\twelveu\rmpo}}\twelvecaps}%
  \setbox\strutbox=\hbox{\vrule height.7\normalbaselineskip
    depth.3\normalbaselineskip width\z@}%
  \normalbaselines\rm}
% consider changing normalbaselineskip to \the\twelvebase

\def\tenpoint{\def\rm{\def\pounds{{\tenu\rmpo}}\fam0\tenrm}%
  \textfont0=\tenrm \scriptfont0=\sevenrm \scriptscriptfont0=\fiverm
  \textfont1=\teni
  \textfont2=\tensy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\itpo}}\fam\itfam\tenit}%
  \textfont\itfam=\tenit
  \def\sl{\def\pounds{{\tenit\slpo}}\fam\slfam\tensl}%
  \textfont\slfam=\tensl
  \def\bf{\def\pounds{{\tenu\bfpo}}\fam\bffam\tenbf}%
  \textfont\bffam=\tenbf
  \def\tt{\def\pounds{{\tentiit\ttpo}}\fam\ttfam\tentt}%
  \textfont\ttfam=\tentt
  \tt \ttglue=.5em plus.25em minus.15em
  \smallskipamount=\tensmallskipamount
  \medskipamount=\tenmedskipamount
  \bigskipamount=\tenbigskipamount
  \normalbaselineskip=\tenbase
  \def\caps{\def\pounds{{\twelveu\rmpo}}\twelvecaps}%
  \def\scaps{\def\pounds{{\tenu\rmpo}}\tencaps}%
  \setbox\strutbox=\hbox{\vrule height10pt depth5pt width\z@}%
  \normalbaselines\rm}

\def\ninepoint{\def\rm{\def\pounds{{\nineit\slpo}}\fam0\ninerm}%
  \textfont0=\ninerm \scriptfont0=\sixrm \scriptscriptfont0=\fiverm
  \textfont1=\ninei
  \textfont2=\ninesy
  \textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex
  \def\it{\def\pounds{{\nineit\itpo}}\fam\itfam\nineit}%
  \textfont\itfam=\nineit
  \def\sl{\def\pounds{{\nineit\slpo}}\fam\slfam\ninesl}%
  \textfont\slfam=\ninesl
  \def\bf{\def\pounds{~}\fam\bffam\ninebf}% pound sign to be added
  \textfont\bffam=\ninebf
  \def\tt{\def\pounds{~}\fam\ttfam\ninett}% no pound sign
  \textfont\ttfam=\ninett
  \tt \ttglue=.5em plus.25em minus.15em
  \smallskipamount=\ninesmallskipamount
  \medskipamount=\ninemedskipamount
  \bigskipamount=\ninebigskipamount
  \normalbaselineskip=\ninebase
  \setbox\strutbox=\hbox{\vrule height8pt depth3pt width\z@}%
  \normalbaselines\rm}


% Part 5 - Footnotes

% These are adapted from the AMSTeX macros
% For details of usage see "The Joy of TeX" by Spivak M.D.

\def\relaxnext@{\let\next\relax}

% This is new. Adaption of \hang etc (Vol.B p.355)

\def\fang{\hangindent\footindent}
\def\fitem{\par\fang\toeindent}
\def\toeindent#1{\noindent\hbox to \footindent{\hss#1\thinspace}}

% This is where AMSPPT.STY is added:

\def\footmarkform@#1{$^{#1}$}
\let\thefootnotemark\footmarkform@
\def\makefootnote@#1#2{\insert\footins
  {\interlinepenalty\interfootnotelinepenalty
% The original (AMSTeX) uses 8-point:
  \ninepoint\splittopskip\ht\strutbox\splitmaxdepth\dp\strutbox
  \floatingpenalty\@MM\leftskip\z@\rightskip\z@
    \spaceskip\z@\xspaceskip\z@
% This differs from the original:
  \fitem{#1}\footstrut\ignorespaces#2\unskip\lower\dp\strutbox
  \vbox to\dp\strutbox{}}}
  \footmarkcount@\z@
\def\footnotemark{%
 \let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}% and from here
 \def\nextii@[##1]{\footmarkform@{##1}\@sf}%
 \def\nextiii@"##1"{{##1}\@sf}%
 \def\nextiv@{{\scriptfont0=\sevenrm % scriptfont changed to 7pt
  \global\advance\footmarkcount@\@ne
  \footmarkform@{\number\footmarkcount@}\@sf}}%
 \futurelet\next\next@}
\def\footnotetext{\relaxnext@
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}%
 \def\nextii@[##1]##2{\makefootnote@{%
  \footmarkform@{##1}}{{\frenchspacing##2}}}% {\frenchspacing} added
 \def\nextiii@"##1"##2{\makefootnote@{##1}{{\frenchspacing##2}}}%
 \def\nextiv@##1{\makefootnote@{%
  \footmarkform@{\number\footmarkcount@}}{{\frenchspacing}##1}}%
 \futurelet\next\next@}
\def\footnote{\let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}%
 \def\nextii@[##1]##2{%
  \footnotemark[##1]\footnotetext[##1]{{\frenchspacing##2}}}%
 \def\nextiii@"##1"##2{%
  \footnotemark"##1"\footnotetext"##1"{{\frenchspacing##2}}}%
 \def\nextiv@##1{\footnotemark\footnotetext{{\frenchspacing##1}}}%
 \futurelet\next\next@}
\def\adjustfootnotemark#1{\advance\footmarkcount@#1\relax}

\def\ref{\unskip\footnote}% Remove space from \se if necessary

% Prevent footnote splitting

\interfootnotelinepenalty=10000 % No splitting of footnotes
\skip\footins=12pt plus 2pt minus 4pt
% space added when footnote is present - taken from manmac


% Part 6 - Macros to set all counts to zero

\def\clearnotenumber{\footmarkcount@\z@} % footnote counter 
\def\clearrecno{\recno=64}         % Recital counter: 65 is `A'
\def\clearclno{\clno=0}            % Clause etc counters
\def\clearsclno{\sclno=0}
\def\clearssclno{\ssclno=96}       % 97 is `a'
\def\clearsssclno{\sssclno=0}
\def\clearssssclno{\ssssclno=96}
\def\clearsssssclno{\sssssclno=96}
\def\cleargreekno{\greekno="010A}  % "010B is alpha "027C is heart
\def\clearcardno{\cardno="027B}    % "027C is heart-suit
\def\clearexno{\exno=0} % exhibits
\def\clearpageno{\pageno=1 \footline={\hss\tenrm\folio\hss}}

\def\reset{%
  \clearrecno
  \clearclno
  \clearsclno
  \clearssclno
  \clearsssclno
  \clearssssclno
  \clearsssssclno
  \cleargreekno
  \clearcardno
  \clearexno
  \clearnotenumber
  \clearpageno
  \clauselevel=0}


% Part 7 - Automatic clause numbering

% The #1 in \xcl etc. is the clause number
% These macros do not increase the count regs.
% \ignorespaces is used to excess since these macros
% can be abused somewhat - leading to odd spaces
% appearing in unexpected places!

\def\xcl#1{\clearsclno% Set scl counter to zero
  \dimen0=\the\parindent\parindent=0pt% store current setting
  \ifclind \hangindent=\clindent \else\hangindent=\hclindent\fi
  \clauselevel=1
  \hangafter=1
  \vskip\clskip
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\hbox to\clindent{%
      \ignorespaces#1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \ignorespaces}

\def\xscl#1{\clearssclno %
  \dimen0=\the\parindent \parindent=0pt 
  % Note the difference between next line and same in \xsscl
  % This seems to be essential
  \ifnum\prevgraf=0\kern-\clindent\else\vskip\sclskip\fi
  \ifclind \hangindent=\sclindent \else\hangindent=\hsclindent\fi
  \clauselevel=2
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else\leavevmode\unskip\hbox to \sclindent{%
    \hskip\clindent\ignorespaces #1\hfil}%
    \ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \unskip\ignorespaces}

\def\xsscl#1{\clearsssclno % \advance\ssclno by 1
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\sclindent\else\vskip\ssclskip\fi
  \ifclind \hangindent=\ssclindent \else\hangindent=\hssclindent\fi
  \clauselevel=3
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \ssclindent{%
    \hskip\sclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \unskip\ignorespaces}

\def\xssscl#1{\clearssssclno \cleargreekno % \advance\sssclno by 1
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\ssclindent\else\vskip\sssclskip\fi
  \ifclind \hangindent=\sssclindent \else\hangindent=\hsssclindent\fi
  \clauselevel=4
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \sssclindent{%
    \hskip\ssclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

\def\xsssscl#1{\clearsssssclno \clearcardno
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\sssclindent\fi
  \ifclind \hangindent=\ssssclindent \else\hangindent=\hssssclindent\fi
  \clauselevel=5 % This is not used as yet
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
  \leavevmode\unskip\hbox to \ssssclindent{%
    \hskip\sssclindent
    \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

\def\xssssscl#1{% Nothing to clear!
  \dimen0=\the\parindent \parindent=0pt
  \ifdim\hangindent>0pt \kern-\ssssclindent\fi
  \ifclind \hangindent=\sssssclindent 
    \else\hangindent=\hsssssclindent\fi
  \clauselevel=6
  \hangafter=1
  \edef\testit{#1}%
  \ifx\testit\empty\hangafter0\noindent
  \else
    \leavevmode\unskip\hbox to \sssssclindent{%
      \hskip\ssssclindent
      \ignorespaces #1\hfil}\ignorespaces
  \fi
  \parindent=\the\dimen0\relax
  \aftergroup\ignorespaces}

% The Recital macros use \xcl and \xscl
% Recitals have the same indentation as Clauses.

\def\rec{\clauselevel=0%
  \advance\recno by1 \xcl{(\char\the\recno)}}% Letter A
\def\srec{\clauselevel=0
  \advance\sclno by1 \xscl{(\romannumeral\the\sclno)}}% Small Roman i

% Now Clauses etc

\def\normalnumbering{%
  \def\cl{\advance\clno by1\xcl{\the\clno.}}%
  \def\scl{\advance\sclno by1\xscl{(\the\sclno)}}%
  \def\sscl{\advance\ssclno by1\xsscl{(\char\the\ssclno)}}%
  \def\ssscl{\advance\sssclno by1\xssscl{%
    (\romannumeral\the\sssclno)}}%
  \def\sssscl{\advance\ssssclno by1 \advance\greekno by1\xsssscl{%
    \ifgreek($\mathchar\the\greekno$)
    \else(\char\the\ssssclno\char\the\ssssclno)\fi}}%
  \def\ssssscl{\advance\sssssclno by1 \advance\cardno by1\xssssscl{%
    \ifcard($\mathchar\the\cardno$)
    \else\ifgreek(\char\the\sssssclno\char\the\sssssclno)
    \else(\char\the\sssssclno\char\the\sssssclno
    \char\the\sssssclno)\fi\fi}}}

\def\computernumbering{%
  \clindent=\the\cnindent
  \sclindent=\the\cnindent
  \ssclindent=\the\cnindent
  \sssclindent=\the\cnindent
  \ssssclindent=\the\cnindent
  \sssssclindent=\the\cnindent
  \hclindent=0pt % Indentation of clauses if clindfalse
  \hsclindent=0pt
  \hssclindent=0pt
  \hsssclindent=0pt
  \hssssclindent=0pt
  \hsssssclindent=0pt
  \def\clearssclno{\ssclno=0}%       97 is `a'
  \def\clearssssclno{\ssssclno=0}%
  \def\clearsssssclno{\sssssclno=0}%
  \def\clearrecno{\recno=0}%
  \def\cl{\advance\clno by1\xcl{\the\clno.}}%
  \def\scl{\advance\sclno by1\xscl{\unskip\the\clno.\the\sclno.}}%
  \def\sscl{\advance\ssclno by1\xsscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.}}%
  \def\ssscl{\advance\sssclno by1\xssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.\the\sssclno.}}%
  \def\sssscl{\advance\ssssclno by1\xsssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.\the\sssclno\the\ssssclno.}}%
  \def\ssssscl{\advance\sssssclno by1\xssssscl{%
    \unskip\the\clno.\the\sclno.\the\ssclno.%
    \the\sssclno\the\ssssclno.\the\sssssclno.}}%
  \def\rec{\clauselevel=0%
    \advance\recno by1 \xcl{\unskip\the\recno.}}%
  \def\srec{\clauselevel=0
    \advance\sclno by1 \xscl{\unskip\the\recno.\the\sclno.}}%
  \def\hcl##1\par{\cl{\bf##1}\par\nobreak}%
  }

% The \ncl "clauses" have the same indentation - but no numbers

\def\ncl{\xcl{}}
\def\nscl{\xscl{}}
\def\nsscl{\xsscl{}}
\def\nssscl{\xssscl{}}
\def\nsssscl{\xsssscl{}}
\def\nssssscl{\xssssscl{}}

\def\tcl#1{% For use with text or numbers longer than \clindent.
  \clearsclno% Set scl counter to zero
  \dimen0=\the\parindent\parindent=0pt% store current setting
  \ifclind \hangindent=\clindent \else\hangindent=\hclindent\fi
  \clauselevel=1
  \hangafter=1
  \vskip\clskip
  \leavevmode\hbox{% to\clindent{%
    \ignorespaces#1\space}\ignorespaces
  \parindent=\the\dimen0\relax
  \ignorespaces}

% \def\tscl etc to follow


% Part 8

% The contents, index and cross-reference macros
% First, the commands to use them

\def\contents{\contentstrue \writecontents}
\def\marginalnotes{\marginalnotestrue}

% Minor definitions

\def\ctstitle#1{\gdef\titlename{\vtop{#1}}}% Title used on Contents page
\ctstitle{}% Default is nothing

% Use this for sub-headings in Table of Contents 
\def\stitle#1{% 
  \xdef\next{\write\cont{\string\centerline{%
  \string\vtop{\string#1}}\par
  \string\nobreak\string\medskip}}\next
  \inform{#1}}

\def\contentsname{Table of Contents}% Obvious.

\gdef\topofcontents{\centerline{\titlefont\titlename}
  \bigskip\centerline{\titlefont\contentsname}
  \vfill} % this material will start the table of contents page
\def\botofcontents{\vfill\eject} % this material will end it
\def\contentspagenumber{-1} % default page number for table of contents
\def\contentsreadfile{\jobname.cts} % file that gets table of contents info
\def\contentswritefile{\jobname.cts} % file that takes it
\def\writecontents{\inform{Opening contents file: }
  \openout\cont=\contentswritefile}
\def\readcontents{\input \contentsreadfile}
\def\leaderfill{\leaders\hbox to .75em{\hss.\hss}\hfil}
\def\clname{Clause}
\def\xreffile{\jobname.xrf}
\def\raggedleft{\leftskip=0pt plus 4em% see tb p101
 \spaceskip=.3333em \xspaceskip=.5em } % Can be used in mnote
\def\bigpenalty{\penalty10000\ }
\def\xrfwarn#1{%
   \xrfmissingtrue
   \warn{This cross-reference (#1) does not exist.}
   \inform{Re-run TeX on the file.}
   }

% Now the contents macros themselves.

\def\printcontents{% Print the contents
  \write\cont{}% ensure that the contents file isn't empty  
  \immediate\closeout\cont% contents information has been fully gathered
  \pageno=\contentspagenumber
  \inform{Table of contents: }%
  \topofcontents
  \line{\hfill Page}%
  \medskip
   \advance\baselineskip by0pt plus1pt minus0pt % add some give
   \readcontents\relax % read the contents info
   \botofcontents }% print the contents page(s), don't terminate

% TUGboat 1987/3/310 + tb p 423

\let\hat=\^ % Is this necessary?
 
% Note that the order of the lines in \specialhat is critical

\def\specialhat{\ifmmode\def\next{^}
  \else\let\next=\checkit\fi\next}
\def\checkit{\futurelet\next\testdoublehat}
\def\testdoublehat{\ifx\next\specialhat\let\next=\silentnote
  \else\visibletrue\let\next=\anote\fi \next}%
\catcode`\^=\active \let ^=\specialhat
\def\silentnote^{\visiblefalse\anote}% 
\def\mnote#1{%
  \strut\vadjust{%
    \kern-\dp\strutbox
    \vtop to \dp\strutbox{%
      \vss\baselineskip=\dp\strutbox
%     \moveleft\notespace
      \moveright\notespace\rightline{%
        \rlap{%
          \hbox{%
            \ninebase=12pt \ninepoint
            \vbox to \ht\strutbox{%
              \hsize\maxnote \raggedright
              \tolerance=1000
              \leftskip=0pt
              \rightskip=0pt plus.6\maxnote
              \noindent\bf\strut#1% \strut
              \vss
              }% end of \vbox to \ht\strutbox
            }% end of \hbox
          }%  end of \rlap
        } % end of \rightline
      \null
      }% end of \vtop tp \dp\strutbox
    }% end of \vadjust
  }% end of \mnote

% Note that this now works on the basis that a space before the 
% macro is neutral, ie printed unless it follows a macro
% and a space following the macro is ignored. Therefore no added \space
% at the beginning of \silentnote and ignorespaces at the end of \anote
% and possibly also of \mnote.

\def\anote#1{%
  \ifvisible\null\fi
  \ifmarginalnotes\ignorespaces\mnote{#1}\fi
  \ifcontents\ifcase\number\clauselevel% 
    \contentsentry{#1}% \clauselevel=0
    \or\clcont{#1}%     \clauselevel=1
    \or\sclcont{#1}%    \clauselevel=2
    \or\ssclcont{#1}%   \clauselevel=3
    \or\sssclcont{#1}%  \clauselevel=4
    \or\inform{This (#1) will not appear in the table of contents}% =5
    \or\inform{This (#1) will not appear in the table of contents}% =6
    \fi\fi%
  \ifvisible#1\else\unskip\ignorespaces\fi
}%

% Now the macros to deal with \cl etc in contents

\def\clcont#1{%
  \xdef\next{\write\cont{\string\line{%
  \setbox0=\hbox{\clname\ \hbox to 20pt{\testit\hfil}}%
  \global\clnamelength=\wd0\copy0#1
  \string\leaderfill\noexpand\number\pageno}}}\next
  \inform{\testit\space#1}}%

\def\sclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength%
  \hbox to 25pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{  \testit\space#1}}%

\def\ssclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength\hskip25pt%
  \hbox to 20pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{      [ascii \testit] #1}} 

\def\sssclcont#1{%
  \xdef\next{\write\cont{\line{\hskip\clnamelength\hskip45pt%
  \hbox to 20pt{\testit\hfil}#1
  \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{      (\romannumeral\the\sssclno) #1}} 

\def\contentsentry#1{%
  \xdef\next{\write\cont{\line{#1
    \string\leaderfill\noexpand\number\pageno}}}\next%
  \inform{#1}} % Use this as eg \contentsentry{Parties}


% These are the cross-ref macros by S v. B (adapted)

% First, do we have xrefs?

\def\checkoldxrf{%
  \ifoldxrffile\let\next\relax\else\let\next\getxrefs\fi\next}

\gdef\getxrefs{%
  \null\global\oldxrffiletrue\inform{Opening xrf file }%
  \immediate\openin\xrf=\xreffile\relax
  \ifeof\xrf
   \xrfmissingtrue
   \inform{}%
   \inform{WARNING: \xreffile\space is empty, or does not exist.}%
   \inform{Re-run TeX on the file.}%
   \inform{}%
  \else\xrefstrue\fi
  \immediate\closein\xrf\relax
  \ifxrefs\input\xreffile\relax\fi
  \immediate\openout\xrf=\xreffile\relax
  }

\def\newxref #1#2#3#4#5#6{%
  \expandafter\gdef\csname CLREF-#1\endcsname{#2%
      \inform{    (Cross-reference to #2)}}%
  \expandafter\gdef\csname PAGEREF-#1\endcsname{#6%
      \inform{    (Cross-reference to #6)}}%
  \expandafter\gdef\csname NOTEREF-#1\endcsname{#3%
      \inform{    (Cross-reference to #3)}}%
  \expandafter\gdef\csname SCHEDREF-#1\endcsname{#4%
      \inform{    (Cross-reference to #4)}}%
  \expandafter\gdef\csname APPREF-#1\endcsname{#5%
      \inform{    (Cross-reference to #5)}}%
  }

\def\clref#1{%
  \checkoldxrf
  \expandafter
   \ifx\csname CLREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Clause ???]\fi
  \csname CLREF-#1\endcsname
  }

\def\pararef#1{%
  \begingroup
   \def\clause{Paragraph}%
   \def\subclause{sub-paragraph}%
   \def\paragraph{sub-sub-paragraph}%
   \def\subparagraph{sub-sub-sub-paragraph}%
   \clref{#1}%
  \endgroup
  }

\def\pageref #1{%
  \checkoldxrf
  \ignorespaces
  \expandafter
   \ifx\csname PAGEREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Page ???]\fi
  \csname PAGEREF-#1\endcsname
  }

\def\noteref #1{%
  \checkoldxrf
  \ignorespaces
  \expandafter
   \ifx\csname NOTEREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Footnote ???]\fi
  \csname NOTEREF-#1\endcsname
  }

\def\schedref #1{%
  \checkaux
  \checkoldxrf
  \ignorespaces
  \ifmanyscheds
    \expandafter
    \ifx\csname SCHEDREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Schedule ???]\fi
    \csname SCHEDREF-#1\endcsname
  \else\xrfwarn{#1} the Schedule %
  \fi
  }

\def\appref #1{%
  \checkauxref
  \checkoldxrf
  \ignorespaces
  \ifmanyappends
    \expandafter
    \ifx\csname APPREF-#1\endcsname\relax\xrfwarn{#1}\unskip[Appendix ???]\fi
    \csname APPREF-#1\endcsname
  \else\xrfwarn{#1} the Appendix %
  \fi
  }

\def\xrfwarn#1{%
   \xrfmissingtrue
   \warn{This cross-reference (#1) does not exist.}%
   \inform{Re-run TeX on the file.}%
   }

\def\writexref{\write\xrf}
\def\nsnbps{\noexpand\string\noexpand\bigpenalty\space}% shorthand
\def\nsn{\noexpand\string\noexpand}

\def\clause{Clause}
\def\subclause{sub-clause}
\def\paragraph{paragraph}
\def\subparagraph{sub-paragraph}

\def\xref#1{%
  \checkoldxrf
  \ignorespaces 
  \xdef\fct{\the\footmarkcount@}%
  \xdef\schct{\fullnumbers{\the\schedcount}}%
  \xdef\appct{\fullnumbers{\the\appendixcount}}%
  \edef\xreftemp{%
    \nsn\ignorespaces%
    \nsn\newxref%
    {#1}% becomes Parameter 1 to \newxref
    {\ifcase\number\clauselevel%
       \or \nsn\clause\nsnbps\the\clno%
       \or \nsn\subclause\nsnbps(\the\sclno)%
       \or \nsn\paragraph\nsnbps(\char\the\ssclno)%
       \or \nsn\subparagraph\nsnbps(\romannumeral\the\sssclno)%
     \fi}% becomes Parameter 2 to \newxref
    {Footnote\nsnbps\fct}% becomes Parameter 3 to \newxref
    {the \schct\nsnbps Schedule}% becomes Parameter 4 to \newxref
    {the \appct\nsnbps Appendix}% becomes Parameter 5 to \newxref
    }% End of \xreftemp
  \expandafter\expandafter\expandafter%
   \writexref\expandafter{%
    \xreftemp{%
      Page\noexpand\bigpenalty\the\pageno\noexpand\ignorespaces}% Param 6 to \newxref
    \string\unskip}%
    \unskip\ignorespaces}% Final unskip now unnec.

% Gulp


% Part 9 - Miscellaneous macros start here:

\def\hangit{\hangindent\clindent}

\def\per{\ca per\se}

\def\ruledtable{% Get TeXsis macros
  \input txsruled\relax
  \ruledtable}

\def\nofancystuff{% Get rid of fancy fonts, disliked by \write's
  \def\xo{}\def\xxo{}\def\xxxo{}%
  \def\ul{}\def\uul{}\def\uuul{}%
  \def\setamendcount##1{}%
  \def\ignorespaces{}%
  \def\bigpenalty{ }}

\def\inform#1{{\nofancystuff\immediate\write16{#1}}}
\def\warn#1{{\nofancystuff\immediate\write16{}\immediate\write16{WARNING: #1}
  \immediate\write16{}}}

% Manmac macros for verbatim scanning
\chardef\other=12
\def\ttverbatim{\begingroup
  \catcode`\\=\other
  \catcode`\{=\other
  \catcode`\}=\other
  \catcode`\$=\other
  \catcode`\&=\other
  \catcode`\#=\other
  \catcode`\%=\other
  \catcode`\~=\other
  \catcode`\_=\other
  \catcode`\^=\other
  \catcode`\*=\other
  \obeyspaces \obeylines \tt}

\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=\z@
  \catcode`\|=0 \rightskip-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
  |obeylines % end of line is active
  |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
\catcode`\|=\active
{\catcode`\^=7
\obeylines \gdef|{\ttverbatim \spaceskip\ttglue \let^^M=\  \let|=\endgroup}}

% macros to demarcate lines quoted from TeX source files
\def\beginlines{\par\begingroup\nobreak\medskip\parindent\z@ \obeylines
  \hrule\kern1pt\nobreak \everypar{\strut}}
\def\nrbeginlines{\par\begingroup\nobreak\medskip\parindent\z@ \obeylines
  \kern1pt\nobreak \everypar{\strut}}
\def\endlines{\kern1pt\hrule\endgroup\medbreak\noindent}
\def\weakendlines{\kern1pt\hrule\endgroup\medskip\noindent}
\def\finalendlines{\kern1pt\hrule\endgroup\medbreak}
\def\nrendlines{\kern1pt\endgroup\smallskip\noindent}

\gdef\blank{\space\hglue\blankskip}%5 Oct 90

\def\noaddr{\phantom{11}\blank\phantom{Rail-}\blank
  \phantom{way}\blank\phantom{Cutt-}\blank\phantom{ings}
  \blank\phantom{Cheam}\blank
  \phantom{Lon-}\blank\phantom{don}\blank\phantom{SW12}
  \blank}

\gdef\noday{\phantom{31st\ }\blank}
\gdef\nomonth{\phantom{January\ }\blank}
\gdef\noyear{\noday\ day of %
  \nomonth\ }
\gdef\nodate{\noyear\number\year\penalty-150\maybespace}

\def\noname{\phantom{Anthony}\blank\phantom{Aloy-}
  \blank\phantom{nsius }\blank\phantom{Hancock}
  \blank}

\def\nopounds{\pounds\phantom{50,000}\maybespace}

\gdef\initials#1{\xdef\inits{#1}} 
  \initials{}
\def\exhibit{\advance\exno by1 ``\hbox{\ifx\inits{}
  \else\inits\,\ignorespaces\fi\the\exno}''}

\def\exhibited{produced and shown to me marked \exhibit\maybespace}

\def\bundled{produced and shown to me bundled together %
  and marked \exhibit\maybespace} % note maybespace

\newif\ifversion
\gdef\version#1{%
 \versiontrue
 \edef\versno{#1}
 \footline={\llap{\fiverm\versno}\hss\tenrm\folio\hss}}

% Amstex oldnos macros:
\def\oldnos#1{\ifmmode{\mathcode`\,="013B \fam\@ne#1}\else
  \leavevmode\hbox{$\mathcode`\,="013B \fam\@ne#1$}\fi}

% minor macros from manmac
\def\bull{\vrule height .9ex width .8ex depth -.1ex } % square bullet
\def\|{\leavevmode\hbox{\tt\char`\|}} % vertical line
\def\]{\leavevmode\hbox{\tt\char`\ }} % visible space

\def\Filbreak{\par\vskip\bigskipamount % used in \ssd etc.
 \vfil\penalty-200\vfilneg} % Adapted from \filbreak

% \today etc

\def\st{st}
\def\nd{nd}
\def\rd{rd}
\def\th{th}

\def\addsuffix#1{#1\ignorespaces\ifcase#1%
  \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th
  \or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\th
  \or\st\or\nd\or\rd\or\th\or\th\or\th\or\th\or\th\or\th\or\th\or\st\fi}

\def\today{%
  \addsuffix{\number\day}%
  \space
  \ifcase\month\or January\or February\or March\or April\or May\or
  June\or July\or August\or September\or October\or November\or December\fi
  \ifnocommaindate\space\else,\space\fi
  \number\year}

\def\longtoday{%
  \addsuffix{\number\day}%
  \space
  day of\space
  \ifcase\month\or January\or February\or March\or April\or May\or
  June\or July\or August\or September\or October\or November\or December\fi
  \ifnocommaindate\space\else,\space\fi
  \number\year}
  
\newif\ifwrongmonth
\newcount\feb

\def\leapcheck{%
 \count0=\number\year
 \advance\count0 by-1900
 \count1=\the\count0
 \divide\count0 by4
 \multiply\count0 by4
 \ifnum\count0=\number\count1
  \feb=29%
  \else\feb=28%
 \fi}

\def\increasedays{%
  \ifcase\month% month 0
   \or\daysinmonth{31}% jan
   \or\leapcheck\daysinmonth{\feb}% feb. Not a leap year
   \or\daysinmonth{31}% mar
   \or\daysinmonth{30}% apr
   \or\daysinmonth{31}% may
   \or\daysinmonth{30}% jun
   \or\daysinmonth{31}% jul
   \or\daysinmonth{31}% aug
   \or\daysinmonth{30}% sep
   \or\daysinmonth{31}% oct
   \or\daysinmonth{30}% nov
   \or\daysinmonth{31}% dec
  \fi}

\def\reducedays{%
  \ifcase\month% month 0
   \or\daysinlastmonth{31}% dec
   \or\daysinlastmonth{31}% jan
   \or\leapcheck\daysinlastmonth{\feb}% feb. Not a leap year
   \or\daysinlastmonth{31}% mar
   \or\daysinlastmonth{30}% apr
   \or\daysinlastmonth{31}% may
   \or\daysinlastmonth{30}% jun
   \or\daysinlastmonth{31}% jul
   \or\daysinlastmonth{31}% aug
   \or\daysinlastmonth{30}% sep
   \or\daysinlastmonth{31}% oct
   \or\daysinlastmonth{30}% nov
  \fi}

\def\daysinmonth#1{%
 \ifnum\day>#1 \wrongmonthtrue
  \advance\day by-#1 
  \advance\month by1
  \ifnum\month=13 \month=1
   \advance\year by1
  \fi
 \fi}

\def\daysinlastmonth#1{%
 \ifnum\day<1 \wrongmonthtrue
  \advance\day by#1 
  \advance\month by-1
  \ifnum\month=0 \month=12
   \advance\year by-1
  \fi
 \fi}

\def\futureday#1{%
 {\advance\day by#1
  \loop
  \wrongmonthfalse
   \begingroup
     \ifnum#1<0 
      \aftergroup\reducedays
     \else 
      \aftergroup\increasedays
     \fi
   \endgroup
 \ifwrongmonth
  \repeat
 \today
 }}

\def\tomorrow{%
  \futureday{1}}

\def\yesterday{%
  \futureday{-1}}

% Taken from the LaTeX extensions.sty
\def\@dow{\count2 }                        % gets day of the week
\def\@leap{\count5 }                       % leap year fingaler
\def\@x{\count6 }                          % temp register
\def\@y{\count7 }                          % another temp register


\def\dayofweek{{%
%            leap = year + (month - 14)/12;
  \@leap=\month \advance\@leap by -14 \divide\@leap by 12
  \advance\@leap by \year
%            dow = (13 * (month + 10 - (month + 10)/13*12) - 1)/5
  \@dow=\month \advance\@dow by 10
  \@y=\@dow \divide\@y by 13 \multiply\@y by 12
  \advance\@dow by -\@y \multiply\@dow by 13 \advance\@dow by -1 \divide\@dow by 5
%            dow += day + 77 + 5 * (leap % 100)/4
  \advance\@dow by \day \advance\@dow by 77
  \@x=\@leap \@y=\@x \divide\@y by 100 \multiply\@y by 100 \advance\@x by -\@y
  \multiply\@x by 5 \divide\@x by 4 \advance\@dow by \@x
%            dow += leap / 400
  \@x=\@leap \divide\@x by 400 \advance\@dow by \@x
%            dow -= leap / 100 * 2;
%            dow = (dow % 7)
  \@x=\@leap \divide\@x by 100 \multiply\@x by 2 \advance\@dow by -\@x
  \@x=\@dow \divide\@x by 7 \multiply\@x by 7 \advance\@dow by -\@x
  \ifcase\@dow Sunday\or Monday\or Tuesday\or Wednesday\or
      Thursday\or Friday\or Saturday\fi}}


% The signature macros. These have been simplified & extended.

\edef\lincoln{\hbox{Lincoln's Inn}}
\def\grays{\hbox{Gray's Inn}}
\def\temple{\hbox{\Temple}}
\def\middletemple{\hbox{Middle Temple}}
\def\innertemple{\hbox{Inner Temple}}
\let\inn=\lincoln

\def\signed{%
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\def\csettled#1{%
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\def\cresettled#1{% Note the \par
  \par\nobreak
  \vfill
  \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Re-Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}
  \vfill\vfill}

\gdef\settled{%
  \csettled{}}

\def\resettled{%
  \cresettled{}}

\def\jointsettled{%
  \multiply\settledgap by2
  \csettled{}}


% Part 10

% The signed sealed and delivered macros

% First, adapt \cases from plain
\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
  \ialign{$##\hfil$&\quad##\hfil\crcr#1\crcr}}\,\right\}}

\def\rbracket#1{\noindent$\rcases{% Put a large bracket at R.
  \tolerance=3000\pretolerance=3000\parskip=0pt\hfuzz=1.75pt
  \hbadness=9999
  \doublehyphendemerits=200
  \finalhyphendemerits=200
  \adjdemerits=200
  \vbox{\hsize=\rbracketsize{#1}}}$}

\def\lbracket#1{\noindent $\cases{% Put a large bracket at L.
  \tolerance=2000\pretolerance=2000\parskip=0pt\hfuzz=1.75pt
  \hbadness=9999
  \doublehyphendemerits=500
  \finalhyphendemerits=200
  \adjdemerits=200
  \vbox{\hsize=\lbracketsize{#1}}}$}

\def\ssgen#1{\clauselevel=0%
  {\raggedright\rbracket{% As \rbracket, but space below text
  #1\hfil\break\vtop to\brackdepth{}}}}

% Text for use in contents macros
\def\attestationtext{Attestation}
\def\electiontext{Fiscal Election}
\def\testimoniumtext{Testimonium}
\def\stampdutytext{Stamp Duty Certificate}


\def\ssd#1{%
  \clauselevel=0%
  \ifnum\ssdcount>0\Filbreak
  \else
   \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \fi
  \advance\ssdcount by1
  \ssgen{\hbox{SIGNED AS A DEED} by %
  #1 in the presence of---}%
  \par}

\def\ssc#1{%
  \clauselevel=0%
  \ifnum\ssdcount>0\Filbreak
  \else
   \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \fi
  \advance\ssdcount by1
  \ssgen{\hbox{THE COMMON SEAL of }%
  #1 was affixed hereunto in the presence of---}%
  \par}

\def\ssw#1{%
  \par\nobreak\bigskip\bigskip^^{\attestationtext}%
  \ssgen{\brackdepth=1in SIGNED by #1 %
  the Testator as and for his last Will
  and Testament in our presence and by us in his---}%
  \par}
%
\def\witness{%
  \par\clauselevel=0
  \nobreak\vbox{\bigskip IN WITNESS whereof the parties hereto have signed
  this instrument as a deed in the presence of the persons mentioned
  below}^^{\testimoniumtext}%
  \par}

\def\singlewitness{%
  \par\clauselevel=0
  \nobreak
  \vbox{\bigskip IN WITNESS whereof this instrument has been signed as
    a deed in the presence of the person mentioned
    below}^^{\testimoniumtext}%
  \par}

\def\sworn{%
  \clauselevel=0^^{\attestationtext}%
  \par\nobreak\vskip3\clskip
  \vtop{\rbracket{%
    SWORN at\hfil\break
    \vtop to\normalbaselineskip{}\hfil\break
    in the County of\hfil\break
    this \nodate\break
    before me---\hfil\break
   \vtop to\brackdepth{}\hfil\break
   \hbox{A Solicitor empowered to take Oaths}\hfil}\par}}

\def\whereas{\medskip\clauselevel=0 WHEREAS---}
\def\now{\medbreak\clauselevel=0 NOW THIS DEED WITNESSETH as follows---}
\def\wwhereas{\medskip\clauselevel=0 WHEREAS }
\def\nnow{\medbreak\clauselevel=0 NOW THIS DEED WITNESSETH }

\def\witnessetc{\clauselevel=0 \par
  \nobreak\vbox{\bigskip IN WITNESS, \etc^^{\testimoniumtext}}
  }

\def\swornetc{\clauselevel=0 \par
  \nobreak\vbox{\bigskip SWORN, \etc^^{\testimoniumtext}}
  }

\def\election{\par\cl^^{\electiontext}%
  \unskip\ignorespaces
  The parties hereto hereby elect %
  that the provisions of Section~49~(6) of the %
  Capital Gains Tax Act~1979 %
  and Section~142~(1) of the Inheritance Tax Act~1984 %
  shall apply to the variation hereby made\par}

\def\sdcert#1{\par
  \cl^^{\stampdutytext}It is hereby certified %
   that this instrument %
   falls within category #1 in the Schedule to the %
   Stamp Duty (Exempt Instruments) Regulations~1987\par}

\def\dovcert{\sdcert{L}}
\def\giftcert{\sdcert{M}}

% Somewhat complicated macros to produce automatically
% numbered Schedules and Appendixes

\newcount\appendixcount
\gdef\appendix{%
  \checkaux
  \ifnum\appendixcount=1
    \write\aux{\noexpand\manyappendstrue}%
  \fi
  \clauselevel=0
  \clearclno
  \ifnum\appendixcount>0
    \bigbreak
  \else
    \par\nobreak\bigskip
  \fi
  \advance\appendixcount by1
  \ifmanyappends
    \centerline{^{THE \ucfullnumbers{\the\appendixcount}
      \unskip\space APPENDIX}}
  \else
    \centerline{^{THE APPENDIX}}
  \fi
  \nobreak
  \smallskip}

\gdef\schedule{%
  \checkaux
  \ifnum\schedcount=2
    \write\aux{\string\manyschedstrue}%
  \fi
  \clauselevel=0
  \clearclno
  \ifnum\schedcount>0
    \bigbreak
  \else
    \par\nobreak\bigskip
  \fi
  \advance\schedcount by1
  \ifmanyscheds
    \centerline{^{THE \ucfullnumbers{\the\schedcount}
     \unskip\space SCHEDULE}}
  \else
    \centerline{^{THE SCHEDULE}}
  \fi
  \nobreak
  \smallskip}
  
\def\fullnumbers#1{%
  \ifcase#1% = zeroth
  \or First%
  \or Second%
  \or Third%
  \or Fourth%
  \or Fifth%
  \or Sixth%
  \or Seventh%
  \or Eighth%
  \or Ninth%
  \or Tenth%
  \else \blank
  \fi}

 \def\ucfullnumbers#1{%
   \expandafter\expandafter\expandafter\uppercase%
     \expandafter{\fullnumbers{#1}}
   }

\newif\ifmanyappends
\newif\ifmanyscheds
\newif\ifauxmissing
\newif\ifauxfile
\newif\ifaux

\def\auxfile{\jobname.aux}

\newread\aux
\newwrite\aux

\def\checkaux{%
 \ifauxfile\let\next\relax\else\let\next\getaux\fi\next}

\gdef\getaux{%
  \null\global\auxfiletrue\inform{Opening aux file }%
  \immediate\openin\aux=\auxfile\relax% 
  \ifeof\aux%
   \auxmissingtrue%
   \inform{}%
   \inform{WARNING: \auxfile\space is empty, or does not exist.}%
   \inform{It may be necessary to re-run TeX on the file.}%
   \inform{}%
  \else\auxtrue
  \fi%
  \immediate\closein\aux\relax%
  \ifaux\input\auxfile\relax\fi%
  \immediate\openout\aux=\auxfile\relax%
  }

\def\part#1{% note no \par
  \ifnum\partcount>0\filbreak\else
  \par\nobreak\bigskip\fi
  \advance\partcount by1
  \centerline{^{Part #1}}\smallskip\nobreak}

\def\centertext#1{{\skip0=0pt plus.25\hsize
  \advance \leftskip by \skip0 \advance \rightskip by \skip0 
  \parfillskip=0pt \spaceskip=.3333em \xspaceskip=.5em 
  \pretolerance=9999 \tolerance=9999
  \hyphenpenalty=9999 \exhyphenpenalty=9999 #1\par}}

\def\maybespace{%
  \futurelet\next\testforother}

\def\testforother{% \noexpand is required to avoid \ref being expanded
  \if\noexpand\next[\let\next=\space % if [  add space
  \else\if\noexpand\next(\let\next=\space % if (  add space
  \else\ifcat\noexpand\next.\let\next=\empty % if . no space
%\else\ifcat\noexpand\next\noexpand\\next=\empty  % if \ no space
% Don't use. It could cause problems if \space followed \ok or \se
% It is not required for \ref
  \else\let\next=\space
%\fi % relates to \ifcat\\
  \fi\fi\fi\next}% Note that \ref still generates a space-then eats it

\def\ca{%
  \begingroup\it\frenchspacing % This deals with, eg. Ltd. and v.
  }
\def\v{\unskip\/\ {\rm v}\maybespace}% taken out of \ca
\def\se{\unskip\/\endgroup\maybespace}% mod aftergroup

\def\bo{\def\on{\unskip\/\ {\rm on }}\begingroup\sl\frenchspacing}
\def\ok{\unskip\/\endgroup\maybespace}

% U.C. hyphens
\def\uc-{\discretionary{\raise.25ex\hbox{-}}{}{\raise.25ex\hbox{-}}}
\def\duc-{\discretionary{\raise.25ex\hbox{-}}{}{}}

% Quotation macros
\def\beginquote{\vskip\the\parskip \vskip-\quoteparskip
  \begingroup\tenpoint
  \parskip=\quoteparskip \parindent=\quoteparindent
  \clskip=\smallskipamount
  \advance\leftskip by \quoteindent \relax
  \par\ifq\leavevmode\llap{``}\fi
  \prevgraf=1
  \DeleteOptionalSpacesandPars{\noindent\ignorespaces}}

\def\endquote{\ignorespaces\ifq\rlap{''}\fi\par\endgroup}
\def\beginsclquote{\beginquote\advance\leftskip by-\clindent}
\def\beginssclquote{\beginquote\advance\leftskip by-\sclindent}
\def\beginsssclquote{\beginquote\advance\leftskip by-\ssclindent}

\newcount\quoteparacount \quoteparacount=0

\long\def\OldQuotes#1\par{%
  \advance\quoteparacount by1%
  {\setbox0=\hbox{``}%
   \setbox1=\vbox{%
   \storeparindent=\the\parindent
   \ifnum\quoteparacount=1 \parindent=0pt\fi 
     \advance\hsize by -1.5\wd0%
     \advance\hsize-\the\leftskip
     \leftskip=0pt%
     \leavevmode
     \llap{\hbox to 1.5\wd0{%
       \strut``\hfill}}\unskip#1\unskip\nobreak
       \parindent=\the\storeparindent}%
   \vfuzz=10pt                % suppress overfull warnings
   \splittopskip=0pt          % no skip at top of bix 1
   \count1=0                  % initialise line count
   \par\noindent              % start new paragraph
   \def\rebox{%
     \advance\count1 by1
     \ifnum\count1=1\hbox to1.5\wd0{\strut\hfill}\else
     \ifnum\count1>1\hbox to1.5\wd0{\strut``\hfill}\fi\fi
     \nobreak
     \setbox2=\vsplit 1 to6.1pt
       \vbox{\unvbox2\unskip}%
       \hskip 0pt plus 0pt\relax}%
     \loop
       \rebox                  % do one line at a time
       \ifdim \ht1>0pt         % test if more lines
     \repeat
     \par}}

\def\EndOldQuotes{\unskip\nobreak\hbox to 1.5\wd0{\hfill\strut''}}

\newif\ifosq
\def\newquotes{\osqfalse}
\def\oldquotes{\osqtrue \begindoublequotes}

% Set " to produce `` and '' and for use in \oldquotes
\catcode`\"=\active% Make " an active character

\gdef\begindoublequotes{%% \begindoublequotes enables "
    \global\catcode`\"=\active% Make " an active character
    \global\chardef\dq=`\"% Double-quote char. via \dq
    \global\let\dblqu@te=L% Always start with a left double-quote
    }% End of macro
\let\xxx=\spacefactor% Save the \spacefactor
\let\dblqu@te=L%
\gdef"{%
  \ifinner\else\ifvmode\let\dblqu@te=L\fi\fi
  \if L\dblqu@te\ifosq\OldQuotes\else``\fi\global\let\dblqu@te=R%
  \else
   \let\xxx=\spacefactor% Save the \spacefactor
   \ifosq\EndOldQuotes\else''\fi\global\let\dblqu@te=L%% Insert '' and reset \dblqu@te
   \spacefactor\xxx% Reset the \spacefactor
  \fi% End of \if L\dblqu@te...
  }% End of " macro

\gdef\enddoublequotes{%
  \catcode`\"=12%Set " back to other
  }

% Spacing
\def\,{\hskip.2em\relax}

% top-lap and bottom-lap - previous name of \tlap was \vlap
\def\tlap#1{\vbox to 0pt{\vss#1}} % toplap - 14.12.88
\def\blap#1{\vtop to 0pt{\vss#1}} % bottomlap - 14.12.88

\def\frac#1/#2{\leavevmode\kern.1em
  \raise.5ex\hbox{\the\scriptfont0 #1}\kern-.1em
  /\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}}

\def\vfrac#1/#2{\leavevmode$#1\over#2$\space}

% Whether these are miscellaneous is a moot point
% However, here is as good a place as any

\def\ifsinglepage{% This pair of macros needs amneding
  \edef\tempfootline{\the\footline}%
   \ifnum\pageno=1
    \ifnum\vbadness>9999
     \footline=\expandafter{\temptfootline}%
   \else\nopagenumbers\inform{No pagenumbers}\fi\fi}%
  \def\numberpages{\def\singlepage{}}

\def\printsp{%
 \ifsinglepage
  \vfill\supereject
  \backmatter\supereject
 \fi} % should it go here? 
 
\outer\def\bye{\par
 \signoff % This is the signature
  \vfil\supereject
  \backmatter\supereject
  \ifcontents
   \printcontents\contentsfalse\vfill\supereject
  \fi
  \ifxrefs
   \immediate\write\xrf{\noexpand\unskip}% check. Have all writes been written?
   \immediate\closeout\xrf
  \fi
  \ifxrfmissing
   \warn{\xreffile\space is missing or incomplete.}%
   \inform{Run TeX on the file again.}%
  \fi
  \ifaux
   \immediate\write\aux{\noexpand\relax}% check. Have all writes been written?
   \immediate\closeout\aux
  \fi
  \ifauxmissing
   \warn{\auxfile\space is missing or incomplete.}%
   \inform{Run TeX on the file again.}%
  \fi
  \supereject
  \iffax\printfaxsheet\fi
  \ifchit\chit\fi
  \end} 

% A fudged bit here to prevent multiple backsheets
% and additional pages containing rubbish.
% Will be corrected in next release

\newif\iflpwbs % if last page was backsheet...

\def\enddoc{\par
  \edef\tempfootline{\the\footline}%
  \iflpwbs\else\signoff\fi % signature/settled
  \vfill\supereject
  \iflpwbs\let\backmatter\empty\fi
  \ifnum\totalpages>1
    \backmatter\supereject\lpwbstrue
  \fi% No backsheet unless text!
  \footline=\expandafter{\tempfootline}%
  \ifcontents\printcontents\contentsfalse\fi
  \ifxrefs\immediate\write\xrf{\string\unskip}
  \fi
  \ifxrfmissing
   \inform{}%
   \inform{WARNING: \xreffile\space is missing or incomplete.}%
   \inform{}%
   \inform{Run TeX on the file again.}%
  \inform{}%
  \fi
  \ifaux\immediate\write\aux{\string\unskip}%
  \fi
  \ifauxmissing % is this necessary?
  \inform{}%
  \inform{WARNING: \auxfile\space is missing or incomplete.}%
  \inform{}%
  \inform{Run TeX on the file again.}%
  \inform{}%
  \fi
  \reset
  }

\def\counsel#1{\edef\counselname{#1}}

\def\formalcounselname{Mr.~\counselname}

\def\signature{\par\nobreak\vskip\the\clskip
 \hskip\signindent\ifx\counselname\undefined{[{\it Counsel's Name\/}]}%
 \else\counselname\fi
 \medskip}

% Other misc macros---
\def\etc{{\it \&c\/}.}

\newdimen\surround \surround=5pt
\def\Boxit#1#2{\vbox{\hrule\hbox{\vrule\kern#1
 \vbox{\kern#1#2\kern#1}\kern#1\vrule}\hrule}}


% Part 11 - backsheet macros

% Miscellaneous

\def\upperc#1{% This enable the first line to be UC
  \ifucfirstline\uppercase{#1} \gdef\upperc##1{##1}\else{#1}\fi}

\def\shift{% Full size or half size backsheets
  \iffullsize\null\else{\hskip1in\hskip.5\hsize}\fi} 
% The 1in \hskip in the previous line = the margin of the half size page

\def\xcenterline#1{\line{\shift\hss#1\hss}}
\def\centervers#1{\line{\llap{\fiverm\version}\shift\hss#1\hss}}

% Macros to extract names from files

\def\sols{} % Prevents error messages if undefined
\def\solname{} % ditto
\def\sname#1/#2\par{#1} % Used to extract solname from cref

\def\z:#1:#2\par{%
  \def\anyname{#1}\ifx\solname\anyname
  \afterassignment\endinput\def\sols{#2}\fi}

\gdef\getaddress{%
   \ifx\cref\empty
     \edef\solname{not given, and so}
   \else
     \edef\solname{\expandafter\sname\cref/\par}%
   \fi
   \ifx\sols\empty
     \ifx\cref\empty\else\input\addressfile\relax\fi
   \fi
   \ifx\sols\empty
      \warn{Reference \solname\space not found in file "\addressfile"}%
   \fi}

% Set up the parameters

\def\bsparams{%
 \tolerance=7500
 \doublehyphendemerits=0
 \finalhyphendemerits=10000
 \hyphenpenalty=100
 \parindent=0pt
 \normalbottom
 \pageno=0
 \nopagenumbers
  \advance\vsize\bstopincrease  \advance\vsize\bsbotincrease
  \advance\voffset-\bstopincrease
  \def\addressfile{solicitors}% name of input file
  \twelvebase=12pt\twelvepoint
  \inform{Backsheet for \ifdraft draft \fi\doctype}%
 }

% Backsheets for Opinions
\def\bsop{%
 \getworkdone
 \getbstitlewidth
 \begingroup
 \capacitytrue
 \bsparams
  \ifpleading% try adding \gettitle here and pleadingtrue elsewhere 
  \else\xcenterline{{\sl\today}}\vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr
    \title\crcr}}}%
  \vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim \wd0<\bstitlewidth\copy0
     \else\vtop{\hsize=\bstitlewidth\centertext{\doctype}}\fi}%
  \rm
   \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}\inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}%
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}%
 \supereject
 \endgroup}

% Not yet working
\def\bscopyop{%
 \getworkdone
 \getbstitlewidth
 \begingroup
 \capacitytrue
 \bsparams
  \ifpleading% try adding \gettitle here and pleadingtrue elsewhere 
  \else\xcenterline{{\sl\today}}\vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr
    \title\crcr}}}%
\vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim \wd0<\bstitlewidth\vtop{%
         \hbox{\llap{\scaps[copy]}\phantom{\doctype}\strut}%
         \hbox{\doctype}}
     \else
      \vtop{\hsize=\bstitlewidth
        \centertext{\llap{\scaps[copy]}\break\doctype}}%
     \fi}%
  \rm
   \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}%
     \inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}%
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}%
 \supereject
 \endgroup}

\let\doextras\empty

\def\bsdft{%
 \doextras
 \getworkdone
  \getbstitlewidth
 \begingroup
 \capacitytrue
  \bsparams
\ifendorsement\bsendorsement\global\endorsementfalse\fi 
 \ifpleading\null
   \else\xcenterline{\underbar{DATED\hskip2in \number\year}}%
   \bigskip
   \vfil\fi
  \xcenterline{\vtop{\openup2\jot
    \halign{\hfil\vtop{\hsize=\bstitlewidth 
    \clindent=0pt % I am not sure why this is required. But it is.
    \centertext{##}}\hfil\cr% Are the hfils nec?
    \title\crcr}}}%
  \vfil
  \tabskip=0pt
  \headerfont
  \xcenterline{\vtop{\openup2\jot
  \halign{\hfil##\hfil\cr
  \ifdraft \llap{\it draft/}\hfill\fi\cr
  \noalign{\smallskip}%
  \setbox0\hbox{\doctype}%
   \ifdim \wd0<\bstitlewidth\copy0
   \else\vtop{\hsize=\bstitlewidth\centertext{\doctype}}\fi\crcr}}}%
  \rm
  \smallskip
  \vfil\vfil
 \getaddress
 \halign{\def\temp{##}\xcenterline{\temp}\inform{::\temp::}\cr
   \ifx\sols\empty\else\sols\fi\crcr}%
 \smallskip
 \ifx\sref\empty
  \else\xcenterline{{\eightrm Solicitors' Reference: \sref}}\fi
 \ifx\cref\empty
  \else\xcenterline{{\eightrm Counsel's Reference: \col/\cref}}\fi
 \ifversion\leftline{\llap{\fiverm\versno}}\fi
 \supereject
 \endgroup
%\global\maxp@rtywidth=\the\maxpartywidth
\resetpleadingdefaults}


% Fee Chits

% Chit user macros

\def\solsref#1{\def\sref{#1}}
\def\colsref#1{\def\cref{#1}}
\def\timetaken#1{\def\timespent{#1}}
\def\casetype#1{\def\typeofcase{#1}}
\def\value#1{\def\amountatstake{#1}}
\def\difficulty#1{\def\howhard{#1}}
\def\proposedfee#1{\def\suggestedfee{#1}}
\def\legalaidno#1{\def\legalaid{#1}}
\def\comments#1{\def\remarks{#1}}

% Now the chit macros themselves
\def\chit{%
 \begingroup
  \parindent=0pt
  \inform{Fee Chit}%
  \pageno=1
  \nopagenumbers
  \def\\{ }
\maxp@rtywidth=.5\hsize
  \ifpleading\def\title{\chittitle\hfil}\fi
  \def\cr{\par}\def\noalign{}%
  \tenbase=12.5pt \tenpoint
\def\scriptsize{\let\rm\eightrm}%
  \def\chittext{%
   \parskip=0pt
  \raggedright \tolerance=10000
\hbadness=10000 
  \uchyph=0
   {\bf Date:} \today\quad {\bf cref:} \col/\cref\par
   {\bf sref:} \sref\par
   {\bf Title:} {\def\hfill{}\frenchspacing\title\strut}\par
   {\bf Legal Aid No:} \legalaid\par
   {\bf Work Done:} \workdone.\par
   {\bf Time Spent:} \ifx\timespent\empty\else\timespent\ hours\fi\par
   {\bf Value:} \pounds\amountatstake\par
   {\bf Difficulty:} \howhard\par
   {\bf Type of Case:} \typeofcase\par
   {\bf Suggested Fee:} \pounds\suggestedfee\par
   {\bf Filename:} {\tt\jobname}\par
   {\bf Remarks:} \remarks\par
  }% end of chittext
  %
  \leftline{{\it Clerk's Copy}\hfil}
  \chittext
  \vskip1in
  \leftline{{\it Counsel's Copy}\hfil}
  \chittext
  \vfil
  \supereject
 \endgroup}

\gdef\getworkdone{%
  {\nofancystuff
  \tempwd=\expandafter{\workdone}%
  \def\temppunct{\expandafter\if\the\tempwd\empty\else, \fi}%
  \xdef\workdone{\the\tempwd\temppunct
   \ifx\signoff\settled\ draft \fi\doctype
  \ifversion\space(\versno)\fi}}}


% Part 12---Advisory and non-litigious drafting

% The TUG macros (taken from tugboat.sty) which delete spaces etc
\def\if@baseis@next{\ifx\@basetoken\@nexttoken}

\long\def\@checknexttoken #1#2#3{%
  \futurelet\@basetoken\iffalse#1\fi
  \long\def\@next{%
    \if@baseis@next
      \long\def\@@next{#2}%
    \else\long\def\@@next{#3}\fi
    \@@next}%
  \futurelet\@nexttoken\@next}

% execute #2 after ignoring (possibly) one occurrence of #1
\long\def\@ignoreone#1#2{%
  \def\@ignoreform#1{#2}%
  \@checknexttoken{#1}{\@ignoreform}{#2}%
  }

% execute #2 after ignoring all occurrences of #1
\long\def\@ignoreall#1#2{%
  \def\@ignoreform#1{\@ignoretest}%
  \def\@ignoretest{\@checknexttoken{#1}{\@ignoreform}{#2}}%
  \@ignoretest
  }

% execute #1 after ignoring spaces
\def\DeleteOptionalSpaces#1{%
  \@ignoreall{ }{#1}%
  }

% execute #1 after ignoring spaces and \pars
\def\DeleteOptionalSpacesandPars#1{%
  \@ignoreall{ }{\@ignoreall{\par}{#1}}%
  }

%  Checking and reading options.
%  To check for the next optional argument, the macros must look
%  ahead to the next character.  If the next character is a `[',
%  the option-reading mechanism is invoked.  This check may be suppressed if
%  the user has executed the \lastoption option.  If \@lastoption is
%  "true" or if the [ is NOT next, the macro goes on to reading any
%  arguments and executing appropriately.

\def\@checkoptions{%
  \if@lastoption
    \def\@next{\@executetoend}%
  \else
    \def\@next{\@checknexttoken {[}{\@readoptions}{\@executetoend}}%
  \fi
  \@next
  }

% The default parameters used in advisory work

\def\pageparameters{%
  \widowpenalty=7500
  \def\footnoterule{}%
  \parindent=20pt
  \quoteindent=20pt
  \twelvepoint
  }

\def\advising#1{%
  \enddoc
  \ifpleading\gettitle\fi
  \pageparameters
  \inform{#1}%
  \chittrue % print a fee chit
  \def\doctype{#1}%
   \let\backmatter=\bsop
   \let\signoff=\signed
  \clindfalse
  \centerline{\headerfont #1}
  \nobreak\vskip10pt
  \DeleteOptionalSpacesandPars{\noindent\ignorespaces}}


\def\opinion{%
  \advising{Opinion}}
\def\note{%
  \advising{Note}}
\def\advice{%
  \advising{Advice}}
\def\jopinion{%
  \let\signed\jsigned
  \advising{Joint Opinion}}
\def\nopinion{%
  \advising{}}
\def\jnote{%
  \let\signed\jsigned
  \advising{Joint Note}}

\def\draftparameters{%
  \widowpenalty=7500
  \def\footnoterule{}%
  \parindent=0pt
  \quoteindent=\the\clindent
  \twelvepoint
}

\gdef\draft#1{%
  \ifended\endedfalse
  \else\enddoc
  \fi
  \begingroup
   \amendtextfalse
   \gdef\doctype{#1}%
   \inform{\ifdraft draft \fi#1}%
  \endgroup
   \draftparameters
   \chittrue
   \let\backmatter=\bsdft
   \ifdraft\let\signoff\settled % see \chit
    \else\let\signoff\empty\fi
   \clindtrue
   \lpwbsfalse}%

\def\conference{%
  \inform{Conference}%
  \chittrue
  \def\doctype{Conference}%
  \getworkdone}% normally set by backsheet

\def\telcon{%
  \inform{Telephone Conference}%
  \chittrue
  \def\doctype{Telephone Conference}%
  \getworkdone}


% Part 13---Pleadings
 
% Note: The pleadings macros are in the process of being rewritten. 
% As a result they contain a blend of stuff from the old and new 
% systems and some macros have been left in order to provide continuity.
% In other words, they are a mess at the moment.

% First a whole block of defs, some of which are no longer needed
\newdimen\storeparindent

\def\solicitors{Solicitors} % change to single for sole practitioner
\def\plaintiffs{} % List macro (tb 378), names of plaintiffs
\def\defendants{} % ditto, defendants
\def\thirdparties{} % ditto
\def\plaintiffsaddrs{} % ditto; addresses
\def\defendantsaddrs{}
\def\thirdpartiesaddrs{}
\def\matters{}  % List macro
\def\partyname{} % Temporary storage of individual party's name.
\def\outofrange{\noaddr} % If too few \of's, use blank address.
\def\courtname{\phantom{BORCHESTER}}%
\def\issuer{}
\def\chambers{\blank in \blank,} % Is this necessary?
\def\depsname{\blank} % name of deponent in aff endorse.
\def\shortname#1{\def\depsname{#1}}
\def\capacity#1{\ifcapacity ({\it #1\/})\else\unskip\fi}

\def\firm{\capacity{a firm}}
\def\widow{\capacity{Widow}\female}
\def\minor{\capacity{a Minor}}
\def\patient{\capacity{a Patient}}
\def\mw{\capacity{Married Woman}\female}
\def\co{\capacity{a Company}}
\def\tradingas#1{\capacity{Trading as #1}}
\def\as#1{\capacity{#1}}
\def\female{\unskip
 \ifplaintiff\femalepltrue\fi
 \ifdefendant\femaledeftrue\fi
 \ifthirdparty\femaletptrue\fi}
%\def\re{}
%\def\res{}
\def\theirsols{\noname} % redefine if necessary
\def\theirsolsaddr{\noaddr} % ditto
\def\doctype{}
\def\appellant{\global\appealtrue \plaintiff}
\def\applicant{\global\applicationtrue \plaintiff}
\def\respondent{\defendant}
\def\petitioner{}
\def\petitioner#1{\global\petitiontrue \def\petitioner{#1}}
\def\amend{}
\def\address#1{\def\address{#1}}
\def\petitionersaddress#1{\def\petitionersaddress{#1}}
\def\xheading#1{\removelastskip\medskip\goodbreak
  \noindent{\bf #1}\nobreak}

\newif\ifappeal
\newif\ifcountycourt
\newif\ifcourtofappeal
\newif\ifpetition
\newif\ifapplication

\newif\ifplaintiff
\newif\ifdefendant
\newif\ifthirdparty
\newif\iffourthparty
\newif\ifappellant
\newif\ifrespondent
\newif\ifapplicant

\newif\ifpluralplaintiff
\newif\ifpluraldefendant
\newif\ifpluralthirdparty
\newif\ifpluralfourthparty
\newif\ifpluralappellant
\newif\ifpluralrespondent
\newif\ifpluralapplicant

\newif\ifclientpl
\newif\ifnoparties
\newif\ifcapacity
\newif\ifintendedaction
\newif\ifaffidavit % check this
\newif\iffemalepl
\newif\iffemaledef
\newif\iffemaletp

\def\intendedparties{\global\intendedactiontrue}

\def\whenadded{\quad ~~/~~/91}
\def\added{(added\whenadded)}

\newcount\plcount % total number of plaintiffs
\newcount\dfcount % total number of defendants
\newcount\tpcount % total number of third parties
\newcount\partyno % This party - temporary storage
\newcount\testone % Temporary storage
\newcount\testtwo % Temporary storage
\newcount\mattercount % No. of Matters.

\def\claims{%
   \vskip\the\clskip
   \clearclno
   {\scaps And the \plaintfs}\ \wants---}
\def\claim{\claims}

% List macros, taken from the T.B. page 378 ff.

\toksdef\ta=0 \toksdef\tb=2 % token list registers for temp use
\newcount\cardcount

\def\rightappenditem#1\to#2{\ta={\\{#1}}\tb=\expandafter{#2}%
 \edef#2{\the\tb\the\ta}}%
\def\select#1\of#2\to#3{\def#3{\outofrange}%
 \long\def\\##1{\advance#1-1 \ifnum#1=0 \def#3{\relax##1}\fi}#2}%
\def\cardinality#1\to#2{#2=0 \long\def\\##1{\advance#2 by 1 }#1}


% Some dimensions to help with formatting of parties

\newdimen\plwidth \plwidth=0pt
\newdimen\dfwidth \dfwidth=0pt
\newdimen\tpwidth \tpwidth=0pt
\newdimen\allwidths \allwidths=0pt
\newdimen\maxp@rtywidth \maxp@rtywidth=4.5in
\newdimen\partyhang \partyhang=0pt

% Macros that add plaintiff's name etc to the list
% These macros are quite complicated since they use \csname
% and \endcsname, sometimes to excess

\def\plaintiffsstuff{}
\def\defendantsstuff{}
\def\thirdpartiesstuff{}
\def\currentpartyaddrs{}

\newcount\andcount
\newcount\testthree
\newcount\testfour

\newtoks\tc 
\newtoks\tx
\newtoks\cpatoks
\newtoks\cpstoks
\newtoks\cpsctoks
\newtoks\cpfctoks
\newtoks\cpntoks
\newtoks\cpwtoks

\def\upit{\global\advance\testtwo by-1
  \global\advance\testthree by-1}

\def\uupit{\global\advance\testtwo by0
  \global\advance\testthree by-2}

\def\downit{\unskip}

\def\of#1{% Address of party
  \advance\andcount by1
  \edef\abode{%
   \ifcase\andcount%
    \or{of}
    \or{both of}
   \else{all of}
   \fi}
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}%
  \tc=\expandafter{\abode#1\, }%
  \expandafter\edef\csname\expandafter
   \gobble\the\cpatoks\endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}%
   \tc=\expandafter{\downit}%
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \andcount=0
  }

\def\and{% For use where two parties have same address
  \advance\andcount by1
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}% 
  \tc=\expandafter{and}%
  \expandafter\edef\csname\expandafter\gobble\the\cpatoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}%
   \tc=\expandafter{\upit}%
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \expandafter\advance\csname\expandafter\gobble\the\cpsctoks
   \endcsname by-1
  }

% The \, in \tc may not be working
\def\nand{% For use where more than two parties have same address
  \advance\andcount by1
  \ta={\\} \tb=\expandafter{\currentpartyaddrs}%
   \tc=\expandafter{\, }%
  \expandafter\edef\csname\expandafter\gobble\the\cpatoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ta={\\} \tb=\expandafter{\currentpartystuff}% 
  \tc=\expandafter{\upit}% Formerly \uupit
  \expandafter\edef\csname\expandafter\gobble\the\cpstoks
    \endcsname{\the\tb\the\ta{\the\tc}}%
  \expandafter\advance\csname\expandafter\gobble\the\cpsctoks
    \endcsname by-1
  }

\def\converttc#1#2{% let <control word> = other word...
 \expandafter\expandafter\let\expandafter#1%
  \csname\expandafter\gobble\the#2\endcsname
 }

% If this macro is called eg with the parameter \plaintiff
% it lets eg \currentpartyshortcount=\plaintiffshortcount

\def\converttokens#1{% A general purpose macro...
  \cpsctoks=\expandafter{\string#1shortcount}%
  \converttc{\currentpartyshortcount}{\cpsctoks}%
  \cpfctoks=\expandafter{\string#1fullcount}%
  \converttc{\currentpartyfullcount}{\cpfctoks}%
  \cpatoks=\expandafter{\string#1addrs}%
  \converttc{\currentpartyaddrs}{\cpatoks}%
  \cpstoks=\expandafter{\string#1stuff}%
  \converttc{\currentpartystuff}{\cpstoks}%
  \cpntoks=\expandafter{\string#1}%
  \converttc{\currentpartynames}{\cpntoks}%
  \cpwtoks=\expandafter{\string#1width}%
  \converttc{\currentpartywidth}{\cpwtoks}%
  }

% This macro is calld by eg \plaintiff
% In that case #1 is \plaintiff and #2 the actual name of the
% Plaintiff in question (eg JOHN SMITH)
% In the next edition it will do rather more than it does now.

\def\party#1#2{%#1=party, #2=name
  \converttokens{#1}%
  \unskip
  \cardinality\currentpartyaddrs\to\cardcount
  \ifnum\currentpartyfullcount>\the\cardcount
   \of{\noaddr}%
  \fi
  \global\expandafter\advance\csname\expandafter\gobble\the\cpfctoks
   \endcsname by1
  \global\expandafter\advance\csname\expandafter\gobble\the\cpsctoks
   \endcsname by1
  \setbox0=\hbox{#2}%
  \ifdim\wd0>\the\maxp@rtywidth
    \global\csname\expandafter\gobble\the\cpwtoks
     \endcsname=\the\maxp@rtywidth
  \else\ifdim\currentpartywidth<\wd0%
    \csname\expandafter\gobble\the\cpwtoks\endcsname=\wd0
  \fi\fi
  \converttc{\currentpartywidth}{\cpwtoks}% Reset
  \unskip
  \ifdim\allwidths<\currentpartywidth 
   \allwidths=\the\currentpartywidth\fi
  \ta={\\} \tb=\expandafter{\currentpartynames}% 
  \tc=\expandafter{#2}%
  \expandafter\edef\csname\expandafter\gobble\the\cpntoks
   \endcsname{\the\tb\the\ta{\the\tc}}%
  \ifnum\currentpartyfullcount=1 \andcount=0\fi
  }


% This macro recovers the parties so that their names can be formatted
% The logic in it is still far from perfect
% It is intended to put "and" in the right place, but sometimes fails...

\newif\ifnoandneeded
\edef\testand{\relax and}

\def\getparties#1#2{% #1=partylist,#2=partytext
  \converttokens{#1}%
  \unskip%
  \testone=0\testtwo=0%
  \testthree=\the\currentpartyfullcount%
  \testfour=\the\currentpartyshortcount%
  \ifnum\currentpartyfullcount>\the\cardcount%
   \advance\andcount by1%
   \edef\abode{% Print addresses
    \ifcase\andcount%
     \or{of}%
     \or{both of}%
    \else{all of}%
    \fi}%
   \rightappenditem\abode\to\currentpartyaddrs%
   \rightappenditem{}\to\currentpartystuff%
  \fi%
  \unskip
  \loop
   \begingroup
    \global\advance\testone by1%
    \global\advance\testtwo by1%
    \partyno=\the\testone%
    \select\partyno\of\currentpartynames\to\partyname%
     \partyno=\the\testone% reset the counter%
    \select\partyno\of\currentpartyaddrs\to\partyaddress%
     \partyno=\the\testone% reset the counter
    \select\partyno\of\currentpartystuff\to\partystuff%
    \partystuff\unskip\relax%
      \ifnum\testone>1
         {\ifnum\testtwo=\the\currentpartyshortcount
           {\ifnoandneeded
             \else\unskip\ and%
            \fi
           }%
           \global\advance\testtwo by1
          \fi
         }%
      \fi
    \ifx\partyaddress\testand \global\noandneededtrue
     \else\global\noandneededfalse
    \fi
    \ifx\partyaddress\empty\let\partyaddress\noaddr\fi%fudge
    \unskip\ \partyname\ \partyaddress%
   \endgroup
   \ifnum\testone<\the\currentpartyfullcount%
  \repeat%
  #2}

% A number of these are not yet used
% (and may never be used)

\def\getpls{\getparties{\plaintiffs}{\pltext}}
\def\getdefs{\getparties{\defendants}{\dftext}}
\def\gettps{\getparties{\thirdparties}{\tptext}}
\def\getfps{\getparties{\fourthparties}{\fptext}}
%\def\getaps{\getparties{\appellants}{\aptext}}
%\def\getresp{\getparties{\respondents}{\rptext}}
%\def\getapplics{\getparties{\applicants}{\altext}}

\newcount\plshortcount
\newcount\dfshortcount
\newcount\tpshortcount
\newcount\fpshortcount
%\newcount\apshortcount
%\newcount\rpshortcount
%\newcount\alshortcount

\newcount\plaintiffsshortcount
\newcount\defendantsshortcount
\newcount\thirdpartiesshortcount
\newcount\fourthpartiesshortcount
%\newcount\appellantsshortcount
%\newcount\respondentsshortcount
%\newcount\applicantsshortcount

\newcount\plaintiffsfullcount
\newcount\defendantsfullcount
\newcount\thirdpartiesfullcount
\newcount\fourthpartiesfullcount
%\newcount\appellantsfullcount
%\newcount\respondentsfullcount
%\newcount\applicantsfullcount

\newdimen\plaintiffswidth
\newdimen\defendantswidth
\newdimen\thirdpartieswidth
\newdimen\fourthpartieswidth
%\newdimen\appellantswidth
%\newdimen\respondentswidth
%\newdimen\applicantswidth

\def\unsetallparties{%
 \plaintifffalse
 \defendantfalse
 \thirdpartyfalse
 \fourthpartyfalse
 }

\def\plaintiff#1{\unsetallparties\plaintifftrue
 \party{\plaintiffs}{#1}}
\def\defendant#1{\unsetallparties\defendanttrue
 \party{\defendants}{#1}}
\def\thirdparty#1{\unsetallparties\thirdpartytrue
 \party{\thirdparties}{#1}}            
\def\fourthparty#1{\unsetallparties\fourthpartytrue
 \party{\fourthparties}{#1}}
%\def\appellant#1{\unsetallparties\appellanttrue
% \party{\appellants}{#1}}
%\def\respondent#1{\unsetallparties\respondenttrue
% \party{\respondents}{#1}}
%\def\applicant#1{\unsetallparties\applicanttrue
% \party{\applicants}{#1}}

\def\listpls{\listparties{\plaintiffs}}
\def\listdfs{\listparties{\defendants}}
\def\listtps{\listparties{\thirdparties}}
\def\listfps{\listparties{\fourthparties}}
%\def\listaps{\listparties{\appellants}}
%\def\listrps{\listparties{\respondents}}
%\def\listapplics{\listparties{\applicants}}

\def\slistpls{\slistparties{\plaintiffs}}
\def\slistdfs{\slistparties{\defendants}}
\def\slisttps{\slistparties{\thirdparties}}
\def\slistfps{\slistparties{\fourthparties}}
%\def\slistaps{\slistparties{\appellants}}
%\def\slistrps{\slistparties{\respondents}}
%\def\slistapplics{\slistparties{\applicants}}

\gdef\pluraltext{%
    \gdef\addressis{addresses are}%
    \gdef\seek{seek}%
    \gdef\wants{claim}%
    \gdef\respectively{respectively}%
    \gdef\them{them}%
    \gdef\do{do}%
    }

\gdef\singulartext{%
    \gdef\addressis{address is}%
    \gdef\seek{seeks}%
    \gdef\wants{claims}%
    \gdef\respectively{\unskip}%
    \gdef\do{does}%
    \gdef\them{him}%
    }

\gdef\pltext{%
  \ifnum\plaintiffsfullcount>1%
    \gdef\plaintfs{\Plaintiffs}%
    \pluraltext
  \else%
    \ifpluralplaintiff%
    \gdef\plaintfs{\Plaintiffs}%
    \pluraltext
  \else%
    \gdef\plaintfs{\Plaintiff}%
    \singulartext
  \fi\fi}

\gdef\dftext{%
  \ifnum\defendantsfullcount>1%
    \gdef\dfdants{\Defendants}%
    \pluraltext
  \else%
    \ifpluraldefendant%
    \pluraltext
  \else%
    \gdef\dfdants{\Defendant}%
    \singulartext
    \gdef\them{\iffemaledef her\else him\fi}%
  \fi\fi}%

\gdef\tptext{%
  \ifnum\thirdpartiesfullcount>1%
    \gdef\thirdparts{Third Parties}%
    \pluraltext
  \else%
    \ifpluralthirdparty%
    \gdef\thirdparts{Third Parties}%
    \pluraltext
  \else%
    \gdef\thirdparts{Third Party}%
    \singulartext
  \fi\fi}

\gdef\fptext{%
  \ifnum\fourthpartiesfullcount>1%
    \gdef\fourthparts{Fourth Parties}%
    \pluraltext
  \else%
    \ifpluralfourthparty%
    \gdef\fourthparts{Fourth Parties}%
    \pluraltext
  \else%
    \gdef\fourthparts{Fourth Party}%
    \singulartext
  \fi\fi}

%\gdef\aptext{%
%  \ifnum\appellantsfullcount>1%
%    \gdef\plaintfs{Appellants}%
%    \pluraltext
%  \else%
%    \ifpluralappellant%
%    \gdef\plaintfs{Appellants}%
%    \pluraltext
%  \else%
%    \gdef\plaintfs{Appellant}%
%    \gdef\addressis{address is}%
%    \pluraltext
%  \fi\fi}
%%
%\gdef\rptext{%
%  \ifnum\respondentsfullcount>1%
%    \gdef\dfdants{Respondents}%
%    \pluraltext
%  \else%
%    \ifpluralrespondent%
%    \gdef\dfdants{Respondents}%
%    \pluraltext
%  \else%
%    \gdef\dfdants{Respondent}%
%    \singulartext
%  \fi\fi}%
%%
%\gdef\altext{%
%  \ifnum\applicantsfullcount>1%
%    \gdef\plaintfs{Applicants}%
%    \pluraltext
%  \else%
%    \ifpluralappellant%
%    \gdef\plaintfs{Applicants}%
%    \pluraltext
%  \else%
%    \gdef\plaintfs{Applicant}%
%    \singulartext
%  \fi\fi}
%%
% Phew. I reckon those need amending...

% This is one macro that will soon go, being replaced by
% \pleading and \spleading

\def\topofpleading#1#2{% doctype & ct
  \reset
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \def\doctype{#1}
  \ct=#2
  \pleadingtrue
  \clientpltrue
  \gettitle
  \def\backsheet{\enddoc\bsdft}
  \heading
  \parties}

% So will this. It will be \let equal to \pleading

\def\generic#1{%
  \reset
  \def\doctype{\vtop{\centertext{#1}}}
  \heading
  \ifnoparties\else\parties\fi
  \centertext{#1}
  \medskip}

\def\am@nd{%
  \ifnum\amendcount>2{\uuul RE-}\fi
  \ifnum\amendcount>1{\uul RE-}\fi
  \ifnum\amendcount>0{\ul AMENDED }\fi
  }

\def\pleading#1{% doctype
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{\am@nd#1}
  \pleadingtrue
  \gettitle
  \heading
  \parties
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \medbreak
  \leavevmode
  \centertext{\am@nd#1}%
  \nobreak
  \amendnote}

\def\spleading#1{% doctype
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{\am@nd#1}
  \pleadingtrue
  \gettitle
  \heading
  \sparties
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \medbreak
  \centertext{\am@nd#1}%
  \nobreak
  \amendnote}

\def\gettitle{% This needs a lot of work
  \pltext\dftext\tptext % added to deal with ops on their own
  \getbstitlewidth
  \gdef\title{%
   \global\maxp@rtywidth=\the\bstitlewidth
    \centerline{\court}\cr
    \scaps
    \division\cr
    \regis\cr  
    \reference\cr
    \noalign{\bigskip}%
    \rm
    \centertext{\inthematter}\cr
    \noalign{\medskip}%
    \slistpls\cr
    \hfill\it\plaintfs\cr
    \against\cr
    \strut\cr
    \slistdfs\cr
    \hfill\it\dfdants\cr}%
   \global\maxp@rtywidth=\the\maxpartywidth}

\def\headingskip{\vskip-\lastskip\smallskip}

\gdef\heading{% Can this be broken down further?
  \vbox{\baselineskip=15pt
   \line{\court\hfil\reference}%
   \headingskip 
   \scaps % Turn on caps and smallcaps
    \apcourt
    \headingskip
    \division
    \headingskip
    \regis
    \headingskip
    \subdivision
    \headingskip
    \judgename
    \headingskip
    \rm % Back to roman
    \Writissued
    \headingskip
    \inthematter
    }% end of vbox
  \medskip}

\def\parties{%
  \capacitytrue
  \pltext% set up the alternative text for `his', `their', etc.
  \dftext
  \tptext
  {\noindent\leftline{BETWEEN\raise.15ex\hbox{---}}
  \bigskip
  % The next few lines box up the parties.
  \centerline{\hbox{\vtop{\baselineskip=15pt %Baselineskip in parties
    \halign{\hfill ##\hfill\cr
    \listpls\cr
  \relax\hidewidth\rightline{\hfil\it
    \ifintendedaction Intended\ \fi\plaintfs}
  \hidewidth\relax\cr
    \hfill \against\hfill\cr
    \strut\cr
  \listdfs\cr
  \relax\hidewidth\rightline{\it 
    \ifintendedaction Intended\ \fi\dfdants}
  \hidewidth\relax\cr
  \ifthirdparty
    \hfill \against\hfill\cr
    \strut\cr
  \listtps\cr
  \relax\hidewidth\rightline{\it 
    \ifintendedaction Intended\ \fi\thirdparts}
    \hidewidth\relax\cr\fi  
  }}}}}%
  \twelvepoint\bigskip
  \capacityfalse}

% Short version of parties for affy's, etc.

\def\sparties{%
  \capacitytrue
  \pltext % set up the alternative text for `his', `their', etc.
  \dftext
  \tptext
  {\noindent\leftline{BETWEEN\raise.15ex\hbox{---}}
  % The next few lines box up the parties.
  \centerline{\hbox{\vtop{\baselineskip=15pt
    \halign{\hfill ##\hfill\cr
    \slistpls\cr
  \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\plaintfs}
    \hidewidth\relax\cr
    \hfill \against\hfill\cr
    \strut\cr
    \slistdfs\cr
   \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\dfdants}
    \hidewidth\relax\cr
  \ifthirdparty
    \hfill \against \hfill\cr
    \strut\cr
    \slisttps\cr
  \relax\hidewidth\rightline{\hfill\it 
    \ifintendedaction Intended\ \fi\thirdparts}
    \hidewidth\relax\cr\fi}}%
  }}}%
  \bigskip
  \capacityfalse}%

\def\listparties#1{% #1=partylist (eg \plaintiffs)
  \converttokens{#1}%
  \testone=0\def\\##1{\relax##1\cr}%
  \tabskip=0pt
  \vtop{\hsize=\the\maxp@rtywidth
    \hyphenpenalty=10000\tolerance=2750
    \ifnum\currentpartyfullcount>1
      \halign{\global\advance\testone by1
      \hfil
      \llap{(\the\testone)\quad}
      \vtop{%
        \hsize=\the\currentpartywidth
        \hangafter1\hangindent\the\partyhang
        \strut##\strut}% end of \vtop
      \hfil\cr#1}% end of \halign
     \else
      \ifnum\currentpartyfullcount=1
      \partyno=1
      \select\partyno \of#1 \to\partyname
      \centertext{\partyname}%
     \fi\fi}}

\def\slistparties#1{% #1=\plaintiffs
  \converttokens{#1}%
  \partyno=1\def\\##1{\relax##1\cr}%
  \tabskip=0pt
  \select\partyno \of#1 \to\partyname
  \vtop{\hsize=\the\maxp@rtywidth
   \hyphenpenalty=10000\tolerance=2750
   \ifnum\currentpartyfullcount>2
     \centertext{\partyname{ \it \&~Ors.\/}}%
   \else\ifnum\currentpartyfullcount=2
     \centertext{\partyname{ \it \&~Anor.\/}}%
   \else\ifnum\currentpartyfullcount=1
     \centertext{\partyname}%
   \fi\fi\fi}}

% This is a default definition.
\long\def\bottomofpleading#1{%#1=text
  \def\addressfile{solicitors}
  \getaddress
  {\def\cr{ of \def\cr{, }}%
  \medskip
  #1}%
  \global\parindent=\the\storeparindent}

\def\inthematter{%
  \ifx\matters\empty
  \else\testone=0\def\\##1{\relax\global\advance\testone by1%
   \def\and{\ifnum\testone<2{}%
  \else{And\ }\fi}% Now do the work
  {\scaps \and}##1\strut\cr
  \ifnum\testone<\the\mattercount \noalign{\smallskip}\fi}%
  \halign{%
    \vtop{\twelvebase=15pt\twelvepoint
    \hangafter1 \hangindent\clindent ##\strut}\hfil\cr
    \matters\crcr}%
  \fi}

% Now some other pleading stuff, esp. amendments

\def\served#1{\getservicedate{#1}{\dateofservice}}
\def\reserved#1{\getservicedate{#1}{\dateofreservice}}
\def\rereserved#1{\getservicedate{#1}{\dateofrereservice}}
\def\rerereserved#1{\getservicedate{#1}{\dateofrerereservice}}

\def\writissued#1{%
  \getservicedate{#1}{\datewritissued}%
  \gdef\Writissued{Writ issued the \nodate}%
  }

\def\getservicedate#1#2{{%
   \def\sserved##1/##2/##3roger{%
     \def\day{##1}%
     \def\month{##2}%
     \def\year{\ifnum##3<100 19##3\else##3\fi}%
     \expandafter\xdef\csname\expandafter\gobble\string#2\endcsname{\longtoday}%
     }%
   \sserved#1roger
   }}

\newif\ifamendtext\amendtexttrue
\def\setamendcount#1{\global\amendcount=#1}

\newcount\amendcount
\newcount\aamct \aamct=0

\gdef\amended{%
  \enddoc
  \setamendcount{1}%
  \ifamendtext\amendstuff\fi}

\gdef\reamended{%
  \enddoc
  \setamendcount{2}
  \ifamendtext\amendstuff\fi}

\gdef\rereamended{%
  \setamendcount{3}%
  \ifamendtext\amendstuff\fi}

\def\amendstuff{%This overlong macro deals with amendment formal parts
  \gdef\amendnote{%
     \ifnum\amendcount<2% First amendment
       \tcl{\scaps Note:} Text inserted by this amendment to this 
       pleading is shown underlined, {\ul thus}; text deleted by 
       this amendment is shown crossed-out, {\xo thus}.
     \else % Second and subsequent amendments
       \tcl{\scaps Note 1:} Text inserted by the first amendment 
       is shown underlined, {\ul thus}; text deleted by the 
       first amendment is shown crossed-out, {\xo thus};
       \par
       \tcl{\scaps Note 2:} Text inserted by the second amendment 
       is shown underlined twice, {\uul thus}; text deleted by the 
       second amendment is shown crossed-out twice, {\xxo thus}.
     \fi
     \par
     \ifnum\amendcount=3% re-re-amendment
       \tcl{\scaps Note 3:} Text inserted by the third amendment 
       is shown underlined thrice, {\uuul thus}; text deleted by 
       the third amendment is shown crossed-out thrice, {\xxxo thus}.
     \fi
     }%
    \ifnum\ct=1\ccendofpleading\else\hcendofpleading\fi
  \global\amendtextfalse
  }

\def\hcendofpleading{% End of pleading for High Court
    \gdef\endofpleading{%
      \signature      
      {\ul \signature}
      \ifnum\amendcount>1{\uul \signature}\fi
      \ifnum\amendcount>2{\uuul \signature}\fi
      \bottomofpleading{%
        Served the \ifx\dateofservice\empty{\nodate}%
         \else{\dateofservice}\fi
      \unskip
      \ifnum\amendcount=1{\ul\ and }\fi% Amend
      \ifnum\amendcount>1{\ignorespaces\ul\unskip, }\fi
      {\ul re-served the \ifx\dateofreservice\empty{\nodate}%
         \else{\dateofreservice}\fi\unskip}
      \ifnum\amendcount=2{\ul\ and }\fi% Reamend
      \ifnum\amendcount>2{\ignorespaces\ul\unskip, }\fi
      \ifnum\amendcount>1% ie \amendcount is 2 or more
         {\uul re-re-served the 
           \ifx\dateofrereservice\empty{\nodate}%
           \else{\dateofrereservice}\fi\unskip}
           \fi
      \ifnum\amendcount=3{\ul\ and }\fi% Re-re-amend
        \ifnum\amendcount>2% ie \amendcount is 3 or more
           {\uuul re-re-re-served the 
            \ifx\dateofrerereservice\empty{\nodate}%
             \else{\dateofrerereservice}\fi}
         \fi
       by \ignorespaces\sols \solicitors\ for the\forwhom\par
         }%
     }%
    }

\def\ccendofpleading{% End of pleading for county court
    \gdef\endofpleading{%
      \medskip
      Dated the \ifx\dateofservice\empty{\nodate}%
       \else{\dateofservice}\fi
      \signature      
      {\ul Dated the \ifx\dateofreservice\empty{\nodate}%
       \else{\dateofreservice}\fi\unskip}
      {\ul \signature}
      \ifnum\amendcount>1
        {\uul Dated the \ifx\dateofrereservice\empty{\nodate}%
        \else{\dateofrereservice}\fi\unskip}
        {\uul \signature}
      \fi
      \ifnum\amendcount>2% ie \amendcount is 3 or more
        {\uuul Dated the \ifx\dateofrerereservice\empty{\nodate}%
        \else{\dateofrerereservice}\fi}
        {\uuul\signature}
      \fi
      \bottomofpleading{%
        \rightline{\vtop{\hsize=.6\hsize
          The \forwhom's \solicitors\ are \sols
          where they will accept service of proceedings 
          on behalf of the \forwhom.}}
        \bigskip
        \leftline{\vtop{\hsize=.6\hsize
          To the District Judge of the \courtname\ 
          COUNTY COURT and to the \notforwhom.}}
        }%
     }%
    }

% Clause numbering for use inside amendments

\def\acl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno.\enspace}}

\def\aacl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno\char
  \the\recno.\enspace}}

\def\aaacl{\clauselevel=1
 \advance\recno by1 \xcl{\hss\the\clno\char\the\recno\char\the\recno%
    \char\the\recno.\enspace}}

\def\ascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno)\enspace}}

\def\aascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno%
    \char\the\recno)\enspace}}

\def\aaascl{\clauselevel=2
 \advance\recno by1 \xcl{\hss(\the\sclno\char\the\recno\char\the\recno%
    \char\the\recno)\enspace}}

\let\dateofservice\empty
\let\dateofreservice\empty
\let\dateofrereservice\empty
\let\dateofrerereservice\empty
\let\datewritissued\empty

\def\resetpleadingdefaults{%
   \ifnum\ct=1
     \def\endofpleading{%
      \medskip
      Dated this \nodate\par\signature
      \bottomofpleading{%
        \rightline{\vtop{\hsize=.6\hsize
          The \forwhom's \solicitors\ are \sols 
          where they will accept service of proceedings 
          on behalf of the \forwhom.}}
        \bigskip
        \leftline{\vtop{\hsize=.6\hsize
          To the District Judge of the \courtname\ 
          COUNTY COURT and to the \notforwhom.}}
        }}%
   \else
    \def\endofpleading{%
      \signature
      \bottomofpleading{%
        Served the \nodate by \ignorespaces\sols \solicitors\ 
        for the \forwhom}}
   \fi
   \gdef\amendnote{}% Reset it.
   \let\dateofservice\empty
   \let\dateofreservice\empty
   \let\dateofrereservice\empty
   \let\datewritissued\empty
   \setamendcount{0}%
   \global\maxp@rtywidth=\the\maxpartywidth}

% These may change. They set up names.

\gdef\Plaintiffs{\ifappeal Appellants\else\ifapplication Applicants%
  \else Plaintiffs\fi\fi}
\gdef\Plaintiff{\ifappeal Appellant\else\ifapplication Applicant%
  \else Plaintiff\fi\fi}
\gdef\Defendants{\ifappeal Respondents\else\ifapplication Respondents%
  \else Defendants\fi\fi}
\gdef\Defendant{\ifappeal Respondent\else\ifapplication Respondent%
  \else Defendant\fi\fi}
\gdef\Thirdparty{Third Party}
\gdef\Thirdparties{Third Parties}

% examples of use

% This assumes that \clientpl has already been set true or false
\def\arrangement{%
 \def\endofpleading{}
  \spleading{ARRANGEMENT}}

\def\soc{%
  \ifx\Writissued\empty\def\Writissued{Writ issued the \nodate}\fi
  \clientpltrue
  \pleading{STATEMENT OF CLAIM}}

\def\defence{%
 \let\Writissued\empty
 \clientplfalse
 \pleading{DEFENCE}}

\def\dacc{%
 \gdef\counterclaim{%
   \vskip\the\clskip
   \centerline{COUNTERCLAIM}
   \nobreak}
 \let\Writissued\empty
 \clientplfalse
 \pleading{DEFENCE AND COUNTERCLAIM}
 \smallskip
 \centerline{DEFENCE}
 \nobreak}

\def\counterclaim{% Counterclaim on its own
 \let\Writissued\empty
 \clientplfalse
 \pleading{COUNTERCLAIM}}

\def\reply{% Reply on its own
 \let\Writissued\empty
 \clientpltrue
 \pleading{REPLY}}

\def\rdcc{% Reply and Defence to Counterclaim
 \let\Writissued\empty
 \clientpltrue
 \pleading{REPLY AND DEFENCE TO COUNTERCLAIM}}

% County Court. Note: These macros do not yet reproduce
% all (or indeed any) of the batty prescribed forms, although
% it would not be difficult to achieve this.
% Most macros are the same as the HC macros

\def\poc{%
 \let\Writissued\empty
 \clientpltrue
 \pleading{PARTICULARS OF CLAIM}}

% The Affidavit macros. These are fairly complicated
% First, some general bits and pieces

\newtoks\shortinitials \shortinitials={}
\newtoks\tempinitials \tempinitials={}
\newtoks\surname \surname={} 
\newif\ifsomeletters \somelettersfalse
\newif\ifspace \spacefalse
\newif \ifpunct
\newtoks\firstletter \firstletter={}
\newif\ifmac \macfalse
\newtoks\longinitials \longinitials={}

\newcount\lettercount
\newcount\surnamecount
\newcount\front

\def\affyno#1{%
 \def\affno{\addsuffix{#1}}}
\affyno{1}% set 1st as default

% Now some stuff to extract initials from fullnames

\def\itsaspace{% 
\dbhelp{It is a space}%
  \ifsomeletters% 
    \edef\tin{\the\shortinitials\the\firstletter.}%
    \shortinitials=\expandafter{\tin}%
    \somelettersfalse\fi%
  \lettercount=0\surnamecount=0\relax\unskip}

\def\itsaletter#1{%
\dbhelp{It is a letter-"#1"}%
  \advance\lettercount by1% #1 is a letter
  \advance\surnamecount by1\relax%
  \ifnum\lettercount=1 \firstletter={#1}
   \someletterstrue\fi
  \ifnum\surnamecount=1\surname=\expandafter{#1}%
    \tempinitials=\expandafter{#1}%
  \else\ifnum\surnamecount>1%
    \tempinitials=\expandafter{\the\tempinitials#1}
    \maccheck{#1}%
  \fi\fi}

\def\maccheck#1{%
\dbhelp{Doing MacCheck}%
  \ta={Mc}
  \edef\tone{\the\ta}%
  \edef\ttwo{\the\tempinitials}%
  \ifx\tone\ttwo
    \mactrue
    \surname=\expandafter{\the\tempinitials}%
  \else\ifpunct\punctfalse\surname=\expandafter{\the\surname#1}%
   \firstletter=\expandafter{\the\firstletter#1}%
  \else\ifmac\macfalse\surname=\expandafter{\the\surname#1}%
    \firstletter=\expandafter{\the\tempinitials}%
  \else\surname=\expandafter{\the\surname\lowercase{#1}}%
  \fi\fi\fi}

\def\itspunctuation#1{%
\dbhelp{It is punctuation-"#1"}%
%\def\temppunct#1{\if#1\noexpand~-\else#1\fi}%
  \somelettersfalse
  \edef\tin{\the\tempinitials#1}
  \tempinitials=\expandafter{\tin}%
  \surname=\expandafter{\the\surname#1}%
  \someletterstrue
  \if#1\space\firstletter=\expandafter{\the\firstletter.}\else
   \firstletter=\expandafter{\the\firstletter#1}\fi
  \advance\surnamecount by1\puncttrue\relax}

\gdef\length#1{\lettercount=0\surnamecount=0
\unskip\ignorespaces\getlength#1!}

\gdef\getlength#1{%
\dbhelp{Character="#1"}
  \unskip\ignorespaces
  \if#1!
    \let\next=\relax
    \edef\tin{\the\shortinitials\the\firstletter.}%
    \longinitials=\expandafter{\tin}%
  \else% ie if not end of name
    \edef\fullname{\fullname#1}%
    \dbhelp{Fullname="\fullname"}%
    \ifcat\noexpand#1\noexpand~  \itsaspace\fi% 
    \if#1\noexpand_\itspunctuation{ }\else
     \ifcat#1-\itspunctuation{#1}\fi\fi%
    \ifcat#1a \itsaletter{#1}\fi%
    \let\next=\getlength%
 \fi% it is an exclamation mark
 \unskip\next}

\gdef\deponent{%
 \enddoc \endedtrue
 \def\clearexno{\exno=0 \front=0}%Use \setexno{n} to reset to other number.
 \shortinitials={}%reset the lot
 \surname={}
 \longinitials={}
  \def\of##1{\def\hisaddr{##1}%
  \ifx\hisaddr\empty\def\hisaddr{[{\it address\/}]}\fi}%
  \def\occupation##1{\def\hisoccupation{##1}%
  \ifx\hisoccupation\empty
    \def\hisoccupation{[{\it occupation\/}]}\fi
    \def\comma{, }}%
  \of{}\occupation{}% set up the defaults
  \def\nooccupation{\def\hisoccupation{}%
    \def\comma{}}%
  \catcode`\ =\active % Make spaces active ftb.
  \global\catcode`\_=\other % Make underlines into letters
  \let\tempt=~ \catcode`\~=\other \let\tilde=~ % check tilde
  \let\tempb=\blank \let\blank=\space
  \whatsnext}

\def\whatsnext#1{%
  \ifx#1\noname
   \shortinitials={\blank}%
   \surname={\blank\blank}%
   \longinitials={\blank\blank}%
   \def\fullname{\noname}%
  \else
   \edef\fullname{}%
   \length{#1}%
  \fi
  \def\depsname{\hbox{\ignorespaces%
    \the\shortinitials\space\the\surname}}%
  \xdef\inits{\the\longinitials}%
  \catcode`\ =10% reset the catcodes
  \catcode`\~=\active
  \catcode`\_=8
  \let~=\tempt
  \let\blank=\tempb
  \gdef\deplname{I, \fullname, of \hisaddr\comma 
   \hisoccupation, make oath and say as follows---}}

\def\affidavit{\par% Note: This does NOT set \clientpl
  \clearexno
  \draft{AFFIDAVIT}% This has been moved
  \gettitle
  \pleadingtrue
  \endorsementtrue
  \ifdraft
   \def\signoff{\endofpleading\settled}%
  \else\let\signoff\endofpleading\fi
  \def\endofpleading{%
    \bottomofpleading{\sworn}}%
  \ifdraft\else
    \def\doextras{\getfrontsheets\let\doextras\empty}
  \fi
  \endorsement
  \heading
  \sparties
  \deplname % produces I, etc, make oath, etc.
  \medskip}

\def\endorsement{\tlap{\rightline{%
 \baselineskip=13pt\tenbf\getendorsement}\medskip}}

\def\bsendorsement{\tlap{\xcenterline{%
 \baselineskip=10pt\ninebf\getendorsement}}}

\def\getendorsement{%
 \setbox0\hbox{Deponent}\dimen1=.4\wd0
 \setbox0\hbox{Party\hskip\dimen1\forwhom}\dimen2=\wd0
 \setbox0\hbox{Deponent\hskip\dimen1\depsname}%
  \ifdim\wd0>\dimen2 \dimen2=\wd0\fi
 \setbox0\hbox{No.\ of Affidavit\hskip\dimen1\affno}%
  \ifdim\wd0 >\dimen2 \dimen2=\wd0\fi
 \setbox0\hbox{Date Sworn\hskip\dimen1\whensworn}%
  \ifdim\wd0>\dimen2 \dimen2=\wd0\fi
 \vbox{%
  \hbox to \dimen2{Party\dotfill\ignorespaces\forwhom}%
  \hbox to \dimen2{Deponent\dotfill\ignorespaces\depsname}
  \hbox to \dimen2{No.\ of Affidavit\dotfill%
    \hbox{\ignorespaces\affno}}%
  \hbox to \dimen2{Date Sworn\dotfill\whensworn}%
 }}

\def\frontsheet#1{% Produces frontsheets for exhibits
  \vfil\eject
  \endorsement
  \heading
  \sparties
  \pageno=0
  \nopagenumbers
  \inform{Frontsheet for Exhibit "\inits \number#1"}%
  \vtop{\raggedright\uchyph=0
   This is the Exhibit marked ``\inits\,\number#1'' referred to 
   in the Affidavit of \fullname\ sworn before me this \nodate
   \vskip1.5in
   \hskip.6\hsize\nobreak Solicitor }%
  \vfil\eject}

\def\getfrontsheets{%
 \ifnum\exno=0
 \else
  \loop
  \advance\front by1
  \frontsheet{\number\front}%
  \ifnum\exno>\number\front\repeat
 \fi}

% End of affidavit macros


% Originating Summons - long form

%\gdef\os{%
% \topofpleading{ORIGINATING SUMMONS}{0}
% \def\endos{\bottomofpleading{\endostext}}
% \ostext}
%
% Originating Summons - short form 
%
% Minutes of Order
%
%\def\minutes{%
%  \topofpleading{MINUTES OF ORDER}{0}
%  \medskip
%  \centerline{MINUTES OF ORDER}
%  \medskip
%   {\scaps This Application}, \etc\par
%   {\scaps And Upon Hearing}, \etc\par
%   {\scaps And Upon Reading}, \etc\par}
%
\def\order{%
  \topofpleading{ORDER}{0}
  \medskip
  \centerline{ORDER}
  \medskip}

% Other macros take the same form. (More will be added.)

\def\statementofclaim{%
  \topofpleading{\amend STATEMENT OF CLAIM}{0}
  \medskip
  \centerline{\amend STATEMENT OF CLAIM}
 \par\nobreak\medskip}

\def\endwrittext{%
    {\scaps This Writ} was issued by \ignorespaces\sols \solicitors\ for 
    the said \plaintfs\ whose \addressis\ as stated above}

\def\endgenwrit{% This can be removed
%  \signature
   \bottomofpleading{%
    {\scaps This Writ} was issued by \ignorespaces\sols \solicitors\ for 
    the said \plaintfs\ whose \addressis\ as stated above}}

\def\sjsummons{% O.14. It may be necessary to set \clientpl
  \origprocess{SUMMONS}{\summarytext}{}{}{\endsummarytext}%
  }

\def\spsummons{% O.86. It may be necessary to set \clientpl
 \topofpleading{SUMMONS}{0}
 \specifictext}

\def\summons{% This is an ordinary summons
  \topofpleading{SUMMONS}{0}
  \summonstext}
 
\def\endsummons{%
  {\scaps Dated} \nodate
  \bottomofpleading{This Summons was taken out by\sols \solicitors\ for 
  the above-named \forwhom\par
  \medskip
  To the \notforwhom\ and to \theirsols, of \theirsolsaddr, Solicitors 
  for the above-named \notforwhom.}}

\def\defenceandcounterclaim{%
  \reset
  \def\doctype{DEFENCE AND COUNTERCLAIM}
  \pleadingtrue
  \clientplfalse
  \draftparameters
  \gettitle
  \def\backsheet{\enddoc\bsdft}
  \heading
  \parties
  \centerline{\amend DEFENCE}
  \medskip}

\def\reply{%
  \reset
  \def\doctype{\amend REPLY}
  \clientpltrue
  \heading
  \ifnoparties\else\parties\fi
  \centerline{\amend REPLY}
  \medskip}

\def\replyanddefencetocounterclaim{%
  \reset
  \def\doctype{\vtop{\hsize=2.5in
    \centertext{\amend REPLY AND DEFENCE 
    TO COUNTERCLAIM}}}
  \clientpltrue
  \heading
  \ifnoparties\else\parties\fi
  \centerline{\amend REPLY AND DEFENCE TO COUNTERCLAIM}
  \medskip
  \centerline{\amend REPLY}
  \medskip}

\def\counterclaim{% This is for use in a Defence & Counterclaim
  \bigbreak\centerline{\amend COUNTERCLAIM}\nobreak\medskip}

\def\particulars{\clno=0
  \par\smallskip\centerline{PARTICULARS}\par}

\def\served{%
  \bottomofpleading{%
  Served the \nodate by \ignorespaces\sols \solicitors\ 
  for the \dfdants}}

% backsheet macros

% Misc

\edef\workdone{}
\newtoks\tempwd \tempwd={}
\newdimen\bstopincrease \bstopincrease=.5in
\newdimen\bsbotincrease \bsbotincrease=.5in
\def\chittitle{%
  \slistpls\cr
  \ v.\cr
  \slistdfs\cr}
\newdimen\storeparindent

\def\osinhtext{LET\ignorespaces\getdefs\ attend 
  before Master \nomonth at Chancery Chambers, 
  Room No.\noday, Royal Courts of Justice, Strand, 
  London, WC2A2LL on a day to be fixed on the hearing 
  by the \plaintfs \getpls for the following relief, 
  that is to say---\par
\medskip}

\def\endosinhtext{And let the \dfdants\ within [14 days] 
  after service of this summons on \them\ counting the 
  day of service, return the accompanying Acknowledgment 
  of Service to the appropriate Court Office.\par
  \nobreak\smallskip
  Dated the \nodate

  {\bf Note---}This summons may not be served later than 12 
  calendar months beginning with the above date unless 
  renewed by order of the Court.\par
  \medskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the said \plaintfs\ whose \addressis\ as stated above
  \medskip

  {\bf Note---}If a defendant does not attend personally 
  or by his counsel or solicitor at the time and place 
  above-mentioned such order will be made as the Court may 
  think fit just and expedient.\par
  \medskip
  A defendant who is a personal representative must, 
  within 21 days after service of this summons on him, 
  counting the day of service, lodge with the court an 
  affidavit in answer, stating the particulars required by 
  Order 99, rule 5 of the Rules of the Supreme Court.\par
  \medskip
  \centerline{\bf IMPORTANT}\par\nobreak
  Directions for Acknowledgment of Service are given with the 
  accompanying form.\par
  }

\def\summarytext{% Spacing reduced to get it on one page
  \twelvebase=17pt\twelvepoint
  \smallskip
  {\scaps Let all parties} concerned attend \chambers\ 
  Royal Courts of Justice, Strand, London WC2A 2LL, 
  on  \phantom{[Mon]}day the \nodate\ at \noname on 
  the hearing of an application on the part of the \plaintfs\ 
  for the  relief claimed in the Statement of Claim
  \smallskip
  {\scaps Take Notice} that a party intending to oppose 
  this application or to apply for a stay of execution 
  should send to the opposite party or his Solicitor to 
  reach him not less than three days before the date 
  above mentioned a copy of any affidavit intended to be used.}

\def\endsummarytext{%
  {\scaps Dated} \nodate
  \smallskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the \plaintfs.
  \smallskip
  TO \noname, of \noaddr, \solicitors\ for the \dfdants.\par}

\def\specifictext{%
  \smallskip
  {\scaps Let all parties} concerned attend before Master
  \if\mast\empty\blank\blank\else\mast\ \fi
  at the Chambers of the Judge, Room No.~\phantom{100}, Royal
  Courts of Justice, Strand, London WC2A 2LL, on
  \phantom{Wednesday} the \nodate\ at \phantom{12}~o'clock in
  the \phantom{after}noon on the hearing of an application on
  the part of the \plaintfs\ for the following relief---

  \cl An order pursuant to Order 86 of the Rules of the Supreme Court 
  for specific performance of the agreement in the Writ in this action 
  mentioned in the terms of the Minutes set out in the Schedule hereto

  \cl All necessary and further inquiries and accounts

  \cl In the alternative Directions as to the pleading in and further 
  conduct of this action
  \schedule\par}

\def\summonstext{%
  {\scaps Let all parties} concerned attend before Master \blank
  at the Chambers of the Judge, Room No.~\phantom{100}, Royal
  Courts of Justice, Strand, London WC2A 2LL, on
  \phantom{Wednesday} the \nodate\ at \phantom{12}~o'clock in
  the \phantom{after}noon on the hearing of an application on
  the part of the \plaintfs\ for the following
  relief---\par\nobreak\medskip} 

\def\ostext{%
  TO\ignorespaces\getdefs
  \smallskip
  {\scaps Let The \expandafter{\dfdants}}\ within [14] days after 
  service of this summons on \them\ \respectively, counting the day 
  of service, return the accompanying Acknowledgment of Service 
  to the appropriate Court Office
  \smallskip
  {\scaps By This Summons}, which is issued on the application of the
  \plaintfs\unskip\space\getpls\unskip\space the \plaintfs\ \seek\ the 
  following relief, that is to say---\hfil\par}

\def\endostext{%
  If the \dfdants\ \do\ not acknowledge service, such judgment may 
  be given or order made against or in relation to \them\ as the 
  Court may think just and expedient
  \medskip
  Dated the \nodate
  \medskip
  {\bf Note}---This summons may not be served later than 4~calendar 
  months beginning with the above date unless renewed by order of 
  the Court.
  \medskip
  This summons was taken out by \ignorespaces\sols \solicitors\ 
  for the said \plaintfs\ whose \addressis\ as stated above
  \medskip
  \centerline{\bf IMPORTANT}\par\nobreak
  Directions for Acknowledgment of Service are given with the 
  accompanying form.\par
  }

\def\subjectmatter#1#2{%#1=matter,#2=text
  \global\advance\mattercount by1
  \rightappenditem{\scaps#1 \rm of} #2\to\matters}

\def\matter#1{\subjectmatter{In the Matter}{#1}}
\def\estate#1{\subjectmatter{In the Estate}{#1}}

\def\re#1{\nopartiestrue\def\res{\vbox{\hsize=2.8in
  \centertext{#1}}}}

% Set up the parties

\def\forwhom{\pltext\dftext%\unskip
  \ifclientpl\plaintfs\else\dfdants\fi}

\def\notforwhom{\pltext\dftext%\unskip
  \ifclientpl\dfdants\else\plaintfs\fi}

\newcount\ct % courts
\def\court{\ifcase\ct IN THE HIGH COURT OF JUSTICE
  \or IN THE \courtname\ COUNTY COURT
  \or IN THE COURT OF APPEAL
  \or IN THE HOUSE OF LORDS
  \else IN THE HIGH COURT OF JUSTICE
  \fi}

\def\highcourt{\ct=0}

\def\countycourt{%\ct=1 \div=0 \dref=0
  \morecountycourtdefaults\countycourtstuff\getcourtname}

\def\getcourtname{% adapted from \setupccrefs below
 \begingroup\obeylines
 \aftergroup\getnameofcase\casereferences}

\def\getnameofcase{%
 \def\dateref{}%
 \def\caseref{}%
 \def\courtname{\argument1}%
 }


\def\courtofappeal{\ct=2\def\appealtext{\courtofappealtrue}}
\def\houseoflords{\ct=3}

\newcount\div
\newcount\dref

\def\chancery{\div=1 \dref=1
  \def\divref{CH\ }
  \def\issuer{Chancery Chambers}
  \def\chambers{Master
  \if\mast\empty \blank
    \else\mast\ \fi in Chancery
  Chambers, Room No.\noday, }}

\def\queensbench{\div=2 \dref=2
  \def\divref{QB\ }
  \def\issuer{Central Office}
    \def\chambers{the Master in Chambers in Room No.\noday, 
  Central Office, }}

\def\familydivision{\div=3 \dref=3
  \def\divref{No.\ }
  \def\issuer{The Principal [{\it or\/} 
  \blank District Probate] Registry}
    \def\chambers{}}

\newcount\subdiv
\def\subdivision{\ifcase\subdiv 
  \or Companies Court
  \or Commercial Court
  \or Official Referee's Court
  \or The Principal [{\it or\/} \blank District Probate] 
    Registry
  \fi}
\def\companiescourt{\subdiv=1}
\def\commercialcourt{\subdiv=2}
\def\OR{\subdiv=3}
\def\probateregistry{\subdiv=4}

\def\mrjustice{}
\def\judge#1{\def\mrjustice{#1}}
\def\judgename{\if\mrjustice\empty\else Mr Justice \mrjustice\fi}

\def\mast{}
\def\master#1{\def\mast{#1}}
\def\mastername{\if\mast\empty\else Master \mast\fi}

\def\divref{\ifcase\dref 
  \or CH\
  \or QB\
  \or Fam.\
  \fi}

\def\dateref{\ifcountycourt\else\number\year\fi}
\def\caseref{\ifcountycourt\else --\phantom{A}--\fi}
\def\casenumber{No.~\phantom{1234}}
\def\issued{}
\def\writissued{}
\def\issued#1 #2 #3 {\def\writissued{%
  Writ issued the #1 day of #2 #3}}

\def\no#1 {\def\casenumber{No.\ #1}
  \def\dateref{}
  \def\caseref{}}

\def\reference{\divref\dateref\caseref\casenumber}

% Can't remember what these did...
%\def\sref#1{\def\sref{#1}}
%\def\cref#1{\creftrue\def\cref{#1}}

\def\attention#1{\def\attentionof{#1}}
\attention{}
\long\def\comment#1{\def\faxtext{\if#1\empty
 \else\medskip#1\fi}}
\comment{}

\def\backsheet{\enddoc\bsdft}% default
\let\beginos\os

% Here are all the default parameters set by LeXTeX---

\greektrue % Used in \sssscl
\cardtrue % Used in \ssssscl
\clindtrue % hanging indentation in clauses
\nocommaindatefalse % Comma in the date
\qfalse %  No quotes in quotations

\footindent=10pt % Indentation of footnotes
\clindent=23pt % Indentation of clauses
\sclindent=46pt % Indentation of sub-clauses
\ssclindent=69pt % Indentation of sub-sub-clauses
\sssclindent=92pt % Indentation of sub-sub-sub-clauses
\ssssclindent=115pt % Etc
\sssssclindent=138pt % Etc
\cnindent=65pt % indentation of "computer-numbered" clauses

\hclindent=0pt % Indentation of clauses if clindfalse
\hsclindent=\clindent % Ditto of sub-clauses
\hssclindent=\sclindent % Etc
\hsssclindent=\ssclindent
\hssssclindent=\sssclindent
\hsssssclindent=\ssssclindent

\parindent=20pt % indentation of paragraphs
\quoteindent=20pt % indentation of quotations
\quoteparindent=20pt % \parindent in a quotation
\rbracketsize=2.85in % The width of the \vbox used for \ssd etc
\lbracketsize=2.225in % The width of a left bracket \vbox
\brackdepth=.5in % The space left under "in the presence of---"
\hfuzz=1.5pt
\hsize=5.35in
\vsize=8.5in
\hoffset0.5in
\voffset.5in
\parskip=3pt plus .75pt minus .75pt
\def\footnoterule{}

\quoteparskip=1.5pt plus 1pt % The amount of \parskip in quotes
\blankskip=10pt plus20pt minus 0pt % Used in \noaddr etc
\signindent=3.5in % Indentation of signature 

\settledgap=1in plus.3fill minus.5in % v. space Settled, \inn
\clskip=\medskipamount % amount of skip before a clause
\sclskip=\smallskipamount % amount of skip before a \scl
\ssclskip=0pt plus1pt minus0pt % amount of skip before a \sscl
\sssclskip=0pt plus.5pt minus0pt % ditto before a \ssscl

\twelvebase=18pt % \normalbaselines in \twelvepoint
\tenbase=15pt    % \normalbaselines in \tenpoint
\ninebase=11pt   % \normalbaselines in \ninepoint

\twelvesmallskipamount=4.5pt plus1pt minus1pt
\twelvemedskipamount=9pt plus2pt minus2pt
\twelvebigskipamount=18pt plus4pt minus4pt
% The next three are set by PLAIN
%\tensmallskipamount=3pt plus1pt minus1pt
%\tenmedskipamount=6pt plus2pt minus 1pt
%\tenbigskipamount=12pt plus4pt minus4pt
\ninesmallskipamount=2pt plus.5pt minus.5pt
\ninemedskipamount=4pt plus1pt minus 1pt
\ninebigskipamount=8pt plus2pt minus 2pt

% The next three are used by xref/contents macros
\notespace=0.2in % space marginal notes--text
\maxnote=1.0in % width of note
\clnamelength=0pt % Default width in table of contents
\pagewidth=\hsize % used by the index macros
\pageheight=\vsize 

\def\against{and} % the "and" between parties in pleadings

\tolerance=750

\def\engrossment{%
 \draftfalse
 \def\csettled##1{}
 \def\cresettled##1{}}

\def\setexno#1{\def\clearexno{\exno=#1 \front=#1}\clearexno}

\countdef\totaldocuments=1 \totaldocuments=0
\countdef\totalpages=2 \totalpages=1

\def\advancepageno{\ifnum\pageno<\z@ \global\advance\pageno\m@ne
  \else\global\advance\pageno\@ne\fi
  \global\advance\totalpages\@ne}
  \output{\plainoutput}

\def\plainoutput{\ifnum\pageno=1 \global\advance\totaldocuments\@ne\fi
  \message{Shipping out page}
  \shipout\vbox{\makeheadline\pagebody\makefootline}%
  \inform{(\ifnum\pageno=0 Unnumbered page\else Page \the\pageno\fi
    \space of Document \the\totaldocuments, 
    Total of \the\totalpages\space\ifnum\totalpages=1 page\else pages\fi\space so far)}%  
  \inform{}%
  \advancepageno
  \ifnum\outputpenalty>-\@MM \else\dosupereject\fi}

\let\backmatter=\empty
\let\signoff=\empty

\def\bstitle#1{%
 \getbstitlewidth
 \def\title{\setbox0\hbox{#1}
  \ifdim\wd0<\bstitlewidth\copy0
   \else\vtop{\hsize=\bstitlewidth\centertext{#1}}\fi
 }} % used for backsheets

\newdimen\maxpartywidth 

% These slightly complicated macros were derived from some suggestions made
% by Amy Hendrickson in TUGboat Vol 11, No 3, p359.
% \default defines eg \argument1 to be parameter 2.
% Unfortunately it would not be possible to call \argument1 directly.
% It would be necessary to use \csname argument1\endcsname[parameter 2]
% The macro \argument gets round this difficulty; \argument{1} (or \argument1
% if there is only one token to be used) converts to \argument1 (all one word).
% So \argument12 converts to \argument1{2}. Clear?
          
\def\default#1#2{\expandafter\def\csname argument#1\endcsname{#2}}
\def\argument#1{\csname argument#1\endcsname}

\def\highcourtdefaults{%
 \resetpleadingdefaults
 \ct=0% I think this should be elsewhere
 \default1{\number\year}
 \default2{\phantom{W}}
 \default3{\phantom{4321}}
 \def\divref{CH~}
 }

% get rid of old defs
\def\dateref{}
\def\caseref{}
\def\casenumber{}

\def\probatedefaults{%
 \resetpleadingdefaults
 \default1{}
 \default2{}
 \default3{}
 \def\divref{File No.~}
 \def\sparties{}}

\def\countycourtdefaults{%
 \resetpleadingdefaults
 \default1{\phantom{1234}}
 \def\divref{}
 }

\def\morecountycourtdefaults{%
 \resetpleadingdefaults
 \default1{\phantom{BORCHESTER}}
 \def\divref{}
 }

\def\division{\ifcase\div% \blank Division
  \or Chancery Division%            1
  \or Queen's Bench Division%       2
  \or Family Division%              3
  \or\or\or\or\or\or\or%           10
  \or Chancery Division (Probate)% 11
  \else \blank Division
  \fi}

\def\chanceryp{\div=11 \dref=1
  \def\divref{CH\ }
  \def\issuer{Chancery Chambers}
  \def\chambers{Master
  \if\mast\empty \blank
    \else\mast\ \fi in Chancery
  Chambers, Room No.\noday, }}

\def\countycourtstuff{%
 \ct=1 \div=0 \dref=0
 \countycourttrue
 }%

\gdef\ch{%
  \pleadingtrue\highcourtdefaults
  \chancery\setuphcrefs}
\gdef\qb{%
  \pleadingtrue\highcourtdefaults
  \queensbench\setuphcrefs}
\gdef\family{%
  \pleadingtrue\highcourtdefaults
  \familydivision\setupfamrefs}
\gdef\case{%
  \pleadingtrue\countycourtdefaults
  \countycourtstuff\setupccrefs}
\gdef\chp{%
  \pleadingtrue\highcourtdefaults
  \chanceryp\setuphcrefs}
\def\probate{%
  \pleadingtrue\probatedefaults
  \familydivision\begingroup}

\def\setuphcrefs{% The \endgroup is given by \lookatarg
 \begingroup\obeylines
 \aftergroup\setuphighcourt\casereferences}

\def\setupfamrefs{% The \endgroup is given by \lookatarg
 \begingroup\obeylines
 \aftergroup\setupfamcourt\casereferences}

\def\setupccrefs{%
% \countycourtdefaults
 \begingroup\obeylines
 \aftergroup\setupcountycourt\casereferences}

\def\setuphighcourt{%
 \def\dateref{\argument1}%
 \def\caseref{---\argument2---}%
 \def\casenumber{No.~\argument3}%
 }

\def\setupfamcourt{%
 \def\dateref{\argument1}%
 \def\caseref{ of~\argument2}%
 \def\casenumber{}%
 }

\def\setupcountycourt{%
 \def\dateref{}%
 \def\caseref{}%
 \def\casenumber{Case No.~\argument1}%
 }

% Note: Do not concatenate the next two lines
% The end of line is the delimiter of #1 of \casereferences.
% roger is the delimiter of #1 of \lookatarg. See Amy Hendrickson's
% Article in TUGboat for an explanation.
 
{\obeylines\gdef\casereferences#1
{\expandafter\lookatarg#1 roger }}

\newcount\argcount \argcount=0
\def\endofargs{roger}

\def\lookatarg#1 {\def\thisarg{#1}
  \ifx\thisarg\empty \let\go\lookatarg\else
  \ifx\thisarg\endofargs\let\go\endgroup
  \else\unskip\advance\argcount by1
   \expandafter\xdef\csname argument\the\argcount\endcsname{\thisarg} 
  \let\go=\lookatarg
  \fi\fi
  \go}

\def\registry#1{%
  \gdef\regis{#1 Registry}}
\let\regis\empty


% Move the next def
\def\appealcourt{\def\apcourt{ON APPEAL FROM
                  \headingskip
                  \courtappealled}}
\let\apcourt\empty 

\newdimen\bstitlewidth 
\def\getbstitlewidth{\iffullsize\bstitlewidth=\hsize
 \else\bstitlewidth=.5\hsize\fi}

% add to counter too many backsheet in multiple affys
\newif\ifended

\def\datesworn#1{\def\whensworn{#1}}
\datesworn{~~/~~/\number\year}

\def\origprocess#1#2#3#4#5{%#1=text for \draft, #2=intro text,
% #3=heading of document, #4=signature (if used), #5=end text
  \enddoc
  \storeparindent=\the\parindent
  \global\parindent=0pt
  \draft{#1}
  \pleadingtrue
  \gettitle
  \heading
  \parties
  \def\endofpleading{#4\bottomofpleading{#5}}
  \ifdraft
   \def\signoff{\endofpleading\settled} % see \chit
  \else\let\signoff\endofpleading\fi
  \medbreak
  \leavevmode
  #2\par
  \centertext{#3}
  \nobreak
  \amendnote}

\gdef\os{%
  \origprocess{ORIGINATING SUMMONS}%
    {\ostext}{}{}{\endostext}}
  
\def\osinheritance{%
  \origprocess{ORIGINATING SUMMONS}%
    {\osinhtext}{}{}{\endosinhtext}}

\def\specialwrit{%
   \clientpltrue
   \origprocess{WRIT OF SUMMONS\break(SPECIALLY ENDORSED)}%
    {\writtext}{STATEMENT OF CLAIM}{\signature}{\endwrittext}}

\def\generalwrit{% No Statement of Claim
   \origprocess{WRIT OF SUMMONS\break(GENERALLY ENDORSED)}%
    {\writtext}{}{\signature}{\endwrittext}}

\def\writ{\specialwrit}

\def\pageparameters{
  \def\footnoterule{}
  \parindent=10pt
  \quoteindent=20pt
  \quoteparindent=10pt
  \twelvepoint
}

% These should be redefined in RHlocal
\def\myaddress{\ouraddress}
\def\ouraddress{}

\newif\iffax
\def\faxsheet{\faxtrue}

\def\printfaxsheet{%
  \amendtextfalse
  \gdef\doctype{Sent by Fax}
  \inform{\doctype}
  \draftparameters
  \draftfalse
  \getworkdone
  \let\backmatter\empty
  \let\signoff\empty
  \clindfalse
%  \begingroup
   \pageno=1
   \nopagenumbers
   \parindent=0pt
   \centerline{\caps Fax from \counselname}
   \centerline{\vtop{\baselineskip=13pt\halign{\hfil##\hfil\cr
      \myaddress\crcr}}\strut}
   \bigskip
   \leftline{\vtop{\tenpoint\halign{##\hfil\cr
      \today\cr
      \noalign{\medskip}
      Solicitors' Reference---\sref\cr
      Counsel's Reference---\cref\cr
      \if\attentionof\empty\else
       \noalign{\medskip}
       For the Attention of \attentionof\cr
      \fi
     }\strut}}
   \bigskip
   \ifpleading\def\title{\chittitle\hfil}\fi
   \centerline{\vtop{\halign{\hfil##\hfil\cr\title\crcr}}}
   \vfil
   \centerline{\caps This Fax Consists of \the\count1\ Pages}
     \centerline{\caps (including this page)}
   \faxtext
   \vfil
   \def\addressfile{solicitors}
    \getaddress
    \leftline{\vtop{\baselineskip=13pt
                   \halign{##\hfil\cr
                     \sols\crcr}
                   \strut}}
   \supereject
 %  \endgroup
   \faxfalse}

\font\eightsl=cmsl8
\font\eightit=cmti8

\def\ca{% \def\v has been moved since it caused spacing problems
\begingroup\it\frenchspacing % This deals with, eg. Ltd. and v.
}

\def\v{\unskip\/\ {\rm v}\maybespace}% taken out of \ca
\def\se{\unskip\/\endgroup\maybespace}% mod aftergroup

\def\signed{%
 \inform{signature}%
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

\def\jsigned{%
 \inform{signatures}%
 \par\nobreak
 \vskip1in plus 2fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 1fill minus1in}

\def\copysigned{%
 \par\nobreak
 \vskip.75in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \parindent0pt
  \hbox{\counselname}
  \hbox{\inn}
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

% These are defined twice! One should go...
\def\csettled#1{%
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}%
  \vskip 1in plus 2fill minus1in}

\def\cresettled#1{% Note the \par
 \par\nobreak
 \vskip1in plus 1fill
 \hbox{\hskip\signindent\vtop{%
  \advance\hsize by-\signindent
  \parindent0pt
  \raggedright\tolerance=1000
  Re-Settled, \ignorespaces#1
  \vskip\settledgap
  \inn
  \hbox{\today}}}%
 \vskip 1in plus 2fill minus1in}

\def\silenthyphen{\space}

\def\footnotemark{% One bracket deleted.
 \let\@sf\empty\relaxnext@\ifhmode\edef
 \@sf{\spacefactor\the\spacefactor}\/\fi
 \def\next@{\ifx[\next\let\next\nextii@\else
  \ifx"\next\let\next\nextiii@\else
  \let\next\nextiv@\fi\fi\next}% bracket deleted.
 \def\nextii@[##1]{\footmarkform@{##1}\@sf}%
 \def\nextiii@"##1"{{##1}\@sf}%
 \def\nextiv@{{\scriptfont0=\sevenrm % scriptfont changed to 7pt
  \global\advance\footmarkcount@\@ne
  \footmarkform@{\number\footmarkcount@}\@sf}}%
 \futurelet\next\next@}
\catcode`\@=\other

\def\instructions{%
 \getbstitlewidth
 \begingroup
 \def\doctype{INSTRUCTIONS TO COUNSEL} 
 \capacitytrue
 \bsparams
 \ifpleading
   \else\xcenterline{\underbar{DATED\hskip2in \number\year}}\vfil\fi
 \xcenterline{\vtop{\openup2\jot
     \halign{\hfil##\hfil\cr
 \title\crcr}}}
\vfil
   \headerfont
   \xcenterline{%
    \setbox0\hbox{\doctype}%
    \ifdim\wd0<\bstitlewidth\copy0
     \else\vtop{\hsize=\bstitlewidth\centertext{\doctype\strut}}%
     \fi}
  \rm
  \medskip
  \xcenterline{\formalcounselname}%
  \vfil\vfil
   \getaddress
   \halign{\def\temp{##}\xcenterline{\upperc{\temp}}\inform{::\temp::}\cr
  \sols\crcr}%
   \smallskip
   \xcenterline{\eightrm Solicitors' Reference: \sref}
   \xcenterline{{\eightrm Counsel's Reference: \col/\cref}}
 \supereject
 \endgroup}

\def\writecontents{\inform{Opening contents file: }%
 \immediate\openout\cont=\contentswritefile}

\def\minutes{%
  \spleading{MINUTES OF ORDER}
   {\scaps This Application}, \etc\par
   {\scaps And Upon Hearing}, \etc\par
   {\scaps And Upon Reading}, \etc\par}

\vbadness=5000 % No messages about underfull pages
\delimitershortfall=1pt
\delimiterfactor=999

% amend topofpleading to have 3 params, 3 being party.
\def\dovcert{\sdcert{M}}
\def\giftcert{\sdcert{L}}

\def\capacityfont{}
\def\capacity#1{\ifcapacity ({\capacityfont #1\/})\else\unskip\fi}

\def\beginparticulars{%
 \par
 \vskip\clskip
 \begingroup
  \clno=0
  \centerline{PARTICULARS}
  \par\nobreak}

\def\endparticulars{%
  \endgroup}

\def\writtext{%
 {\scaps To The \expandafter\uppercase{\dfdants}}%
 \unskip\space\getdefs\smallskip
 {\caps This Writ of Summons} has been issued against you by
 the \plaintfs\ \getpls\unskip\ in respect of the claim
 hereinafter set out. 
 \medskip
 Within 14 days after the service of this Writ on you,
 counting the day of service, you must either satisfy the
 claim or return to the Court Office mentioned below the
 accompanying {\scaps Acknowledgment of Service} stating
 therein whether you intend to contest these proceedings.
 \medskip
 If you fail to satisfy the claim or to return the
 Acknowledgment without stating therein an intention to
 contest the proceedings, the \plaintfs\ may proceed with the
 action and judgment may be entered against you forthwith
 without further notice.
 \medskip
 Issued from the \issuer\ of the High Court this \nodate
 \bigskip
 {\bf Note}---This Writ may not be served later than 4 calendar
 months beginning with that date unless renewed by order of
 the Court.
 \bigskip
 \centerline{\bf IMPORTANT}
 \nobreak\medskip
 Directions for Acknowledgement of Service are given with the
 accompanying form.\par
 \bigskip 
 %\vfil\penalty-5000\vfilneg
 \baselineskip=18pt
 \nobreak\smallskip\nobreak} % End of \writtext

% set up defaults
\bstitle{}
\solsref{}
\colsref{}           % Omit Counsel's initials
\timetaken{}         % hours
\casetype{}
\value{}             % omit pound sign
\difficulty{}        % out of 10
\proposedfee{}       % omit pound sign
\legalaidno{}
\comments{}

\def\Writissued{}
\maxpartywidth=4.5in % set \maxp@rtywidth. 
\def\amendnote{}
\def\amend{}
% Set up default in case no division is given.
\ch

\pleadingfalse % And reset this
\resetpleadingdefaults
\reset
\input rhlocal
\catcode`@=12
\normalnumbering
\twelvepoint