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
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
|
'\" t
.\" groff_mdoc.man
.\"
.\" A complete reference of the mdoc macro package for GNU troff.
.\"
.\" Based on NetBSD's mdoc.samples.7, version 1.21.
.\"
.\"
.\" Warning: You can't format this file with the old mdoc macros!
.\"
.\"
.\" Copyright (C) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in
.\" the documentation and/or other materials provided with the
.\" distribution.
.\" 3. [Deleted. See
.\" ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change]
.\" 4. Neither the name of the University nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS"
.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
.\" PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" @(#)mdoc.samples.7 8.2 (Berkeley) 12/30/93
.\"
.\" This reference invokes every macro in the package several times and
.\" is guaranteed to give worst-case performance for an already
.\" extremely slow package.
.
.
.\" Save and disable compatibility mode (for, e.g., Solaris 10/11).
.do nr *groff_groff_mdoc_7_man_C \n[.cp]
.cp 0
.
.
.Dd 4 October 2023
.Dt groff_mdoc 7
.Os groff 1.23.0
.
.
.Sh Name
.
.Nm groff_mdoc
.Nd compose BSD-style manual (man) pages with GNU
.Xr roff
.
.
.Sh Synopsis
.
.Nm groff Fl m Ns Cm doc Ar file No ...
.
.
.Sh Description
.
The GNU implementation of the
.Xr mdoc
macro package is part of the
.Xr groff 1
document formatting system.
.
.Xr mdoc
is a
structurally- and semantically-oriented package for writing
.Ux
manual pages with
.Xr \%troff 1 .
.
Its predecessor,
the
.Xr man 7
package,
primarily addressed page layout and presentational concerns,
leaving the selection of fonts and other typesetting details to the
individual author.
.
This discretion has led to divergent styling practices among authors
using it.
.
.
.Pp
.Xr mdoc
organizes its macros into
.Em domains .
.
The
.Em "page structure domain"
lays out the page and
comprises titles,
section headings,
displays,
and lists.
.
The
.Em "general text domain"
supplies macros to quote or style text,
or to interpolate common noun phrases.
.
The
.Em "manual domain"
offers semantic macros corresponding to the terminology used by
practitioners in discussion of
.Ux
commands,
routines,
and files.
.
Manual domain macros distinguish
command-line arguments and options,
function names,
function parameters,
pathnames,
variables,
cross references to other manual pages,
and so on.
.
These terms are meaningful both to the author and the readers of a
manual page.
.
It is hoped that the resulting increased consistency of the man page
corpus will enable easier translation to future documentation tools.
.
.
.Pp
Throughout
.Ux
documentation,
a manual entry is referred to simply as a
.Dq "man page" ,
regardless of its length,
without gendered implication,
and irrespective of the macro package selected for its composition.
.
.
.Sh "Getting started"
.
The
.Xr mdoc
package attempts to simplify man page authorship and maintenance without
requiring mastery of the
.Xr roff
language.
.
This document presents only essential facts about
.Xr roff.
.
For further background,
including a discussion of basic typographical concepts like
.Dq breaking ,
.Dq filling ,
and
.Dq adjustment ,
see
.Xr roff 7 .
.
Specialized units of measurement also arise,
namely
ens,
vees,
inches,
and points,
abbreviated
.Dq n ,
.Dq v ,
.Dq i ,
and
.Dq p ,
respectively;
see section
.Sx Measurements
of
.Xr groff 7 .
.
.
.Pp
For brief examples,
we employ an arrow notation illustrating a transformation of input on
the left to rendered output on the right.
.
Consider the
.Pf . Ic \&Dq
macro,
which double-quotes its arguments.
.
.Bl -tag -width ".Dq\ man page" -offset indent -compact
.It Li ".Dq man page"
\[->]
.Dq man page
.El
.
.
.Ss Usage
.
An
.Xr mdoc
.Em macro
is
.Em called
by placing the
.Xr roff
control character,
.Ql .\&
(dot)
at the beginning of a line followed by its name.
.\" XXX; All mdoc macro names except Brq, Bro, Brc are 2 characters long
.\" and thus portable to old troffs. Why the innovation here, when
.\" `Cq`, `Co`, and `Cc` were available? Try to sell this reform to
.\" Ingo Schwarze.
.
In this document,
we often discuss a macro name with this leading dot to identify it
clearly,
but the dot is
.Em not
part of its name.
.
Space or tab characters can separate the dot from the macro name.
.
Arguments may follow,
separated from the macro name and each other by spaces,
but
.Em not
tabs.
.
The dot at the beginning of the line prepares the formatter to expect a
macro name.
.
A dot followed immediately by a newline is ignored;
this is called the
.Em "empty request" .
.
To begin an input line with a dot
(or a neutral apostrophe
.Ql \[aq] )
in some context other than a macro call,
precede it with the
.Ql \e&
escape sequence;
this is a dummy character,
not formatted for output.
.
The backslash is the
.Xr roff
escape character;
it can appear anywhere and it always followed by at least one more
character.
.
If followed by a newline,
the backslash escapes the input line break;
you can thus keep input lines to a reasonable length without affecting
their interpretation.
.
.
.Pp
Macros in GNU
.Xr troff
accept an unlimited number of arguments,
in contrast to other
.Xr troff Ns No s
that often can't handle more than nine.
.
In limited cases,
arguments may be continued or extended on the next input line without
resort to the
.Ql \[rs] Ns Em newline
escape sequence;
see subsection
.Sx "Extended arguments"
below.
.
Neutral double quotes
.Li \[dq]
can be used to group multiple words into an argument;
see subsection
.Sx "Passing space characters in an argument"
below.
.
.
.Pp
Most of
.Xr mdoc Ns No 's
general text and manual domain macros
.Em parse
their argument lists
for
.Em callable
macro names.
.
This means that an argument in the list matching a general text or
manual domain macro name
(and defined to be callable)
will be called with the remaining arguments when it is encountered.
.
In such cases,
the argument,
although the name of a macro,
is not preceded by a dot.
.
Macro calls can thus be nested.
.
This approach to macro argument processing is a unique characteristic of
the
.Xr mdoc
package,
not a general feature of
.Xr roff
syntax.
.
.
.Pp
For example,
the option macro,
.Pf . Ic \&Op ,
may call the flag and argument macros,
.Pf . Ic \&Fl
and
.Pf . Ic \&Ar ,
to specify an optional flag with an argument.
.
.\" Use width of second example below.
.Bl -tag -width ".Op\ \e&Fl\ s\ \e&Ar bytes" -offset indent -compact
.It Li ".Op Fl s Ar bytes"
\[->]
.Op Fl s Ar bytes
.El
.
To prevent a word from being interpreted as a macro name,
precede it with the dummy character.
.
.Bl -tag -width ".Op\ \e&Fl\ s\ \e&Ar bytes" -offset indent -compact
.It Li ".Op \e&Fl s \e&Ar bytes"
\[->]
.Op \&Fl s \&Ar bytes
.El
.
.
.Pp
In this document,
macros whose argument lists are parsed for callable arguments are
referred to as
.Em parsed ,
and those that may be called from an argument list are referred to as
.Em callable .
.
This usage is a technical
.Em "faux pas" ,
since all
.Xr mdoc
macros are in fact interpreted
(unless prevented with
.Ql \e& ) ,
but as it is cumbersome to constantly refer to macros as
.Dq "being able to call other macros" ,
we employ the term
.Dq parsed
instead.
.
Except where explicitly stated,
all
.Xr mdoc
macros are parsed and callable.
.
.
.Pp
In the following,
we term an
.Xr mdoc
macro that starts a line
(with a leading dot)
a
.Em command
if a distinction from those appearing as arguments of other macros is
necessary.
.
.
.Ss "Passing space characters in an argument"
.
Sometimes it is desirable to give a macro an argument containing one or
more space characters,
for instance to specify a particular arrangement of arguments demanded
by the macro.
.
Additionally,
quoting multi-word arguments that are to be treated the same makes
.Xr mdoc
work faster;
macros that parse arguments do so once
(at most)
for each.
.
For example,
the function command
.Pf . Ic \&Fn
expects its first argument to be the name of a function and any
remaining arguments to be function parameters.
.
Because C language standards mandate the inclusion of types
.Em and
identifiers in the parameter lists of function definitions,
each
.Ql \&Fn
parameter after the first will be at least two words in length,
as in
.Dq Ar "int foo" .
.
.
.Pp
There are a few ways to embed a space in a macro argument.
.
One is to use the unadjustable space escape sequence
.Li \[rs] Ns Em space .
.
The formatter treats this escape sequence as if it were any other
printable character,
and will not break a line there as it would a word space when the
output line is full.
.
This method is useful for macro arguments that are not expected to
straddle an output line boundary,
but has a drawback:
this space does not adjust as others do when the output line is
formatted.
.
An alternative is to use the unbreakable space escape sequence,
.Ql \[rs]\[ti] ,
which cannot break but does adjust.
.
This
.Xr groff
extension is widely but not perfectly portable.
.
Another method is to enclose the string in double quotes.
.
.Bl -tag -width ".Fn\ fetch\ \[dq]char\ *str\[dq]" -offset indent \
-compact
.It Li ".Fn fetch char\e *str"
\[->]
.Fn fetch char\ *str
.It Li ".Fn fetch char\e\[ti]*str"
\[->]
.Fn fetch char\~*str
.It Li ".Fn fetch \[dq]char *str\[dq]"
\[->]
.Fn fetch "char *str"
.El
.
If the
.Ql \[rs]
before the space in the first example
or the double quotes in the third example
were omitted,
.Ql .Fn
would see three arguments,
and the result would contain an undesired comma.
.
.\" Use same width as before so it's easier to see the discrepancy.
.Bl -tag -width ".Fn\ fetch\ \[dq]char\ *str\[dq]" -offset indent \
-compact
.It Li ".Fn fetch char *str"
\[->]
.Fn fetch char *str
.El
.
.
.\".Pp
.\" For an example of what happens when the parameter list overlaps a
.\" newline boundary,
.\" see the
.\" .Sx Bugs
.\" section.
.
.
.Ss "Trailing space characters"
.
.\" XXX: This claim of confusion is nonsense. The formatter ignores
.\" them. If mdoc doesn't, that's a bug or design flaw. It's still
.\" good style not to have them. Whitespace churn makes diff(1) and
.\" revision control users unhappy.
.\"
.\".Xr \%troff
.\"can be confused by space characters at the end of a line.
.
It is wise to remove trailing spaces from the ends of input lines.
.
Should the need arise to put a formattable space at the end of a line,
do so with the unadjustable or unbreakable space escape sequences.
.
.
.Ss "Formatting the backslash glyph"
.
When you need the
.Xr roff
escape character
.Ql \[rs]
to appear in the output,
use
.Ql \[rs]e
or
.Ql \[rs](rs
instead.
.
Technically,
.Ql \[rs]e
formats the current escape character;
it works reliably as long as no
.Xr roff
request is used to change it,
which should never happen in man pages.
.
.Ql \[rs](rs
is a
.Xr groff
special character escape sequence that explicitly formats the
.Dq "reverse solidus"
(backslash) glyph.
.
.
.Ss "Other possible pitfalls"
.
.Xr "groff mdoc"
warns when an empty input line is found outside of a
.Em display ,
a topic presented in subsection
.Sx "Examples and displays"
below.
.
Use empty requests to space the source document for maintenance.
.
.
.Pp
Leading spaces cause a break and are formatted.
.
Avoid this behaviour if possible.
.
Similarly,
do not put more than one space between words in an ordinary text line;
they are not
.Dq normalized
to a single space as other text formatters might do.
.
.
.Pp
Don't try to use the neutral double quote character
.Ql \[dq]
to represent itself in an argument.
.
Use the special character escape sequence
.Ql \[rs](dq
to format it.
.\" That's NOT a groffism, but showed up in the "post" and "Latin1"
.\" devices of Tenth Edition Research Unix.
.
Further,
this glyph should not be used for conventional quotation;
.Xr mdoc
offers several quotation macros.
.
See subsection
.Sx "Enclosure and quoting macros"
below.
.
.
.Pp
The formatter attempts to detect the ends of sentences and by default
puts the equivalent of two spaces between sentences on the same output
line;
see
.Xr roff 7 .
.
To defeat this detection in a parsed list of macro arguments,
put
.Ql \e&
before the punctuation mark.
.
Thus,
.
.Bd -literal -offset indent -compact
The
\&.Ql .
character.
\&.Pp
The
\&.Ql \e&.
character.
\&.Pp
\&.No test .
test
\&.Pp
\&.No test.
test
.Ed
.
gives
.
.Bd -filled -offset indent -compact
The
.Ql .
character
.
.
.Pp
The
.Ql \&.
character.
.
.
.Pp
.No test .
test
.
.
.Pp
.No test.
test
.Ed
.
as output.
.
As can be seen in the first and third output lines,
.Xr mdoc
handles punctuation characters specially in macro arguments.
.
This will be explained in section
.Sx "General syntax"
below.
.
.
.Pp
A comment in the source file of a man page can begin with
.Sq Li .\e"
at the start of an input line,
.Sq Li \e"
after other input,
or
.Sq Li \e#
anywhere
(the last is a
.Xr groff
extension);
the remainder of any such line is ignored.
.
.
.Sh "A man page template"
.
Use
.Xr mdoc
to construct a man page from the following template.
.
.Bd -literal -offset indent
\&.\e" The following three macro calls are required.
\&.Dd date
\&.Dt topic [section-identifier [section-keyword-or-title]]
\&.Os [package-or-operating system [version-or-release]]
\&.Sh Name
\&.Nm topic
\&.Nd summary-description
\&.\e" The next heading is used in sections 2 and 3.
\&.\e" .Sh Library
\&.\e" The next heading is used in sections 1-4, 6, 8, and 9.
\&.Sh Synopsis
\&.Sh Description
\&.\e" Uncomment and populate the following sections as needed.
\&.\e" .Sh \[dq]Implementation notes\[dq]
\&.\e" The next heading is used in sections 2, 3, and 9.
\&.\e" .Sh \[dq]Return values\[dq]
\&.\e" The next heading is used in sections 1, 3, 6, and 8.
\&.\e" .Sh Environment
\&.\e" .Sh Files
\&.\e" The next heading is used in sections 1, 6, and 8.
\&.\e" .Sh \[dq]Exit status\[dq]
\&.\e" .Sh Examples
\&.\e" The next heading is used in sections 1, 4, 6, 8, and 9.
\&.\e" .Sh Diagnostics
\&.\e" .Sh Compatibility
\&.\e" The next heading is used in sections 2, 3, 4, and 9.
\&.\e" .Sh Errors
\&.\e" .Sh \[dq]See also\[dq]
\&.\e" .Sh Standards
\&.\e" .Sh History
\&.\e" .Sh Authors
\&.\e" .Sh Caveats
\&.\e" .Sh Bugs
.Ed
.
.
.Pp
The first items in the template are the commands
.Pf . Ic \&Dd ,
.Pf . Ic \&Dt ,
and
.Pf . Ic \&Os .
.
They identify the page and are discussed below in section
.Sx "Title macros" .
.
.
.Pp
The remaining items in the template are section headings
.Pf ( Pf . Ic \&Sh ) ;
of which
.Sx Name
and
.Sx Description
are mandatory.
.
These headings are discussed in section
.Sx "Page structure domain" ,
which follows section
.Sx "Manual domain" .
.
Familiarize yourself with manual domain macros first;
we use them to illustrate the use of page structure domain macros.
.
.
.Sh Conventions
.
In the descriptions of macros below,
square brackets surround optional arguments.
.
An ellipsis
.Pf ( Sq ... )
represents repetition of the preceding argument zero or more times.
.
Alternative values of a parameter are separated with
.Ql | .
.
If a mandatory parameter can take one of several alternative values,
use braces to enclose the set,
with spaces and
.Ql |
separating the items.
.
.\" XXX: Angle brackets should only be necessary when space doesn't
.\" separate parameters.
.\" .
.\" Metasyntactic variables are specified within angle brackets.
.\"Bl -tag -width 6n -offset indent -compact
.Bl -tag -offset indent -compact
.It Nm ztar Xo
.Brq Cm c | Cm x
.Op Fl w Op Fl y | Fl z
.Op Fl f Ar archive
.Ar member No ...
.Xc
.El
.
An alternative to using braces is to separately synopsize distinct
operation modes,
particularly if the list of valid optional arguments is dependent on the
user's choice of a mandatory parameter.
.
.Bl -tag -offset indent -compact
.It Nm ztar Xo
.Cm c
.Op Fl w Op Fl y | Fl z
.Op Fl f Ar archive
.Ar member No ...
.Xc
.It Nm ztar Xo
.Cm x
.Op Fl w Op Fl y | Fl z
.Op Fl f Ar archive
.Ar member No ...
.Xc
.El
.
.
.Pp
Most macros affect subsequent arguments until another macro or a newline
is encountered.
.
For example,
.Sq Li ".Li ls Bq Ar file"
doesn't produce
.Sq Li "ls [file]" ,
but
.Sq Li ls Bq Ar file .
.
Consequently,
a warning message is emitted for many commands if the first argument is
itself a macro,
since it cancels the effect of the preceding one.
.\" XXX: I don't think it is made clear which macros eat only one
.\" argument and which ones devour tokens until another macro is
.\" encountered. -- GBR
.
On rare occasions,
you might want to format a word along with surrounding brackets as a
literal.
.
.\" XXX: Why do we need the extra "\ " for the width parameter? Without
.\" it, the line breaks before the arrow on a 78n terminal. But there
.\" should be room anyway...bug?
.\"
.\" XXX: Arguably, Bq should respect the altered font family in a `Bl`,
.\" but it sets the brackets and argument in Times roman. Maybe all the
.\" enclosures work this way.
.Bl -tag -width "Li\ \[dq]ls\ [file]\[dq]\ " -offset indent -compact
.It Li ".Li \[dq]ls [file]\[dq]"
\[->]
.Li "ls [file]"
.Em "# list any files named e, f, i, or l"
.El
.
.
.Pp
Many macros possess an implicit width,
used when they are contained in lists and displays.
.
If you avoid relying on these default measurements,
you escape potential conflicts with site-local modifications of the
.Xr mdoc
package.
.
Explicit
.Fl width
and
.Fl offset
arguments to the
.Pf . Ic \&Bl
and
.Pf . Ic \&Bd
macros are preferable.
.
.
.Sh "Title macros"
.
We present the
.Sy mandatory
title macros first due to their importance even though they formally
belong to the page structure domain macros.
.\" XXX: This was formerly "...for someone who wishes to start writing a
.\" man page yesterday."
.\"
.\" Cute joke, but we're 800+ lines into this page source and four pages
.\" into the document when formatted for U.S. letter paper. We lost
.\" that kind of reader last _week_.
.
They designate the
topic,
date of last revision,
and the operating system or software project associated with the page.
.
Call each once at the beginning of the document.
.
They populate the page headers and footers,
which are in
.Xr roff
parlance termed
.Dq titles .
.
.
.Bl -tag -width 6n
.It Li .Dd Xo
.Ar date
.Xc
This first macro of any
.Xr mdoc
manual records the last modification date of the document source.
.
Arguments are concatenated and separated with space characters.
.
.
.Pp
Historically,
.Ar date
was written in U.S.\& traditional format,
.Do
.\" XXX: Em -> Ar when we de-Courierize .Ar.
.Em Month day Li , Em year
.Dc
where
.Em Month
is the full month name in English,
.Em day
an integer without a leading zero,
and
.Em year
the four-digit year.
.
This localism is not enforced,
however.
.
You may prefer ISO 8601 format,
.Em YYYY-MM-DD.
.
A
.Ar date
of the form
.Sq Li $Mdocdate: Ar Month day year Li $
is also recognized.
.
It is used in
.Ox
manuals to automatically insert the current date when committing.
.
.
.Pp
This macro is neither callable nor parsed.
.
.
.br
.ne 5v
.It Li .Dt Ar topic Op Ar section-identifier \
Op Ar section-keyword-or-title
.
.Ar topic
is the subject of the man page.
.
A
.Ar section-identifier
that begins with an integer in the range 1\[en]9
or is one of the words
.Ql unass ,
.Ql draft ,
or
.Ql paper
selects a predefined section title.
.
This use of
.Dq section
has nothing to do with the section headings otherwise discussed in this
page;
it arises from the organizational scheme of printed and bound Unix
manuals.
.
.
.br
.ne 3v
.Pp
In this implementation,
the following titles are defined for integral section numbers.
.
.
.Bd -unfilled -offset indent
.TS
Lf(CR) L.
1 \*[doc-volume-ds-1]
2 \*[doc-volume-ds-2]
3 \*[doc-volume-ds-3]
4 \*[doc-volume-ds-4]
5 \*[doc-volume-ds-5]
6 \*[doc-volume-ds-6]
7 \*[doc-volume-ds-7]
8 \*[doc-volume-ds-8]
9 \*[doc-volume-ds-9]
.TE
.Ed
.
.
.Pp
A section title may be arbitrary or one of the following abbreviations.
.
.
.Bd -unfilled -offset indent
.TS
Lf(CR) L.
USD \*[doc-volume-ds-USD]
PS1 \*[doc-volume-ds-PS1]
AMD \*[doc-volume-ds-AMD]
SMM \*[doc-volume-ds-SMM]
URM \*[doc-volume-ds-URM]
PRM \*[doc-volume-ds-PRM]
KM \*[doc-volume-ds-KM]
IND \*[doc-volume-ds-IND]
LOCAL \*[doc-volume-ds-LOCAL]
CON \*[doc-volume-ds-CON]
.TE
.Ed
.
.
.Pp
For compatibility,
.Ql MMI
can be used for
.Ql IND ,
and
.Ql LOC
for
.Ql LOCAL .
.
Values from the previous table will specify a new section title.
.
If
.Ar section-keyword-or-title
designates a computer architecture recognized by
.Xr "groff mdoc" ,
its value is prepended to the default section title as specified by the
second parameter.
.\" mandoc(1) appears to put the architecture string after (or in place
.\" of) the section title, in parentheses.
.
By default,
the following architecture keywords are defined.
.
\# we use 'No' to avoid hyphenation
.\" Resort to ps/vs violence if necessary because this macro package is
.\" obsessed with dumping gigantic piles of identifiers on users, and I
.\" need the space to keep this macro description to a single page in
.\" PS/PDF(!). Lists of information like this simply beg to bit-rot.
.\" -- GBR
.br
.ps -2
.vs -2
.Bd -ragged -offset 4n
.No acorn26 , acorn32 , algor , alpha , amd64 , amiga , amigappc ,
.No arc , arm , arm26 , arm32 , armish , atari , aviion ,
.No beagle , bebox , cats , cesfic , cobalt , dreamcast ,
.No emips , evbarm , evbmips , evbppc , evbsh3 , ews4800mips ,
.No hp300 , hp700 , hpcarm , hpcmips , hpcsh , hppa , hppa64 ,
.No i386 , ia64 , ibmnws , iyonix , landisk , loongson , luna68k ,
.No luna88k , m68k , mac68k , macppc , mips , mips64 , mipsco , mmeye ,
.No mvme68k , mvme88k , mvmeppc , netwinder , news68k , newsmips ,
.No next68k , ofppc , palm , pc532 , playstation2 , pmax , pmppc ,
.No powerpc , prep , rs6000 , sandpoint , sbmips , sgi , sgimips , sh3 ,
.No shark , socppc , solbourne , sparc , sparc64 , sun2 , sun3 ,
.No tahoe , vax , x68k , x86_64 , xen , zaurus
.Ed
.vs
.ps
.
.
.Pp
If a section title is not determined after the above matches have been
attempted,
.Ar section-keyword-or-title
is used.
.
.
.br
.ne 10v \" Keep explanatory paragraph with the following table.
.Pp
The effects of varying
.Ql .Dt
arguments on the page header content
are shown below.
.
Observe how
.Ql \[rs]&
prevents the numeral\~2 from being used to look up a predefined section
title.
.
.
.Pp
.\" On terminals, 2n is as far as we can offset without overrunning a
.\" 78n width.
.Bd -unfilled -offset 2n
.TS
tab(@);
Lf(CR)1 L2 L C R.
\&.Dt foo 2@\[->]@foo(2)@System Calls Manual@foo(2)
\&.Dt foo 2 m68k@\[->]@foo(2)@m68k System Calls Manual@foo(2)
\&.Dt foo 2 baz@\[->]@foo(2)@System Calls Manual@foo(2)
\&.Dt foo \[rs]&2 baz@\[->]@foo(2)@baz@foo(2)
\&.Dt foo \[dq]\[dq] baz@\[->]@foo@baz@foo
\&.Dt foo M Z80@\[->]@foo(M)@Z80@foo(M)
.TE
.Ed
.
.
.Pp
.Xr roff
strings define section titles and architecture identifiers.
.
Site-specific additions might be found in the file
.Pa mdoc.local ;
see section
.Sx Files
below.
.
.
.Pp
This macro is neither callable nor parsed.
.
.
.It Li .Os Op Ar operating-system-or-package-name \
Op Ar version-or-release
.
This macro associates the document with a software distribution.
.
When composing a man page to be included in the base installation of an
operating system,
do not provide an argument;
.Xr mdoc
will supply it.
.
In this implementation,
that default is
.Dq "\*[doc-default-operating-system]" .
.
It may be overridden in the site configuration file,
.Pa mdoc.local ;
see section
.Sx Files
below.
.
A portable software package maintaining its own man pages can supply
its name and version number or release identifier as optional arguments.
.
A
.Em version-or-release
argument should use the standard nomenclature for the software
specified.
.
In the following table,
recognized
.Em version-or-release
arguments for some predefined operating systems are listed.
.
As with
.Pf . Ic \&Dt ,
site additions might be defined in
.Pa mdoc.local .
.
.Bd -ragged -compact
.Bl -tag -width ".No DragonFly" -offset indent
.It ATT
7th, 7, III, 3, V, V.2, V.3, V.4
.It BSD
3, 4, 4.1, 4.2, 4.3, 4.3t, 4.3T, 4.3r, 4.3R, 4.4
.It NetBSD
0.8, 0.8a, 0.9, 0.9a, 1.0, 1.0a, 1.1, 1.2, 1.2a, 1.2b, 1.2c, 1.2d, 1.2e,
1.3, 1.3a, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.6,
1.6.1, 1.6.2, 1.6.3, 2.0, 2.0.1, 2.0.2, 2.0.3, 2.1, 3.0, 3.0.1, 3.0.2,
3.0.3, 3.1, 3.1.1, 4.0, 4.0.1, 5.0, 5.0.1, 5.0.2, 5.1, 5.1.2, 5.1.3,
5.1.4, 5.2, 5.2.1, 5.2.2, 6.0, 6.0.1, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6,
6.1, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.5, 7.0, 7.0.1, 7.0.2, 7.1, 7.1.1,
7.1.2, 7.2, 8.0, 8.1
.It FreeBSD
1.0, 1.1, 1.1.5, 1.1.5.1, 2.0, 2.0.5, 2.1, 2.1.5, 2.1.6, 2.1.7, 2.2,
2.2.1, 2.2.2, 2.2.5, 2.2.6, 2.2.7, 2.2.8, 2.2.9, 3.0, 3.1, 3.2, 3.3,
3.4, 3.5, 4.0, 4.1, 4.1.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.6.2, 4.7, 4.8,
4.9, 4.10, 4.11, 5.0, 5.1, 5.2, 5.2.1, 5.3, 5.4, 5.5, 6.0, 6.1, 6.2,
6.3, 6.4, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1,
9.2, 9.3, 10.0, 10.1, 10.2, 10.3, 10.4, 11.0, 11.1, 11.2, 11.3, 12.0,
12.1
.It OpenBSD
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3,
3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7,
4.8, 4.9, 5.0, 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7, 5.8, 5.9, 6.0, 6.1,
6.2, 6.3, 6.4, 6.5, 6.6
.It DragonFly
1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.8.1, 1.9, 1.10, 1.11,
1.12, 1.12.2, 1.13, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
2.9.1, 2.10, 2.10.1, 2.11, 2.12, 2.13, 3.0, 3.0.1, 3.0.2, 3.1, 3.2,
3.2.1, 3.2.2, 3.3, 3.4, 3.4.1, 3.4.2, 3.4.3, 3.5, 3.6, 3.6.1, 3.6.2,
3.7, 3.8, 3.8.1, 3.8.2, 4.0, 4.0.1, 4.0.2, 4.0.3, 4.0.4, 4.0.5, 4.0.6,
4.1, 4.2, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.3, 4.4, 4.4.1, 4.4.2, 4.4.3,
4.5, 4.6, 4.6.1, 4.6.2, 4.7, 4.8, 4.8.1, 4.9, 5.0, 5.0.1, 5.0.2, 5.1,
5.2, 5.2.1, 5.2.2, 5.3, 5.4, 5.4.1, 5.4.2, 5.4.3, 5.5, 5.6, 5.6.1, 5.6.2
.It Darwin
8.0.0, 8.1.0, 8.2.0, 8.3.0, 8.4.0, 8.5.0, 8.6.0, 8.7.0, 8.8.0, 8.9.0,
8.10.0, 8.11.0, 9.0.0, 9.1.0, 9.2.0, 9.3.0, 9.4.0, 9.5.0, 9.6.0, 9.7.0,
9.8.0, 10.0.0, 10.1.0, 10.2.0, 10.3.0, 10.4.0, 10.5.0, 10.6.0, 10.7.0,
10.8.0, 11.0.0, 11.1.0, 11.2.0, 11.3.0, 11.4.0, 11.5.0, 12.0.0, 12.1.0,
12.2.0, 13.0.0, 13.1.0, 13.2.0, 13.3.0, 13.4.0, 14.0.0, 14.1.0, 14.2.0,
14.3.0, 14.4.0, 14.5.0, 15.0.0, 15.1.0, 15.2.0, 15.3.0, 15.4.0, 15.5.0,
15.6.0, 16.0.0, 16.1.0, 16.2.0, 16.3.0, 16.4.0, 16.5.0, 16.6.0, 17.0.0,
17.1.0, 17.2.0, 17.3.0, 17.4.0, 17.5.0, 17.6.0, 17.7.0, 18.0.0, 18.1.0,
18.2.0, 18.3.0, 18.4.0, 18.5.0, 18.6.0, 18.7.0, 19.0.0, 19.1.0, 19.2.0
.El
.Ed
.
.
.Pp
Historically,
the first argument used with
.Pf . Ic \&Dt
was
.Li BSD
or
.Li ATT .
.
An unrecognized version argument after
.Li ATT
is replaced with
.Dq Ux ;
for other predefined abbreviations,
it is ignored and a warning diagnostic emitted.
.
Otherwise,
unrecognized arguments are displayed verbatim in the page footer.
.
For instance,
this page uses
.Dq Li .Os groff 1.23.0
whereas a locally produced page might employ
.Dq Li .Os \[dq]UXYZ CS Department\[dq] ,
omitting versioning.
.
.
.Pp
This macro is neither callable nor parsed.
.El
.
.
.br
.ne 4v
.Sh "Introduction to manual and general text domains"
.
.
.Ss "What's in a Name" Ns ... \" XXX: Ns not scrubbed for PDF bookmark
.
The manual domain macro names are derived from the day to day informal
language used to describe commands, subroutines and related files.
Slightly different variations of this language are used to describe the
three different aspects of writing a man page.
First, there is the description of
.Xr mdoc
macro command usage.
Second is the description of a
.Ux
command
.Em with
.Xr mdoc
macros, and third, the description of a command to a user in the verbal
sense; that is, discussion of a command in the text of a man page.
.
.
.Pp
In the first case,
.Xr \%troff
macros are themselves a type of command;
the general syntax for a
.Xr troff
command is:
.
.Bd -filled -offset indent
.Li ".Xx argument1 argument2" ...
.Ed
.
.
.Pp
.
.Ql .Xx
is a macro command, and anything following it are arguments to
be processed.
In the second case, the description of a
.Ux
command using the manual domain macros is a bit more involved;
a typical
.Sx Synopsis
command line might be displayed as:
.
.Bd -filled -offset indent
.Nm filter
.Op Fl flag
.Ao Ar infile Ac Ao Ar outfile Ac
.Ed
.
.
.Pp
Here,
.Nm filter
is the command name and the
bracketed string
.Fl flag
is a
.Em flag
argument designated as optional by the option brackets.
In
.Xr mdoc
terms,
.Ao Ar infile Ac
and
.Ao Ar outfile Ac
are called
.Em meta arguments ;
in this example, the user has to replace the meta expressions given in angle
brackets with real file names.
Note that in this document meta arguments are used to describe
.Xr mdoc
commands; in most man pages, meta variables are not specifically written
with angle brackets.
.
The macros that formatted the above example:
.
.Bd -literal -offset indent
\&.Nm filter
\&.Op Fl flag
\&.Ao Ar infile Ac Ao Ar outfile Ac
.Ed
.
.
.Pp
In the third case,
discussion of commands and command syntax includes both examples above,
but may add more detail.
.
The arguments
.Ao Ar infile Ac
and
.Ao Ar outfile Ac
from the example above might be referred to as
.Em operands
or
.Em file arguments .
.
Some command-line argument lists are quite long:
.
.Bd -ragged
.Bl -tag -width ".Nm make" -offset indent -compact
.It Nm make
.Op Fl eiknqrstv
.Op Fl D Ar variable
.Op Fl d Ar flags
.Op Fl f Ar makefile
.Op Fl I Ar directory
.Op Fl j Ar max_jobs
.Op Ar variable Ns = Ns Ar value
.Bk
.Op Ar target No ...
.Ek
.El
.Ed
.
.
.Pp
Here one might talk about the command
.Xr make
and qualify the argument,
.Ar makefile ,
as an argument to the flag,
.Fl f ,
or discuss the optional file operand
.Ar target .
In the verbal context, such detail can prevent confusion, however the
.Xr mdoc
package does not have a macro for an argument
.Em to
a flag.
Instead the
.Ql \&Ar
argument macro is used for an operand or file argument like
.Ar target
as well as an argument to a flag like
.Ar variable .
The make command line was produced from:
.
.Bd -literal -offset indent
\&.Nm make
\&.Op Fl eiknqrstv
\&.Op Fl D Ar variable
\&.Op Fl d Ar flags
\&.Op Fl f Ar makefile
\&.Op Fl I Ar directory
\&.Op Fl j Ar max_jobs
\&.Op Ar variable Ns = Ns Ar value
\&.Bk
\&.Op Ar target ...
\&.Ek
.Ed
.
.
.Pp
The
.Ql .Bk
and
.Ql .Ek
macros are explained in
.Sx Keeps .
.
.
.Ss "General Syntax"
.
The manual domain and general text domain macros share a similar syntax
with a few minor deviations;
most notably,
.Ql .Ar ,
.Ql .Fl ,
.Ql .Nm ,
and
.Ql .Pa
differ only when called without arguments; and
.Ql .Fn
and
.Ql .Xr
impose an order on their argument lists.
.
All manual domain macros are capable of recognizing and properly
handling punctuation,
provided each punctuation character is separated by a leading space.
.
If a command is given:
.
.
.Pp
.Dl \&.Ar sptr, ptr),
.
.
.Pp
The result is:
.
.
.Pp
.Dl Ar sptr, ptr),
.
.
.Pp
The punctuation is not recognized and all is output in the
font used by
.Ql .Ar .
If the punctuation is separated by a leading white space:
.
.
.Pp
.Dl \&.Ar "sptr , ptr ) ,"
.
.
.Pp
The result is:
.
.
.Pp
.Dl Ar sptr , ptr ) ,
.
.
.Pp
The punctuation is now recognized and output in the default font
distinguishing it from the argument strings.
.
To remove the special meaning from a punctuation character,
escape it with
.Ql \e& .
.
.
.Pp
The following punctuation characters are recognized by
.Xr mdoc :
.
.Bl -column -offset indent-two XXXXXX XXXXXX XXXXXX XXXXXX
.It Li .\& Ta Li ,\& Ta Li :\& Ta Li ;\& Ta Li (\&
.It Li )\& Ta Li [\& Ta Li ]\& Ta Li ?\& Ta Li !\&
.El
.
.
.Pp
.
.Xr troff
is limited as a macro language,
and has difficulty when presented with a string containing certain
mathematical,
logical,
or quotation character sequences:
.
.Bd -literal -offset indent-two
{+,\-,/,*,%,<,>,<=,>=,=,==,&,\[ga],\[aq],"}
.Ed
.
.
.Pp
The problem is that
.Xr troff
may assume it is supposed to actually perform the operation or
evaluation suggested by the characters.
.
To prevent the accidental evaluation of these characters,
escape them with
.Ql \e& .
.
Typical syntax is shown in the first manual domain macro displayed
below,
.Ql .Ad .
.
.
.Sh "Manual domain"
.
.
.Ss Addresses
.
The address macro identifies an address construct.
.
.
.Pp
.Dl Usage: .Ad Ao address Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Ad\ f1\ ,\ f2\ ,\ f3\ :" -compact -offset 15n
.It Li ".Ad addr1"
.Ad addr1
.It Li ".Ad addr1 ."
.Ad addr1 .
.It Li ".Ad addr1 , file2"
.Ad addr1 , file2
.It Li ".Ad f1 , f2 , f3 :"
.Ad f1 , f2 , f3 :
.It Li ".Ad addr ) ) ,"
.Ad addr ) ) ,
.El
.
.
.Pp
The default width is 12n.
.
.Ss "Author Name"
.
The
.Ql .An
macro is used to specify the name of the author of the item being
documented, or the name of the author of the actual manual page.
.
.
.Pp
.Dl Usage: .An Ao author name Ac ...
.
.
.Pp
.Bl -tag -width ".Li .An\ \[dq]Joe\ Author\[dq]\ )\ )\ ," -offset 15n
.It Li ".An \[dq]Joe Author\[dq]"
.An "Joe Author"
.It Li ".An \[dq]Joe Author\[dq] ,"
.An "Joe Author" ,
.It Li ".An \[dq]Joe Author\[dq] Aq nobody@FreeBSD.org"
.An "Joe Author" Aq nobody@FreeBSD.org
.It Li ".An \[dq]Joe Author\[dq] ) ) ,"
.An "Joe Author" ) ) ,
.El
.
.
.Pp
The default width is 12n.
.
.
.Pp
In a section titled
.Dq Authors ,
.Ql \&An
causes a break,
allowing each new name to appear on its own line.
.
If this is not desirable,
.
.Bd -literal -offset indent
\&.An \-nosplit
.Ed
.
.
.Pp
.
call will turn this off.
To turn splitting back on, write
.
.Bd -literal -offset indent
\&.An \-split
.Ed
.
.
.Ss Arguments
.
The
.Li .Ar
argument macro may be used whenever an argument is referenced.
.
If called without arguments,
.Sq Ar
is output.
.
This places the ellipsis in italics,
which is ugly and incorrect,
and will be noticed on terminals that underline text instead of using an
oblique typeface.
.
We recommend using
.Ql ".Ar file \&No ..."
instead.
.
.
.Pp
.Dl Usage: .Ar Oo Ao argument Ac Oc No ...
.
.
.Pp
.Bl -tag -width ".Li .Ar\ file1\ file2" -compact -offset 15n
.It Li .Ar
.Ar
.It Li .Ar file \&No ...
.Ar file No ...
.It Li ".Ar file1"
.Ar file1
.It Li ".Ar file1 ."
.Ar file1 .
.It Li ".Ar file1 file2"
.Ar file1 file2
.It Li ".Ar f1 f2 f3 :"
.Ar f1 f2 f3 :
.It Li ".Ar file ) ) ,"
.Ar file ) ) ,
.El
.
.
.Pp
.
The default width is 12n.
.
.
.Ss "Configuration Declaration (Section Four Only)"
.
The
.Ql .Cd
macro is used to demonstrate a
.Xr config 8
declaration for a device interface in a section four manual.
.
.
.Pp
.Dl Usage: .Cd Ao argument Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Cd\ Xdevice\ le0\ at\ scode?X" -offset 15n
.It Li ".Cd \[dq]device le0 at scode?\[dq]"
.Cd "device le0 at scode?"
.El
.
.
.Pp
In a section titled
.Dq Synopsis ,
.Ql \&Cd
causes a break before and after its arguments.
.
.
.Pp
The default width is 12n.
.
.
.Ss "Command Modifiers"
.
The command modifier is identical to the
.Ql .Fl
(flag) command with the exception that the
.Ql .Cm
macro does not assert a dash in front of every argument.
Traditionally flags are marked by the preceding dash, however, some commands
or subsets of commands do not use them.
Command modifiers may also be specified in conjunction with interactive
commands such as editor commands.
See
.Sx Flags .
.
.
.Pp
The default width is 10n.
.
.
.Ss "Defined Variables"
.
A variable
(or constant)
that is defined in an include file is specified by the macro
.Ql .Dv .
.
.
.Pp
.Dl Usage: .Dv Ao defined-variable Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Dv\ MAXHOSTNAMELEN" -compact -offset 15n
.It Li ".Dv MAXHOSTNAMELEN"
.Dv MAXHOSTNAMELEN
.It Li ".Dv TIOCGPGRP )"
.Dv TIOCGPGRP )
.El
.
.
.Pp
.
The default width is 12n.
.
.
.Ss Errnos
.
The
.Ql .Er
errno macro specifies the error return value for section 2,
3,
and\~9 library routines.
.
The second example below shows
.Ql .Er
used with the
.Ql .Bq
general text domain macro,
as it would be used in a section two manual page.
.
.
.Pp
.Dl Usage: .Er Ao errno type Ac ...
.Pp
.Bl -tag -width ".Li .Bq\ Er\ ENOTDIR" -compact -offset 15n
.It Li ".Er ENOENT"
.Er ENOENT
.It Li ".Er ENOENT ) ;"
.Er ENOENT ) ;
.It Li ".Bq Er ENOTDIR"
.Bq Er ENOTDIR
.El
.Pp
.
The default width is 17n.
.
.
.Ss "Environment Variables"
.
The
.Ql .Ev
macro specifies an environment variable.
.Pp
.Dl Usage: .Ev Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Ev\ PRINTER\ )\ )\ ," -compact -offset 15n
.It Li ".Ev DISPLAY"
.Ev DISPLAY
.It Li ".Ev PATH ."
.Ev PATH .
.It Li ".Ev PRINTER ) ) ,"
.Ev PRINTER ) ) ,
.El
.Pp
.
The default width is 15n.
.
.
.Ss Flags
.
The
.Ql .Fl
macro handles command-line flags.
It prepends a dash,
.Ql \- ,
to the flag.
.
For interactive command flags that are not prepended with a dash,
the
.Ql .Cm
(command modifier)
macro is identical,
but without the dash.
.
.
.Pp
.Dl Usage: .Fl Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Fl\ xyz\ )\ ," -compact -offset 15n
.It Li .Fl
.Fl
.It Li ".Fl cfv"
.Fl cfv
.It Li ".Fl cfv ."
.Fl cfv .
.It Li ".Cm cfv ."
.Cm cfv .
.It Li ".Fl s v t"
.Fl s v t
.It Li ".Fl \- ,"
.Fl \- ,
.It Li ".Fl xyz ) ,"
.Fl xyz ) ,
.It Li ".Fl |"
.Fl |
.El
.Pp
The
.Ql .Fl
macro without any arguments results in a dash representing stdin/stdout.
Note that giving
.Ql .Fl
a single dash will result in two dashes.
.Pp
The default width is 12n.
.
.
.Ss "Function Declarations"
.
The
.Ql .Fd
macro is used in the
.Sx Synopsis
section with section two or three functions.
It is neither callable nor parsed.
.Pp
.Dl Usage: .Fd Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Fd\ X#include\ <sys/types.h>X" -compact -offset 15n
.It Li ".Fd \[dq]#include <sys/types.h>\[dq]"
.Fd "#include <sys/types.h>"
.El
.
.
.Pp
In a section titled
.Dq Synopsis ,
.Ql \&Fd
causes a break if a function has already been presented and a break has
not occurred,
leaving vertical space between one function declaration and the next.
.\" XXX: that's not what "break" means
.
.
.Pp
In a section titled
.Dq Synopsis ,
the
.Ql \&In
macro represents the
.Li #include
statement,
and is the short form of the above example.
.
It specifies the C\~header file as being included in a C\~program.
.
It also causes a break.
.
.
.Pp
While not in the
.Dq Synopsis
section,
it represents the header file enclosed in angle brackets.
.
.
.Pp
.Dl Usage: .In Ao header file Ac
.
.
.Pp
.Bl -tag -width ".Li .In\ stdio.h" -compact -offset 15n
.nr in-synopsis-section 1
.It Li ".In stdio.h"
.In stdio.h
.nr in-synopsis-section 0
.It Li ".In stdio.h"
.In stdio.h
.El
.
.
.Ss "Function Types"
.
This macro is intended for the
.Dq Synopsis
section.
.
It may be used anywhere else in the man page without problems,
but its main purpose is to present the function type
(in BSD kernel normal form)
for the
.Dq Synopsis
of sections two and three.
.
(It causes a break,
allowing the function name to appear on the next line.)
.
.
.Pp
.Dl Usage: .Ft Ao type Ac ...
.Pp
.Bl -tag -width ".Li .Ft\ struct\ stat" -compact -offset 15n
.It Li ".Ft struct stat"
.Ft struct stat
.El
.
.
.Ss "Functions (Library Routines)"
.
The
.Ql .Fn
macro is modeled on
.Tn ANSI\~C
conventions.
.Pp
.Dl Usage: .Fn Ao function Ac Oo Ao parameter Ac Oc ...
.Pp
.Bl -tag -width ".Li .Fn\ align\ Xchar\ *ptrX\ ," -compact -offset 15n
.It Li ".Fn getchar"
.Fn getchar
.It Li ".Fn strlen ) ,"
.Fn strlen ) ,
.It Li ".Fn align \[dq]char *ptr\[dq] ,"
.Fn align "char *ptr" ,
.El
.Pp
Note that any call to another macro signals the end of the
.Ql .Fn
call (it will insert a closing parenthesis at that point).
.
.
.Pp
For functions with many parameters
(which is rare),
the macros
.Ql .Fo
(function open)
and
.Ql .Fc
(function close)
may be used with
.Ql .Fa
(function argument).
.Pp
Example:
.
.Bd -literal -offset indent
\&.Ft int
\&.Fo res_mkquery
\&.Fa "int op"
\&.Fa "char *dname"
\&.Fa "int class"
\&.Fa "int type"
\&.Fa "char *data"
\&.Fa "int datalen"
\&.Fa "struct rrec *newrr"
\&.Fa "char *buf"
\&.Fa "int buflen"
\&.Fc
.Ed
.Pp
.
Produces:
.
.Bd -ragged -offset indent
.Ft int
.Fo res_mkquery
.Fa "int op"
.Fa "char *dname"
.Fa "int class"
.Fa "int type"
.Fa "char *data"
.Fa "int datalen"
.Fa "struct rrec *newrr"
.Fa "char *buf"
.Fa "int buflen"
.Fc
.Ed
.
.
.Pp
Typically,
in a
.Dq Synopsis
section,
the function delcaration will begin the line.
.
If more than one function is presented in the
.Dq Synopsis
section and a function type has not been given,
a break will occur,
leaving vertical space between the current and prior function names.
.\" XXX: that's not what "break" means
.
.
.Pp
The default width values of
.Ql .Fn
and
.Ql .Fo
are 12n and 16n,
respectively.
.
.
.Ss "Function Arguments"
.
The
.Ql .Fa
macro is used to refer to function arguments (parameters) outside of the
.Sx Synopsis
section of the manual or inside the
.Sx Synopsis
section if the enclosure macros
.Ql .Fo
and
.Ql .Fc
instead of
.Ql .Fn
are used.
.Ql .Fa
may also be used to refer to structure members.
.Pp
.Dl Usage: .Fa Ao function argument Ac ...
.Pp
.Bl -tag -width ".Li .Fa\ d_namlen\ )\ )\ ," -compact -offset 15n
.It Li ".Fa d_namlen ) ) ,"
.Fa d_namlen ) ) ,
.It Li ".Fa iov_len"
.Fa iov_len
.El
.Pp
.
The default width is 12n.
.
.
.Ss "Return Values"
.
The
.Ql .Rv
macro generates text for use in the
.Sx Return values
section.
.Pp
.Dl Usage: .Rv Oo \-std Oc Op Ao function Ac ...
.Pp
For example,
.Ql ".Rv \-std atexit"
produces:
.
.Bd -ragged -offset indent
\# a small hack to suppress a warning message
.ds doc-section-old "\*[doc-section]
.ds doc-section 3
.Rv -std atexit
.ds doc-section "\*[doc-section-old]
.Ed
.Pp
.
The
.Fl std
option is valid only for manual page sections\~2 and\~3.
Currently, this macro does nothing if used without the
.Fl std
flag.
.
.
.Ss "Exit Status"
.
The
.Ql .Ex
macro generates text for use in the
.Sx Diagnostics
section.
.Pp
.Dl Usage: .Ex Oo \-std Oc Op Ao utility Ac ...
.Pp
For example,
.Ql ".Ex \-std cat"
produces:
.
.Bd -ragged -offset indent
\# a small hack to suppress a warning message
.ds doc-section-old "\*[doc-section]
.ds doc-section 1
.Ex -std cat
.ds doc-section "\*[doc-section-old]
.Ed
.Pp
.
The
.Fl std
option is valid only for manual page sections 1, 6 and\~8.
Currently, this macro does nothing if used without the
.Fl std
flag.
.
.
.Ss "Interactive Commands"
.
The
.Ql .Ic
macro designates an interactive or internal command.
.Pp
.Dl Usage: .Ic Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Ic\ setenv\ ,\ unsetenv" -compact -offset 15n
.It Li ".Ic :wq"
.Ic :wq
.It Li ".Ic \[dq]do while {...}\[dq]"
.Ic "do while {...}"
.It Li ".Ic setenv , unsetenv"
.Ic setenv , unsetenv
.El
.Pp
.
The default width is 12n.
.
.
.Ss "Library Names"
.
The
.Ql .Lb
macro is used to specify the library where a particular function is compiled
in.
.Pp
.Dl Usage: .Lb Ao argument Ac ...
.Pp
Available arguments to
.Ql .Lb
and their results are:
.
.Pp
.Bl -tag -width ".Li librpcsec_gss" -compact -offset indent
.It Li libarchive
.Lb libarchive
.It Li libarm
.Lb libarm
.It Li libarm32
.Lb libarm32
.It Li libbluetooth
.Lb libbluetooth
.It Li libbsm
.Lb libbsm
.It Li libc
.Lb libc
.It Li libc_r
.Lb libc_r
.It Li libcalendar
.Lb libcalendar
.It Li libcam
.Lb libcam
.It Li libcdk
.Lb libcdk
.It Li libcipher
.Lb libcipher
.It Li libcompat
.Lb libcompat
.It Li libcrypt
.Lb libcrypt
.It Li libcurses
.Lb libcurses
.It Li libdevinfo
.Lb libdevinfo
.It Li libdevstat
.Lb libdevstat
.It Li libdisk
.Lb libdisk
.It Li libdwarf
.Lb libdwarf
.It Li libedit
.Lb libedit
.It Li libelf
.Lb libelf
.It Li libevent
.Lb libevent
.It Li libfetch
.Lb libfetch
.It Li libform
.Lb libform
.It Li libgeom
.Lb libgeom
.It Li libgpib
.Lb libgpib
.It Li libi386
.Lb libi386
.It Li libintl
.Lb libintl
.It Li libipsec
.Lb libipsec
.It Li libipx
.Lb libipx
.It Li libiscsi
.Lb libiscsi
.It Li libjail
.Lb libjail
.It Li libkiconv
.Lb libkiconv
.It Li libkse
.Lb libkse
.It Li libkvm
.Lb libkvm
.It Li libm
.Lb libm
.It Li libm68k
.Lb libm68k
.It Li libmagic
.Lb libmagic
.It Li libmd
.Lb libmd
.It Li libmemstat
.Lb libmemstat
.It Li libmenu
.Lb libmenu
.It Li libnetgraph
.Lb libnetgraph
.It Li libnetpgp
.Lb libnetpgp
.It Li libossaudio
.Lb libossaudio
.It Li libpam
.Lb libpam
.It Li libpcap
.Lb libpcap
.It Li libpci
.Lb libpci
.It Li libpmc
.Lb libpmc
.It Li libposix
.Lb libposix
.It Li libprop
.Lb libprop
.It Li libpthread
.Lb libpthread
.It Li libpuffs
.Lb libpuffs
.It Li librefuse
.Lb librefuse
.It Li libresolv
.Lb libresolv
.It Li librpcsec_gss
.Lb librpcsec_gss
.It Li librpcsvc
.Lb librpcsvc
.It Li librt
.Lb librt
.It Li libsdp
.Lb libsdp
.It Li libssp
.Lb libssp
.It Li libSystem
.Lb libSystem
.It Li libtermcap
.Lb libtermcap
.It Li libterminfo
.Lb libterminfo
.It Li libthr
.Lb libthr
.It Li libufs
.Lb libufs
.It Li libugidfw
.Lb libugidfw
.It Li libulog
.Lb libulog
.It Li libusbhid
.Lb libusbhid
.It Li libutil
.Lb libutil
.It Li libvgl
.Lb libvgl
.It Li libx86_64
.Lb libx86_64
.It Li libz
.Lb libz
.El
.
.
.Pp
Site-specific additions might be found in the file
.Pa mdoc.local ;
see section
.Sx Files
below.
.
.
.Pp
In a section titled
.Dq Library ,
.Ql \&Lb
causes a break before and after its arguments.
.
.
.Ss Literals
.
The
.Ql \&Li
literal macro may be used for special characters,
symbolic constants,
and other syntactical items that should be typed exactly as displayed.
.
.
.Pp
.Dl Usage: .Li Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Li\ cntrl\-D\ )\ ," -compact -offset 15n
.It Li ".Li \een"
.Li \en
.It Li ".Li M1 M2 M3 ;"
.Li M1 M2 M3 ;
.It Li ".Li cntrl\-D ) ,"
.Li cntrl-D ) ,
.It Li ".Li 1024 ..."
.Li 1024 ...
.El
.Pp
.
The default width is 16n.
.
.
.Ss Names
.
The
.Ql \&Nm
macro is used for the document title or page topic.
.
Upon its first call,
it has the peculiarity of remembering its argument,
which should always be the topic of the man page.
.
When subsequently called without arguments,
.Ql \&Nm
regurgitates this initial name for the sole purpose of making less work
for the author.
.
Use of
.Ql \&Nm
is also appropriate when presenting a command synopsis for the topic of
a man page in section 1,
6,
or 8.
.
Its behavior changes when presented with arguments of various forms.
.
.
.Pp
.Bl -tag -width ".Li .Nm\ groff_mdoc" -compact -offset 15n
.It Li ".Nm groff_mdoc"
.Nm groff_mdoc
.It Li ".Nm"
.Nm
.It Li ".Nm \e\-mdoc"
.Nm \-mdoc
.It Li ".Nm foo ) ) ,"
.Nm foo ) ) ,
.It Li ".Nm :"
.Nm :
.El
.
.
.Pp
By default,
the topic is set in boldface to reflect its prime importance in the
discussion.
.
Cross references to other man page topics should use
.Ql \&Xr ;
including a second argument for the section number enables them to be
hyperlinked.
.
By default,
cross-referenced topics are set in italics to avoid cluttering the page
with boldface.
.
.
.Pp
The default width is 10n.
.
.
.Ss Options
The
.Ql .Op
macro places option brackets around any remaining arguments on the
command line,
and places any trailing punctuation outside the brackets.
.
The macros
.Ql .Oo
and
.Ql .Oc
(which produce an opening and a closing option bracket,
respectively)
may be used across one or more lines or to specify the exact position of
the closing parenthesis.
.
.
.Pp
.Dl Usage: .Op Oo Ao option Ac Oc ...
.Pp
.Bl -tag -width ".Li .Op\ Fl\ c\ Ar\ objfil\ Op\ Ar\ corfil\ ," -compact -offset 15n
.It Li .Op
.Op
.It Li ".Op Fl k"
.Op Fl k
.It Li ".Op Fl k ) ."
.Op Fl k ) .
.It Li ".Op Fl k Ar kookfile"
.Op Fl k Ar kookfile
.It Li ".Op Fl k Ar kookfile ,"
.Op Fl k Ar kookfile ,
.It Li ".Op Ar objfil Op Ar corfil"
.Op Ar objfil Op Ar corfil
.It Li ".Op Fl c Ar objfil Op Ar corfil ,"
.Op Fl c Ar objfil Op Ar corfil ,
.It Li ".Op word1 word2"
.Op word1 word2
.It Li ".Li .Op Oo Ao option Ac Oc ..."
.Li .Op Oo Ao option Ac Oc ...
.El
.Pp
Here a typical example of the
.Ql .Oo
and
.Ql .Oc
macros:
.
.Bd -literal -offset indent
\&.Oo
\&.Op Fl k Ar kilobytes
\&.Op Fl i Ar interval
\&.Op Fl c Ar count
\&.Oc
.Ed
.Pp
.
Produces:
.
.Bd -filled -offset indent
.Oo
.Op Fl k Ar kilobytes
.Op Fl i Ar interval
.Op Fl c Ar count
.Oc
.Ed
.Pp
.
The default width values of
.Ql .Op
and
.Ql .Oo
are 14n and 10n, respectively.
.
.
.Ss Pathnames
.
The
.Ql .Pa
macro formats file specifications.
.
If called without arguments,
.Sq Pa
(recognized by many shells)
is output,
representing the user's home directory.
.
.
.Pp
.Dl Usage: .Pa Oo Ao pathname Ac Oc ...
.Pp
.Bl -tag -width ".Li .Pa\ /tmp/fooXXXXX\ )\ ." -compact -offset 15n
.It Li .Pa
.Pa
.It Li ".Pa /usr/share"
.Pa /usr/share
.It Li ".Pa /tmp/fooXXXXX ) ."
.Pa /tmp/fooXXXXX ) .
.El
.Pp
.
The default width is 32n.
.
.
.Ss Standards
.
The
.Ql .St
macro replaces standard abbreviations with their formal names.
.Pp
.Dl Usage: .St Ao abbreviation Ac ...
.Pp
Available pairs for
.Dq Abbreviation/Formal Name
are:
.
.Pp
.Tn ANSI/ISO C
.Pp
.Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
.It Li \-ansiC
.St -ansiC
.It Li \-ansiC\-89
.St -ansiC-89
.It Li \-isoC
.St -isoC
.It Li \-isoC\-90
.St -isoC-90
.It Li \-isoC\-99
.St -isoC-99
.It Li \-isoC\-2011
.St -isoC-2011
.El
.Pp
.
.Tn POSIX
Part 1: System API
.Pp
.Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
.It Li \-iso9945\-1\-90
.St -iso9945-1-90
.It Li \-iso9945\-1\-96
.St -iso9945-1-96
.It Li \-p1003.1
.St -p1003.1
.It Li \-p1003.1\-88
.St -p1003.1-88
.It Li \-p1003.1\-90
.St -p1003.1-90
.It Li \-p1003.1\-96
.St -p1003.1-96
.It Li \-p1003.1b\-93
.St -p1003.1b-93
.It Li \-p1003.1c\-95
.St -p1003.1c-95
.It Li \-p1003.1g\-2000
.St -p1003.1g-2000
.It Li \-p1003.1i\-95
.St -p1003.1i-95
.It Li \-p1003.1\-2001
.St -p1003.1-2001
.It Li \-p1003.1\-2004
.St -p1003.1-2004
.It Li \-p1003.1\-2008
.St -p1003.1-2008
.El
.Pp
.
.Tn POSIX
Part 2: Shell and Utilities
.Pp
.Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
.It Li \-iso9945\-2\-93
.St -iso9945-2-93
.It Li \-p1003.2
.St -p1003.2
.It Li \-p1003.2\-92
.St -p1003.2-92
.It Li \-p1003.2a\-92
.St -p1003.2a-92
.El
.Pp
.
X/Open
.Pp
.Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
.It Li \-susv1
.St -susv1
.It Li \-susv2
.St -susv2
.It Li \-susv3
.St -susv3
.It Li \-susv4
.St -susv4
.It Li \-svid4
.St -svid4
.It Li \-xbd5
.St -xbd5
.It Li \-xcu5
.St -xcu5
.It Li \-xcurses4.2
.St -xcurses4.2
.It Li \-xns5
.St -xns5
.It Li \-xns5.2
.St -xns5.2
.It Li \-xpg3
.St -xpg3
.It Li \-xpg4
.St -xpg4
.It Li \-xpg4.2
.St -xpg4.2
.It Li \-xsh5
.St -xsh5
.El
.Pp
.
Miscellaneous
.Pp
.Bl -tag -width ".Li \-p1003.1g\-2000" -compact -offset indent
.It Li \-ieee754
.St -ieee754
.It Li \-iso8601
.St -iso8601
.It Li \-iso8802\-3
.St -iso8802-3
.El
.
.
.Ss "Variable Types"
The
.Ql .Vt
macro may be used whenever a type is referenced.
.
In a section titled
.Dq Synopsis ,
.Ql \&Vt
causes a break
(useful for old-style C variable declarations).
.
.
.Pp
.Dl Usage: .Vt Ao type Ac ...
.Pp
.Bl -tag -width ".Li .Vt\ extern\ char\ *optarg\ ;" -compact -offset 15n
.It Li ".Vt extern char *optarg ;"
.Vt extern char *optarg ;
.It Li ".Vt FILE *"
.Vt FILE *
.El
.
.
.Ss Variables
.
Generic variable reference.
.Pp
.Dl Usage: .Va Ao variable Ac ...
.Pp
.Bl -tag -width ".Li .Va\ Xchar\ sX\ ]\ )\ )\ ," -compact -offset 15n
.It Li ".Va count"
.Va count
.It Li ".Va settimer ,"
.Va settimer ,
.It Li ".Va \[dq]int *prt\[dq] ) :"
.Va "int *prt" ) :
.It Li ".Va \[dq]char s\[dq] ] ) ) ,"
.Va "char s" ] ) ) ,
.El
.Pp
.
The default width is 12n.
.
.
.Ss "Manual Page Cross References"
.
The
.Ql .Xr
macro expects the first argument to be a manual page name.
.
The optional second argument,
if a string
(defining the manual section),
is
put into parentheses.
.
.
.Pp
.Dl Usage: .Xr Ao man page name Ac Oo Ao section Ac Oc ...
.
.
.Pp
.Bl -tag -width ".Li .Xr\ xinit\ 1x\ ;" -compact -offset 15n
.It Li ".Xr mdoc"
.Xr mdoc
.It Li ".Xr mdoc ,"
.Xr mdoc ,
.It Li ".Xr mdoc 7"
.Xr mdoc 7
.It Li ".Xr xinit 1x ;"
.Xr xinit 1x ;
.El
.
.
.Pp
The default width is 10n.
.
.
.Sh "General text domain"
.
.
.Ss "AT&T Macro"
.
.Pp
.Dl Usage: .At Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .At\ v6\ ." -compact -offset 15n
.It Li .At
.At
.It Li ".At v6 ."
.At v6 .
.El
.Pp
The following values for
.Ao version Ac
are possible:
.Pp
.Dl 32v, v1, v2, v3, v4, v5, v6, v7, III, V, V.1, V.2, V.3, V.4
.
.
.Ss "BSD Macro"
.
.Pp
.Dl "Usage: .Bx" Bro \-alpha | \-beta | \-devel Brc ...
.Dl " .Bx" Oo Ao version Ac Oo Ao release Ac Oc Oc ...
.Pp
.Bl -tag -width ".Li .Bx\ -devel" -compact -offset 15n
.It Li .Bx
.Bx
.It Li ".Bx 4.3 ."
.Bx 4.3 .
.It Li ".Bx \-devel"
.Bx -devel
.El
.Pp
.Ao version Ac
will be prepended to the string
.Sq Bx .
The following values for
.Ao release Ac
are possible:
.Pp
.Dl Reno, reno, Tahoe, tahoe, Lite, lite, Lite2, lite2
.
.
.Ss "NetBSD Macro"
.
.Pp
.Dl Usage: .Nx Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .Nx\ 1.4\ ." -compact -offset 15n
.It Li .Nx
.Nx
.It Li ".Nx 1.4 ."
.Nx 1.4 .
.El
.Pp
For possible values of
.Ao version Ac
see the description of the
.Ql .Os
command above in section
.Sx "Title macros" .
.
.
.Ss "FreeBSD Macro"
.
.Pp
.Dl Usage: .Fx Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .Fx\ 2.2\ ." -compact -offset 15n
.It Li .Fx
.Fx
.It Li ".Fx 2.2 ."
.Fx 2.2 .
.El
.Pp
For possible values of
.Ao version Ac
see the description of the
.Ql .Os
command above in section
.Sx "Title macros" .
.
.
.Ss "DragonFly Macro"
.
.Pp
.Dl Usage: .Dx Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .Dx\ 1.4\ ." -compact -offset 15n
.It Li .Dx
.Dx
.It Li ".Dx 1.4 ."
.Dx 1.4 .
.El
.Pp
For possible values of
.Ao version Ac
see the description of the
.Ql .Os
command above in section
.Sx "Title macros" .
.
.
.Ss "OpenBSD Macro"
.
.Pp
.Dl Usage: .Ox Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .Ox\ 1.0" -compact -offset 15n
.It Li ".Ox 1.0"
.Ox 1.0
.El
.
.
.Ss "BSD/OS Macro"
.
.Pp
.Dl Usage: .Bsx Oo Ao version Ac Oc ...
.Pp
.Bl -tag -width ".Li .Bsx\ 1.0" -compact -offset 15n
.It Li ".Bsx 1.0"
.Bsx 1.0
.El
.
.
.Ss "Unix Macro"
.
.Pp
.Dl Usage: .Ux ...
.Pp
.Bl -tag -width ".Li .Ux" -compact -offset 15n
.It Li .Ux
.Ux
.El
.
.
.Ss "Emphasis Macro"
.
Text may be stressed or emphasized with the
.Ql .Em
macro.
The usual font for emphasis is italic.
.Pp
.Dl Usage: .Em Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Em\ vide\ infra\ )\ )\ ," -compact -offset 15n
.It Li ".Em does not"
.Em does not
.It Li ".Em exceed 1024 ."
.Em exceed 1024 .
.It Li ".Em vide infra ) ) ,"
.Em vide infra ) ) ,
.El
.Pp
.
The default width is 10n.
.
.
.Ss "Font Mode"
.
The
.Ql .Bf
font mode must be ended with the
.Ql .Ef
macro (the latter takes no arguments).
Font modes may be nested within other font modes.
.Pp
.Ql .Bf
has the following syntax:
.Pp
.Dl .Bf Ao font mode Ac
.Pp
.Ao font mode Ac
must be one of the following three types:
.Pp
.Bl -tag -width ".Sy \&Sy | Fl symbolic" -compact -offset indent
.It Sy \&Em | Fl emphasis
Same as if the
.Ql .Em
macro was used for the entire block of text.
.It Sy \&Li | Fl literal
Same as if the
.Ql .Li
macro was used for the entire block of text.
.It Sy \&Sy | Fl symbolic
Same as if the
.Ql .Sy
macro was used for the entire block of text.
.El
.Pp
Both macros are neither callable nor parsed.
.
.
.Ss "Enclosure and Quoting Macros"
.
The concept of enclosure is similar to quoting.
The object being to enclose one or more strings between a pair of characters
like quotes or parentheses.
The terms quoting and enclosure are used interchangeably throughout this
document.
Most of the one-line enclosure macros end in small letter
.Ql q
to give a hint of quoting, but there are a few irregularities.
.
For each enclosure macro,
there is a pair of opening and closing macros that end with the
lowercase letters
.Ql o
and
.Ql c
respectively.
.Pp
\# XXX
.if t \
. ne 10
.
.TS
lb lb lb lb lb
l l l l l.
Quote Open Close Function Result
\&.Aq .Ao .Ac Angle Bracket Enclosure <string>
\&.Bq .Bo .Bc Bracket Enclosure [string]
\&.Brq .Bro .Brc Brace Enclosure {string}
\&.Dq .Do .Dc Double Quote \[lq]string\[rq]
\&.Eq .Eo .Ec Enclose String (in XY) XstringY
\&.Pq .Po .Pc Parenthesis Enclosure (string)
\&.Ql Quoted Literal \[lq]string\[rq] or string
\&.Qq .Qo .Qc Straight Double Quote "string"
\&.Sq .So .Sc Single Quote \[oq]string\[cq]
.TE
.Pp
All macros ending with
.Sq q
and
.Sq o
have a default width value of 12n.
.
.Bl -tag -width ".Li .Ec , .Eo"
.It Li .Eo , .Ec
These macros expect the first argument to be the opening and closing
strings,
respectively.
.
.It Li .Es , .En
To work around the nine-argument limit in the original
.Xr troff \" generic
program,
.Xr mdoc
supports two other macros that are now obsolete.
.
.Ql .Es
uses its first and second parameters as opening and closing marks which
are then used to enclose the arguments of
.Ql .En .
.
The default width value is 12n for both macros.
.
.It Li .Eq
The first and second arguments of this macro are the opening and
closing strings respectively, followed by the arguments to be enclosed.
.It Li .Ql
The quoted literal macro behaves differently in
.Xr troff \" mode
and
.Xr nroff \" mode
modes.
.
If formatted with
.Xr \%nroff 1 ,
a quoted literal is always quoted.
.
If formatted with
.Xr \%troff ,
an item is only quoted if the width of the item is less than three
constant-width characters.
.
This is to make short strings more visible where the font change to
literal (constant-width) is less noticeable.
.
.
.Pp
The default width is 16n.
.
.It Li .Pf
The prefix macro suppresses the whitespace between its first and second
argument:
.
.Bl -tag -width ".Li .Pf\ (\ Fa\ name2" -offset indent
.It Li ".Pf ( Fa name2"
.Pf ( Fa name2
.El
.Pp
.
The default width is 12n.
.Pp
The
.Ql .Ns
macro (see below) performs the analogous suffix function.
.It Li .Ap
The
.Ql .Ap
macro inserts an apostrophe and exits any special text modes, continuing in
.Ql .No
mode.
.El
.Pp
.
Examples of quoting:
.
.Pp
.Bl -tag -width ".Li .Bq\ Em\ Greek\ ,\ French\ ." -compact -offset indent
.It Li .Aq
.Aq
.It Li ".Aq Pa ctype.h ) ,"
.Aq Pa ctype.h ) ,
.It Li .Bq
.Bq
.It Li ".Bq Em Greek , French ."
.Bq Em Greek , French .
.It Li .Dq
.Dq
.It Li ".Dq string abc ."
.Dq string abc .
.It Li ".Dq \[aq]\[rs][ha][A\-Z]\[aq]"
.Dq '\[ha][A-Z]'
.It Li ".Ql man mdoc"
.Ql man mdoc
.It Li .Qq
.Qq
.It Li ".Qq string ) ,"
.Qq string ) ,
.It Li ".Qq string Ns ),"
.Qq string Ns ),
.It Li .Sq
.Sq
.It Li ".Sq string"
.Sq string
.It Li ".Em or Ap ing"
.Em or Ap ing
.El
.Pp
.
For a good example of nested enclosure macros, see the
.Ql .Op
option macro.
It was created from the same underlying enclosure macros as those presented
in the list above.
The
.Ql .Xo
and
.Ql .Xc
extended argument list macros are discussed below.
.
.
.Ss "Normal text macro"
.
.Ql \&No
formats subsequent argument(s) normally,
ending the effect of
.Ql \&Em
and similar.
.
Parsing is
.Em not
suppressed,
so you must prefix words like
.Ql \&No
with
.Ql \e&
to avoid their interpretation as
.Xr mdoc
macros.
.
.
.Pp
.Dl Usage: .No Ar argument No ...
.
.
.Pp
.Bl -tag -width ".Li .Em\ Use\ caution\ No\ here\ ." \
-compact -offset 15n
.It Li ".Em Use caution No here ."
\[->]
.Em Use caution No here .
.It Li ".Em No dogs allowed ."
\[->]
.\" We cheat here to prevent a diagnostic warning. We want to
.\" illustrate output that may surprise the novice.
.Em \&No No dogs allowed .
.It Li ".Em \e&No dogs allowed ."
\[->]
.Em \&No dogs allowed .
.El
.
.
.Pp
The default width is 12n.
.
.
.Ss "No-Space Macro"
.
The
.Ql .Ns
macro suppresses insertion of a space between the current position and its
first parameter.
For example, it is useful for old style argument lists where there is no
space between the flag and argument:
.Pp
.Dl "Usage:" ... Ao argument Ac \&Ns Oo Ao argument Ac Oc ...
.Dl " " .Ns Ao argument Ac ...
.Pp
.Bl -tag -width ".Li .Op\ Fl\ I\ Ns\ Ar\ directory" -compact -offset 15n
.It Li ".Op Fl I Ns Ar directory"
.Op Fl I Ns Ar directory
.El
.Pp
Note: The
.Ql .Ns
macro always invokes the
.Ql .No
macro after eliminating the space unless another macro name follows it.
If used as a command (i.e., the second form above in the
.Sq Usage
line),
.Ql .Ns
is identical to
.Ql .No .
.
.
.Ss "(Sub)section cross references"
.
Use the
.Ql .Sx
macro to cite a (sub)section heading within the given document.
.
.
.Pp
.Dl Usage: .Sx Ao section-reference Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Sx\ Files" -offset 15n
.It Li ".Sx Files"
\[->]
.Sx Files
.El
.
.
.Pp
The default width is 16n.
.
.
.Ss Symbolics
.
The symbolic emphasis macro is generally a boldface macro in either the
symbolic sense or the traditional English usage.
.
.
.Pp
.Dl Usage: .Sy Ao symbol Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Sy\ Important\ Notice" -compact -offset 15n
.It Li ".Sy Important Notice"
\[->]
.Sy Important Notice
.El
.
.
.Pp
The default width is 6n.
.
.
.Ss "Mathematical Symbols"
.
Use this macro for mathematical symbols and similar things.
.
.
.Pp
.Dl Usage: .Ms Ao math symbol Ac ...
.
.
.Pp
.Bl -tag -width ".Li .Ms\ sigma" -compact -offset 15n
.It Li ".Ms sigma"
\[->]
.Ms sigma
.El
.
.
.Pp
The default width is 6n.
.
.
.Ss "References and Citations"
.
The following macros make a modest attempt to handle references.
.
At best,
the macros make it convenient to manually drop in a subset of
.Xr \%refer 1
style references.
.
.
.Pp
.Bl -tag -width 6n -offset indent -compact
.It Li .Rs
Reference start
(does not take arguments).
.
In a section titled
.Dq "See also" ,
it causes a break
and begins collection of reference information until the reference end
macro is read.
.
.It Li .Re
Reference end (does not take arguments).
The reference is printed.
.It Li .%A
Reference author name; one name per invocation.
.It Li .%B
Book title.
.It Li .%C
City/place.
.It Li .%D
Date.
.It Li .%I
Issuer/publisher name.
.It Li .%J
Journal name.
.It Li .%N
Issue number.
.It Li .%O
Optional information.
.It Li .%P
Page number.
.It Li .%Q
Corporate or foreign author.
.It Li .%R
Report name.
.It Li .%T
Title of article.
.It Li .%U
Optional hypertext reference.
.It Li .%V
Volume.
.El
.Pp
Macros beginning with
.Ql %
are not callable but accept multiple arguments in the usual way.
Only the
.Ql .Tn
macro is handled properly as a parameter; other macros will cause strange
output.
.Ql .%B
and
.Ql .%T
can be used outside of the
.Ql .Rs/.Re
environment.
.Pp
Example:
.
.Bd -literal -offset indent
\&.Rs
\&.%A "Matthew Bar"
\&.%A "John Foo"
\&.%T "Implementation Notes on foobar(1)"
\&.%R "Technical Report ABC\-DE\-12\-345"
\&.%Q "Drofnats College"
\&.%C "Nowhere"
\&.%D "April 1991"
\&.Re
.Ed
.Pp
produces
.
.Bd -ragged -offset indent
.Rs
.%A "Matthew Bar"
.%A "John Foo"
.%T "Implementation Notes on foobar(1)"
.%R "Technical Report ABC-DE-12-345"
.%Q "Drofnats College"
.%C "Nowhere"
.%D "April 1991"
.Re
.Ed
.
.Ss "Trade Names or Acronyms"
.
The trade name macro prints its arguments at a smaller type size.
.
It is intended to imitate a small caps fonts for fully capitalized
acronyms.
.
.
.Pp
.Dl Usage: .Tn Ao symbol Ac ...
.Pp
.Bl -tag -width ".Li .Tn\ ASCII" -compact -offset 15n
.It Li ".Tn DEC"
.Tn DEC
.It Li ".Tn ASCII"
.Tn ASCII
.El
.Pp
.
The default width is 10n.
.
.
.Ss "Extended Arguments"
.
The
.Li .Xo
and
.Li .Xc
macros allow one to extend an argument list on a macro boundary for the
.Ql .It
macro (see below).
Note that
.Li .Xo
and
.Li .Xc
are implemented similarly to all other macros opening and closing an
enclosure (without inserting characters, of course).
This means that the following is true for those macros also.
.Pp
Here is an example of
.Ql .Xo
using the space mode macro to turn spacing off:
.
.Bd -literal -offset indent
\&.Bd \-literal \-offset indent
\&.Sm off
\&.It Xo Sy I Ar operation
\&.No \een Ar count No \een
\&.Xc
\&.Sm on
\&.Ed
.Ed
.Pp
.
produces
.
.Bd -filled -offset indent
.Bl -tag -compact
.Sm off
.It Xo Sy I Ar operation
.No \en Ar count No \en
.Xc
.Sm on
.El
.Ed
.Pp
.
Another one:
.
.Bd -literal -offset indent
\&.Bd \-literal \-offset indent
\&.Sm off
\&.It Cm S No / Ar old_pattern Xo
\&.No / Ar new_pattern
\&.No / Op Cm g
\&.Xc
\&.Sm on
\&.Ed
.Ed
.Pp
.
produces
.
.Bd -filled -offset indent
.Bl -tag -compact
.Sm off
.It Cm S No \&/ Ar old_pattern Xo
.No \&/ Ar new_pattern
.No \&/ Op Cm g
.Xc
.Sm on
.El
.Ed
.Pp
.
Another example of
.Ql .Xo
and enclosure macros: Test the value of a variable.
.
.Bd -literal -offset indent
\&.Bd \-literal \-offset indent
\&.It Xo
\&.Ic .ifndef
\&.Oo \e&! Oc Ns Ar variable Oo
\&.Ar operator variable No ...
\&.Oc Xc
\&.Ed
.Ed
.Pp
.
produces
.
.Bd -filled -offset indent
.Bl -tag -width flag -compact
.It Xo
.Ic .ifndef
.Oo \&! Oc Ns Ar variable Oo
.Ar operator variable No ...
.Oc Xc
.El
.Ed
.Pp
.
.
.Sh "Page structure domain"
.
.
.Ss "Section headings"
.
The following
.Ql .Sh
section heading macros are required in every man page.
.
The remaining section headings are recommended at the discretion of the
author writing the manual page.
The
.Ql .Sh
macro is parsed but not generally callable.
It can be used as an argument in a call to
.Ql .Sh
only; it then reactivates the default font for
.Ql .Sh .
.Pp
The default width is 8n.
.
.Bl -tag -width ".Li .Sh\ Return\ values"
.It Li ".Sh Name"
The
.Ql ".Sh Name"
macro is mandatory.
.
If not specified,
headers,
footers,
and page layout defaults will not be set and things will be rather
unpleasant.
.
The
.Em Name
section consists of at least three items.
The first is the
.Ql .Nm
name macro naming the subject of the man page.
The second is the name description macro,
.Ql .Nd ,
which separates the subject name from the third item, which is the
description.
The description should be the most terse and lucid possible, as the space
available is small.
.Pp
.Ql .Nd
first prints
.Ql \- ,
then all its arguments.
.
.It Li ".Sh Library"
This section is for section two and three function calls.
It should consist of a single
.Ql .Lb
macro call;
see
.Sx "Library Names" .
.
.It Li ".Sh Synopsis"
The
.Sx Synopsis
section describes the typical usage of the subject of a man page.
The macros required are either
.Ql .Nm ,
.Ql .Cd ,
or
.Ql .Fn
(and possibly
.Ql .Fo ,
.Ql .Fc ,
.Ql .Fd ,
and
.Ql .Ft ) .
The function name macro
.Ql .Fn
is required for manual page sections\~2 and\~3; the command and general name
macro
.Ql .Nm
is required for sections 1, 5, 6, 7, and\~8.
Section\~4 manuals require a
.Ql .Nm ,
.Ql .Fd
or a
.Ql .Cd
configuration device usage macro.
Several other macros may be necessary to produce the synopsis line as shown
below:
.
.Bd -filled -offset indent
.Nm cat
.Op Fl benstuv
.Op Fl
.Ar file No ...
.Ed
.Pp
.
The following macros were used:
.Pp
.Dl ".Nm cat"
.Dl ".Op Fl benstuv"
.Dl ".Op Fl"
.Dl ".Ar file No ..."
.
.It Li ".Sh Description"
In most cases the first text in the
.Sx Description
section is a brief paragraph on the command, function or file, followed by a
lexical list of options and respective explanations.
To create such a list, the
.Ql .Bl
(begin list),
.Ql .It
(list item) and
.Ql .El
(end list)
macros are used (see
.Sx Lists and Columns
below).
.
.It Li ".Sh Implementation notes"
Implementation specific information should be placed here.
.
.It Li ".Sh Return values"
Sections 2, 3 and\~9 function return values should go here.
The
.Ql .Rv
macro may be used to generate text for use in the
.Sx Return values
section for most section 2 and 3 library functions;
see
.Sx "Return Values" .
.El
.Pp
.
The following
.Ql .Sh
section headings are part of the preferred manual page layout and must
be used appropriately to maintain consistency.
They are listed in the order in which they would be used.
.
.Bl -tag -width ".Li .Sh\ Compatibility"
.It Li ".Sh Environment"
The
.Em Environment
section should reveal any related environment variables and clues to their
behavior and/or usage.
.
.It Li ".Sh Files"
Files which are used or created by the man page subject should be listed via
the
.Ql .Pa
macro in the
.Sx Files
section.
.
.It Li ".Sh Examples"
There are several ways to create examples.
See subsection
.Sx "Examples and Displays"
below for details.
.
.It Li ".Sh Diagnostics"
Diagnostic messages from a command should be placed in this section.
The
.Ql .Ex
macro may be used to generate text for use in the
.Sx Diagnostics
section for most section 1, 6 and\~8 commands;
see
.Sx "Exit Status" .
.
.It Li ".Sh Compatibility"
Known compatibility issues (e.g.\& deprecated options or parameters)
should be listed here.
.
.It Li ".Sh Errors"
Specific error handling, especially from library functions (man page
sections 2, 3, and\~9) should go here.
The
.Ql .Er
macro is used to specify an error (errno).
.
.It Li ".Sh See also"
References to other material on the man page topic and cross references
to other relevant man pages should be placed in the
.Sx "See also"
section.
.
Cross references are specified using the
.Ql .Xr
macro.
.
Currently
.Xr \%refer 1
style references are not accommodated.
.
.
.Pp
It is recommended that the cross references be sorted by section number,
then alphabetically by name within each section,
then separated by commas.
.
Example:
.
.
.Pp
.Xr ls 1 ,
.Xr ps 1 ,
.Xr group 5 ,
.Xr passwd 5
.
.It Li ".Sh Standards"
If the command,
library function,
or file adheres to a specific implementation such as
.St -p1003.2
or
.St -ansiC
this should be noted here.
.
If the command does not adhere to any standard,
its history should be noted in the
.Em History
section.
.
.It Li ".Sh History"
Any command which does not adhere to any specific standards should be
outlined historically in this section.
.
.It Li ".Sh Authors"
Credits should be placed here.
.
Use the
.Ql .An
macro for names and the
.Ql .Aq
macro for email addresses within optional contact information.
.
Explicitly indicate whether the person authored the initial manual page
or the software or whatever the person is being credited for.
.It Li ".Sh Bugs"
Blatant problems with the topic go here.
.El
.Pp
.
User-specified
.Ql .Sh
sections may be added; for example, this section was set with:
.
.Bd -literal -offset 15n
\&.Sh "Page structure domain"
.Ed
.
.
.Ss "Subsection headings"
.
Subsection headings have exactly the same syntax as section headings:
.Ql .Ss
is parsed but not generally callable.
It can be used as an argument in a call to
.Ql .Ss
only; it then reactivates the default font for
.Ql .Ss .
.Pp
The default width is 8n.
.
.
.Ss "Paragraphs and Line Spacing"
.
.Bl -tag -width ".Li .Pp"
.It Li .Pp
The
.Ql .Pp
paragraph command may be used to specify a line space where necessary.
The macro is not necessary after a
.Ql .Sh
or
.Ql .Ss
macro or before a
.Ql .Bl
or
.Ql .Bd
macro (which both assert a vertical distance unless the
.Fl compact
flag is given).
.Pp
The macro is neither callable nor parsed and takes no arguments; an
alternative name is
.Ql .Lp .
.El
.
.\" XXX
.
.\" This worked with version one, need to redo for version three
.\" .Pp
.\" .Ds I
.\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
.\" .Cl Cx \t\t
.\" .Li \&.Cx\ (
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va ax
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy \+
.\" .Cx
.\" .Cl Cx \&(\&
.\" .Va ax
.\" .Cx +
.\" .Va by
.\" .Cx +
.\" .Va c )
.\" .Cx \t
.\" .Em is produced by
.\" .Cx \t
.\" .Li \&.Va by
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy \+
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va c )
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.\" This example shows the same equation in a different format.
.\" The spaces
.\" around the
.\" .Li \&+
.\" signs were forced with
.\" .Li \e :
.\" .Pp
.\" .Ds I
.\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
.\" .Cl Cx \t\t
.\" .Li \&.Cx\ (
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va a
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy x
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx \e\ +\e\ \e&
.\" .Cx
.\" .Cl Cx \&(\&
.\" .Va a
.\" .Sy x
.\" .Cx \ +\ \&
.\" .Va b
.\" .Sy y
.\" .Cx \ +\ \&
.\" .Va c )
.\" .Cx \t
.\" .Em is produced by
.\" .Cl Cx \t\t
.\" .Li \&.Va b
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy y
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx \e\ +\e\ \e&
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va c )
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.\" The incantation below was
.\" lifted from the
.\" .Xr adb 1
.\" manual page:
.\" .Pp
.\" .Ds I
.\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
.\" .Cl Cx \t\t
.\" .Li \&.Cx Op Sy ?/
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Nm m
.\" .Cx
.\" .Cl Cx Op Sy ?/
.\" .Nm m
.\" .Ad \ b1 e1 f1
.\" .Op Sy ?/
.\" .Cx \t
.\" .Em is produced by
.\" .Cx \t
.\" .Li \&.Ar \e\ b1 e1 f1
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Op Sy ?/
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.
.
.Ss Keeps
.
The only keep that is implemented at this time is for words.
.
The macros are
.Ql .Bk
(begin keep)
and
.Ql .Ek
(end keep).
.
The only option that
.Ql .Bk
currently accepts is
.Fl words
(also the default);
this prevents breaks in the middle of options.
.
In the example for
.Nm make
command-line arguments
(see
.Sx What's in a Name ) ,
the keep prevents
.Xr \%nroff
from placing the flag and the argument on separate lines.
.
.
.Pp
Neither macro is callable or parsed.
.
.
.Pp
More work needs to be done on the keep macros;
specifically,
a
.Fl line
option should be added.
.
.
.Ss "Examples and Displays"
.
There are seven types of displays.
.
.
.Pp
.Bl -tag -width ".Li .D1"
.It Li .D1
(This is D-one.)
Display one line of indented text.
This macro is parsed but not callable.
.
.
.Pp
.D1 Fl ldghfstru
.
.
.Pp
The above was produced by:
.Li ".D1 Fl ldghfstru" .
.
.It Li .Dl
(This is D-ell.)
Display one line of indented
.Em literal
text.
The
.Ql .Dl
example macro has been used throughout this file.
It allows the indentation (display) of one line of text.
Its default font is set to constant width (literal).
.Ql .Dl
is parsed but not callable.
.
.
.Pp
.Dl % ls \-ldg /usr/local/bin
.
.
.Pp
The above was produced by:
.Li ".Dl % ls \e\-ldg /usr/local/bin" .
.
.It Li .Bd
Begin display.
The
.Ql .Bd
display must be ended with the
.Ql .Ed
macro.
It has the following syntax:
.
.
.Pp
.Bd -ragged -compact
.Bl -tag -width ".Li .Bd" -offset indent
.It Li .Bd Xo
.Bro \-literal | \-filled | \-unfilled | \-ragged | \-centered Brc
.Oo \-offset Ao string Ac Oc Oo \-file Ao file name Ac Oc Oo \-compact Oc Xc
.El
.Ed
.
.
.Pp
.Bl -tag -width ".Fl file Ao Ar file name Ac " -compact
.It Fl ragged
Fill, but do not adjust the right margin (only left-justify).
.
.It Fl centered
Center lines between the current left and right margin.
.
Note that each single line is centered.
.
.It Fl unfilled
Do not fill;
break lines where their input lines are broken.
.
This can produce overlong lines without warning messages.
.
.It Fl filled
Display a filled block.
The block of text is formatted (i.e., the text is justified on both the left
and right side).
.
.It Fl literal
Display block with literal font (usually fixed-width).
.
Useful for source code or simple tabbed or spaced text.
.
.It Fl file Ao Ar file name Ac
The file whose name follows the
.Fl file
flag is read and displayed before any data enclosed with
.Ql .Bd
and
.Ql .Ed ,
using the selected display type.
.
Any
.Xr \%troff/ Ns Xr mdoc
commands in the file will be processed.
.
.It Fl offset Ao Ar string Ac
If
.Fl offset
is specified with one of the following strings, the string is interpreted to
indicate the level of indentation for the forthcoming block of text:
.
.
.Pp
.Bl -tag -width ".Ar indent-two" -compact
.It Ar left
Align block on the current left margin; this is the default mode of
.Ql .Bd .
.It Ar center
Supposedly center the block.
At this time unfortunately, the block merely gets left aligned about an
imaginary center margin.
.It Ar indent
Indent by one default indent value or tab.
The default indent value is also used for the
.Ql .D1
and
.Ql .Dl
macros, so one is guaranteed the two types of displays will line up.
The indentation value is normally set to\~6n or about two thirds of an inch
(six constant width characters).
.It Ar indent\-two
Indent two times the default indent value.
.It Ar right
This
.Em left
aligns the block about two inches from the right side of the page.
This macro needs work and perhaps may never do the right thing within
.Xr \%troff .
.El
.
.
.Pp
If
.Ao string Ac
is a valid numeric expression instead
.Pf ( Em with a scaling indicator other than
.Sq Em u ) ,
use that value for indentation.
The most useful scaling indicators are
.Sq m
and
.Sq n ,
specifying the so-called
.Em \&Em
and
.Em "En square" .
.
This is approximately the width of the letters
.Sq m
and
.Sq n
respectively
of the current font
(for
.Xr nroff
output,
both scaling indicators give the same values).
.
If
.Ao string Ac
isn't a numeric expression, it is tested whether it is an
.Xr mdoc
macro name, and the default offset value associated with this macro is used.
Finally, if all tests fail,
the width of
.Ao string Ac
(typeset with a fixed-width font) is taken as the offset.
.It Fl compact
Suppress insertion of vertical space before begin of display.
.El
.
.It Li .Ed
End display (takes no arguments).
.El
.
.
.Ss "Lists and Columns"
.
There are several types of lists which may be initiated with the
.Ql .Bl
begin-list macro.
.
Items within the list are specified with the
.Ql .It
item macro,
and each list must end with the
.Ql .El
macro.
.
Lists may be nested within themselves and within displays.
.
The use of columns inside of lists or lists inside of columns is
untested.
.
.
.Pp
In addition,
several list attributes may be specified such as the width of a tag,
the list offset,
and compactness
(blank lines between items allowed or disallowed).
.
Most of this document has been formatted with a tag style list
.Pf ( Fl tag ) .
.
.
.Pp
It has the following syntax forms:
.
.
.Pp
.Bd -ragged -compact
.Bl -tag -width ".Li .Bl" -offset indent -compact
.It Li .Bl Xo
.Bro \-hang | \-ohang | \-tag | \-diag | \-inset Brc
.Oo \-width Ao string Ac Oc
.Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
.It Li .Bl Xo
.No \-column Oo \-offset Ao string Ac Oc
.Ao string1 Ac Ao string2 Ac ... Xc
.It Li .Bl Xo
.Bro \-item | \-enum Oo \-nested Oc | \-bullet | \-hyphen | \-dash Brc
.Oo \-offset Ao string Ac Oc Oo \-compact Oc Xc
.El
.Ed
.
.
.Pp
And now a detailed description of the list types.
.
.
.Pp
.Bl -tag -width ".Fl column" -compact
.It Fl bullet
A bullet list.
.
.Bd -literal -offset indent
\&.Bl \-bullet \-offset indent \-compact
\&.It
Bullet one goes here.
\&.It
Bullet two here.
\&.El
.Ed
.
.
.Pp
Produces:
.
.
.Pp
.Bl -bullet -offset indent -compact
.It
Bullet one goes here.
.It
Bullet two here.
.El
.
.
.Pp
.
.It Fl dash No ( or Fl hyphen )
A dash list.
.
.Bd -literal -offset indent
\&.Bl \-dash \-offset indent \-compact
\&.It
Dash one goes here.
\&.It
Dash two here.
\&.El
.Ed
.
.
.Pp
Produces:
.
.
.Pp
.Bl -dash -offset indent -compact
.It
Dash one goes here.
.It
Dash two here.
.El
.
.
.Pp
.It Fl enum
An enumerated list.
.
.Bd -literal -offset indent
\&.Bl \-enum \-offset indent \-compact
\&.It
Item one goes here.
\&.It
And item two here.
\&.El
.Ed
.
.
.Pp
The result:
.
.
.Pp
.Bl -enum -offset indent -compact
.It
Item one goes here.
.It
And item two here.
.El
.
.
.Pp
If you want to nest enumerated lists,
use the
.Fl nested
flag
(starting with the second-level list):
.
.Bd -literal -offset indent
\&.Bl \-enum \-offset indent \-compact
\&.It
Item one goes here
\&.Bl \-enum \-nested \-compact
\&.It
Item two goes here.
\&.It
And item three here.
\&.El
\&.It
And item four here.
\&.El
.Ed
.
.
.Pp
Result:
.
.
.Pp
.Bl -enum -offset indent -compact
.It
Item one goes here.
.Bl -enum -nested -compact
.It
Item two goes here.
.It
And item three here.
.El
.It
And item four here.
.El
.
.
.Pp
.
.It Fl item
A list of type
.Fl item
without list markers.
.
.Bd -literal -offset indent
\&.Bl \-item \-offset indent
\&.It
Item one goes here.
Item one goes here.
Item one goes here.
\&.It
Item two here.
Item two here.
Item two here.
\&.El
.Ed
.
.
.Pp
Produces:
.
.
.Pp
.Bl -item -offset indent
.It
Item one goes here.
Item one goes here.
Item one goes here.
.It
Item two here.
Item two here.
Item two here.
.El
.
.
.Pp
.It Fl tag
A list with tags.
Use
.Fl width
to specify the tag width.
.
.
.Pp
.Bl -tag -width "PPID" -compact -offset indent
.It SL
sleep time of the process (seconds blocked)
.It PAGEIN
number of disk I/O operations resulting from references by the process
to pages not loaded in core.
.It UID
numerical user-id of process owner
.It PPID
numerical id of parent of process priority
(non-positive when in non-interruptible wait)
.El
.
.
.Pp
The raw text:
.
.Bd -literal -offset indent
\&.Bl \-tag \-width "PPID" \-compact \-offset indent
\&.It SL
sleep time of the process (seconds blocked)
\&.It PAGEIN
number of disk I/O operations resulting from references
by the process to pages not loaded in core.
\&.It UID
numerical user\-id of process owner
\&.It PPID
numerical id of parent of process priority
(non\-positive when in non\-interruptible wait)
\&.El
.Ed
.
.
.Pp
.It Fl diag
Diag lists create section four diagnostic lists and are similar to inset
lists except callable macros are ignored.
The
.Fl width
flag is not meaningful in this context.
.
.
.Pp
Example:
.
.Bd -literal -offset indent
\&.Bl \-diag
\&.It You can't use Sy here.
The message says all.
\&.El
.Ed
.
.
.Pp
produces
.
.Bl -diag
.It You can't use Sy here.
The message says all.
.El
.
.
.Pp
.It Fl hang
A list with hanging tags.
.
.Bl -hang -offset indent
.It Em Hanged
labels appear similar to tagged lists when the
label is smaller than the label width.
.It Em Longer hanged list labels
blend into the paragraph unlike
tagged paragraph labels.
.El
.
.
.Pp
And the unformatted text which created it:
.
.Bd -literal -offset indent
\&.Bl \-hang \-offset indent
\&.It Em Hanged
labels appear similar to tagged lists when the
label is smaller than the label width.
\&.It Em Longer hanged list labels
blend into the paragraph unlike
tagged paragraph labels.
\&.El
.Ed
.
.
.Pp
.It Fl ohang
Lists with overhanging tags do not use indentation for the items;
tags are written to a separate line.
.
.
.Pp
.Bl -ohang -offset indent
.It Sy SL
sleep time of the process (seconds blocked)
.It Sy PAGEIN
number of disk I/O operations resulting from references by the process
to pages not loaded in core.
.It Sy UID
numerical user-id of process owner
.It Sy PPID
numerical id of parent of process priority
(non-positive when in non-interruptible wait)
.El
.
.
.Pp
The raw text:
.
.Bd -literal -offset indent
\&.Bl \-ohang \-offset indent
\&.It Sy SL
sleep time of the process (seconds blocked)
\&.It Sy PAGEIN
number of disk I/O operations resulting from references
by the process to pages not loaded in core.
\&.It Sy UID
numerical user\-id of process owner
\&.It Sy PPID
numerical id of parent of process priority
(non\-positive when in non\-interruptible wait)
\&.El
.Ed
.
.
.Pp
.It Fl inset
Here is an example of inset labels:
.Bl -inset -offset indent
.It Em Tag
The tagged list (also called a tagged paragraph)
is the most common type of list used in the
Berkeley manuals.
Use a
.Fl width
attribute as described below.
.It Em Diag
Diag lists create section four diagnostic lists
and are similar to inset lists except callable
macros are ignored.
.It Em Hang
Hanged labels are a matter of taste.
.It Em Ohang
Overhanging labels are nice when space is constrained.
.It Em Inset
Inset labels are useful for controlling blocks of
paragraphs and are valuable for converting
.Xr mdoc
manuals to other formats.
.El
.
.
.Pp
Here is the source text which produced the above example:
.
.Bd -literal -offset indent
\&.Bl \-inset \-offset indent
\&.It Em Tag
The tagged list (also called a tagged paragraph)
is the most common type of list used in the
Berkeley manuals.
\&.It Em Diag
Diag lists create section four diagnostic lists
and are similar to inset lists except callable
macros are ignored.
\&.It Em Hang
Hanged labels are a matter of taste.
\&.It Em Ohang
Overhanging labels are nice when space is constrained.
\&.It Em Inset
Inset labels are useful for controlling blocks of
paragraphs and are valuable for converting
\&.Xr mdoc
manuals to other formats.
\&.El
.Ed
.
.
.Pp
.
.It Fl column
This list type generates multiple columns.
The number of columns and the width of each column is determined by the
arguments to the
.Fl column
list,
.Aq Ar string1 ,
.Aq Ar string2 ,
etc.
If
.Aq Ar stringN
starts with a
.Ql .\&
(dot) immediately followed by a valid
.Xr mdoc
macro name, interpret
.Aq Ar stringN
and use the width of the result.
Otherwise, the width of
.Aq Ar stringN
(typeset with a fixed-width font) is taken as the
.Ar N Ns th
column width.
.
.
.Pp
Each
.Ql .It
argument is parsed to make a row, each column within the row is a separate
argument separated by a tab or the
.Ql .Ta
macro.
.
.
.Pp
The table:
.
.Bl -column -offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
.It Sy String Ta Sy Nroff Ta Sy Troff
.It Li <= Ta <= Ta \*(<=
.It Li >= Ta >= Ta \*(>=
.El
.
.
.Pp
was produced by:
.
.Bd -literal
\&.Bl \-column \-offset indent ".Sy String" ".Sy Nroff" ".Sy Troff"
\&.It Sy String Ta Sy Nroff Ta Sy Troff
\&.It Li <= Ta <= Ta \e*(<=
\&.It Li >= Ta >= Ta \e*(>=
\&.El
.Ed
.
.
.Pp
Don't abuse this list type!
.
For more complicated cases it might be far better and easier to use
.Xr \%tbl 1 ,
the table preprocessor.
.El
.
.
.Pp
Other keywords:
.
.Bl -tag -width ".Fl indent Ao Ar string Ac"
.It Fl width Ao Ar string Ac
If
.Aq Ar string
starts with a
.Ql .\&
(dot) immediately followed by a valid
.Xr mdoc
macro name, interpret
.Aq Ar string
and use the width of the result.
.
Almost all lists in this document use this option.
.
.
.Pp
Example:
.
.Bd -literal -offset indent
\&.Bl \-tag \-width ".Fl test Ao Ar string Ac"
\&.It Fl test Ao Ar string Ac
This is a longer sentence to show how the
\&.Fl width
flag works in combination with a tag list.
\&.El
.Ed
.
.
.Pp
gives:
.
.Bl -tag -width ".Fl test Ao Ar string Ac"
.It Fl test Ao Ar string Ac
This is a longer sentence to show how the
.Fl width
flag works in combination with a tag list.
.El
.
.
.Pp
(Note that the current state of
.Xr mdoc
is saved before
.Aq Ar string
is interpreted;
afterwards,
all variables are restored again.
.
However,
boxes
(used for enclosures)
can't be saved in
.Tn GNU
.Xr \%troff 1 ;
as a consequence,
arguments must always be
.Em balanced
to avoid nasty errors.
.
For example,
do not write
.Ql ".Ao Ar string"
but
.Ql ".Ao Ar string Xc"
instead if you really need only an opening angle bracket.)
.
.
.Pp
Otherwise,
if
.Aq Ar string
is a valid numeric expression
.Em ( with a scaling indicator other than
.Sq Em u ) ,
use that value for indentation.
The most useful scaling indicators are
.Sq m
and
.Sq n ,
specifying the so-called
.Em \&Em
and
.Em "En square" .
This is approximately the width of the letters
.Sq m
and
.Sq n
respectively
of the current font
(for
.Xr \%nroff
output,
both scaling indicators give the same values).
.
If
.Aq Ar string
isn't a numeric expression, it is tested whether it is an
.Xr mdoc
macro name, and the default width value associated with this macro is used.
Finally, if all tests fail,
the width of
.Aq Ar string
(typeset with a fixed-width font) is taken as the width.
.
.
.Pp
If a width is not specified for the tag list type,
.Sq 6n
is used.
.It Fl offset Ao Ar string Ac
If
.Aq Ar string
is
.Ar indent ,
a default indent value (normally set to\~6n,
similar to the value used in
.Ql .Dl
or
.Ql .Bd )
is used.
If
.Aq Ar string
is a valid numeric expression instead
.Pf ( Em with a scaling indicator other than
.Sq Em u ) ,
use that value for indentation.
The most useful scaling indicators are
.Sq m
and
.Sq n ,
specifying the so-called
.Em \&Em
and
.Em "En square" .
.
This is approximately the width of the letters
.Sq m
and
.Sq n
respectively
of the current font
(for
.Xr nroff
output,
both scaling indicators give the same values).
.
If
.Aq Ar string
isn't a numeric expression, it is tested whether it is an
.Xr mdoc
macro name, and the default offset value associated with this macro is used.
Finally, if all tests fail,
the width of
.Aq Ar string
(typeset with a fixed-width font) is taken as the offset.
.It Fl compact
Suppress insertion of vertical space before the list and between list items.
.El
.
.
.Sh "Miscellaneous macros"
.
A double handful of macros fit only uncomfortably into one of the above
sections.
.
Of these,
we couldn't find attested examples for
.Ql \&Me
or
.Ql \&Ot .
.
They are documented here for completeness\[em]if you know their proper
usage,
please send a mail to
.Mt groff@gnu.org
and include a specimen with its provenance.
.
.
.Bl -tag -width ".Li .Bt"
.It Li .Bt
formats boilerplate text.
.
.\" XXX: .Bt gets parsed (i.e., called) _and_ measured even _with_ a
.\" leading dot. See Savannah #63672.
.Bl -tag -width \&.Bt -offset indent
.It Li .Bt
\[->]
.Bt
.El
.
.
.Pp
It is neither callable nor parsed and takes no arguments.
.
Its default width is 6n.
.
.
.It Li .Fr
is an obsolete means of specifying a function return value.
.
.
.Pp
.D1 Usage: Pf . Ic \&Fr Ar return-value No ...
.
.
.Pp
.Ql \&Fr
allows a break right before the return value
(usually a single digit)
which is bad typographical behaviour.
.
Instead,
set the return value with the rest of the code,
using
.Ql \[rs]\[ti]
to tie the return value to the previous word.
.
.
.Pp
Its default width is 12n.
.
.
.It Li .Hf
Inlines the contents of a (header) file into the document.
.
.
.Pp
.D1 Usage: Pf . Ic \&Hf Ar file
.
.
.Pp
It first prints
.Ql File:
followed by the file name,
then the contents of
.Ar file .
.
It is neither callable nor parsed.
.
.
.It Li .Lk
Embed hyperlink.
.
.
.Pp
.D1 Usage: Pf . Ic \&Lk Ar uri Op Ar link-text
.
.
.Pp
Its default width is 6n.
.
.
.It Li .Me
Usage unknown.
.
The
.Xr mdoc
sources describe it as a macro for
.Dq "menu entries" .
.
.
.Pp
Its default width is 6n.
.
.
.It Li .Mt
Embed email address.
.
.
.Pp
.D1 Usage: Pf . Ic \&Mt Ar email-address
.
.
.Pp
Its default width is 6n.
.
.
.It Li .Ot
Usage unknown.
The
.Xr mdoc
sources describe it as
.Dq "old function type (fortran)" .
.
.
.It Li .Sm
Manipulate or toggle argument-spacing mode.
.
.
.Pp
.D1 Usage: Pf . Ic \&Sm Oo Li on | Li off Oc ...
.
.
.Pp
If argument-spacing mode is off,
no spaces between macro arguments are inserted.
.
If called without a parameter
(or if the next parameter is neither
.Ql on
nor
.Ql off ) ,
.Ql \&Sm
toggles argument-spacing mode.
.
.
.Pp
Its default width is 8n.
.\" XXX: The package demands it, but how is that meaningful?
.
.
.It Li .Ud
formats boilerplate text.
.
.\" XXX: .Ud gets parsed (i.e., called) _and_ measured even _with_ a
.\" leading dot. See Savannah #63672.
.Bl -tag -width \&.Ud -offset indent
.It Li .Ud
\[->]
.Ud
.El
.
.
.Pp
It is neither callable nor parsed and takes no arguments.
.
Its default width is 8n.
.El
.
.
.Sh "Predefined strings"
.
The following strings are predefined for compatibility with legacy
.Xr mdoc
documents.
.
Contemporary ones should use the alternatives shown in the
.Dq Prefer
column below.
.
See
.Xr groff_char 7
for a full discussion of these special character escape sequences.
.
.
.Pp
.\" Note: This table pushes 80-column ASCII and Latin-1 terminals to
.\" the limits of their capacity. Observe the spacing parameters of the
.\" 2nd and 3rd columns; we had to steal a character cell from each (the
.\" default is 3) because in the UCS column, the word "infinity" gets
.\" written out in full, which in turn pushes the >= and Ge rows past
.\" the 78n norm. Update with caution. See Savannah #59424.
.TS
Cb Lb2 Lb2 Lb Lb Lb
Lf(CR) L2 L2 L Lf(CR) L.
String 7-bit 8-bit UCS Prefer Meaning
\[rs]*(<= <= <= \*[<=] \[rs](<= less than or equal to
\[rs]*(>= >= >= \*[>=] \[rs](>= greater than or equal to
\[rs]*(Rq " " \*[Rq] \[rs](rq right double quote
\[rs]*(Lq " " \*[Lq] \[rs](lq left double quote
\[rs]*(ua \[ha] \[ha] \*[ua] \[rs](ua vertical arrow up
\[rs]*(aa \[aq] \' \*[aa] \[rs](aa acute accent
\[rs]*(ga \` \` \*[ga] \[rs](ga grave accent
\[rs]*(q \&" \&" \*[q] \[rs](dq neutral double quote
\[rs]*(Pi pi pi \*[Pi] \[rs](*p lowercase pi
\[rs]*(Ne != != \*[Ne] \[rs](!= not equals
\[rs]*(Le <= <= \*[Le] \[rs](<= less than or equal to
\[rs]*(Ge >= >= \*[Ge] \[rs](>= greater than or equal to
\[rs]*(Lt < < \*[Lt] < less than
\[rs]*(Gt > > \*[Gt] > greater than
\[rs]*(Pm +\- \[+-] \*[Pm] \[rs](+\- plus or minus
\[rs]*(If infinity infinity \*[If] \[rs](if infinity
\[rs]*(Am \*[Am] \*[Am] \*[Am] & ampersand
\[rs]*(Na \*[Na] \*[Na] \*[Na] NaN not a number
\[rs]*(Ba \*[Ba] \*[Ba] \*[Ba] | bar
.TE
.
.
.Pp
Some column headings are shorthand for standardized character encodings;
\[lq]7-bit\[rq] for ISO 646:1991 IRV (US-ASCII),
\[lq]8-bit\[rq] for ISO 8859-1 (Latin-1) and IBM code page 1047,
and
\[lq]UCS\[rq] for ISO 10646 (Unicode character set).
.
Historically, \" (\[ti]1989)
.Xr mdoc
configured the string definitions to fit the capabilities expected of
the output device.
.
Old typesetters \" like the C/A/T
lacked directional double quotes,
producing repeated directional single quotes
\[oq]\[oq]like this\[cq]\[cq];
early versions of
.Xr mdoc
in fact defined the
.Ql Lq
and
.Ql Rq
strings this way. \" thanks to Ingo Schwarze for the research
.
Nowadays,
output drivers \" technically, their macro files or font descriptions
take on the responsibility of glyph substitution,
as they possess relevant knowledge of their available repertoires.
.
.
.Sh Diagnostics
.
The debugging macro
.Ql .Db
offered by
previous versions of
.Xr mdoc
is unavailable in
.Tn GNU
.Xr \%troff 1
since the latter provides better facilities to check parameters;
additionally,
.Xr "groff mdoc"
implements many error and warning messages,
making the package more robust and more verbose.
.
.
.Pp
The remaining debugging macro is
.Ql .Rd ,
which dumps the package's global register and string contents to the
standard error stream.
.
A normal user will never need it.
.
.
.Sh Options
.
The following
.Xr groff
options set registers
(with
.Fl r )
and strings
(with
.Fl d )
recognized and used by the
.Xr mdoc
macro package.
.
To ensure rendering consistent with output device capabilities and
reader preferences,
man pages should never manipulate them.
.
.
.Pp
Setting string
.Ql AD
configures the adjustment mode for most formatted text.
.
Typical values are
.Ql b
for adjustment to both margins
(the default),
or
.Ql l
for left alignment
(ragged right margin).
.
Any valid argument to
.Xr groff Ns 's
.Ql ad
request may be used.
.
See
.Xr groff 7
for less-common choices.
.
.Dl groff \-Tutf8 \-dAD=l \-mdoc groff_mdoc.7 | less \-R
.
.
.Pp
Setting register
.Ql C
to\~1 numbers output pages consecutively,
rather than resetting the page number to\~1
(or the value of register
.Ql P )
with each new
.Xr mdoc
document.
.
.
.Pp
By default,
the package inhibits page breaks,
headers,
and footers in the midst of the document text if it is being displayed
with a terminal device such as
.Sq latin1
or
.Sq utf8 ,
to enable more efficient viewing of the page.
.
This behavior can be changed to format the page as if for 66-line
Teletype output by setting the continuous rendering register
.Ql cR
to zero while calling
.Xr groff 1 .
.
.Dl groff \-Tlatin1 \-rcR=0 \-mdoc foo.man > foo.txt
.
On HTML devices,
it cannot be disabled.
.
.
.Pp
Section headings
(defined with
.Ql .Sh )
and page titles in headers
(defined with
.Ql .Dt )
can be presented in full capitals by setting the registers
.Ql CS
and
.Ql CT ,
respectively,
to 1.
.
These transformations are off by default because they discard case
distinction information.
.
.
.Pp
Setting register
.Ql D
to\~1 enables double-sided page layout,
which is only distinct when not continuously rendering.
.
It places the page number at the bottom right on odd-numbered (recto)
pages,
and at the bottom left on even-numbered (verso) pages,
swapping places with the arguments to
.Ql .Os .
.
.Dl groff \-Tps \-rD1 \-mdoc foo.man > foo.ps
.
.
.Pp
The value of the
.Ql FT
register determines the footer's distance from the page bottom;
this amount is always negative and should specify a scaling unit.
.
At one half-inch above this location,
the page text is broken before writing the footer.
.
It is ignored if continuous rendering is enabled.
.
The default is \-0.5i.
.
.
.Pp
The
.Ql HF
string sets
the font used for section and subsection headings;
the default is
.Ql B
(bold style of the default family).
.
Any valid argument to
.Xr groff Ns 's
.Ql ft
request may be used.
.
.
.Pp
Normally,
automatic hyphenation is enabled using a mode appropriate to the
.Xr groff
locale;
see section \[lq]Localization\[lq] of
.Xr groff 7 .
.
It can be disabled by setting the
.Ql HY
register to zero.
.
.Dl groff \-Tutf8 \-rHY=0 \-mdoc foo.man | less \-R
.
.
.Pp
The paragraph and subsection heading indentation amounts can be changed
by setting the registers
.Ql IN
and
.Ql SN .
.
.Dl groff \-Tutf8 \-rIN=5n \-rSN=2n \-mdoc foo.man | less \-R
.
The default paragraph indentation is 7.2n on typesetters and 7n on
terminals.
.
The default subsection heading indentation amount is 3n;
section headings are set with an indentation of zero.
.
.
.Pp
The line and title lengths can be changed by setting the registers
.Ql LL
and
.Ql LT ,
respectively:
.
.Dl groff \-Tutf8 \-rLL=100n \-rLT=100n \-mdoc foo.man | less \-R
.
If not set,
both registers default to 78n for terminal devices and 6.5i otherwise.
.
.
.Pp
Setting the
.Ql P
register starts enumeration of pages at its value.
.
The default is\~1.
.
.
.Pp
To change the document font size to 11p or 12p,
set register
.Ql S
accordingly:
.
.Dl groff \-Tdvi \-rS11 \-mdoc foo.man > foo.dvi
.
Register
.Ql S
is ignored when formatting for terminal devices.
.
.
.Pp
Setting the
.Ql X
register to a page number
.Ar p
numbers its successors as
.Ar p Ns Li a ,
.Ar p Ns Li b ,
.Ar p Ns Li c ,
and so forth.
.
The register tracking the suffixed page letter uses format
.Ql a
(see the
.Ql af
request in
.Xr groff 7 ) .
.
.
.br
.ne 4v
.Sh Files
.
.Bl -tag
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:andoc\:.tmac
This brief
.Xr groff
program detects whether the
.Xr man
or
.Xr mdoc
macro package is being used by a document and loads the correct macro
definitions,
taking advantage of the fact that pages using them must call
.Li TH
or
.Li Dd ,
respectively,
before any other macros.
.
A user typing,
for example,
.Dl groff \-mandoc page.1
need not know which package the file
.Pa page.1
uses.
.
Multiple man pages,
in either format,
can be handled;
.Pa \%andoc\:.tmac
reloads each macro package as necessary.
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:doc\:.tmac
implements the bulk of the
.Xr groff Xr mdoc
package and loads further components as needed from the
.Pa mdoc
subdirectory.
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:mdoc\:.tmac
is a wrapper that loads
.Pa doc.tmac .
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:mdoc/\:doc\-common
defines macros,
registers,
and strings
concerned with the production of formatted output.
.\" XXX: This is a weak explanation. The boundary between doc.tmac's
.\" concerns and doc-common's is not at all clear to GBR. Should some
.\" of these files be merged?
.
It includes strings of the form
.Ql doc\-volume\-ds\- Ns Ar X
and
.Ql doc\-volume\-as\- Ns Ar X
for manual section titles and architecture identifiers,
respectively,
where
.Ar X
is an argument recognized by
.Pf . Ic \&Dt .
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:mdoc/\:doc\-nroff
defines parameters appropriate for rendering to terminal devices.
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:mdoc/\:doc\-ditroff
defines parameters appropriate for rendering to typesetter devices.
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%1.23.0/\:\%tmac/\:mdoc/\:doc\-syms
defines many strings and macros that interpolate formatted text,
such as names of operating system releases,
*BSD libraries,
and standards documents.
.
The string names are of the form
.Ql doc\-str\- Ns Ar O Ns Li \- Ns Ar V ,
.Ql doc\-str\-St Ns Li \-\- Ns Ar S Ns Li \- Ns Ar I
(observe the double dashes),
or
.Ql doc\-str\-Lb\- Ns Ar L ,
where
.Ar O
is one of the operating system macros from section
.Sx "General text domain"
above,
.Ar V
is an encoding of an operating system release
(sometimes omitted along with the
.Ql \-
preceding it),
.Ar S
an identifier for a standards body or committee,
.Ar I
one for an issue of a standard promulgated by
.Ar S ,
and
.Ar L
a keyword identifying a *BSD library.
.
.
.It Pa /usr/\:\%share/\:\%groff/\:\%site\-tmac/\:mdoc\:.local
This file houses local additions and customizations to the package.
.
It can be empty.
.El
.
.
.Sh "See also"
.
The
.Lk https://mandoc.bsd.lv/ mandoc
project maintains an independent implementation of the
.Xr mdoc
language and a renderer that directly parses its markup as well as that
of
.Xr man .
.
.
.Pp
.Xr groff 1 ,
.Xr man 1 ,
.Xr \%troff 1 ,
.Xr groff_man 7 ,
.Xr mdoc 7
.
.
.Sh Bugs
.
Section 3f has not been added to the header routines.
.
.
.Pp
.Ql .Fn
needs to have a check to prevent splitting up the line if its length is
too short.
.
Occasionally it separates the last parenthesis,
and sometimes looks ridiculous if output lines are being filled.
.
.
.Pp
The list and display macros do not do any keeps and certainly should be
able to.
.
.
.Pp
As of
.Xr groff
1.23,
.Ql \&Tn
no longer changes the type size;
this functionality may return in the next release.
.\" Note what happens if the parameter list overlaps a newline
.\" boundary.
.\" to make sure a line boundary is crossed:
.\" .Bd -literal
.\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
.\" .Ed
.\" .
.\" .
.\" .Pp
.\" produces, nudge nudge,
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
.\" nudge
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
.\" .
.\" .
.\" .Pp
.\" If double quotes are used, for example:
.\" .Bd -literal
.\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
.\" .Ed
.\" .
.\" .
.\" .Pp
.\" produces, nudge nudge,
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
.\" nudge
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
.\" nudge
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
.\" .
.\" .
.\" .Pp
.\" Not a pretty sight...
.\" In a paragraph, a long parameter containing unpaddable spaces as
.\" in the former example will cause
.\" .Xr \%troff
.\" to break the line and spread
.\" the remaining words out.
.\" The latter example will adjust nicely to
.\" justified margins, but may break in between an argument and its
.\" declaration.
.\" In
.\" .Xr \%nroff
.\" the right margin is normally ragged and the problem is not as
.\" severe.
.
.
.\" Restore compatibility mode (for, e.g., Solaris 10/11).
.cp \n[*groff_groff_mdoc_7_man_C]
.do rr *groff_groff_mdoc_7_man_C
.
.
.\" Local Variables:
.\" mode: nroff
.\" fill-column: 72
.\" End:
.\" vim: set filetype=groff textwidth=72:
|