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
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
|
.\" This file is part of groff.
.\"
.\" groff is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU General Public License as published by
.\" the Free Software Foundation, either version 3 of the License, or
.\" (at your option) any later version.
.\"
.\" groff is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
.\" or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
.\" License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program. If not, see <http://www.gnu.org/licenses/>.
.
.\" Handle font requests with families, for instance in tbl(1) tables.
.if n \{\
. ftr CR B \" for a visible distinction from roman
. ftr CB B
. ftr CI I
. ftr CBI BI
. \" Redefine CW to use bold instead for a visible font change.
. als CW B
. \" The "document control settings" table imposes this minimum width.
. nr LL 87n
.\}
.\" This document doesn't require the minus sign (in Times) but we do
.\" want a copy- and-pastable hyphen-minus.
.ie '\*[.T]'cp1047' .char \- \N'96'
.el .char \- \N'45'
.\" A very limited output device might not have a dagger glyph.
.fchar \[dg] *
.nr PS 11
.nr VS 13
.ds FR 1
.nr TC-MARGIN \w'00' \" expect 2-digit page numbers at most
.ie t .nr PI 3.5n
.el .nr PI 4n
.ND May 2023
.EH '%''May 2023'
.EF ''''
.OH 'Using \f[I]groff\f[] with the \f[I]ms\f[] macros''%'
.OF ''''
.TL
Using
.BI groff
with the
.BI ms
Macro Package
.AU
Larry Kollar
.AI
kollar@alltel.net
.AU
G.\& Branden Robinson
.AI
g.branden.robinson@gmail.com
.AB no
The
.I ms
(\[lq]manuscript\[rq]) package is suitable for the composition of
letters,
memoranda,
reports,
and books.
.
These
.I groff
macros feature cover page and table of contents generation,
automatically numbered headings,
several paragraph styles,
a variety of text styling options,
footnotes,
and multi-column page layouts.
.
.I ms
supports the
.I tbl ,
.I eqn ,
.I pic ,
and
.I refer
preprocessors for inclusion of tables,
mathematical equations,
diagrams,
and standardized bibliographic citations.
.
This implementation is mostly compatible with the documented interface
and behavior of AT&T Unix Version\~7
.I ms .
.
Many extensions from 4.2BSD (Berkeley)
.\" Few changes were made in 4.3, Tahoe, Reno, or 4.4.
and Tenth Edition Research Unix have been recreated.
.AE
.
.
.\" ------------------------- End of cover page ------------------------
.NH 1
Introduction
.XS
Introduction
.XE
.
.
.LP
The
.I ms
macros are the oldest surviving package for
.I roff
systems.\**
.
.FS
While manual
.I pages
are older,
early ones used macros supplanted by the
.I man
package of Seventh Edition Unix (1979).
.
.I ms
shipped with Sixth Edition (1975) and was documented by Mike Lesk in a
Bell Labs internal memorandum.
.FE
.
While the
.I man
package was designed for brief reference documents,
the
.I ms
macros are also suitable for longer works intended for printing and
possible publication.
.
.
.PP
In this document,
a right arrow (\[->]) is used to indicate a tab character in the input.
.
.
.KS
.NH 2
Basic information
.XS
Basic information
.XE
.
.
.LP
.I ms
documents are plain text files;
prepare them with your preferred text editor.
.
If you're in a hurry to start,
know that
.I ms
needs one of its macros called at the beginning of a document so that it
can initialize.
.
A
.I macro
is a formatting instruction to
.I ms.
.
Put a macro call on a line by itself.
.
Use
.CW .PP
if you want your paragraph's first line to be indented,
or
.CW .LP
if you don't.
.KE
.
.
.PP
After that,
start typing normally.
.
It is a good practice to start each sentence on a new line,
or to put two spaces after sentence-ending punctuation,
so that the formatter knows where the sentence boundaries are.
.
You can separate paragraphs with further paragraphing macro calls,
or with blank lines,
and you can indent with tabs.
.
When you need one of the features mentioned earlier,
return to this manual.
.
.
.PP
Format the document with the
.I groff (1)
command.
.
.I nroff (1)
can be useful for previewing.
.
.
.if n .ftr TI I
.TS
box center;
Lf(CR)1 Lf(CB).
$ editor radical.ms \f[TI]# vim, emacs, .\|.\|.
$ nroff -ww -z -ms radical.ms \f[TI]# check for errors
$ nroff \-ms radical.ms | less \-R
$ groff \-T pdf \-ms radical.ms > radical.pdf
$ see radical.pdf \f[TI]# or your favorite PDF viewer
.TE
.if n .ftr TI
.
.
.PP
Our
.CW radical.ms
document might look like this.
.
.
.TS
box center;
Lf(CR).
\&.LP
Radical novelties are so disturbing that they tend to be
suppressed or ignored, to the extent that even the
possibility of their existence in general is more often
denied than admitted.
.sp
\[->]That\[aq]s what Dijkstra said, anyway.
.TE
.
.
.LP
.I ms
exposes many aspects of document layout to user control via
.I groff 's
.I registers
and
.I strings,
which store numbers and text,
respectively.
.
Measurements in
.I groff
are expressed with a suffix called a
.I "scaling unit."
.
.
.TS
box center;
cb cb
cf(CR) l .
Scaling unit Description
_
i inches (\[sd])
c centimeters
p points (1/72\[sd])
P picas (1/6\[sd])
v \[lq]vees\[rq]; current vertical spacing
m \[lq]ems\[rq]; width of an \[lq]M\[rq] in the current font
n \[lq]ens\[rq]; one-half em
.TE
.
.
.PP
Set registers with the
.CW nr
request
and strings with the
.CW ds
request.
.
.I Requests
are like macro calls;
they go on lines by themselves and start with the
.I "control character,"
a dot
.CW . ). (
.
The difference is that they directly instruct the formatter program,
rather than the macro package.
.
We'll discuss a few as applicable.
.
It is wise to specify a scaling unit when setting any register that
represents a length,
size,
or distance.
.
.
.TS
box center;
lf(CR).
\&.nr PS 10.5p \[rs]" Use 10.5\-point type.
\&.ds FAM P \[rs]" Use Palatino font family.
.TE
.
.
.LP
In the foregoing,
we see that
.CW \[rs]"
begins a comment.
.
This is an example of an
.I "escape sequence,"
the other kind of formatting instruction.
.
Escape sequences can appear anywhere.
.
They begin with the escape character
.CW \[rs] ) (
and are followed by at least one more character.
.
.I ms
documents like this one tend to use only a few of
.I groff 's
many requests and escape sequences;
see the
.I groff (7)
man page for complete lists.
.
.
.TS
box center;
Cb Cb
Lf(CR) Lx .
Escape sequence Description
_
\[rs]" Begin comment; ignore remainder of line.
\[rs]n[\f[I]reg\f[]] T{
Interpolate value of register
.I reg .
T}
\[rs]*[\f[I]str\f[]] T{
Interpolate contents of string
.I str .
T}
\[rs]*\f[I]s T{
abbreviation of
.CW \[rs]*[\f[I]s\f[]] ;
the name
.I s
must be only one character
T}
\[rs][\f[I]char\f[]] T{
Interpolate glyph of special character named
.I char .
T}
\[rs]& non-printing, zero-width dummy character
\[rs]\[ti] T{
Insert an unbreakable space of adjustable width like a normal space.
T}
\[rs]| T{
Move horizontally by one-sixth em
(\[lq]thin space\[rq]).
T}
.TE
.
.
.PP
Prefix any words that start with a dot
.CW .\& ) (
or neutral apostrophe
.CW \[aq] ) (
with
.CW \[rs]&
if they are at the beginning of an input line
(or might become that way in editing)
to prevent them from being interpreted as macro calls or requests.
.
Suffix
.CW . ,
.CW ? ,
and
.CW !\&
with
.CW \[rs]&
when needed to cancel end-of-sentence detection.
.
.
.TS
box center;
lf(CR).
My exposure was \[rs]&.5 to \[rs]&.6 Sv of neutrons, said Dr.\[rs]&
Wallace after the criticality incident.
.TE
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
General structure of an
.BI ms
document
.XS
General structure of an
.I ms
document
.XE
.
.
.LP
The
.I ms
macro package expects a certain amount of structure:
a well-formed document contains at least one paragraphing or heading
macro call.
.
Longer documents have a structure as follows.
.
.
.IP "\fBDocument type\fP"
Calling the
.CW RP
macro at the beginning of your document puts the document description
(see below)
on a cover page.
.
Otherwise,
.I ms
places this information
(if any)
on the first page,
followed immediately by the body text.
.
Some document types found in other
.I ms
implementations are specific to AT&T or Berkeley,
and are not supported by
.I "groff ms" .
.
.
.IP "\fBFormat and layout\fP"
By setting registers and strings,
you can configure your document's typeface,
margins,
spacing,
headers and footers,
and footnote arrangement.
.
See section \[lq]Document control settings\[rq] below.
.
.
.IP "\fBDocument description\fP"
A document description consists of any of:
a title,
one or more authors' names and affiliated institutions,
an abstract,
and a date or other identifier.
.
See section \[lq]Document description macros\[rq] below.
.
.
.IP "\fBBody text\fP"
The main matter of your document follows its description
(if any).
.
.I ms
supports highly structured text consisting of paragraphs interspersed
with multi-level headings
(chapters,
sections,
subsections,
and so forth)
and augmented by lists,
footnotes,
tables,
diagrams,
and similar material.
.
See section \[lq]Body text\[rq] below.
.
.
.IP "\fBTables of contents\fP"
Macros enable the collection of entries for a table of contents
(or index)
as the material they discuss appears in the document.
.
You then call a macro to emit the table of contents at the end of
your document.
.
The table of contents must necessarily follow the rest of the text since
GNU
.I troff
is a single-pass formatter;
it thus cannot determine the page number of a division of the text until
it has been set and output.
.
Since
.I ms
output was designed for the production of hard copy,
the traditional procedure was to manually relocate the pages containing
the table of contents between the cover page and the body text.
.
Today,
page resequencing is more often done in the digital domain.
.
An index works similarly,
but because it typically needs to be sorted after collection,
its preparation requires separate processing.
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Document control settings
.XS
Document control settings
.XE
.
.
.LP
The document parameters below are presented in the syntax
used to interpolate their values.
.
For any unsatisfactory default,
define its register,
string,
or special character before calling any
.I ms
macro other than
.CW RP .
.
The \[lq]Next\[rq] heading indicates that changes to the parameter are
effective as of the next new element processed of the listed type.
.
For entries marked
.I special ,
see the discussion in the applicable section.
.
.
.TS H
box;
cb | cb cb cb cb
l | lf(CR)p-1 lx l lf(CR)p-1.
Type Parameter Definition Next Default
_
.TH
Margins \[rs]n[PO] Page offset (left margin) page\
1i (0)\*{*\*}
\^ \[rs]n[LL] Line length paragraph \
6.5i (65n)\*{*\*}
\^ \[rs]n[LT] Title line length paragraph \
6.5i (65n)\*{*\*}
\^ \[rs]n[HM] Top (header) margin page 1i
\^ \[rs]n[FM] Bottom (footer) margin page 1i
_
T{
Titles
.br
(headers,
.br
footers)
T} \[rs]*[LH] Left header text header \f[I]empty
\^ \[rs]*[CH] Center header text header \-\[rs]n[%]\-
\^ \[rs]*[RH] Right header text header \f[I]empty
\^ \[rs]*[LF] Left footer text footer \f[I]empty
\^ \[rs]*[CF] Center footer text footer \f[I]empty
\^ \[rs]*[RF] Right footer text footer \f[I]empty
_
Text \[rs]n[PS] Type (point) size paragraph 10p
\^ \[rs]n[VS] Vertical spacing paragraph 12p
\^ \[rs]n[HY] Hyphenation mode paragraph 6
\^ \[rs]*[FAM] Font family paragraph T
_
Paragraphs \[rs]n[PI] Indentation paragraph 5n
\^ \[rs]n[PD] Paragraph distance (spacing) paragraph\
0.3v \f[R](\f[]1v\f[R])\*{\[dg]\*}
\^ \[rs]n[QI] Quotation indentation paragraph 5n
\^ \[rs]n[PORPHANS] # of initial lines kept paragraph\
1
_
Headings \[rs]n[PSINCR] Type (point) size increment\
heading 1p
\^ \[rs]n[GROWPS] Size increase depth limit heading 0
\^ \[rs]n[HORPHANS] # of following lines kept\
heading 1
\^ \[rs]*[SN\-STYLE] Numbering style (alias) heading\
\[rs]*[SN\-DOT]
_
Footnotes \[rs]n[FI] Indentation footnote 2n
\^ \[rs]n[FF] Format footnote 0
\^ \[rs]n[FPS] Type (point) size footnote\
\[rs]n[PS]\-2p
\^ \[rs]n[FVS] Vertical spacing footnote\
\[rs]n[FPS]+2p
\^ \[rs]n[FPD] Paragraph distance (spacing) footnote\
\[rs]n[PD]/2
\^ \[rs]*[FR] Line length ratio \f[I]special 11/12
_
Displays \[rs]n[DD] Display distance (spacing)\
\f[I]special 0.5v \f[R](\f[]1v\f[R])\*{\[dg]\*}
\^ \[rs]n[DI] Display indentation \f[I]special 0.5i
_
Other \[rs]n[MINGW] Minimum gutter width page 2n
\^ \[rs]n[TC\-MARGIN] TOC page number margin width\
\f[CR]PX\f[] call \[rs]w\[aq]000\[aq]
\^ \[rs][TC\-LEADER] TOC leader character\
\f[CR]PX\f[] call .\[rs]h\[aq]1m\[aq]
.TE
.
.
.IP \*{*\*}
Defaults vary by output device and paper format;
the values shown are for typesetters using U.S.\& letter paper,
and then terminals.
.
See section \[lq]Paper format\[rq] of the
.I groff (1)
man page.
.
.
.IP \*{\[dg]\*}
The
.CW PD
and
.CW DD
registers use the larger value if the vertical motion quantum of the
output device is too coarse for the smaller one;
usually,
this is the case only for output to terminals and emulators thereof.
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Document description macros
.XS
Document description macros
.XE
.
.
.LP
Only the simplest document lacks a title.\**
.
.FS
Distinguish a document title from \[lq]titles\[rq],
which are what
.I roff
systems call headers and footers collectively.
.FE
.
As its level of sophistication
(or complexity)
increases,
it tends to acquire a date of revision,
explicitly identified authors,
sponsoring institutions for authors,
and,
at the rarefied heights,
an abstract of its content.
.
By default,
.I ms
arranges most of the document description
(the title,
author names and institutions,
and abstract,
but not the date)
at the top of the first page.
.
.
.PP
Define these data by calling the macros below in the order shown;
.CW .DA
or
.CW .ND
can be called to set the document date
(or other identifier)
at any time before (a) the abstract,
if present,
or (b) its information is required in a header or footer.
.
Use of these macros is optional,
except that
.CW .TL
is mandatory if any of
.CW .RP ,
.CW .AU ,
.CW .AI ,
or
.CW .AB
is called,
and
.CW .AE
is mandatory if
.CW .AB
is called.
.
.
.TS H
box;
lb lb
lf(CR) lx.
Macro Description
_
.TH
\&.RP \f[R][\f[I]option\f[] .\|.\|.] T{
Use the \[lq]report\[rq]
(AT&T: \[lq]released paper\[rq])
format for your document,
creating a separate cover page.
.
If the optional
.CW no\-\:\%repeat\-\:\%info
argument is given,
.I ms
produces a cover page but does not repeat any of its information
subsequently
(but see the
.CW DA
macro below regarding the date).
.
Normally,
.CW .RP
sets the page number following the cover page to\~1.
.
Specifying the optional
.CW no\-\:\%renumber
argument suppresses this alteration.
.
Optional arguments can occur in any order.
.
.CW no
is recognized as a synonym of
.CW no\-\:\%repeat\-\:\%info
for AT&T compatibility.
T}
_
\&.TL T{
Specify the document title.
.
.I ms
collects text on input lines following this call into the title
until reaching
.CW .AU ,
.CW .AB ,
or a heading or paragraphing macro call.
T}
_
\&.AU T{
Specify an author's name.
.
.I ms
collects text on input lines following this call into the author's name
until reaching
.CW .AI ,
.CW .AB ,
another
.CW .AU ,
or a heading or paragraphing macro call.
.
Call it repeatedly to specify multiple authors.
T}
_
\&.AI T{
Specify the preceding author's institution.
.
An
.CW .AU
call is usefully followed by at most one
.CW .AI
call;
if there are more,
the last
.CW .AI
call controls.
.
.I ms
collects text on input lines following this call into the author's
institution until reaching
.CW .AU ,
.CW .AB ,
or a heading or paragraphing macro call.
T}
_
\&.DA \f[R][\f[I]x\f[] .\|.\|.\&] T{
Typeset the current date,
or any
.I x , arguments\~
in the center footer,
and,
if
.CW .RP
is also called,
left-aligned at the end of the document description on the cover page.
T}
_
\&.ND \f[R][\f[I]x\f[] .\|.\|.\&] T{
Typeset the current date,
or any
.I x , arguments\~
if
.CW .RP
is also called,
left-aligned at the end of the document description on the cover page.
.
This is
.I "groff ms" 's
default.
T}
_
\&.AB \f[R][\f[]no\f[R]] T{
Begin the abstract.
.
.I ms
collects text on input lines following this call into the abstract
until reaching an
.CW .AE
call.
.
By default,
.I ms
places the word \[lq]ABSTRACT\[rq] centered and in italics above the
text of the abstract.
.
The optional argument
.CW no
suppresses this heading.
T}
_
\&.AE End the abstract.
.TE
.
.
.KS
.LP
An example document description,
using a cover page,
follows.
.
.
.\" Wrap lines in the code example below at 64 columns.
.TS
box center;
l.
T{
.nf
.CW
\&.RP
\&.TL
The Inevitability of Code Bloat in Commercial and Free Software
\&.AU
J.\[rs]& Random Luser
\&.AI
University of West Bumblefuzz
\&.AB
This report examines the long-term growth of the code bases in
two large,
popular software packages;
the free Emacs and the commercial Microsoft Word.
While differences appear in the type or order of features added,
due to the different methodologies used,
the results are the same in the end.
\&.PP
The free software approach is shown to be superior in that while
free software can become as bloated as commercial offerings,
free software tends to have fewer serious bugs and the added
features are more in line with user demand.
\&.AE
.R
\&.\|.\|.\|the rest of the paper\|.\|.\|.
.fi
T}
.TE
.KE
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Body text
.XS
Body text
.XE
.
.
.LP
A variety of macros,
registers,
and strings can be used to structure and style the body of your
document.
.
They organize your text into
paragraphs,
headings,
footnotes,
and inclusions of material such as tables and figures.
.
.
.KS
.NH 2
Text settings
.XS
Text settings
.XE
.
.
.LP
The
.CW FAM
string,
a GNU extension,
sets the font family for body text;
the default is
.CW T \[rq]. \[lq]
.
The
.CW PS
and
.CW VS
registers set the type size and vertical spacing
(distance between text baselines),
respectively.
.
The font family and type size are ignored on terminal devices.
.
Setting these parameters before the first call of a heading,
paragraphing,
or (non-date) document description macro also applies them to headers,
footers,
and
(for
.CW FAM )
footnotes.
.
.
.PP
Which font families are available depends on the output device;
as a convention,
.CW T
selects a serif family (\[lq]Times\[rq]),
.CW H
a sans-serif family (\[lq]Helvetica\[rq]),
and
.CW C
a monospaced family (\[lq]Courier\[rq]).
.
The man page for the output driver documents its font repertoire.
.
Consult the
.I groff (1)
man page for lists of available output devices and their drivers.
.
.
.PP
The
.CW HY
register defines the automatic hyphenation mode used with the
.CW hy
request.
.
Setting
.CW \[rs]n[HY]
.CW 0 "" to\~
is equivalent to using the
.CW nh
request.
.
This is a Tenth Edition Research Unix extension.
.KE
.
.
.KS
.NH 2
Typographical symbols
.XS
Typographical symbols
.XE
.
.
.LP
.I ms
provides a few strings to obtain typographical symbols not easily
entered with the keyboard.
.
These and many others are available as special character escape
sequences\*[-]see
the
.I groff_char (7)
man page.
.
.TS
box center;
cb lb
Lf(CR) Lx.
String Description
_
\[rs]*[\-] Interpolate an em dash.
_
\[rs]*[Q] T{
Interpolate typographer's quotation marks where available,
and neutral double quotes otherwise.
.
.CW \[rs]*[Q]
is the left quote and
.CW \[rs]*[U]
the right.
T}
\[rs]*[U] \^
.TE
.KE
.
.
.KS
.NH 2
Paragraphs
.XS
Paragraphs
.XE
.
.
.LP
Paragraphing macros
.I break ,
or terminate,
any pending output line so that a new paragraph can begin.
.
Several paragraph types are available,
differing in how indentation
applies to them:
to left,
right,
or both margins;
to the first output line of the paragraph,
all output lines,
or all but the first.
.
All paragraphing macro calls cause the insertion of vertical space in
the amount stored in the
.CW PD
register,
except at page or column breaks.
.
Alternatively,
a blank input line breaks the output line and vertically spaces by one
vee.
.KE
.
.
.PP
The
.CW PORPHANS
register defines the minimum number of initial lines of any paragraph
that must be kept together to avoid isolated lines at the bottom of a
page.
.
If a new paragraph is started close to the bottom of a page,
and there is insufficient space to accommodate
.CW \[rs]n[PORPHANS]
lines before an automatic page break,
then a page break is forced before the start of the paragraph.
.
This is a GNU extension.
.
.
.TS H
box;
lb lb
lf(CR) lx.
Macro Description
_
.TH
\&.LP Set a paragraph without any (additional) indentation.
_
\&.PP T{
Set a paragraph with a first-line left indentation of
.CW \[rs]n[PI] .
T}
_
\&.IP \f[R][\f[I]marker\f[] [\f[I]width\f[]]] T{
Set a paragraph with a left indentation.
.
The optional
.I marker
is not indented and is empty by default.
.
It has several applications;
see subsection \[lq]Lists\[rq] below.
.
.I width
overrides the indentation amount in
.CW \[rs]n[PI] ;
its default unit is
.CW n \[rq]. \[lq]
.
Once specified,
.I width
applies to further
.CW .IP
calls until specified again or a heading or different paragraphing macro
is called.
T}
_
\&.QP T{
Set a paragraph indented from both left and right margins by
.CW \[rs]n[QI] .
T}
_
T{
\&.QS
.br
\&.QE
T} T{
Begin
.CW QS ) (
and end
.CW QE ) (
a region where each paragraph is indented from both margins by
.CW \[rs]n[QI] .
.
The text between
.CW .QS
and
.CW .QE
can be structured further by use of other paragraphing macros.
T}
_
\&.XP T{
Set an \[lq]exdented\[rq] paragraph\[em]one with a left indentation of
.CW \[rs]n[PI]
on every line
.I except
the first
(also known as a hanging indent).
.
This is a Berkeley extension.
T}
.TE
.
.
.KS
.PP
The following example illustrates the use of paragraphing macros.
.
.
.TS
box center;
l.
T{
.nf
.CW
\&.NH 2
Cases used in the 2001 study
\&.LP
Two software releases were considered for this report.
\&.PP
The first is commercial software;
the second is free.
\&.IP \[rs][bu]
Microsoft Word for Windows,
starting with version 1.0 through the current version
(Word 2000).
\&.IP \[rs][bu]
GNU Emacs,
from its first appearance as a standalone editor through the
current version (v20).
See [Bloggs 2002] for details.
\&.QP
Franklin\[aq]s Law applied to software:
software expands to outgrow both RAM and disk space over time.
\&.SH
Bibliography
\&.XP
Bloggs, Joseph R.,
\&.I "Everyone\[aq]s a Critic" ,
Underground Press, March 2002.
A definitive work that answers all questions and criticisms
about the quality and usability of free software.
.R
.fi
T}
.TE
.KE
.
.
.KS
.NH 2
Headings
.XS
Headings
.XE
.
.
.LP
Use headings to create a hierarchical structure for your document.
.
The
.I ms
macros print headings in
.B bold
using the same font family and,
by default,
type size as the body text.
.
Headings are available with and without automatic numbering.
.
Text on input lines following the macro call becomes the heading's
title.
.
Call a paragraphing macro to end the heading text and start the
section's content.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.NH [\f[I]depth\f[]] T{
Set an automatically numbered heading.
.
.I ms
produces a numbered heading in the form
.CW
.I a .\c
.I b .\c
.R
.I c .\|.\|.,
to any level desired,
with the numbering of each depth increasing automatically and being
reset to zero when a more significant depth increases.
.
\[lq]1\[rq]\~is the most significant or coarsest division of the
document.
.
Only non-zero values are output.
.
If
.I depth
is omitted,
it is taken to be
.CW 1 .
.
If you specify
.I depth
such that an ascending gap occurs relative to the previous
.CW NH
call\[em]that is,
you \[lq]skip a depth\[rq],
as by
.CW ".NH\~1" \[rq] \[lq]
and then
.CW ".NH\~3" \[rq]\c \[lq]
.I "groff ms" "" \[em]
emits a warning on the standard error stream.
T}
\&.NH S \f[I]heading-depth-index\f[]\f[R] .\|.\|.\f[] T{
Alternatively,
you can give
.CW NH
a first argument
.CW S , of\~
followed by integers to number the heading depths explicitly.
.
Further automatic numbering,
if used,
resumes using the specified indices as their predecessors.
.
.\" Although undocumented in Tuthill's 4.2BSD ms.diffs paper...
This feature is a Berkeley extension.
T}
.TE
.KE
.
.
.PP
An example may be illustrative.
.
.
.TS
box center;
cb | cb
lf(CR) | lB.
Input Result
_
T{
.nf
\&.NH 1
Animalia
\&.NH 2
Arthropoda
\&.NH 3
Crustacea
\&.NH 2
Chordata
\&.NH S 6 6 6
Daimonia
\&.NH 1
Plantae
.fi
T} T{
.nf
1. Animalia
.sp
1.1. Arthropoda
.sp
1.1.1. Crustacea
.sp
1.2. Chordata
.sp
6.6.6. Daimonia
.sp
7. Plantae
.fi
T}
.TE
.
.
.PP
After
.CW .NH
is called,
the assigned number is made available in the strings
.CW SN\-DOT
(as it appears in a printed heading with default formatting,
followed by a terminating period)
and
.CW SN\-NO\-DOT
(with the terminating period omitted).
.
These are GNU extensions.
.
.
.PP
You can control the style used to print numbered headings by defining an
appropriate alias for the string
.CW SN\-STYLE .
.
By default,
.CW \[rs]*[SN\-STYLE]
is aliased to
.CW \[rs]*[SN\-DOT] .
.
If you prefer to omit the terminating period from numbers appearing in
numbered headings,
you may define the alias as follows.
.
.
.TS
box center;
lf(CR).
\&.als SN\-STYLE SN\-NO\-DOT
.TE
.
.
.LP
Any such change in numbering style becomes effective from the next use
of
.CW .NH
following redefinition of the alias for
.CW \[rs]*[SN\-STYLE] .
.
The formatted number of the current heading is available in
.CW \[rs]*[SN]
(a feature first documented by Berkeley),
which facilitates its inclusion in,
for example,
table captions,
equation labels,
and
.CW .XS /\c
.CW .XA /\c
.CW .XE
table of contents entries.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.SH [\f[I]depth\f[]] T{
Set an unnumbered heading.
.
The optional
.I depth
argument is a GNU extension indicating the heading depth corresponding
to the
.I depth
argument of
.CW .NH .
.
It matches the type size at which the heading is set to that of a
numbered heading at the same depth when the
.CW \[rs]n[GROWPS]
and
.CW \[rs]n[PSINCR]
heading size adjustment mechanism is in effect.
T}
.TE
.
.
.PP
The
.CW PSINCR
register defines an increment in type size to be applied to a heading at
a lesser depth than that specified in
.CW \[rs]n[GROWPS] .
.
The value of
.CW \[rs]n[PSINCR]
should be specified in points with the
.CW p
scaling unit and may include a fractional component;
for example,
.
.
.TS
box center;
lf(CR).
\&.nr PSINCR 1.5p
.TE
.
.
.LP
sets a type size increment of 1.5 points.
.
.
.PP
The
.CW GROWPS
register defines the heading depth above which the type size increment
set by
.CW \[rs]n[PSINCR]
becomes effective.
.
For each heading depth less than the value of
.CW \[rs]n[GROWPS] ,
the type size is increased by
.CW \[rs]n[PSINCR] .
.
Setting
.CW \[rs]n[GROWPS]
to a value less than\~2 disables the incremental heading size feature.
.
.
.PP
In other words,
if the value of
.CW GROWPS
register is greater than the
.I depth
argument to a
.CW .NH
or
.CW .SH
call,
the type size of a heading produced by these macros increases by
.CW \[rs]n[PSINCR]
units over
.CW \[rs]n[PS]
multiplied by the difference of
.CW \[rs]n[GROWPS]
and
.I depth .
.
.
For example,
the sequence
.
.TS
box center;
lf(CR).
\&.nr PS 10
\&.nr GROWPS 3
\&.nr PSINCR 1.5p
\&.NH 1
Carnivora
\&.NH 2
Felinae
\&.NH 3
Felis catus
\&.SH 2
Machairodontinae
.TE
.
.
.LP
will cause \[lq]1. Carnivora\[rq] to be printed in 13-point text,
followed by \[lq]1.1. Felinae\[rq] in 11.5-point text,
while \[lq]1.1.1. Felis catus\[rq] and all more deeply nested headings
will remain in the 10-point text specified by the
.CW PS
register.
.
\[lq]Machairodontinae\[rq] is printed at 11.5 points,
since it corresponds to heading depth\~2.
.
.
.PP
The
.CW \[rs]n[HORPHANS]
register operates in conjunction with the
.CW NH
and
.CW SH
macros to inhibit the printing of isolated headings at the bottom of a
page;
it specifies the minimum number of lines of the subsequent paragraph
that must be kept on the same page as the heading.
.
If insufficient space remains on the current page to accommodate the
heading and this number of lines of paragraph text,
a page break is forced before the heading is printed.
.
Any display macro call or
.I tbl ,
.I pic ,
or
.I eqn
region
(see subsequent sections)
between the heading and the subsequent paragraph suppresses this
grouping.
.
.
.\" The next table is huge and we need a lot of room for it, but we
.\" can't use a keep because it's a boxed repeated-heading table. Flush
.\" the pending output line and demand half a page.
.br
.ne (\n[.p]u / 2u)
.NH 2
Typeface and decoration
.XS
Typeface and decoration
.XE
.
.
.LP
The
.I ms
macros provide a variety of ways to style text.
.
Attend closely to the ordering of arguments labeled
.I pre
and
.I post,
which is not intuitive.
.
Support for
.I pre
arguments is a GNU extension.\**
.FS
This idiosyncrasy arose through feature accretion;
for example,
the
.CW B
macro in Version\~6 Unix
.I ms
(1975) accepted only one argument,
the text to be set in boldface.
.
By Version\~7 (1979) it recognized a second argument;
in 1990,
.I "groff ms"
added a \*[Q]pre\*[U] argument,
placing it third to avoid breaking support for older documents.
.FE
.
.
.TS H
box;
lb lb
lf(CR) lx.
Macro Description
_
.TH
\&.B \f[R][\f[I]text\f[] [\f[I]post\f[] [\f[I]pre\f[]]]] T{
Style
.I text
in
.B bold ,
followed by
.I post
in the previous font style without intervening space,
and preceded by
.I pre
similarly.
.
Without arguments,
.I ms
styles subsequent text in bold
until the next
paragraphing,
heading,
or no-argument typeface macro call.
T}
_
\&.R \f[R][\f[I]text\f[] [\f[I]post\f[] [\f[I]pre\f[]]]] T{
As
.CW .B ,
but use the roman style
(upright text of normal weight)
instead of bold.
.
Argument recognition is a GNU extension.
T}
_
\&.I \f[R][\f[I]text\f[] [\f[I]post\f[] [\f[I]pre\f[]]]] T{
As
.CW .B ,
but use an
.I italic
or oblique style instead of bold.
T}
_
\&.BI \f[R][\f[I]text\f[] [\f[I]post\f[] [\f[I]pre\f[]]]] T{
As
.CW .B ,
but use a
.BI "bold italic"
or bold oblique style instead of upright bold.
.
This is a Tenth Edition Research Unix extension.
.\" possibly 9th, but definitely not Berkeley
T}
_
\&.CW \f[R][\f[I]text\f[] [\f[I]post\f[] [\f[I]pre\f[]]]] T{
As
.CW .B ,
but use a
.CW constant-width
(monospaced) roman typeface instead of bold.
.
This is a Tenth Edition Research Unix extension.
.\" possibly 9th, but definitely not Berkeley
T}
_
\&.BX \f[R][\f[I]text\f[]] T{
Typeset
.I text
and draw a
.BX box
around it.
.
On terminal devices,
reverse video is used instead
(see the implementation note below).
.
If you want
.I text
to contain space,
use unbreakable space or horizontal motion escape sequences
.CW \[rs]\[ti] , (
.CW \[rs]\c
.I space ,
.CW \[rs]\[ha] ,
.CW \[rs]| ,
.CW \[rs]0 ,
or
.CW \[rs]h ).
T}
_
\&.UL \f[R][\f[I]text\f[] [\f[I]post\f[]]] T{
Typeset
.I text
with an
.UL underline .
.
.I post,
if present,
is set after
.I text
with no intervening space.
T}
_
\&.LG T{
Set subsequent text in
.LG
larger type
.NL
(2\~points larger than the current size)
until the next
type size,
paragraphing,
or heading macro call.
.
You can
.LG
specify this macro
.LG
multiple times
.NL
to enlarge the type size as needed.
T}
_
\&.SM T{
Set subsequent text in
.SM
smaller type
.NL
(2\~points smaller than the current size)
until the next
type size,
paragraphing,
or heading macro call.
.
You can
.SM
specify this macro
.SM
multiple times
.NL
to reduce the type size as needed.
T}
_
\&.NL T{
Set subsequent text at the normal type size
.CW \[rs]n[PS] ). (
T}
.TE
.
.
.PP
.I pre
and
.I post
arguments
are typically used to simplify the attachment of punctuation to styled
words.
When
.I pre
is used,
a hyphenation control escape sequence
.CW \[rs]%
that would ordinarily start
.I text
must start
.I pre
instead to have the desired effect.
.
.TS
box center;
Cb Cb
Lf(CR) L.
Input Result
T{
.na
.nh
The CS course\[aq]s students found one C language keyword
.br
\&.CW static ) \[rs]%(
.br
most troublesome.
T} T{
The CS course's students found one C language keyword
.CW static ) \%(
most troublesome.
T}
.TE
.
.KS
You can use the output line continuation escape sequence
.CW \[rs]c
to achieve the same result.
.
It is also portable to some older
.I ms
implementations. \" DWB 3.3 ms: no; Heirloom Doctools ms: yes
.
.TS
box center;
Cb Cb
Lf(CR) L.
Input Result
T{
.na
.nh
The CS course\[aq]s students found one C language keyword
.br
\[rs]%(\[rs]c
.br
\&.CW static )
.br
most troublesome.
T} T{
The CS course's students found one C language keyword
\%(\c
.CW static )
most troublesome.
T}
.TE
.KE
.
.
.PP
Rather than calling the
.CW CW
macro,
in
.I "groff ms"
you might prefer to change the font family to Courier by setting
.CW \[rs]*[FAM]
to
.CW C \[rq]. \[lq]
.
You can then use all four style macros above,
returning to the default family (Times) with
.CW ".ds FAM T" \[rq]. \[lq]
.
Because changes to
.CW \[rs]*[FAM]
take effect only at the next paragraph,
this document uses
.CW .CW
to \[lq]inline\[rq] a change to the font family,
marking syntactical elements of
.I ms
and
.I groff .
.
.
.KS
.PP
.I "groff ms"
also offers strings to begin and end super- and subscripting.
.
These are GNU extensions.
.
.
.TS
box;
lb lb
lf(CR) lx.
String Description
_
\[rs]*{ Begin superscripting.
\[rs]*} End superscripting.
_
\[rs]*< Begin subscripting.
\[rs]*> End subscripting.
.TE
.KE
.
.
.nr PS -2
.nr VS -2
.LP
.B1
.hy 0
.I "Implementation note:"
In
.CW nroff
mode,
the
.CW BX
macro \[lq]boxes\[rq] its argument by bracketing it with
.I groff
extension escape sequences to set the foreground color to black and the
background to white and then reset them to their previous values;
the terminal output driver,
.I grotty (1),
converts these to ISO\~6429 color escape sequences,
which may be ignored or mishandled by some terminals,
or may be disabled by
.I grotty 's
.CW \-c
option.
.
Further,
if the terminal is set up to use these colors in those roles already,
.CW .BX
will cause no visible effect in the output.
.
Surmounting these challenges would require adding features to
.I grotty ,
for instance to provide a mechanism to request ISO\~6429's
\[lq]standout\[rq] mode \" That's "smso" and "rmso" in terminfo.
(often supported on monochrome terminals),
or to replace the presumed support of the terminal for ISO\~6429 escape
sequences with the use of a library that can query the capabilities of
the terminal and adapt the output sent to the device accordingly.
.
(Practically,
this likely means adding a dependency on
.CW libtinfo .)
.
Contact the
.I groff
development mailing list if you'd like to contribute.
.sp \n[PD]/2
.B2
.nr PS +2
.nr VS +2
.
.
.NH 2
Lists
.XS
Lists
.XE
.
.
.LP
The
.I marker
argument to the
.CW IP
macro can be employed to present a variety of lists;
for instance,
you can use a bullet glyph
.CW \[rs][bu] ) (
for unordered lists,
a number
(or auto-incrementing register)
for numbered lists,
or a word or phrase for glossary-style or definition lists.
.
If you set the paragraph indentation register
.CW PI
before calling
.CW IP ,
you can later reorder the items in the list without having to ensure
that a
.I width
argument remains affixed to the first call.
.
.
.TS H
box center;
cb cb
lf(CR) l .
Input Result
_
.TH
T{
.nf
\&.nr PI 2n
A bulleted list:
\&.IP \[rs][bu]
lawyers
\&.IP \[rs][bu]
guns
\&.IP \[rs][bu]
money
.fi
T} T{
.nr PI 2n
A bulleted list:
.IP \[bu]
lawyers
.IP \[bu]
guns
.IP \[bu]
money
T}
_
T{
.nf
\&.nr step 0 1
\&.nr PI 3n
A numbered list:
\&.IP \[rs]n+[step].
lawyers
\&.IP \[rs]n+[step].
guns
\&.IP \[rs]n+[step].
money
.fi
T} T{
.nr step 0 1
.nr PI 3n
A numbered list:
.IP \n+[step].
lawyers
.IP \n+[step].
guns
.IP \n+[step].
money
T}
_
T{
.nf
A glossary-style list:
\&.IP lawyers 0.4i
Two or more attorneys.
\&.IP guns
Firearms,
preferably large-caliber.
\&.IP money
Gotta pay for those
lawyers and guns!
.fi
T} T{
A glossary-style list:
.
.IP lawyers 0.4i
Two or more attorneys.
.IP guns
Firearms,
preferably large-caliber.
.IP money
Gotta pay for those lawyers and guns!
T}
.TE
.
.
.PP
In the enumerated list example,
we employed the
.CW nr
request to create a register of our own,
.CW step .
.
We initialized it to zero and assigned it an auto-increment of 1.
.
Each time we use the escape sequence
.CW \[rs]n+[PI]
(note the plus sign),
the formatter applies the increment just before interpolating the
register's value.
.
Preparing the
.CW PI
register as well enables us to rearrange the list without the tedium of
updating macro calls.
.
.
.PP
In the glossary example,
observe how the
.CW IP
macro places the definition on the same line as the term if it has
enough space.
.
If this is not what you want,
there are a few workarounds we will illustrate by modifying the example.
.
First,
you can use a
.CW br
request to force a break after printing the term or label.
.
Second,
you could apply the
.CW \[rs]p
escape sequence to force a break.
.
The space following the escape sequence is important;
if you omit it,
.I groff
prints the first word of the paragraph text on the same line as the term
or label
(if it fits)
.I then
breaks the line.
.
Finally,
you may append a horizontal motion to the marker with the
.CW \[rs]h
escape sequence;
using the same amount as the indentation will ensure that the marker is
too wide for
.I groff
to treat it as \[lq]fitting\[rq] on the same line as the paragraph text.
.
.
.TS
box center;
cb | cb | cb
lf(CR) | lf(CR) | lf(CR).
Approach #1 Approach #2 Approach #3
_
T{
.nf
\&.IP guns
\&.br
Firearms,
.fi
T} T{
.nf
\&.IP guns
\[rs]p Firearms,
.fi
T} T{
.nf
\&.IP guns\[rs]h\[aq]0.4i\[aq]
Firearms,
.fi
T}
_
.T&
cb s s
l s s.
Result
_
T{
A glossary-style list:
.
.IP lawyers 0.4i
Two or more attorneys.
.IP guns\h\[aq]0.4i\[aq] 0.4i
Firearms,
preferably large-caliber.
.IP money
Gotta pay for those lawyers and guns!
T}
.TE
.
.
.NH 2
Indented regions
.XS
Indented regions
.XE
.
.
.LP
You may need to indent a region of text while otherwise formatting it
normally.
.
Indented regions can be nested;
you can change
.CW \[rs]n[PI]
before each call to vary the amount of inset.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.RS T{
Begin a region where headings,
paragraphs,
and displays are indented (further) by
.CW \[rs]n[PI] .
T}
\&.RE T{
End the (next) most recent indented region.
T}
.TE
.
.
.PP
This feature enables you to easily line up text under hanging and
indented paragraphs.
.
For example,
you may wish to structure lists hierarchically.
.
.
.KS
.TS
box center;
cb cb
lf(CR)8 l .
Input Result
_
T{
.nf
.CW
\&.IP \[rs][bu] 2
Lawyers:
\&.RS
\&.IP \[rs][bu]
Dewey,
\&.IP \[rs][bu]
Cheatham,
and
\&.IP \[rs][bu]
Howe.
\&.RE
\&.IP \[rs][bu]
Guns
.R
\&.\|.\|.
.fi
T} T{
.IP \[bu] 2
Lawyers:
.RS
.IP \[bu]
Dewey,
.IP \[bu]
Cheatham,
and
.IP \[bu]
Howe.
.RE
.IP \[bu]
Guns
\&.\|.\|.
T}
.TE
.KE
.
.
.NH 2
Keeps, boxed keeps, and displays
.XS
Keeps, boxed keeps, and displays
.XE
.
.
.LP
On occasion,
you may want to
.I keep
several lines of text,
or a region of a document,
together on a single page,
preventing an automatic page break within certain boundaries.
.
This can cause a page break to occur earlier than it normally would.
.
For example,
you may want to keep two paragraphs together,
or a paragraph that refers to a table,
list,
or figure adjacent to the item it discusses.
.
.I ms
provides the
.CW KS
and
.CW KE
macros for this purpose.
.
.
.PP
You can alternatively specify a
.I "floating keep:"
if a keep cannot fit on the current page,
.I ms
holds its contents and allows material following the keep
(in the source document)
to fill the remainder of the current page.
.
When the page breaks,
whether by reaching the end or
.CW bp
request,
.I ms
puts the floating keep at the beginning of the next page.
.
This is useful for placing large graphics or tables that do not need to
appear exactly where they occur in the source document.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.KS Begin a keep.
\&.KF Begin a floating keep.
_
\&.KE End (floating) keep.
.TE
.
.
.PP
As an alternative to the keep mechanism,
the
.CW ne
request forces a page break if there is not at least the amount of
vertical space specified in its argument remaining on the page.
.
One application of
.CW ne
is to reserve space on the page for a figure or illustration to be
included later.
.
.
.KS
.PP
A
.I "boxed keep"
has a frame drawn around it.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.B1 Begin a keep with a box drawn around it.
\&.B2 End boxed keep.
.TE
.KE
.
.
.KS
.LP
Boxed keep macros cause breaks;
if you need to box a word or phrase within a line,
see the
.CW BX
macro in section \[lq]Typeface and decoration\[rq] above.
.
Box lines are drawn as close as possible to the text they enclose so
that they are usable within paragraphs.
.
If you wish to place one or more paragraphs in a boxed keep,
you may improve their appearance by calling
.CW .B1
after the first paragraphing macro,
and by adding a small amount of vertical space before calling
.CW .B2 .
.
.
.TS
box center;
lf(CR).
\&.LP
\&.B1
\&.I Warning:
Happy Fun Ball may suddenly accelerate to dangerous speeds.
\&.sp \[rs]n[PD]/2 \[rs]" space by half the inter-paragraph distance
\&.B2
.TE
.KE
.
.
.LP
If you want a boxed keep to float,
you will need to enclose the
.CW .B1
and
.CW .B2
calls within a pair of
.CW .KF
and
.CW .KE
calls.
.
.
.PP
.I Displays
turn off filling;
lines of verse or program code are shown with their lines broken as in
the source document without requiring
.CW br
requests between lines.
.
Displays can be kept on a single page or allowed to break across pages.
.
The
.CW DS
macro begins a kept display of the layout specified in its first
argument;
non-kept displays are begun with dedicated macros corresponding to their
layout.
.
.
.TS
box;
cb s | cb
cb cb | ^
lf(CR) lf(CR) | lx .
Display macro Description
With keep Without keep
_
\&.DS L \&.LD Begin left-aligned display.
\&.DS \f[R][\f[]I\f[R] [\,\f[I]indent\/\f[]]] \
\&.ID \f[R][\,\f[I]indent\/\f[]] T{
Begin display indented by
.I indent
if given,
.CW \[rs]n[DI]
otherwise.
T}
\&.DS B \&.BD T{
Begin block display
(left-aligned with longest line centered).
T}
\&.DS C \&.CD Begin centered display.
\&.DS R \&.RD T{
Begin right-aligned display.
This is a GNU extension.
T}
_
.T&
cf(CR) s | lx .
\&.DE End any display.
.TE
.
.
.PP
The distance stored in
.CW \[rs]n[DD]
is inserted before and after each pair of display macros;
this is a Berkeley extension.
.
In
.I "groff ms" ,
this distance replaces any adjacent inter-paragraph distance
or subsequent spacing prior to a section heading.
.
The
.CW DI
register is a GNU extension;
its value is an indentation applied to displays created with
.CW .DS
and
.CW .ID
without arguments,
to
.CW .DS\~I \[rq] \[lq]
without an indentation argument,
and to equations set with
.CW .EQ\~I \[rq]. \[lq]
.
Changes to either register take effect at the next display boundary.
.
.
.KS
.NH 2
Tables, figures, equations, and references
.XS
Tables, figures, equations, and references
.XE
.LP
The
.I ms
package is often used with the
.I tbl ,
.I pic ,
.I eqn ,
and
.I refer
preprocessors.
.
The
.CW \[rs]n[DD]
distance is also applied to regions of the document preprocessed with
.I tbl ,
.I pic ,
and
.I eqn .
.
Mark text meant for preprocessors by enclosing it in pairs of tokens as
follows,
with nothing between the dot and the macro name.
.
The preprocessors match these tokens only at the start of an input line.
.
.
.TS
box;
cb cb
lf(CR) lx .
Tag pair Description
_
T{
\&.TS
.R
.CW H ] [
.CW
.br
\&.TE
T} T{
Demarcate a table to be processed by the
.I tbl
preprocessor.
.
The optional
.CW H
argument to
.CW .TS
instructs
.I ms
to repeat table rows
(often column headings)
at the top of each new page the table spans,
if applicable;
calling the
.CW TH
macro marks the end of such rows.
.
The GNU
.I tbl (1)
man page provides a comprehensive reference to the preprocessor and
offers examples of its use.
T}
_
T{
\&.PS
.br
\&.PE
.br
\&.PF
T} T{
.CW .PS
begins a picture to be processed by the
.I pic
preprocessor;
either of
.CW .PE
or
.CW .PF
ends it,
the latter with \[lq]flyback\[rq] to the vertical position at its top.
.
You can create
.I pic
input manually or with a program such as
.I xfig (1).
T}
_
T{
\&.EQ
.R
.I align \~[\c [
.I label ]]
.CW
.br
\&.EN
T} T{
Demarcate an equation to be processed by the
.I eqn
preprocessor.
.
The equation is centered by default;
.I align
can be
.CW C ,
.CW L ,
or
.CW I
to (explicitly) center,
left-align,
or indent it by
.CW \[rs]n[DI] ,
respectively.
.
If specified,
.I label
is set right-aligned.
T}
_
T{
\&.[
.br
\&.]
T} T{
Demarcate a bibliographic citation to be processed by the
.I refer
preprocessor.
.
The GNU
.I refer (1)
man page provides a comprehensive reference to the preprocessor and the
format of its bibliographic database.
T}
.TE
.KE
.
.
.PP
When
.I refer
emits collected references
(as might be done on a \[lq]Works Cited\[rq] page),
it interpolates the string
.CW \[rs]*[REFERENCES]
as an unnumbered heading
.CW .SH ). (
.
.
.KS
.PP
The following is an example of how to set up a table that may print
across two or more pages.
.
.
.TS
box center;
l .
T{
.nf
.CW
\&.TS H
allbox;
Cb | Cb .
Part\[->]Description
_
\&.TH
\&.T&
L | Lx .
GH-1978\[->]Fribulating gonkulator
.R
\&.\|.\|.\|the rest of the table follows\|.\|.\|.
.CW
\&.TE
.R
.fi
T}
.TE
.
.
Attempting to place a multi-page table inside a keep can lead to
unpleasant results,
particularly if the
.I tbl
.CW allbox
option is used.
.KE
.
.
.PP
Mathematics can be typeset using the language of the
.I eqn
preprocessor.
.
.
.TS
box center;
Lf(CR).
\&.EQ C (\[rs]*[SN\-NO\-DOT]a)
p \[ti] = \[ti] q sqrt { 1 + \[ti] ( x / q sup 2 ) }
\&.EN
.TE
.
.
This input formats a labelled equation.
.
We used the
.CW SN\-NO\-DOT
string to base the equation label on the current heading number,
giving us more flexibility to reorganize the document.
.
.
.EQ C (\*[SN-NO-DOT]a)
p ~ = ~ q sqrt { 1 + ~ ( x / q sup 2 ) }
.EN
.
Use
.I groff
options
to run preprocessors on the input:
.CW \-e
for
.I eqn ,
.CW \-p
for
.I pic ,
.CW \-R
for
.I refer ,
and
.CW \-t
for
.I tbl.
.
.
.KS
.NH 2
Footnotes
.XS
Footnotes
.XE
.
.
.LP
.\" The following sentence is used below as an example as well. Keep it
.\" in sync.
A footnote is typically anchored to a place in the text with a
.I marker,
which is a small integer,\**
.FS
like this numeric footnote
.FE
a symbol,\*{\[dg]\*}
.FS \[dg]
like this symbolic footnote
.FE
or arbitrary user-specified text.
.
.
.TS
box;
lb lb
lf(CR) lx.
String Description
_
\[rs]** T{
Place an
.I "automatic number,"
an automatically updated numeric footnote marker,
in the text.
.
Each time this string is interpolated,
the number it produces increments by one.
.
Automatic numbers start at 1.
.
This is a Berkeley extension.
T}
.TE
.KE
.
.
.PP
Enclose the footnote text in
.CW FS
and
.CW FE
macro calls to set it at the nearest available \[lq]foot\[rq],
or bottom,
of a text column or page.
.
.
.TS
box;
cb cb
lfCR lx .
Macro Description
_
\&.FS \f[R][\f[I]marker\f[]] T{
Begin a footnote.
.
The
.CW FS\-MARK
hook
(see below)
is called with any supplied
.I marker
argument,
which is then also placed at the beginning of the footnote text.
.
If
.I marker
is omitted,
the next pending automatic number enqueued by interpolation of the
.CW *
string is used,
and if none exists,
nothing is prefixed.
.
T}
_
\&.FE End footnote text.
.TE
.
.
.PP
You may not desire automatically numbered footnotes in spite of their
convenience.
.
You can indicate a footnote with a symbol or other text by specifying
its marker at the appropriate place
(for example,
by using
.CW \[rs][dg]
for the dagger glyph)
.I and
as an argument to the
.CW FS
macro.
.
Such manual marks should be repeated as arguments to
.CW .FS
or as part of the footnote text to disambiguate their correspondence.
.
You may wish to use
.CW \[rs]*{
and
.CW \[rs]*}
to superscript the marker at the anchor point,
in the footnote text,
or both.
.
.
.PP
.I "groff ms"
provides a hook macro,
.CW FS\-MARK ,
for user-determined operations to be performed when the
.CW FS
macro is called.
.
It is passed the same arguments as
.CW FS
itself.
.
An application of
.CW FS\-MARK
is anchor placement for a hyperlink reference,
so that a footnote can link back to its referential context.\**
.
.FS
\[lq]Portable Document Format Publishing with GNU Troff\[rq],
.I pdfmark.ms
in the
.I groff
distribution,
uses this technique.
.FE
.
By default,
this macro has an empty definition.
.
.CW FS\-MARK
is a GNU extension.
.
.
.PP
The following input was used to produce the first sentence in this
section.
.
.
.TS
box center;
lfCR.
A footnote is anchored to a place in the text with a
\&.I marker,
which is a small integer,\[rs]**
\&.FS
like this numeric footnote
\&.FE
a symbol,\[rs]*{\[rs][dg]\[rs]*}
\&.FS \[rs][dg]
like this symbolic footnote
\&.FE
or arbitrary user-specified text.
.TE
.
.
.PP
Footnotes can be safely used within keeps and displays,
but you should avoid using automatically numbered footnotes within
floating keeps.
.
You can place a second
.CW \[rs]**
interpolation between a
.CW \[rs]**
and its corresponding
.CW .FS
call as long as each
.CW .FS
call occurs
.I after
the corresponding
.CW \[rs]**
and occurrences of
.CW .FS
are in the same order as corresponding occurrences of
.CW \[rs]** .
.
.
.PP
Footnote text is formatted as paragraphs are,
using analogous parameters.
.
The registers
.CW FI ,
.CW FPD ,
.CW FPS ,
and
.CW FVS
correspond to
.CW PI ,
.CW PD ,
.CW PS ,
and
.CW VS ,
respectively;
.CW FPD ,
.CW FPS ,
and
.CW FVS
are GNU extensions.
.
.
.KS
.PP
The
.CW FF
register controls the formatting of automatically numbered footnote
paragraphs,
and those for which
.CW .FS
is given a
.I marker
argument,
at the bottom of a column or page as follows.
.
.
.TS
box;
cb cb
lf(CR) lx .
\f[CB]FF\f[] value Description
_
0 T{
Set an automatic number as a superscript
(on typesetter devices)
or surrounded by square brackets
(on terminals).
.
The footnote paragraph is indented as with
.CW .PP
if there is an
.CW .FS
argument or an automatic number,
and as with
.CW .LP
otherwise.
.
This is the default.
T}
1 T{
As
.CW 0 ,
but set the marker as regular text,
and follow an automatic number with a period.
T}
2 T{
As
.CW 1 ,
but without indentation
(like
.CW .LP ).
T}
3 T{
As
.CW 1 ,
but set the footnote paragraph with the marker hanging
(like
.CW .IP ).
T}
.TE
.KE
.
.
.PP
The default footnote line length is 11/12ths of the normal line length
for compatibility with the expectations of historical
.I ms
documents;
you may wish to set
.CW \[rs]*[FR]
to
.CW 1
to align with contemporary typesetting practices.
.
In the past,\**
.FS
Unix
Version\~7
.I ms ,
its descendants,
and
.I "groff ms"
prior to version 1.23.0
.FE
an
.CW FL
register was used for the line length in footnotes;
however,
setting this register at document initialization time had no effect on
the footnote line length in multi-column arrangements.\**
.
.FS
You could reset it after each call to
.CW .1C ,
.CW .2C ,
or
.CW .MC .
.FE
.
.
.PP
.CW \[rs]*[FR]
should be used in preference to
.CW \[rs]n[FL]
in contemporary documents.
.
The footnote line length is effectively computed as
.I column-width "" \[lq]
.CW "\~*\~\[rs]*[FR]" \[rq].
.
If an absolute footnote line length is required,
recall that arithmetic expressions in the
.I roff
language are evaluated strictly from left to right,
with no operator precedence
(parentheses are honored).
.
.
.TS
box center;
lf(CR).
\&.ds FR 0+3i \[rs]" Set footnote line length to 3 inches.
.TE
.
.
.LP \" continuing previous paragraph
Changes to the footnote length ratio
.CW \[rs]*[FR]
take effect with the next footnote written in single-column
arrangements,
but on the next page in multiple-column contexts.
.
.
.KS
.NH 2
Language and localization
.XS
Language and localization
.XE
.
.
.LP
.I "groff ms"
provides several strings that you can customize for your own purposes,
or redefine to adapt the macro package to languages other than English.
.
It is already localized for
.\" cs, de, fr, it, sv
Czech,
German,
French,
Italian,
and
Swedish.
.
Load the desired localization macro package after
.I ms ;
see the
.I groff_tmac (5)
man page.
.
.
.TS
box center;
lf(CR).
$ \f[CB]groff \-ms \-mfr bienvenue.ms
.TE
.
.
.PP
The following strings are available.
.
.TS
box center;
cb lb
lf(CR) lf(CR) .
String Default
_
\[rs]*[REFERENCES] References
\[rs]*[ABSTRACT] \[rs]f[I]ABSTRACT\[rs]f[]
\[rs]*[TOC] Table of Contents
\[rs]*[MONTH1] January
\[rs]*[MONTH2] February
\[rs]*[MONTH3] March
\[rs]*[MONTH4] April
\[rs]*[MONTH5] May
\[rs]*[MONTH6] June
\[rs]*[MONTH7] July
\[rs]*[MONTH8] August
\[rs]*[MONTH9] September
\[rs]*[MONTH10] October
\[rs]*[MONTH11] November
\[rs]*[MONTH12] December
.TE
.
.
.PP
The default for
.CW \[rs]*[ABSTRACT]
includes font selection escape sequences to set the word in italics.
.KE
.
.
.KS
.NH 2
Glyphs for special characters
.XS
Glyphs for special characters
.XE
.
.
.LP
Some of the special character escape sequences used in this document
are listed below.
.
The minus sign glyph can also be accessed by the shorthand
.CW \[rs]\[mi] .
.
These and many others are documented in the
.I groff_char (7)
man page.
.
.
.TS
box center;
Cb Lb Lb
Lf(CR) L L .
Input Appearance Description
_
\[rs][\-] \[mi] minus sign
\[rs][\->] \[->] right arrow
\[rs][aq] \[aq] neutral apostrophe
\[rs][bu] \[bu] bullet
\[rs][dq] \[dq] neutral double quote
\[rs][dg] \[dg] dagger
\[rs][em] \[em] em dash
\[rs][ha] \[ha] circumflex accent (caret, hat)
\[rs][lg] \[lq] left double quotation mark
\[rs][rq] \[rq] right double quotation mark
\[rs][rs] \[rs] reverse solidus (backslash)
\[rs][sd] \[sd] seconds (double prime) mark
\[rs][ti] \[ti] tilde
.TE
.KE
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Page layout
.XS
Page layout
.XE
.LP
.I ms 's
default page layout arranges text
in a single column
with the page number
between hyphens
centered in a header
on each page
except the first,
and produces no footers.
.
You can customize this arrangement.
.
.
.NH 2
Headers and footers
.XS
Headers and footers
.XE
.
.
.LP
There are multiple ways to produce headers and footers.
.
One is to define the strings
.CW LH ,
.CW CH ,
and
.CW RH
to set the left,
center,
and right headers,
respectively;
and
.CW LF ,
.CW CF ,
and
.CW RF
to set the left,
center,
and right footers.
.
This approach suffices for documents that do not distinguish odd- and
even-numbered pages.
.
.
.PP
Another method is to call macros that set headers or footers for odd- or
even-numbered pages.
.
Each such macro takes a delimited argument separating the left,
center,
and right header or footer texts from each other.
.
You can replace the neutral apostrophes (\[aq]) shown below with any
character not appearing in the header or footer text.
.
These macros are Berkeley extensions.
.
.
.TS
box;
lb lb
lf(CR) lx.
Macro Description
_
\&.OH \[aq]\f[I]left\f[]\[aq]\f[I]center\f[]\[aq]\f[I]right\f[]\[aq]\
T{
Set the left, center, and right headers on odd-numbered (recto) pages.
T}
\&.OF \[aq]\f[I]left\f[]\[aq]\f[I]center\f[]\[aq]\f[I]right\f[]\[aq]\
T{
Set the left, center, and right footers on odd-numbered (recto) pages.
T}
\&.EH \[aq]\f[I]left\f[]\[aq]\f[I]center\f[]\[aq]\f[I]right\f[]\[aq]\
T{
Set the left, center, and right headers on even-numbered (verso) pages.
T}
\&.EF \[aq]\f[I]left\f[]\[aq]\f[I]center\f[]\[aq]\f[I]right\f[]\[aq]\
T{
Set the left, center, and right footers on even-numbered (verso) pages.
T}
.TE
.
.
.PP
With either method,
a percent sign
.B %
in header or footer text is replaced by the current page number.
.
By default,
.I ms
places no header on a page numbered \[lq]1\[rq]
(regardless of its number format).
.
.
.TS
box;
lb lb
lf(CR) lx.
Macro Description
_
\&.P1 T{
Typeset the header even on page\~1.
.
To be effective,
this macro must be called before the header trap is sprung on any page
numbered \[lq]1\[rq];
in practice,
unless your page numbering is unusual,
this means that you should call it early,
before
.CW .TL
or any heading or paragraphing macro.
.
This is a Berkeley extension.
T}
.TE
.
.
.PP
For even greater flexibility,
.I ms
is designed to permit the redefinition of the macros that are called
when the
.I groff
traps that ordinarily cause the headers and footers to be output are
sprung.
.
.CW PT
(\[lq]page trap\[rq])
is called by
.I ms
when the header is to be written,
and
.CW BT
(\[lq]bottom trap\[rq])
when the footer is to be.
.
The
.I groff
page location trap that
.I ms
sets up to format the header also calls the
(normally undefined)
.CW HD
macro after
.CW .PT ;
you can define
.CW .HD
if you need additional processing after setting the header
(for example,
to draw a line below it).
.
.\" Although undocumented in Tuthill's 4.2BSD ms.diffs paper...
The
.CW HD
hook is a Berkeley extension.
.
Any such macros you (re)define must implement any desired specialization
for odd-,
even-,
or first numbered pages.
.
.
.KS
.NH 2
Tab stops
.XS
Tab stops
.XE
.
.
.LP
Use the
.CW ta
request to set tab stops as needed.
.
.
.TS
box;
lb lb
lf(CR) lx.
Macro Description
_
\&.TA T{
Reset the tab stops to the
.I ms
default
(every 5 ens).
.
Redefine this macro to create a different set of default tab stops.
T}
.TE
.KE
.
.
.KS
.NH 2
Margins
.XS
Margins
.XE
.
.
.LP
Control margins using the registers summarized in the \[lq]Margins\[rq]
portion of the table in section \[lq]Document control settings\[rq]
above.
.
There is no setting for the right margin;
the combination of page offset
.CW \[rs]n[PO]
and line length
.CW \[rs]n[LL]
determines it.
.KE
.
.
.KS
.NH 2
Multiple columns
.XS
Multiple columns
.XE
.
.
.LP
.I ms
can set text in as many columns as reasonably fit on the page.
.
The following macros force a page break if a multi-column layout is
active when they are called.
.
.CW \[rs]n[MINGW]
is the default minimum gutter width;
it is a GNU extension.
.
When multiple columns are in use,
keeps
and the
.CW \%HORPHANS
and
.CW \%PORPHANS
registers
work with respect to column breaks instead of page breaks.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.1C T{
Arrange page text in a single column (the default).
T}
_
\&.2C T{
Arrange page text in two columns.
T}
_
\&.MC \f[R][\f[I]column-width\f[] [\f[I]gutter-width\f[]]] T{
Arrange page text in multiple columns.
.
If you specify no arguments,
it is equivalent to the
.CW 2C
macro.
.
Otherwise,
.I column-width
is the width of each column and
.I gutter-width
is the minimum distance between columns.
T}
.TE
.KE
.
.
.\" ------------------------
.NH 2
Creating a table of contents
.XS
Creating a table of contents
.XE
.LP
Because
.I roff
formatters process their input in a single pass,
material on page 50,
for example,
cannot influence what appears on page\~1\[em]this poses a challenge for
a table of contents at its traditional location in front matter,
if you wish to avoid manually maintaining it.
.
.I ms
enables the collection of material to be presented in the table of
contents as it appears,
saving its page number along with it,
and then emitting the collected contents on demand toward the end of the
document.
.
The table of contents can then be resequenced to its desired location
by physically rearranging the pages of a printed document,
or as part of post-processing\[em]with a
.I sed (1)
script to reorder the pages in
.I troff 's
output,
with
.I pdfjam (1),
or with
.I gropdf (1)'s
.B .pdfswitchtopage
feature,
for example.
.
.
.PP
Define an entry to appear in the table of contents by bracketing its
text between calls to the
.CW XS
and
.CW XE
macros.
.
A typical application is to call them immediately after
.CW NH
or
.CW SH
and repeat the heading text within them.
.
The
.CW XA
macro,
used within
.CW .XS /\c
.CW .XE
pairs,
supplements an entry\[em]for instance,
when it requires multiple output lines,
whether because a heading is too long to fit or because style dictates
that page numbers not be repeated.
.
You may wish to indent the text thus wrapped to correspond to its
heading depth;
this can be done in the entry text by prefixing it with tabs or
horizontal motion escape sequences,
or by providing a second argument to the
.CW XA
macro.
.
.CW .XS
and
.CW .XA
automatically associate the page number where they are called with the
text following them,
but they accept arguments to override this behavior.
.
At the end of the document,
call
.CW TC
or
.CW PX
to emit the table of contents;
.CW .TC
resets the page number
.B i "" to\~
(Roman numeral one),
and then calls
.CW PX .
.
All of these macros are Berkeley extensions.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.XS \f[R][\f[I]page-number\f[]] T{
Begin,
supplement,
and end a table of contents entry.
.
Each entry is associated with
.I page-number
(otherwise the current page number);
a
.I page-number
of
.CW no
prevents a leader and page number from being emitted for that entry.
.
Use of
.CW .XA
within
.CW .XS /\c
.CW .XE
is optional;
it can be repeated.
.
If
.I indentation
is present,
a supplemental entry is indented by that amount;
ens are assumed if no unit is indicated.
.
Text on input lines between
.CW .XS
and
.CW .XE
is stored for later recall by
.CW .PX .
T}
\&.XA \f[R][\f[I]page-number\f[] [\f[I]indentation\f[]]] \^
\&.XE \^
_
\&.PX \f[R][\f[]no\f[R]] T{
Switch to single-column layout.
.
Unless
.CW no
is specified,
center and interpolate
.CW \[rs]*[TOC]
in bold and two points larger than the body text.
.
Emit the table of contents entries.
T}
_
\&.TC \f[R][\f[]no\f[R]] T{
Set the page number to\~1,
the page number format to lowercase Roman numerals,
and call
.CW PX
(with a
.CW no
argument,
if present).
T}
.TE
.
.
.KS
.PP
Here's an example of typical
.I ms
table of contents preparation and
its result.
.
We employ horizontal escape sequences
.CW \[rs]h
to indent the entries by sectioning depth.
.
.TS
box center;
L.
T{
.nf
.CW
\&.NH 1
Introduction
\&.XS
Introduction
\&.XE
.R
\&.\|.\|.
.CW
\&.NH 2
Methodology
\&.XS
\[rs]h\[aq]2n\[aq]Methodology
\&.XA no
\[rs]h\[aq]4n\[aq]Fassbinder\[aq]s Approach
\&.XA no
\[rs]h\[aq]4n\[aq]Kahiu\[aq]s Approach
\&.XE
.R
\&.\|.\|.
.CW
\&.NH 1
Findings
\&.XS
Findings
\&.XE
.R
\&.\|.\|.
.CW
\&.TC
.fi
T}
.TE
.KE
.
.nr SavedPageNumber \n%
.nr SavedH1 \n[H1] \" groff ms internal name
.nr SavedH2 \n[H2] \" groff ms internal name
.nr % 1
.rr H1
.rr H2
.als SavedTOC toc*div \" groff ms internal name
.rm toc*div
.di ThrowAway
.NH 1
Introduction
.XS
Introduction
.XE
.nr % 2
.NH 2
Methodology
.XS
\h'2n'Methodology
.XA no
\h'4n'Fassbinder's Approach
.XA no
\h'4n'Kahiu's Approach
.XE
.nr % 5
.NH 1
Findings
.XS
Findings
.XE
.br
.di
.\" We can't emit the TOC inside a B1/B2 box, so use lines instead.
.R
\l'\n[.l]u'
.PX
\l'\n[.l]u'
.als toc*div SavedTOC
.rm SavedTOC
.nr % \n[SavedPageNumber]
.nr H1 \n[SavedH1]
.nr H2 \n[SavedH2]
.rr SavedPageNumber
.rr SavedH1
.rr SavedH2
.
.
.PP
The remaining features in this subsection are GNU extensions.
.
.I "groff ms"
obviates the need to repeat heading text after
.CW XS
calls.
.
Call
.CW XN
and
.CW XH
after
.CW NH
and
.CW SH ,
respectively.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.XN \f[I]heading-text T{
Format
.I heading-text
and create a corresponding table of contents entry;
the indentation is computed from the depth of the preceding
.CW NH
call.
T}
\&.XH \f[I]depth heading-text T{
As
.CW .XN ,
but use
.I depth
to determine the indentation.
T}
.TE
.
.
.KS
.PP
.I "groff ms"
encourages customization of table of contents entry production.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.XN\-REPLACEMENT \f[I]heading-text T{
These hook macros implement
.CW .XN
and
.CW .XH ,
respectively.
.
They call
.CW \%XN\-INIT
and
pass their
.I heading-text
arguments to
.CW .\%XH\-UPDATE\-TOC .
T}
\&.XH\-REPLACEMENT \f[I]depth heading-text \^
\&.XH\-INIT T{
This hook macro does nothing by default.
T}
\&.XH\-UPDATE\-TOC\~ \f[I]depth heading-text T{
Bracket
.I heading-text
with
.CW XS
and
.CW XE
calls,
indenting it by 2 ens per level of
.I depth
beyond the first.
T}
.TE
.KE
.
.
.LP
.TS
box center;
L.
T{
.nf
.CW
\&.NH 1
\&.XN Introduction
.R
\&.\|.\|.
.CW
\&.NH 2
\&.XN Methodology
\&.XH 3 \[dq]Fassbinder\[aq]s Approach\[dq]
\&.XH 3 \[dq]Kahiu\[aq]s Approach\[dq]
.R
\&.\|.\|.
.CW
\&.NH 1
\&.XN Findings
.R
\&.\|.\|.
.CW
\&.TC
.fi
T}
.TE
.
.nr SavedPageNumber \n%
.nr SavedH1 \n[H1] \" groff ms internal name
.nr SavedH2 \n[H2] \" groff ms internal name
.nr % 1
.rr H1
.rr H2
.als SavedTOC toc*div \" groff ms internal name
.rm toc*div
.di ThrowAway
.NH 1
.XN Introduction
.nr % 2
.NH 2
.XN Methodology
.XH 3 "Fassbinder's Approach"
.XH 3 "Kahiu's Approach"
.nr % 5
.NH 1
.XN Findings
.br
.di
.\" We can't emit the TOC inside a B1/B2 box, so use lines instead.
.R
\l'\n[.l]u'
.PX
\l'\n[.l]u'
.als toc*div SavedTOC
.rm SavedTOC
.nr % \n[SavedPageNumber]
.nr H1 \n[SavedH1]
.nr H2 \n[SavedH2]
.rr SavedPageNumber
.rr SavedH1
.rr SavedH2
.
.
.PP
To get the section number of the numbered headings into the table of
contents entries,
we might define
.CW \%XN\-REPLACEMENT
as follows.
.
(We obtain the heading depth from
.I "groff ms" 's
internal register
.CW nh*hl .)
.
.
.LP
.TS
box center;
L.
T{
.nf
.CW
\&.de XN\-REPLACEMENT
\&.XN\-INIT
\&.XH\-UPDATE\-TOC \[rs]\[rs]n[nh*hl] \[rs]\[rs]$@
\&\[rs]&\[rs]\[rs]*[SN] \[rs]\[rs]$*
\&..
T}
.TE
.
.
.PP
You can change the style of the leader that bridges each table of
contents entry with its page number;
define the
.CW TC\-LEADER
special character by using the
.CW char
request.
.
A typical leader combines the dot glyph
.CW .\& \[rq] \[lq]
with a horizontal motion escape sequence to spread the dots.
.
The width of the page number field is stored in the
.CW TC\-MARGIN
register.
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Differences from AT&T
.BI ms
.XS
Differences from AT&T
.I ms
.XE
.LP
The
.I "groff ms"
macros are an independent reimplementation,
using no AT&T code.
.
Since they take advantage of the extended features of
.I groff ,
they cannot be used with AT&T
.I troff .
.
.I "groff ms"
supports features described above as Berkeley and Tenth Edition Research
Unix extensions,
and adds several of its own.
.
.
.PP
The internals of
.I "groff ms"
differ from those of AT&T
.I ms .
.
Documents that depend upon implementation details of AT&T
.I ms
may not format properly with
.I "groff ms" .
.
Such details include macros whose function was not documented in the
AT&T
.I ms
manual [Lesk 1978].
.\" TODO: Use refer(1).
.\" XXX: We support RT anyway; maybe we should stop?
.
.
.PP
The error-handling policy of
.I "groff ms"
is to detect and report errors,
rather than to ignore them silently.
.
.
.PP
Tenth Edition \" possibly 9th
Research Unix supported
.B P1 /
.B P2
macros to bracket code examples;
.I "groff ms"
does not.
.
.
.PP
.I "groff ms"
does not work in GNU
.I troff 's \" GNU
AT&T compatibility mode.
.
If loaded when that mode is enabled,
it aborts processing with a diagnostic message.
.
.
.PP
Multiple line spacing is not supported.
.
Use a larger vertical spacing instead.
.
.
.PP
.I "groff ms"
uses the same header and footer defaults in both
.CW nroff
and
.CW troff
modes
as AT&T
.I ms
does in
.CW troff
mode;
AT&T's default in
.CW nroff
mode is to put the date,
in U.S.\& traditional format
(e.g.,
\[lq]January 1, 2021\[rq]),
in the center footer
(the
.CW CF
string).
.
.
.PP
Many
.I "groff ms"
macros,
including those for paragraphs,
headings,
and displays,
cause a reset of formatting parameters,
and may change the indentation;
they do so not by incrementing or decrementing it,
but by setting it absolutely.
.
This can cause problems for documents that define additional macros of
their own that try to manipulate indentation.
.
Use
.CW .RS
and
.CW .RE
instead of the
.CW in
request.
.
.
.PP
AT&T
.I ms
interpreted the values of the registers
.CW PS
and
.CW VS
in points,
and did not support the use of scaling units with them.
.
.I "groff ms"
interprets values of the registers
.CW PS ,
.CW VS ,
.CW FPS ,
and
.CW FVS
equal to or larger than\~1,000
(one thousand)
as decimal fractions multiplied by\~1,000.\**
.FS
Register values are converted to and stored as basic units.
.
See \[lq]Measurements\[rq] in the
.I groff
Texinfo manual or in
.I groff (7).
.FE
.
This threshold makes use of a scaling unit with these parameters
practical for high-resolution devices while preserving backward
compatibility.
.
It also permits expression of non-integral type sizes.
.
For example,
.CW "groff \-rPS=10.5p" \[rq] \[lq]
at the shell prompt is equivalent to placing
.CW ".nr PS 10.5p" \[rq] \[lq]
at the beginning of the document.
.
.
.PP
AT&T
.I ms 's
.CW AU
macro supported arguments used with some document types;
.I "groff ms"
does not.
.
.
.PP
Right-aligned displays are available.
.
The AT&T
.I ms
manual observes that \[lq]it is tempting to assume that
.CW ".DS R"
will right adjust lines,
but it doesn't work\[rq].
.
In
.I "groff ms" ,
it does.
.
.
.PP
To make
.I "groff ms"
use the default page offset
(which also specifies the left margin),
the
.B PO
register must stay undefined until the first
.I ms
macro is called.
.
This implies that
.B \[rs]n[PO]
should not be used early in the document,
unless it is changed also:
accessing an undefined register automatically defines it.
.
.
.PP
.I "groff ms"
supports the
.CW PN
register,
but it is not necessary;
you can access the page number via the usual
.CW %
register and invoke the
.CW af
request to assign a different format to it if desired.\**
.FS
If you redefine the
.I ms
.CW PT
macro \" I wouldn't mention that, but Lesk 1978 encourages doing so. :-/
and desire special treatment of certain page numbers
(like
.CW 1 \[rq]), \[lq]
you may need to handle a non-Arabic page number format,
as
.I "groff ms" 's
.CW .PT
does;
see the macro package source.
.
.I "groff ms"
aliases the
.CW PN
register to
.CW % .
.FE
.
.
.PP
The AT&T
.I ms
manual documents registers
.CW CW
and
.CW GW
as setting the default column width and \[lq]intercolumn gap\[rq],
respectively,
and which applied when
.CW .MC
was called with fewer than two arguments.
.
.I "groff ms"
instead treats
.CW .MC
without arguments as synonymous with
.CW .2C ;
there is thus no occasion for a default column width register.
.
Further,
the
.CW MINGW
register
and the second argument to
.CW .MC
specify a
.I minimum
space between columns,
not the fixed gutter width of AT&T
.I ms .
.
.
.PP
The AT&T
.I ms
manual did not document the
.CW QI
register;
Berkeley and
.I "groff ms"
do.
.
.
.PP
The register
.CW GS
is set to\~1 by the
.I "groff ms"
macros,
but is not used by the AT&T
.I ms
package.
.
Documents that need to determine whether they are being formatted with
.I "groff ms"
or another implementation should test this register.
.
.
.\" XXX: We can't use a keep here because the wrong page number will be
.\" recorded in the table of contents; see Savannah #63159.
.\"KS
.br
.ne 6v
.NH 2
Unix Version\~7
.BI ms
macros not implemented by
.BI "groff ms"
.XS
Unix Version 7
.I ms
macros not implemented by
.I "groff ms"
.XE
.LP
Several macros described in the Unix Version\~7
.I ms
documentation are unimplemented by
.I "groff ms"
because they are specific to the requirements of documents produced
internally by Bell Laboratories,
some of which also require a glyph for the Bell System logo that
.I groff
does not support.
.
These macros implemented several document type formats
(\c
.CW EG , \" engineer's notes
.CW IM , \" internal memorandum
.CW MF , \" memorandum for file
.CW MR , \" memorandum for record
.CW TM , \" technical memorandum
.CW TR ), \" technical report
were meaningful only in conjunction with the use of certain document
types
(\c
.CW AT , \" attachments
.CW CS , \" cover sheet info for `TM` documents
.CW CT , \" copies to
.CW OK , \" "other keywords" for `TM` documents
.CW SG ), \" signatures for `TM` documents
stored the postal addresses of Bell Labs sites
(\c
.CW HO , \" Holmdel
.CW IH , \" Naperville
.CW MH , \" Murray Hill
.CW PY , \" Piscataway
.CW WH ), \" Whippany
or lacked a stable definition over time
(\c
.CW UX ). \" Unix; on 1st use, add footnote identifying trademark owner
.
To compatibly render historical
.I ms
documents using these macros,
we advise your documents to invoke the
.CW rm
request to remove any such macros it uses and then define replacements
with an authentically typeset original at hand.\**
.FS
The removal beforehand is necessary because
.I "groff ms"
aliases these macros to a diagnostic macro,
and you want to redefine the aliased name,
not its target.
.FE
.
For informal purposes,
a simple definition of
.CW UX
should maintain the readability of the document's substance.
.
.
.TS
box center;
lf(CR).
\&.rm UX
\&.ds UX Unix\[rs]"
.TE
.rs \" XXX: Work around Savannah #64005.
.\"KE
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Legacy features
.XS
Legacy features
.XE
.
.
.LP
.I "groff ms"
retains some legacy features solely to support formatting of historical
documents;
contemporary ones should not use them because they can render poorly.
.
See
.I groff_char (7)
instead.
.
.
.KS
.NH 2
AT&T
.I ms
accent mark strings
.XS
AT&T
.I ms
accent mark strings
.XE
.LP
AT&T
.I ms
defined
accent mark strings as follows.
.
.
.TS
box center;
Cb Lb
Lf(CR) Lx.
String Description
_
\[rs]*[\[aq]] Apply acute accent to subsequent glyph.
\[rs]*[\[ga]] Apply grave accent to subsequent glyph.
\[rs]*[:] Apply dieresis (umlaut) to subsequent glyph.
\[rs]*[\[ha]] Apply circumflex accent to subsequent glyph.
\[rs]*[\[ti]] Apply tilde accent to subsequent glyph.
\[rs]*[C] Apply caron to subsequent glyph.
.\" \*v was an undocumented (in Lesk 1978-11-13) synonym for \*C.
\[rs]*[,] Apply cedilla to subsequent glyph.
.TE
.KE
.
.
.NH 2
Berkeley
.I ms
accent mark and glyph strings
.XS
Berkeley
.I ms
accent mark and glyph strings
.XE
.LP
Berkeley
.I ms
offered an
.CW AM
macro;
calling it redefined the AT&T accent mark strings
(except for
.CW \[rs]*C ),
applied them to the
.I preceding
glyph,
and defined additional strings,
some for spacing glyphs.
.
.
.TS
box;
cb cb
lf(CR) lx .
Macro Description
_
\&.AM Enable alternative accent mark and glyph-producing strings.
.TE
.
.
.TS
box center;
Cb Lb
Lf(CR) Lx.
String Description
_
\[rs]*[\[aq]] Apply acute accent to preceding glyph.
\[rs]*[\[ga]] Apply grave accent to preceding glyph.
\[rs]*[:] Apply dieresis (umlaut) to preceding glyph.
\[rs]*[\[ha]] Apply circumflex accent to preceding glyph.
\[rs]*[\[ti]] Apply tilde accent to preceding glyph.
\[rs]*[,] Apply cedilla to preceding glyph.
\[rs]*[/] Apply stroke (slash) to preceding glyph.
\[rs]*[v] Apply caron to preceding glyph.
\[rs]*[_] Apply macron to preceding glyph.
\[rs]*[.] Apply underdot to preceding glyph.
\[rs]*[o] Apply ring accent to preceding glyph.
_
\[rs]*[?] Interpolate inverted question mark.
\[rs]*[!] Interpolate inverted exclamation mark.
\[rs]*[8] Interpolate small letter sharp s.
\[rs]*[q] Interpolate small letter o with hook accent (ogonek).
\[rs]*[3] Interpolate small letter yogh.
\[rs]*[d-] Interpolate small letter eth.
\[rs]*[D-] Interpolate capital letter eth.
\[rs]*[th] Interpolate small letter thorn.
\[rs]*[TH] Interpolate capital letter thorn.
\[rs]*[ae] Interpolate small ae ligature.
\[rs]*[AE] Interpolate capital ae ligature.
\[rs]*[oe] Interpolate small oe ligature.
\[rs]*[OE] Interpolate capital oe ligature.
.TE
.rs \" XXX: Work around Savannah #64005.
.
.
.\" ------------------------
.if t \{\
. br
. bp
.\}
.NH 1
Further reading
.XS
Further reading
.XE
.
.
.XP
\[lq]Typing Documents on the Unix System:
Using the \-ms Macros with Troff and Nroff\[rq];
M.\& E.\& Lesk;
November 13, 1978.
.
This document describes the
.I ms
supplied with AT&T Unix Version\~7.
.
.
.XP
\[lq]A Revised Version of \-ms\[rq];
Bill Tuthill;
August 1983.
.
The 4.2BSD release featured several extensions to
.I ms ,
most of which are recreated in
.I "groff ms" .
.
(The exceptions are the
.CW TM
and
.CW CT
macros for setting a doctoral thesis in the format required by the
contemporaneous degree-granting authorities of the University of
California at Berkeley.)
.
.
.XP
\[lq]Using PDF boxes with
.I groff
and the
.I ms
macros\[rq];
Deri James;
March 2021.
.
.CW BOXSTART
and
.CW BOXSTOP
macros are available via the
.I sboxes
extension package,
enabling colored,
bordered boxes when the
.CW pdf
output device is used.
.
This document is distributed with
.I groff
as the file
.I msboxes.pdf .
.
.
.LP
This manual was composed using
.I "groff ms" ;
the curious may consult its source in the file
.I ms.ms
to see how its formatting was achieved.
.\" ------------------------
.TC
.
.
.\" Local Variables:
.\" fill-column: 72
.\" mode: nroff
.\" End:
.\" vim: set filetype=groff textwidth=72:
|