summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/glossaries/glossaries-user.tex
blob: f4dc52e08eb5dc64ed9d0e08831d9b06147cf581 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
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
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577
9578
9579
9580
9581
9582
9583
9584
9585
9586
9587
9588
9589
9590
9591
9592
9593
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
9609
9610
9611
9612
9613
9614
9615
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9646
9647
9648
9649
9650
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9672
9673
9674
9675
9676
9677
9678
9679
9680
9681
9682
9683
9684
9685
9686
9687
9688
9689
9690
9691
9692
9693
9694
9695
9696
9697
9698
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9722
9723
9724
9725
9726
9727
9728
9729
9730
9731
9732
9733
9734
9735
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9746
9747
9748
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9759
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9770
9771
9772
9773
9774
9775
9776
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9961
9962
9963
9964
9965
9966
9967
9968
9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10012
10013
10014
10015
10016
10017
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10077
10078
10079
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10131
10132
10133
10134
10135
10136
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10784
10785
10786
10787
10788
10789
10790
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10803
10804
10805
10806
10807
10808
10809
10810
10811
10812
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10834
10835
10836
10837
10838
10839
10840
10841
10842
10843
10844
10845
10846
10847
10848
10849
10850
10851
10852
10853
10854
10855
10856
10857
10858
10859
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10883
10884
10885
10886
10887
10888
10889
10890
10891
10892
10893
10894
10895
10896
10897
10898
10899
10900
10901
10902
10903
10904
10905
10906
10907
10908
10909
10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11043
11044
11045
11046
11047
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11256
11257
11258
11259
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11291
11292
11293
11294
11295
11296
11297
11298
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11346
11347
11348
11349
11350
11351
11352
11353
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11375
11376
11377
11378
11379
11380
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11439
11440
11441
11442
11443
11444
11445
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11488
11489
11490
11491
11492
11493
11494
11495
11496
11497
11498
11499
11500
11501
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11544
11545
11546
11547
11548
11549
11550
11551
11552
11553
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11755
11756
11757
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11904
11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11938
11939
11940
11941
11942
11943
11944
11945
11946
11947
11948
11949
11950
11951
11952
11953
11954
11955
11956
11957
11958
11959
11960
11961
11962
11963
11964
11965
11966
11967
11968
11969
11970
11971
11972
11973
11974
11975
11976
11977
11978
11979
11980
11981
11982
11983
11984
11985
11986
11987
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12022
12023
12024
12025
12026
12027
12028
12029
12030
12031
12032
12033
12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
12061
12062
12063
12064
12065
12066
12067
12068
12069
12070
12071
12072
12073
12074
12075
12076
12077
12078
12079
12080
12081
12082
12083
12084
12085
12086
12087
12088
12089
12090
12091
12092
12093
12094
12095
12096
12097
12098
12099
12100
12101
12102
12103
12104
12105
12106
12107
12108
12109
12110
12111
12112
12113
12114
12115
12116
12117
12118
12119
12120
12121
12122
12123
12124
12125
12126
12127
12128
12129
12130
12131
12132
12133
12134
12135
12136
12137
12138
12139
12140
12141
12142
12143
12144
12145
12146
12147
12148
12149
12150
12151
12152
12153
12154
12155
12156
12157
12158
12159
12160
12161
12162
12163
12164
12165
12166
12167
12168
12169
12170
12171
12172
12173
12174
12175
12176
12177
12178
12179
12180
12181
12182
12183
12184
12185
12186
12187
12188
12189
12190
12191
12192
12193
12194
12195
12196
12197
12198
12199
12200
12201
12202
12203
12204
12205
12206
12207
12208
12209
12210
12211
12212
12213
12214
12215
12216
12217
12218
12219
12220
12221
12222
12223
12224
12225
12226
12227
12228
12229
12230
12231
12232
12233
12234
12235
12236
12237
12238
12239
12240
12241
12242
12243
12244
12245
12246
12247
12248
12249
12250
12251
12252
12253
12254
12255
12256
12257
12258
12259
12260
12261
12262
12263
12264
12265
12266
12267
12268
12269
12270
12271
12272
12273
12274
12275
12276
12277
12278
12279
12280
12281
12282
12283
12284
12285
12286
12287
12288
12289
12290
12291
12292
12293
12294
12295
12296
12297
12298
12299
12300
12301
12302
12303
12304
12305
12306
12307
12308
12309
12310
12311
12312
12313
12314
12315
12316
12317
12318
12319
12320
12321
12322
12323
12324
12325
12326
12327
12328
12329
12330
12331
12332
12333
12334
12335
12336
12337
12338
12339
12340
12341
12342
12343
12344
12345
12346
12347
12348
12349
12350
12351
12352
12353
12354
12355
12356
12357
12358
12359
12360
12361
12362
12363
12364
12365
12366
12367
12368
12369
12370
12371
12372
12373
12374
12375
12376
12377
12378
12379
12380
12381
12382
12383
12384
12385
12386
12387
12388
12389
12390
12391
12392
12393
12394
12395
12396
12397
12398
12399
12400
12401
12402
12403
12404
12405
12406
12407
12408
12409
12410
12411
12412
12413
12414
12415
12416
12417
12418
12419
12420
12421
12422
12423
12424
12425
12426
12427
12428
12429
12430
12431
12432
12433
12434
12435
12436
12437
12438
12439
12440
12441
12442
12443
12444
12445
12446
12447
12448
12449
12450
12451
12452
12453
12454
12455
12456
12457
12458
12459
12460
12461
12462
12463
12464
12465
12466
12467
12468
12469
12470
12471
12472
12473
12474
12475
12476
12477
12478
12479
12480
12481
12482
12483
12484
12485
12486
12487
12488
12489
12490
12491
12492
12493
12494
12495
12496
12497
12498
12499
12500
12501
12502
12503
12504
12505
12506
12507
12508
12509
12510
12511
12512
12513
12514
12515
12516
12517
12518
12519
12520
12521
12522
12523
12524
12525
12526
12527
12528
12529
12530
12531
12532
12533
12534
12535
12536
12537
12538
12539
12540
12541
12542
12543
12544
12545
12546
12547
12548
12549
12550
12551
12552
12553
12554
12555
12556
12557
12558
12559
12560
12561
12562
12563
12564
12565
12566
12567
12568
12569
12570
12571
12572
12573
12574
12575
12576
12577
12578
12579
12580
12581
12582
12583
12584
12585
12586
12587
12588
12589
12590
12591
12592
12593
12594
12595
12596
12597
12598
12599
12600
12601
12602
12603
12604
12605
12606
12607
12608
12609
12610
12611
12612
12613
12614
12615
12616
12617
12618
12619
12620
12621
12622
12623
12624
12625
12626
12627
12628
12629
12630
12631
12632
12633
12634
12635
12636
12637
12638
12639
12640
12641
12642
12643
12644
12645
12646
12647
12648
12649
12650
12651
12652
12653
12654
12655
12656
12657
12658
12659
12660
12661
12662
12663
12664
12665
12666
12667
12668
12669
12670
12671
12672
12673
12674
12675
12676
12677
12678
12679
12680
12681
12682
12683
12684
12685
12686
12687
12688
12689
12690
12691
12692
12693
12694
12695
12696
12697
12698
12699
12700
12701
12702
12703
12704
12705
12706
12707
12708
12709
12710
12711
12712
12713
12714
12715
12716
12717
12718
12719
12720
12721
12722
12723
12724
12725
12726
12727
12728
12729
12730
12731
12732
12733
12734
12735
12736
12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
12765
12766
12767
12768
12769
12770
12771
12772
12773
12774
12775
12776
12777
12778
12779
12780
12781
12782
12783
12784
12785
12786
12787
12788
12789
12790
12791
12792
12793
12794
12795
12796
12797
12798
12799
12800
12801
12802
12803
12804
12805
12806
12807
12808
12809
12810
12811
12812
12813
12814
12815
12816
12817
12818
12819
12820
12821
12822
12823
12824
12825
12826
12827
12828
12829
12830
12831
12832
12833
12834
12835
12836
12837
12838
12839
12840
12841
12842
12843
12844
12845
12846
12847
12848
12849
12850
12851
12852
12853
12854
12855
12856
12857
12858
12859
12860
12861
12862
12863
12864
12865
12866
12867
12868
12869
12870
12871
12872
12873
12874
12875
12876
12877
12878
12879
12880
12881
12882
12883
12884
12885
12886
12887
12888
12889
12890
12891
12892
12893
12894
12895
12896
12897
12898
12899
12900
12901
12902
12903
12904
12905
12906
12907
12908
12909
12910
12911
12912
12913
12914
12915
12916
12917
12918
12919
12920
12921
12922
12923
12924
12925
12926
12927
12928
12929
12930
12931
12932
12933
12934
12935
12936
12937
12938
12939
12940
12941
12942
12943
12944
12945
12946
12947
12948
12949
12950
12951
12952
12953
12954
12955
12956
12957
12958
12959
12960
12961
12962
12963
12964
12965
12966
12967
12968
12969
12970
12971
12972
12973
12974
12975
12976
12977
12978
12979
12980
12981
12982
12983
12984
12985
12986
12987
12988
12989
12990
12991
12992
12993
12994
12995
12996
12997
12998
12999
13000
13001
13002
13003
13004
13005
13006
13007
13008
13009
13010
13011
13012
13013
13014
13015
13016
13017
13018
13019
13020
13021
13022
13023
13024
13025
13026
13027
13028
13029
13030
13031
13032
13033
13034
13035
13036
13037
13038
13039
13040
13041
13042
13043
13044
13045
13046
13047
13048
13049
13050
13051
13052
13053
13054
13055
13056
13057
13058
13059
13060
13061
13062
13063
13064
13065
13066
13067
13068
13069
13070
13071
13072
13073
13074
13075
13076
13077
13078
13079
13080
13081
13082
13083
13084
13085
13086
13087
13088
13089
13090
13091
13092
13093
13094
13095
13096
13097
13098
13099
13100
13101
13102
13103
13104
13105
13106
13107
13108
13109
13110
13111
13112
13113
13114
13115
13116
13117
13118
13119
13120
13121
13122
13123
13124
13125
13126
13127
13128
13129
13130
13131
13132
13133
13134
13135
13136
13137
13138
13139
13140
13141
13142
13143
13144
13145
13146
13147
13148
13149
13150
13151
13152
13153
13154
13155
13156
13157
13158
13159
13160
13161
13162
13163
13164
13165
13166
13167
13168
13169
13170
13171
13172
13173
13174
13175
13176
13177
13178
13179
13180
13181
13182
13183
13184
13185
13186
13187
13188
13189
13190
13191
13192
13193
13194
13195
13196
13197
13198
13199
13200
13201
13202
13203
13204
13205
13206
13207
13208
13209
13210
13211
13212
13213
13214
13215
13216
13217
13218
13219
13220
13221
13222
13223
13224
13225
13226
13227
13228
13229
13230
13231
13232
13233
13234
13235
13236
13237
13238
13239
13240
13241
13242
13243
13244
13245
13246
13247
13248
13249
13250
13251
13252
13253
13254
13255
13256
13257
13258
13259
13260
13261
13262
13263
13264
13265
13266
13267
13268
13269
13270
13271
13272
13273
13274
13275
13276
13277
13278
13279
13280
13281
13282
13283
13284
13285
13286
13287
13288
13289
13290
13291
13292
13293
13294
13295
13296
13297
13298
13299
13300
13301
13302
13303
13304
13305
13306
13307
13308
13309
13310
13311
13312
13313
13314
13315
13316
13317
13318
13319
13320
13321
13322
13323
13324
13325
13326
13327
13328
13329
13330
13331
13332
13333
13334
13335
13336
13337
13338
13339
13340
13341
13342
13343
13344
13345
13346
13347
13348
13349
13350
13351
13352
13353
13354
13355
13356
13357
13358
13359
13360
13361
13362
13363
13364
13365
13366
13367
13368
13369
13370
13371
13372
13373
13374
13375
13376
13377
13378
13379
13380
13381
13382
13383
13384
13385
13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
13398
13399
13400
13401
13402
13403
13404
13405
13406
13407
13408
13409
13410
13411
13412
13413
13414
13415
13416
13417
13418
13419
13420
13421
13422
13423
13424
13425
13426
13427
13428
13429
13430
13431
13432
13433
13434
13435
13436
13437
13438
13439
13440
13441
13442
13443
13444
13445
13446
13447
13448
13449
13450
13451
13452
13453
13454
13455
13456
13457
13458
13459
13460
13461
13462
13463
13464
13465
13466
13467
13468
13469
13470
13471
13472
13473
13474
13475
13476
13477
13478
13479
13480
13481
13482
13483
13484
13485
13486
13487
13488
13489
13490
13491
13492
13493
13494
13495
13496
13497
13498
13499
13500
13501
13502
13503
13504
13505
13506
13507
13508
13509
13510
13511
13512
13513
13514
13515
13516
13517
13518
13519
13520
13521
13522
13523
13524
13525
13526
13527
13528
13529
13530
13531
13532
13533
13534
13535
13536
13537
13538
13539
13540
13541
13542
13543
13544
13545
13546
13547
13548
13549
13550
13551
13552
13553
13554
13555
13556
13557
13558
13559
13560
13561
13562
13563
13564
13565
13566
13567
13568
13569
13570
13571
13572
13573
13574
13575
13576
13577
13578
13579
13580
13581
13582
13583
13584
13585
13586
13587
13588
13589
13590
13591
13592
13593
13594
13595
13596
13597
13598
13599
13600
13601
13602
13603
13604
13605
13606
13607
13608
13609
13610
13611
13612
13613
13614
13615
13616
13617
13618
13619
13620
13621
13622
13623
13624
13625
13626
13627
13628
13629
13630
13631
13632
13633
13634
13635
13636
13637
13638
13639
13640
13641
13642
13643
13644
13645
13646
13647
13648
13649
13650
13651
13652
13653
13654
13655
13656
13657
13658
13659
13660
13661
13662
13663
13664
13665
13666
13667
13668
13669
13670
13671
13672
13673
13674
13675
13676
13677
13678
13679
13680
13681
13682
13683
13684
13685
13686
13687
13688
13689
13690
13691
13692
13693
13694
13695
13696
13697
13698
13699
13700
13701
13702
13703
13704
13705
13706
13707
13708
13709
13710
13711
13712
13713
13714
13715
13716
13717
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
13754
13755
13756
13757
13758
13759
13760
13761
13762
13763
13764
13765
13766
13767
13768
13769
13770
13771
13772
13773
13774
13775
13776
13777
13778
13779
13780
13781
13782
13783
13784
13785
13786
13787
13788
13789
13790
13791
13792
13793
13794
13795
13796
13797
13798
13799
13800
13801
13802
13803
13804
13805
13806
13807
13808
13809
13810
13811
13812
13813
13814
13815
13816
13817
13818
13819
13820
13821
13822
13823
13824
13825
13826
13827
13828
13829
13830
13831
13832
13833
13834
13835
13836
13837
13838
13839
13840
13841
13842
13843
13844
13845
13846
13847
13848
13849
13850
13851
13852
13853
13854
13855
13856
13857
13858
13859
13860
13861
13862
13863
13864
13865
13866
13867
13868
13869
13870
13871
13872
13873
13874
13875
13876
13877
13878
13879
13880
13881
13882
13883
13884
13885
13886
13887
13888
13889
13890
13891
13892
13893
13894
13895
13896
13897
13898
13899
13900
13901
13902
13903
13904
13905
13906
13907
13908
13909
13910
13911
13912
13913
13914
13915
13916
13917
13918
13919
13920
13921
13922
13923
13924
13925
13926
13927
13928
13929
13930
13931
13932
13933
13934
13935
13936
13937
13938
13939
13940
13941
13942
13943
13944
13945
13946
13947
13948
13949
13950
13951
13952
13953
13954
13955
13956
13957
13958
13959
13960
13961
13962
13963
13964
13965
13966
13967
13968
13969
13970
13971
13972
13973
13974
13975
13976
13977
13978
13979
13980
13981
13982
13983
13984
13985
13986
13987
13988
13989
13990
13991
13992
13993
13994
13995
13996
13997
13998
13999
14000
14001
14002
14003
14004
14005
14006
14007
14008
14009
14010
14011
14012
14013
14014
14015
14016
14017
14018
14019
14020
14021
14022
14023
14024
14025
14026
14027
14028
14029
14030
14031
14032
14033
14034
14035
14036
14037
14038
14039
14040
14041
14042
14043
14044
14045
14046
14047
14048
14049
14050
14051
14052
14053
14054
14055
14056
14057
14058
14059
14060
14061
14062
14063
14064
14065
14066
14067
14068
14069
14070
14071
14072
14073
14074
14075
14076
14077
14078
14079
14080
14081
14082
14083
14084
14085
14086
14087
14088
14089
14090
14091
14092
14093
14094
14095
14096
14097
14098
14099
14100
14101
14102
14103
14104
14105
14106
14107
14108
14109
14110
14111
14112
14113
14114
14115
14116
14117
14118
14119
14120
14121
14122
14123
14124
14125
14126
14127
14128
14129
14130
14131
14132
14133
14134
14135
14136
14137
14138
14139
14140
14141
14142
14143
14144
14145
14146
14147
14148
14149
14150
14151
14152
14153
14154
14155
14156
14157
14158
14159
14160
14161
14162
14163
14164
14165
14166
14167
14168
14169
14170
14171
14172
14173
14174
14175
14176
14177
14178
14179
14180
14181
14182
14183
14184
14185
14186
14187
14188
14189
14190
14191
14192
14193
14194
14195
14196
14197
14198
14199
14200
14201
14202
14203
14204
14205
14206
14207
14208
14209
14210
14211
14212
14213
14214
14215
14216
14217
14218
14219
14220
14221
14222
14223
14224
14225
14226
14227
14228
14229
14230
14231
14232
14233
14234
14235
14236
14237
14238
14239
14240
14241
14242
14243
14244
14245
14246
14247
14248
14249
14250
14251
14252
14253
14254
14255
14256
14257
14258
14259
14260
14261
14262
14263
14264
14265
14266
14267
14268
14269
14270
14271
14272
14273
14274
14275
14276
14277
14278
14279
14280
14281
14282
14283
14284
14285
14286
14287
14288
14289
14290
14291
14292
14293
14294
14295
14296
14297
14298
14299
14300
14301
14302
14303
14304
14305
14306
14307
14308
14309
14310
14311
14312
14313
14314
14315
14316
14317
14318
14319
14320
14321
14322
14323
14324
14325
14326
14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
14337
14338
14339
14340
14341
14342
14343
14344
14345
14346
14347
14348
14349
14350
14351
14352
14353
14354
14355
14356
14357
14358
14359
14360
14361
14362
14363
14364
14365
14366
14367
14368
14369
14370
14371
14372
14373
14374
14375
14376
14377
14378
14379
14380
14381
14382
14383
14384
14385
14386
14387
14388
14389
14390
14391
14392
14393
14394
14395
14396
14397
14398
14399
14400
14401
14402
14403
14404
14405
14406
14407
14408
14409
14410
14411
14412
14413
14414
14415
14416
14417
14418
14419
14420
14421
14422
14423
14424
14425
14426
14427
14428
14429
14430
14431
14432
14433
14434
14435
14436
14437
14438
14439
14440
14441
14442
14443
14444
14445
14446
14447
14448
14449
14450
14451
14452
14453
14454
14455
14456
14457
14458
14459
14460
14461
14462
14463
14464
14465
14466
14467
14468
14469
14470
14471
14472
14473
14474
14475
14476
14477
14478
14479
14480
14481
14482
14483
14484
14485
14486
14487
14488
14489
14490
14491
14492
14493
14494
14495
14496
14497
14498
14499
14500
14501
14502
14503
14504
14505
14506
14507
14508
14509
14510
14511
14512
14513
14514
14515
14516
14517
14518
14519
14520
14521
14522
14523
14524
14525
14526
14527
14528
14529
14530
14531
14532
14533
14534
14535
14536
14537
14538
14539
14540
14541
14542
14543
14544
14545
14546
14547
14548
14549
14550
14551
14552
14553
14554
14555
14556
14557
14558
14559
14560
14561
14562
14563
14564
14565
14566
14567
14568
14569
14570
14571
14572
14573
14574
14575
14576
14577
14578
14579
14580
14581
14582
14583
14584
14585
14586
14587
14588
14589
14590
14591
14592
14593
14594
14595
14596
14597
14598
14599
14600
14601
14602
14603
14604
14605
14606
14607
14608
14609
14610
14611
14612
14613
14614
14615
14616
14617
14618
14619
14620
14621
14622
14623
14624
14625
14626
14627
14628
14629
14630
14631
14632
14633
14634
14635
14636
14637
14638
14639
14640
14641
14642
14643
14644
14645
14646
14647
14648
14649
14650
14651
14652
14653
14654
14655
14656
14657
14658
14659
14660
14661
14662
14663
14664
14665
14666
14667
14668
14669
14670
14671
14672
14673
14674
14675
14676
14677
14678
14679
14680
14681
14682
14683
14684
14685
14686
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14703
14704
14705
14706
14707
14708
14709
14710
14711
14712
14713
14714
14715
14716
14717
14718
14719
14720
14721
14722
14723
14724
14725
14726
14727
14728
14729
14730
14731
14732
14733
14734
14735
14736
14737
14738
14739
14740
14741
14742
14743
14744
14745
14746
14747
14748
14749
14750
14751
14752
14753
14754
14755
14756
14757
14758
14759
14760
14761
14762
14763
14764
14765
14766
14767
14768
14769
14770
14771
14772
14773
14774
14775
14776
14777
14778
14779
14780
14781
14782
14783
14784
14785
14786
14787
14788
14789
14790
14791
14792
14793
14794
14795
14796
14797
14798
14799
14800
14801
14802
14803
14804
14805
14806
14807
14808
14809
14810
14811
14812
14813
14814
14815
14816
14817
14818
14819
14820
14821
14822
14823
14824
14825
14826
14827
14828
14829
14830
14831
14832
14833
14834
14835
14836
14837
14838
14839
14840
14841
14842
14843
14844
14845
14846
14847
14848
14849
14850
14851
14852
14853
14854
14855
14856
14857
14858
14859
14860
14861
14862
14863
14864
14865
14866
14867
14868
14869
14870
14871
14872
14873
14874
14875
14876
14877
14878
14879
14880
14881
14882
14883
14884
14885
14886
14887
14888
14889
14890
14891
14892
14893
14894
14895
14896
14897
14898
14899
14900
14901
14902
14903
14904
14905
14906
14907
14908
14909
14910
14911
14912
14913
14914
14915
14916
14917
14918
14919
14920
14921
14922
14923
14924
14925
14926
14927
14928
14929
14930
14931
14932
14933
14934
14935
14936
14937
14938
14939
14940
14941
14942
14943
14944
14945
14946
14947
14948
14949
14950
14951
14952
14953
14954
14955
14956
14957
14958
14959
14960
14961
14962
14963
14964
14965
14966
14967
14968
14969
14970
14971
14972
14973
14974
14975
14976
14977
14978
14979
14980
14981
14982
14983
14984
14985
14986
14987
14988
14989
14990
14991
14992
14993
14994
14995
14996
14997
14998
14999
15000
15001
15002
15003
15004
15005
15006
15007
15008
15009
15010
15011
15012
15013
15014
15015
15016
15017
15018
15019
15020
15021
15022
15023
15024
15025
15026
15027
15028
15029
15030
15031
15032
15033
15034
15035
15036
15037
15038
15039
15040
15041
15042
15043
15044
15045
15046
15047
15048
15049
15050
15051
15052
15053
15054
15055
15056
15057
15058
15059
15060
15061
15062
15063
15064
15065
15066
15067
15068
15069
15070
15071
15072
15073
15074
15075
15076
15077
15078
15079
15080
15081
15082
15083
15084
15085
15086
15087
15088
15089
15090
15091
15092
15093
15094
15095
15096
15097
15098
15099
15100
15101
15102
15103
15104
15105
15106
15107
15108
15109
15110
15111
15112
15113
15114
15115
15116
15117
15118
15119
15120
15121
15122
15123
15124
15125
15126
15127
15128
15129
15130
15131
15132
15133
15134
15135
15136
15137
15138
15139
15140
15141
15142
15143
15144
15145
15146
15147
15148
15149
15150
15151
15152
15153
15154
15155
15156
15157
15158
15159
15160
15161
15162
15163
15164
15165
15166
15167
15168
15169
15170
15171
15172
15173
15174
15175
15176
15177
15178
15179
15180
15181
15182
15183
15184
15185
15186
15187
15188
15189
15190
15191
15192
15193
15194
15195
15196
15197
15198
15199
15200
15201
15202
15203
15204
15205
15206
15207
15208
15209
15210
15211
15212
15213
15214
15215
15216
15217
15218
15219
15220
15221
15222
15223
15224
15225
15226
15227
15228
15229
15230
15231
15232
15233
15234
15235
15236
15237
15238
15239
15240
15241
15242
15243
15244
15245
15246
15247
15248
15249
15250
15251
15252
15253
15254
15255
15256
15257
15258
15259
15260
15261
15262
15263
15264
15265
15266
15267
15268
15269
15270
15271
15272
15273
15274
15275
15276
15277
15278
15279
15280
15281
15282
15283
15284
15285
15286
15287
15288
15289
15290
15291
15292
15293
15294
15295
15296
15297
15298
15299
15300
15301
15302
15303
15304
15305
15306
15307
15308
15309
15310
15311
15312
15313
15314
15315
15316
15317
15318
15319
15320
15321
15322
15323
15324
15325
15326
15327
15328
15329
15330
15331
15332
15333
15334
15335
15336
15337
15338
15339
15340
15341
15342
15343
15344
15345
15346
15347
15348
15349
15350
15351
15352
15353
15354
15355
15356
15357
15358
15359
15360
15361
15362
15363
15364
15365
15366
15367
15368
15369
15370
15371
15372
15373
15374
15375
15376
15377
15378
15379
15380
15381
15382
15383
15384
15385
15386
15387
15388
15389
15390
15391
15392
15393
15394
15395
15396
15397
15398
15399
15400
15401
15402
15403
15404
15405
15406
15407
15408
15409
15410
15411
15412
15413
15414
15415
15416
15417
15418
15419
15420
15421
15422
15423
15424
15425
15426
15427
15428
15429
15430
15431
15432
15433
15434
15435
15436
15437
15438
15439
15440
15441
15442
15443
15444
15445
15446
15447
15448
15449
15450
15451
15452
15453
15454
15455
15456
15457
15458
15459
15460
15461
15462
15463
15464
15465
15466
15467
15468
15469
15470
15471
15472
15473
15474
15475
15476
15477
15478
15479
15480
15481
15482
15483
15484
15485
15486
15487
15488
15489
15490
15491
15492
15493
15494
15495
15496
15497
15498
15499
15500
15501
15502
15503
15504
15505
15506
15507
15508
15509
15510
15511
15512
15513
15514
15515
15516
15517
15518
15519
15520
15521
15522
15523
15524
15525
15526
15527
15528
15529
15530
15531
15532
15533
15534
15535
15536
15537
15538
15539
15540
15541
15542
15543
15544
15545
15546
15547
15548
15549
15550
15551
15552
15553
15554
15555
15556
15557
15558
15559
15560
15561
15562
15563
15564
15565
15566
15567
15568
15569
15570
15571
15572
15573
15574
15575
15576
15577
15578
15579
15580
15581
15582
15583
15584
15585
15586
15587
15588
15589
15590
15591
15592
15593
15594
15595
15596
15597
15598
15599
15600
15601
15602
15603
15604
15605
15606
15607
15608
15609
15610
15611
15612
15613
15614
15615
15616
15617
15618
15619
15620
15621
15622
15623
15624
15625
15626
15627
15628
15629
15630
15631
15632
15633
15634
15635
15636
15637
15638
15639
15640
15641
15642
15643
15644
15645
15646
15647
15648
15649
15650
15651
15652
15653
15654
15655
15656
15657
15658
15659
15660
15661
15662
15663
15664
15665
15666
15667
15668
15669
15670
15671
15672
15673
15674
15675
15676
15677
15678
15679
15680
15681
15682
15683
15684
15685
15686
15687
15688
15689
15690
15691
15692
15693
15694
15695
15696
15697
15698
15699
15700
15701
15702
15703
15704
15705
15706
15707
15708
15709
15710
15711
15712
15713
15714
15715
15716
15717
15718
15719
15720
15721
15722
15723
15724
15725
15726
15727
15728
15729
15730
15731
15732
15733
15734
15735
15736
15737
15738
15739
15740
15741
15742
15743
15744
15745
15746
15747
15748
15749
15750
15751
15752
15753
15754
15755
15756
15757
15758
15759
15760
15761
15762
15763
15764
15765
15766
15767
15768
15769
15770
15771
15772
15773
15774
15775
15776
15777
15778
15779
15780
15781
15782
15783
15784
15785
15786
15787
15788
15789
15790
15791
15792
15793
15794
15795
15796
15797
15798
15799
15800
15801
15802
15803
15804
15805
15806
15807
15808
15809
15810
15811
15812
15813
15814
15815
15816
15817
15818
15819
15820
15821
15822
15823
15824
15825
15826
15827
15828
15829
15830
15831
15832
15833
15834
15835
15836
15837
15838
15839
15840
15841
15842
15843
15844
15845
15846
15847
15848
15849
15850
15851
15852
15853
15854
15855
15856
15857
15858
15859
15860
15861
15862
15863
15864
15865
15866
15867
15868
15869
15870
15871
15872
15873
15874
15875
15876
15877
15878
15879
15880
15881
15882
15883
15884
15885
15886
15887
15888
15889
15890
15891
15892
15893
15894
15895
15896
15897
15898
15899
15900
15901
15902
15903
15904
15905
15906
15907
15908
15909
15910
15911
15912
15913
15914
15915
15916
15917
15918
15919
15920
15921
15922
15923
15924
15925
15926
15927
15928
15929
15930
15931
15932
15933
15934
15935
15936
15937
15938
15939
15940
15941
15942
15943
15944
15945
15946
15947
15948
15949
15950
15951
15952
15953
15954
15955
15956
15957
15958
15959
15960
15961
15962
15963
15964
15965
15966
15967
15968
15969
15970
15971
15972
15973
15974
15975
15976
15977
15978
15979
15980
15981
15982
15983
15984
15985
15986
15987
15988
15989
15990
15991
15992
15993
15994
15995
15996
15997
15998
15999
16000
16001
16002
16003
16004
16005
16006
16007
16008
16009
16010
16011
16012
16013
16014
16015
16016
16017
16018
16019
16020
16021
16022
16023
16024
16025
16026
16027
16028
16029
16030
16031
16032
16033
16034
16035
16036
16037
16038
16039
16040
16041
16042
16043
16044
16045
16046
16047
16048
16049
16050
16051
16052
16053
16054
16055
16056
16057
16058
16059
16060
16061
16062
16063
16064
16065
16066
16067
16068
16069
16070
16071
16072
16073
16074
16075
16076
16077
16078
16079
16080
16081
16082
16083
16084
16085
16086
16087
16088
16089
16090
16091
16092
16093
16094
16095
16096
16097
16098
16099
16100
16101
16102
16103
16104
16105
16106
16107
16108
16109
16110
16111
16112
16113
16114
16115
16116
16117
16118
16119
16120
16121
16122
16123
16124
16125
16126
16127
16128
16129
16130
16131
16132
16133
16134
16135
16136
16137
16138
16139
16140
16141
16142
16143
16144
16145
16146
16147
16148
16149
16150
16151
16152
16153
16154
16155
16156
16157
16158
16159
16160
16161
16162
16163
16164
16165
16166
16167
16168
16169
16170
16171
16172
16173
16174
16175
16176
16177
16178
16179
16180
16181
16182
16183
16184
16185
16186
16187
16188
16189
16190
16191
16192
16193
16194
16195
16196
16197
16198
16199
16200
16201
16202
16203
16204
16205
16206
16207
16208
16209
16210
16211
16212
16213
16214
16215
16216
16217
16218
16219
16220
16221
16222
16223
16224
16225
16226
16227
16228
16229
16230
16231
16232
16233
16234
16235
16236
16237
16238
16239
16240
16241
16242
16243
16244
16245
16246
16247
16248
16249
16250
16251
16252
16253
16254
16255
16256
16257
16258
16259
16260
16261
16262
16263
16264
16265
16266
16267
16268
16269
16270
16271
16272
16273
16274
16275
16276
16277
16278
16279
16280
16281
16282
16283
16284
16285
16286
16287
16288
16289
16290
16291
16292
16293
16294
16295
16296
16297
16298
16299
16300
16301
16302
16303
16304
16305
16306
16307
16308
16309
16310
16311
16312
16313
16314
16315
16316
16317
16318
16319
16320
16321
16322
16323
16324
16325
16326
16327
16328
16329
16330
16331
16332
16333
16334
16335
16336
16337
16338
16339
16340
16341
16342
16343
16344
16345
16346
16347
16348
16349
16350
16351
16352
16353
16354
16355
16356
16357
16358
16359
16360
16361
16362
16363
16364
16365
16366
16367
16368
16369
16370
16371
16372
16373
16374
16375
16376
16377
16378
16379
16380
16381
16382
16383
16384
16385
16386
16387
16388
16389
16390
16391
16392
16393
16394
16395
16396
16397
16398
16399
16400
16401
16402
16403
16404
16405
16406
16407
16408
16409
16410
16411
16412
16413
16414
16415
16416
16417
16418
16419
16420
16421
16422
16423
16424
16425
16426
16427
16428
16429
16430
16431
16432
16433
16434
16435
16436
16437
16438
16439
16440
16441
16442
16443
16444
16445
16446
16447
16448
16449
16450
16451
16452
16453
16454
16455
16456
16457
16458
16459
16460
16461
16462
16463
16464
16465
16466
16467
16468
16469
16470
16471
16472
16473
16474
16475
16476
16477
16478
16479
16480
16481
16482
16483
16484
16485
16486
16487
16488
16489
16490
16491
16492
16493
16494
16495
16496
16497
16498
16499
16500
16501
16502
16503
16504
16505
16506
16507
16508
16509
16510
16511
16512
16513
16514
16515
16516
16517
16518
16519
16520
16521
16522
16523
16524
16525
16526
16527
16528
16529
16530
16531
16532
16533
16534
16535
16536
16537
16538
16539
16540
16541
16542
16543
16544
16545
16546
16547
16548
16549
16550
16551
16552
16553
16554
16555
16556
16557
16558
16559
16560
16561
16562
16563
16564
16565
16566
16567
16568
16569
16570
16571
16572
16573
16574
16575
16576
16577
16578
16579
16580
16581
16582
16583
16584
16585
16586
16587
16588
16589
16590
16591
16592
16593
16594
16595
16596
16597
16598
16599
16600
16601
16602
16603
16604
16605
16606
16607
16608
16609
16610
16611
16612
16613
16614
16615
16616
16617
16618
16619
16620
16621
16622
16623
16624
16625
16626
16627
16628
16629
16630
16631
16632
16633
16634
16635
16636
16637
16638
16639
16640
16641
16642
16643
16644
16645
16646
16647
16648
16649
16650
16651
16652
16653
16654
16655
16656
16657
16658
16659
16660
16661
16662
16663
16664
16665
16666
16667
16668
16669
16670
16671
16672
16673
16674
16675
16676
16677
16678
16679
16680
16681
16682
16683
16684
16685
16686
16687
16688
16689
16690
16691
16692
16693
16694
16695
16696
16697
16698
16699
16700
16701
16702
16703
16704
16705
16706
16707
16708
16709
16710
16711
16712
16713
16714
16715
16716
16717
16718
16719
16720
16721
16722
16723
16724
16725
16726
16727
16728
16729
16730
16731
16732
16733
16734
16735
16736
16737
16738
16739
16740
16741
16742
16743
16744
16745
16746
16747
16748
16749
16750
16751
16752
16753
16754
16755
16756
16757
16758
16759
16760
16761
16762
16763
16764
16765
16766
16767
16768
16769
16770
16771
16772
16773
16774
16775
16776
16777
16778
16779
16780
16781
16782
16783
16784
16785
16786
16787
16788
16789
16790
16791
16792
16793
16794
16795
16796
16797
16798
16799
16800
16801
16802
16803
16804
16805
16806
16807
16808
16809
16810
16811
16812
16813
16814
16815
16816
16817
16818
16819
16820
16821
16822
16823
16824
16825
16826
16827
16828
16829
16830
16831
16832
16833
16834
16835
16836
16837
16838
16839
16840
16841
16842
16843
16844
16845
16846
16847
16848
16849
16850
16851
16852
16853
16854
16855
16856
16857
16858
16859
16860
16861
16862
16863
16864
16865
16866
16867
16868
16869
16870
16871
16872
16873
16874
16875
16876
16877
16878
16879
16880
16881
16882
16883
16884
16885
16886
16887
16888
16889
16890
16891
16892
16893
16894
16895
16896
16897
16898
16899
16900
16901
16902
16903
16904
16905
16906
16907
16908
16909
16910
16911
16912
16913
16914
16915
16916
16917
16918
16919
16920
16921
16922
16923
16924
16925
16926
16927
16928
16929
16930
16931
16932
16933
16934
16935
16936
16937
16938
16939
16940
16941
16942
16943
16944
16945
16946
16947
16948
16949
16950
16951
16952
16953
16954
16955
16956
16957
16958
16959
16960
16961
16962
16963
16964
16965
16966
16967
16968
16969
16970
16971
16972
16973
16974
16975
16976
16977
16978
16979
16980
16981
16982
16983
16984
16985
16986
16987
16988
16989
16990
16991
16992
16993
16994
16995
16996
16997
16998
16999
17000
17001
17002
17003
17004
17005
17006
17007
17008
17009
17010
17011
17012
17013
17014
17015
17016
17017
17018
17019
17020
17021
17022
17023
17024
17025
17026
17027
17028
17029
17030
17031
17032
17033
17034
17035
17036
17037
17038
17039
17040
17041
17042
17043
17044
17045
17046
17047
17048
17049
17050
17051
17052
17053
17054
17055
17056
17057
17058
17059
17060
17061
17062
17063
17064
17065
17066
17067
17068
17069
17070
17071
17072
17073
17074
17075
17076
17077
17078
17079
17080
17081
17082
17083
17084
17085
17086
17087
17088
17089
17090
17091
17092
17093
17094
17095
17096
17097
17098
17099
17100
17101
17102
17103
17104
17105
17106
17107
17108
17109
17110
17111
17112
17113
17114
17115
17116
17117
17118
17119
17120
17121
17122
17123
17124
17125
17126
17127
17128
17129
17130
17131
17132
17133
17134
17135
17136
17137
17138
17139
17140
17141
17142
17143
17144
17145
17146
17147
17148
17149
17150
17151
17152
17153
17154
17155
17156
17157
17158
17159
17160
17161
17162
17163
17164
17165
17166
17167
17168
17169
17170
17171
17172
17173
17174
17175
17176
17177
17178
17179
17180
17181
17182
17183
17184
17185
17186
17187
17188
17189
17190
17191
17192
17193
17194
17195
17196
17197
17198
17199
17200
17201
17202
17203
17204
17205
17206
17207
17208
17209
17210
17211
17212
17213
17214
17215
17216
17217
17218
17219
17220
17221
17222
17223
17224
17225
17226
17227
17228
17229
17230
17231
17232
17233
17234
17235
17236
17237
17238
17239
17240
17241
17242
17243
17244
17245
17246
17247
17248
17249
17250
17251
17252
17253
17254
17255
17256
17257
17258
17259
17260
17261
17262
17263
17264
17265
17266
17267
17268
17269
17270
17271
17272
17273
17274
17275
17276
17277
17278
17279
17280
17281
17282
17283
17284
17285
17286
17287
17288
17289
17290
17291
17292
17293
17294
17295
17296
17297
17298
17299
17300
17301
17302
17303
17304
17305
17306
17307
17308
17309
17310
17311
17312
17313
17314
17315
17316
17317
17318
17319
17320
17321
17322
17323
17324
17325
17326
17327
17328
17329
17330
17331
17332
17333
17334
17335
17336
17337
17338
17339
17340
17341
17342
17343
17344
17345
17346
17347
17348
17349
17350
17351
17352
17353
17354
17355
17356
17357
17358
17359
17360
17361
17362
17363
17364
17365
17366
17367
17368
17369
17370
17371
17372
17373
17374
17375
17376
17377
17378
17379
17380
17381
17382
17383
17384
17385
17386
17387
17388
17389
17390
17391
17392
17393
17394
17395
17396
17397
17398
17399
17400
17401
17402
17403
17404
17405
17406
17407
17408
17409
17410
17411
17412
17413
17414
17415
17416
17417
17418
17419
17420
17421
17422
17423
17424
17425
17426
17427
17428
17429
17430
17431
17432
17433
17434
17435
17436
17437
17438
17439
17440
17441
17442
17443
17444
17445
17446
17447
17448
17449
17450
17451
17452
17453
17454
17455
17456
17457
17458
17459
17460
17461
17462
17463
17464
17465
17466
17467
17468
17469
17470
17471
17472
17473
17474
17475
17476
17477
17478
17479
17480
17481
17482
17483
17484
17485
17486
17487
17488
17489
17490
17491
17492
17493
17494
17495
17496
17497
17498
17499
17500
17501
17502
17503
17504
17505
17506
17507
17508
17509
17510
17511
17512
17513
17514
17515
17516
17517
17518
17519
17520
17521
17522
17523
17524
17525
17526
17527
17528
17529
17530
17531
17532
17533
17534
17535
17536
17537
17538
17539
17540
17541
17542
17543
17544
17545
17546
17547
17548
17549
17550
17551
17552
17553
17554
17555
17556
17557
17558
17559
17560
17561
17562
17563
17564
17565
17566
17567
17568
17569
17570
17571
17572
17573
17574
17575
17576
17577
17578
17579
17580
17581
17582
17583
17584
17585
17586
17587
17588
17589
17590
17591
17592
17593
17594
17595
17596
17597
17598
17599
17600
17601
17602
17603
17604
17605
17606
17607
17608
17609
17610
17611
17612
17613
17614
17615
17616
17617
17618
17619
17620
17621
17622
17623
17624
17625
17626
17627
17628
17629
17630
17631
17632
17633
17634
17635
17636
17637
17638
17639
17640
17641
17642
17643
17644
17645
17646
17647
17648
17649
17650
17651
17652
17653
17654
17655
17656
17657
17658
17659
17660
17661
17662
17663
17664
17665
17666
17667
17668
17669
17670
17671
17672
17673
17674
17675
17676
17677
17678
17679
17680
17681
17682
17683
17684
17685
17686
17687
17688
17689
17690
17691
17692
17693
17694
17695
17696
17697
17698
17699
17700
17701
17702
17703
17704
17705
17706
17707
17708
17709
17710
17711
17712
17713
17714
17715
17716
17717
17718
17719
17720
17721
17722
17723
17724
17725
17726
17727
17728
17729
17730
17731
17732
17733
17734
17735
17736
17737
17738
17739
17740
17741
17742
17743
17744
17745
17746
17747
17748
17749
17750
17751
17752
17753
17754
17755
17756
17757
17758
17759
17760
17761
17762
17763
17764
17765
17766
17767
17768
17769
17770
17771
17772
17773
17774
17775
17776
17777
17778
17779
17780
17781
17782
17783
17784
17785
17786
17787
17788
17789
17790
17791
17792
17793
17794
17795
17796
17797
17798
17799
17800
17801
17802
17803
17804
17805
17806
17807
17808
17809
17810
17811
17812
17813
17814
17815
17816
17817
17818
17819
17820
17821
17822
17823
17824
17825
17826
17827
17828
17829
17830
17831
17832
17833
17834
17835
17836
17837
17838
17839
17840
17841
17842
17843
17844
17845
17846
17847
17848
17849
17850
17851
17852
17853
17854
17855
17856
17857
17858
17859
17860
17861
17862
17863
17864
17865
17866
17867
17868
17869
17870
17871
17872
17873
17874
17875
17876
17877
17878
17879
17880
17881
17882
17883
17884
17885
17886
17887
17888
17889
17890
17891
17892
17893
17894
17895
17896
17897
17898
17899
17900
17901
17902
17903
17904
17905
17906
17907
17908
17909
17910
17911
17912
17913
17914
17915
17916
17917
17918
17919
17920
17921
17922
17923
17924
17925
17926
17927
17928
17929
17930
17931
17932
17933
17934
17935
17936
17937
17938
17939
17940
17941
17942
17943
17944
17945
17946
17947
17948
17949
17950
17951
17952
17953
17954
17955
17956
17957
17958
17959
17960
17961
17962
17963
17964
17965
17966
17967
17968
17969
17970
17971
17972
17973
17974
17975
17976
17977
17978
17979
17980
17981
17982
17983
17984
17985
17986
17987
17988
17989
17990
17991
17992
17993
17994
17995
17996
17997
17998
17999
18000
18001
18002
18003
18004
18005
18006
18007
18008
18009
18010
18011
18012
18013
18014
18015
18016
18017
18018
18019
18020
18021
18022
18023
18024
18025
18026
18027
18028
18029
18030
18031
18032
18033
18034
18035
18036
18037
18038
18039
18040
18041
18042
18043
18044
18045
18046
18047
18048
18049
18050
18051
18052
18053
18054
18055
18056
18057
18058
18059
18060
18061
18062
18063
18064
18065
18066
18067
18068
18069
18070
18071
18072
18073
18074
18075
18076
18077
18078
18079
18080
18081
18082
18083
18084
18085
18086
18087
18088
18089
18090
18091
18092
18093
18094
18095
18096
18097
18098
18099
18100
18101
18102
18103
18104
18105
18106
18107
18108
18109
18110
18111
18112
18113
18114
18115
18116
18117
18118
18119
18120
18121
18122
18123
18124
18125
18126
18127
18128
18129
18130
18131
18132
18133
18134
18135
18136
18137
18138
18139
18140
18141
18142
18143
18144
18145
18146
18147
18148
18149
18150
18151
18152
18153
18154
18155
18156
18157
18158
18159
18160
18161
18162
18163
18164
18165
18166
18167
18168
18169
18170
18171
18172
18173
18174
18175
18176
18177
18178
18179
18180
18181
18182
18183
18184
18185
18186
18187
18188
18189
18190
18191
18192
18193
18194
18195
18196
18197
18198
18199
18200
18201
18202
18203
18204
18205
18206
18207
18208
18209
18210
18211
18212
18213
18214
18215
18216
18217
18218
18219
18220
18221
18222
18223
18224
18225
18226
18227
18228
18229
18230
18231
18232
18233
18234
18235
18236
18237
18238
18239
18240
18241
18242
18243
18244
18245
18246
18247
18248
18249
18250
18251
18252
18253
18254
18255
18256
18257
18258
18259
18260
18261
18262
18263
18264
18265
18266
18267
18268
18269
18270
18271
18272
18273
18274
18275
18276
18277
18278
18279
18280
18281
18282
18283
18284
18285
18286
18287
18288
18289
18290
18291
18292
18293
18294
18295
18296
18297
18298
18299
18300
18301
18302
18303
18304
18305
18306
18307
18308
18309
18310
18311
18312
18313
18314
18315
18316
18317
18318
18319
18320
18321
18322
18323
18324
18325
18326
18327
18328
18329
18330
18331
18332
18333
18334
18335
18336
18337
18338
18339
18340
18341
18342
18343
18344
18345
18346
18347
18348
18349
18350
18351
18352
18353
18354
18355
18356
18357
18358
18359
18360
18361
18362
18363
18364
18365
18366
18367
18368
18369
18370
18371
18372
18373
18374
18375
18376
18377
18378
18379
18380
18381
18382
18383
18384
18385
18386
18387
18388
18389
18390
18391
18392
18393
18394
18395
18396
18397
18398
18399
18400
18401
18402
18403
18404
18405
18406
18407
18408
18409
18410
18411
18412
18413
18414
18415
18416
18417
18418
18419
18420
18421
18422
18423
18424
18425
18426
18427
18428
18429
18430
18431
18432
18433
18434
18435
18436
18437
18438
18439
18440
18441
18442
18443
18444
18445
18446
18447
18448
18449
18450
18451
18452
18453
18454
18455
18456
18457
18458
18459
18460
18461
18462
18463
18464
18465
18466
18467
18468
18469
18470
18471
18472
18473
18474
18475
18476
18477
18478
18479
18480
18481
18482
18483
18484
18485
18486
18487
18488
18489
18490
18491
18492
18493
18494
18495
18496
18497
18498
18499
18500
18501
18502
18503
18504
18505
18506
18507
18508
18509
18510
18511
18512
18513
18514
18515
18516
18517
18518
18519
18520
18521
18522
18523
18524
18525
18526
18527
18528
18529
18530
18531
18532
18533
18534
18535
18536
18537
18538
18539
18540
18541
18542
18543
18544
18545
18546
18547
18548
18549
18550
18551
18552
18553
18554
18555
18556
18557
18558
18559
18560
18561
18562
18563
18564
18565
18566
18567
18568
18569
18570
18571
18572
18573
18574
18575
18576
18577
18578
18579
18580
18581
18582
18583
18584
18585
18586
18587
18588
18589
18590
18591
18592
18593
18594
18595
18596
18597
18598
18599
18600
18601
18602
18603
18604
18605
18606
18607
18608
18609
18610
18611
18612
18613
18614
18615
18616
18617
18618
18619
18620
18621
18622
18623
18624
18625
18626
18627
18628
18629
18630
18631
18632
18633
18634
18635
18636
18637
18638
18639
18640
18641
18642
18643
18644
18645
18646
18647
18648
18649
18650
18651
18652
18653
18654
18655
18656
18657
18658
18659
18660
18661
18662
18663
18664
18665
18666
18667
18668
18669
18670
18671
18672
18673
18674
18675
18676
18677
18678
18679
18680
18681
18682
18683
18684
18685
18686
18687
18688
18689
18690
18691
18692
18693
18694
18695
18696
18697
18698
18699
18700
18701
18702
18703
18704
18705
18706
18707
18708
18709
18710
18711
18712
18713
18714
18715
18716
18717
18718
18719
18720
18721
18722
18723
18724
18725
18726
18727
18728
18729
18730
18731
18732
18733
18734
18735
18736
18737
18738
18739
18740
18741
18742
18743
18744
18745
18746
18747
18748
18749
18750
18751
18752
18753
18754
18755
18756
18757
18758
18759
18760
18761
18762
18763
18764
18765
18766
18767
18768
18769
18770
18771
18772
18773
18774
18775
18776
18777
18778
18779
18780
18781
18782
18783
18784
18785
18786
18787
18788
18789
18790
18791
18792
18793
18794
18795
18796
18797
18798
18799
18800
18801
18802
18803
18804
18805
18806
18807
18808
18809
18810
18811
18812
18813
18814
18815
18816
18817
18818
18819
18820
18821
18822
18823
18824
18825
18826
18827
18828
18829
18830
18831
18832
18833
18834
18835
18836
18837
18838
18839
18840
18841
18842
18843
18844
18845
18846
18847
18848
18849
18850
18851
18852
18853
18854
18855
18856
18857
18858
18859
18860
18861
18862
18863
18864
18865
18866
18867
18868
18869
18870
18871
18872
18873
18874
18875
18876
18877
18878
18879
18880
18881
18882
18883
18884
18885
18886
18887
18888
18889
18890
18891
18892
18893
18894
18895
18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
18976
18977
18978
18979
18980
18981
18982
18983
18984
18985
18986
18987
18988
18989
18990
18991
18992
18993
18994
18995
18996
18997
18998
18999
19000
19001
19002
19003
19004
19005
19006
19007
19008
19009
19010
19011
19012
19013
19014
19015
19016
19017
19018
19019
19020
19021
19022
19023
19024
19025
19026
19027
19028
19029
19030
19031
19032
19033
19034
19035
19036
19037
19038
19039
19040
19041
19042
19043
19044
19045
19046
19047
19048
19049
19050
19051
19052
19053
19054
19055
19056
19057
19058
19059
19060
19061
19062
19063
19064
19065
19066
19067
19068
19069
19070
19071
19072
19073
19074
19075
19076
19077
19078
19079
19080
19081
19082
19083
19084
19085
19086
19087
19088
19089
19090
19091
19092
19093
19094
19095
19096
19097
19098
19099
19100
19101
19102
19103
19104
19105
19106
19107
19108
19109
19110
19111
19112
19113
19114
19115
19116
19117
19118
19119
19120
19121
19122
19123
19124
19125
19126
19127
19128
19129
19130
19131
19132
19133
19134
19135
19136
19137
19138
19139
19140
19141
19142
19143
19144
19145
19146
19147
19148
19149
19150
19151
19152
19153
19154
19155
19156
19157
19158
19159
19160
19161
19162
19163
19164
19165
19166
19167
19168
19169
19170
19171
19172
19173
19174
19175
19176
19177
19178
19179
19180
19181
19182
19183
19184
19185
19186
19187
19188
19189
19190
19191
19192
19193
19194
19195
19196
19197
19198
19199
19200
19201
19202
19203
19204
19205
19206
19207
19208
19209
19210
19211
19212
19213
19214
19215
19216
19217
19218
19219
19220
19221
19222
19223
19224
\documentclass[report,inlinetitle,noprint,wbprompt,x11names]{nlctdoc}

\usepackage[inner=0.25in,outer=0.5in,includemp]{geometry}

\usepackage{array}
\usepackage{alltt}
\usepackage{pifont}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{accsupp}
\ifpdf
 \usepackage{lmodern}
 \usepackage{mathpazo}
 \usepackage[scaled=.88]{helvet}
 \usepackage{courier}
 \usepackage{metalogo}
\else
 \newcommand{\grimace}{{\fontencoding {U}\fontfamily{futs}\selectfont \char77}}
 \providecommand{\XeLaTeX}{XeLaTeX}
 \providecommand{\XeTeX}{XeTeX}
 \providecommand{\LuaLaTeX}{LuaLaTeX}
\fi
\usepackage[colorlinks,
            bookmarks,
            linkcolor=blue,
            urlcolor=Magenta4,
            hyperindex=false,
            pdfauthor={Nicola L.C. Talbot},
            pdftitle={User Manual for glossaries.sty},
            pdfkeywords={LaTeX,package,glossary,acronyms}]{hyperref}
\usepackage{xr-hyper}
\usepackage[
  xindy,
  nonumberlist,
  toc,
  nopostdot,
  nogroupskip,
  style=altlist
]{glossaries}
\usepackage{glossary-inline}

\pagestyle{headings}

\glsnoexpandfields

\renewcommand*{\glsseeformat}[3][\seename]{%
  (\xmakefirstuc{#1} \glsseelist{#2}.)%
}

\renewcommand*{\glossarypreamble}{%
\emph{This glossary style was setup using:}
\begin{ttfamily}
\begin{tabbing}
\cs{usepackage}[\=xindy,\\
\+\>nonumberlist,\\
  toc,\\
  nopostdot,\\
  style=altlist,\\
  nogroupskip]\{glossaries\}
\end{tabbing}
\end{ttfamily}
}

\renewcommand{\nlctdocmainencap}{}

\makeglossaries

\renewcommand{\importantfmt}{}
\renewcommand{\importantsymbolfont}[1]{\textcolor{red}{\bfseries\Huge#1}}

\newcommand*{\xtrfont}[1]{\textcolor{teal}{#1}}

\newcommand*{\codecomment}[1]{\emph{\rmfamily\color{gray}#1}}

\makeatletter
\@nlctdoc@if@usingtexht
{
  % Need an extra line break in the html version
  % (Don't have time to fiddle with cfg files!)
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{#1}\glstarget{#1}{\glossentryname{#1}}]\mbox{}\newline
      \glossentrydesc{#1}\glspostdescription\space #2\newline}%
  \newcommand*{\htmldoc}[2]{\href{#2.html}{\qt{#1}}}
  \newcommand{\glsxtrnote}{\HCode{<br/><span style="float: left; font-size: small; border: solid 2px green; margin-right: 1em; ">}\gls{glossaries-extra}\HCode{</span>}}
  \newcommand{\bibglsnote}{\HCode{<span style="float: left; font-size: small; border: solid 2px green; margin-right: 1em;">}\gls{bib2gls}\HCode{</span>}}
  \newenvironment{xtr}%
   {\par
    \HCode{<div title="glossaries-extra.sty" style="border: solid 2pt green;">}}%
   {\HCode{</div>}\par\noindent}
  \newenvironment{bib2gls}%
   {\par
    \HCode{<div title="bib2gls" style="border: solid 2pt green;">}}%
   {\HCode{</div>}\par\noindent}

  \newcommand{\commandpromptnote}{}
  \newcommand{\maincommandpromptnote}{}
  \newenvironment{important*}{\begin{important}\importantpar}{\end{important}}
  \renewcommand{\S}{\HCode{&\#167;}}
  \newcommand{\strong}[1]{\HCode{<strong>}#1\HCode{</strong>}}
  \newcommand*{\linkanchor}[1]{\HCode{<a title="anchor" style="font-size: x-small; text-decoration: none;" href="\##1">&\#128279;</a>}}
}
{
  \externaldocument{glossaries-code}
  \renewcommand{\idxmarker}{\textsuperscript{\xtrfont{\textdagger}}}
  \newcommand*{\htmldoc}[2]{\qt{#1}}
  \newcommand{\glsxtrnote}{%
    \leavevmode\marginpar{\glslink{glossaries-extra}{\xtrfont{\footnotesize\styfmt{glossaries-extra.sty}}}}%
  }
  \newcommand{\bibglsnote}{%
    \leavevmode\marginpar{{\footnotesize\glslink{bib2gls}{\xtrfont{\appfmt{bib2gls}}}}}%
  }
  \newenvironment{xtr}[1][\glsxtrnote]%
   {%
     \def\xtrmarginnote{#1}%
     \setlength{\fboxrule}{4pt}%
     \setlength\defwidth{\linewidth}%
     \addtolength\defwidth{-2\fboxsep}%
     \addtolength\defwidth{-2\fboxrule}%
     \begin{lrbox}{\defsbox}%
      \begin{minipage}[t]{\defwidth}%
      \setlength\parindent{1em}%
      \noindent\ignorespaces
   }%
   {%
      \end{minipage}%
     \end{lrbox}%
     \par\vskip10pt\noindent
     \xtrmarginnote
     \fcolorbox{teal}{white}{\usebox{\defsbox}}\par\vskip10pt
     \noindent\ignorespacesafterend
   }
  \newenvironment{bib2gls}{\begin{xtr}[\bibglsnote]}{\end{xtr}}
  \newcommand{\commandpromptnote}{The \texttt{\bfseries\$} symbol in the instructions
  indicates the command prompt. It should be omitted when copying the text. }
  \newcommand{\maincommandpromptnote}{The command prompt is indicated with
  \texttt{\bfseries\$} in this documentation. Don't type that character when 
  copying examples. }

  \def\verbatim@font{\MacroFont}

  \newenvironment{important*}%
  {%
     \renewcommand{\importantsymbolfont}[1]{\textcolor{red}{\bfseries\huge##1}}%
     \begin{important}\importantpar[-2][-1ex]%
  }%
  {\end{important}}
  \newcommand{\strong}{\textbf}
  \newcommand{\linkanchor}[1]{}
}
\renewcommand*{\@isty}[1]{\index{#1 package=\styfmt{#1}
  package|hyperpage}}
\renewcommand*{\s@isty}[1]{\index{#1 package=\doidxmarker\styfmt{#1}
  package|hyperpage}} 
\renewcommand*{\@icls}[1]{\index{#1 class=\clsfmt{#1}
  class|hyperpage}}
\renewcommand*{\s@icls}[1]{\index{#1 class=\doidxmarker\clsfmt{#1}
  class|hyperpage}}

\renewrobustcmd*{\iterm}[1]{\index{#1|hyperpage}}

\makeatother
\renewcommand*{\main}[1]{\hyperpage{#1}}
\newcommand*{\htextbf}[1]{\textbf{\hyperpage{#1}}}
\newcommand*{\itermdef}[1]{\index{#1|htextbf}}

\newcommand{\itempar}[1]{\item[{#1}]\mbox{}\par}

\newcommand{\Index}[1]{#1\index{#1|hyperpage}}

\newcommand{\xtrpkgoptdef}[1]{\hypertarget{pkgopt:#1}{\pkgopt*{#1}}}
\newcommand{\pkgoptdef}[1]{\hypertarget{pkgopt:#1}{\pkgopt{#1}}}
\newcommand{\deppkgoptdef}[1]{\hypertarget{pkgopt:#1}{\deprecatedpkgopt{#1}}}

\newcommand{\pkgoptsec}[2][]{%
  \pdfbookmark[2]{#2}{pkgopt.#2}
  \ifstrempty{#1}%
  {\subsection*{\protect\pkgoptdef{#2}}}%
  {\subsection*{\protect\pkgoptdef{#2}\pkgoptfmt{=\protect\marg{#1}}}}%
}

\newcommand{\deppkgoptsec}[2][]{%
  \pdfbookmark[2]{#2}{pkgopt.#2}
  \ifstrempty{#1}%
  {\subsection*{\protect\deppkgoptdef{#2}}}%
  {\subsection*{\protect\deppkgoptdef{#2}\pkgoptfmt{=\marg{#1}}}}%
}

\newcommand{\xtrpkgoptsec}[2][]{%
  \pdfbookmark[2]{#2 (glossaries-extra.sty)}{pkgopt.#2}
  \ifstrempty{#1}%
  {\subsection*{\protect\xtrfont{\protect\xtrpkgoptdef{#2} (glossaries-extra.sty)}}}%
  {\subsection*{\protect\xtrfont{\protect\xtrpkgoptdef{#2}\pkgoptfmt{=\protect\marg{#1}} 
     (glossaries-extra.sty)}}}%
}

\newcommand{\glslike}{\hyperref[sec:gls-like]{\cs{gls}-like}}
\newcommand{\glstextlike}{\hyperref[sec:glstext-like]{\cs{glstext}-like}}

\newcommand{\gallery}[2]{\href{https://www.dickimaw-books.com/gallery/#1}{#2}}
\newcommand{\galleryurl}[1]{\gallery{#1}{\nolinkurl{https://www.dickimaw-books.com/gallery/#1}}}
\newcommand{\gallerytopic}[1]{\galleryurl{\##1}}

\newcommand*{\bibglsgallery}[2][\gallerytitle]{%
 \def\gallerytitle{#2}%
 \gallery{index.php?label=bib2gls-#2}{\appfmt{bib2gls} gallery: \gallerytitle}}

\newcommand*{\bibglsbegin}{%
 \href{http://mirrors.ctan.org/support/bib2gls/bib2gls-begin.pdf}{\styfmt{glossaries-extra} and \appfmt{bib2gls}: An Introductory Guide}}

\IndexPrologue{\chapter*{\indexname}
 \addcontentsline{toc}{chapter}{\indexname}%
 \markboth{\indexname}{\indexname}
 \par\idxmarker Requires \gls{glossaries-extra}.
}

\longnewglossaryentry{indexingapp}%
{
  name={Indexing application},
  text={indexing application}
}%
{%
  An application (piece of software) separate from
  \TeX/\LaTeX\ that collates and sorts information that has an
  associated page reference. Generally the information is an index
  entry but in this case the information is a glossary entry.
  There are two main indexing applications that are used with \TeX:
  \gls{makeindex} and \gls{xindy}. These are both 
  \gls{cli} applications.
}

\longnewglossaryentry{cli}
{
  name={Command Line Interface (CLI)},
  first={command line interface (CLI)},
  text={CLI}
}
{%
  An application that doesn't have a graphical user
  interface. That is, an application that doesn't have any windows,
  buttons or menus and can be run in 
  \href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{a command
  prompt or terminal}. \maincommandpromptnote
}

\longnewglossaryentry{xindy}{%
  name={\appfmt{xindy}\index{xindy=\appfmt{xindy}|htextbf}},
  sort={xindy},
  text={\appfmt{xindy}\iapp{xindy}}
}%
{%
  A flexible \gls{indexingapp} with multilingual
  support written in Perl. See \opt3.
}

\newglossaryentry{makeindex}{%
name={\appfmt{makeindex}\index{makeindex=\appfmt{makeindex}|htextbf}},%
sort={makeindex},%
text={\appfmt{makeindex}\iapp{makeindex}},%
description={An \gls{indexingapp}. See \opt2.}
}

\newglossaryentry{bib2gls}{%
name={\appfmt{bib2gls}\index{bib2gls=\doidxmarker\appfmt{bib2gls}|htextbf}},%
sort={bib2gls},%
text={\appfmt{bib2gls}\iapp*{bib2gls}},%
description={An \gls{indexingapp} that combines two functions in
one: (1) fetches entry definition from a \filetype{bib} file
based on information provided in the \filetype{aux} file (similar
to \appfmt{bibtex}); (2) hierarchically sorts and collates location
lists (similar to \gls{makeindex} and \gls{xindy}).
This application is designed for use with \gls{glossaries-extra}
and can't be used with just the base \styfmt{glossaries} package.
See \opt4.}
}

\newglossaryentry{convertgls2bib}{%
name={\appfmt{convertgls2bib}\index{convertgls2bib=\doidxmarker\appfmt{convertgls2bib}|htextbf}},%
sort={convertgls2bib},%
text={\appfmt{convertgls2bib}\iapp*{convertgls2bib}},%
description={An application provided with \gls{bib2gls} that
converts \filetype{tex} files containing entry definitions to
\filetype{bib} files suitable for use with \gls{bib2gls}.
This application is designed for files that just contain entry
definitions, but it can work on a complete document file.
However, there will be a lot of \qt{undefined command} warnings as
\gls{convertgls2bib} only has a limited set of known commands. You
can limit it so that it only parses the preamble with the
\texttt{-{}-preamble-only} switch (requires at least \gls{bib2gls}
v2.0).}
}

\newglossaryentry{makeglossaries}{%
name={\appfmt{makeglossaries}\index{makeglossaries=\appfmt{makeglossaries}|htextbf}},%
sort={makeglossaries},%
text={\appfmt{makeglossaries}\iapp{makeglossaries}},%
description={A custom designed Perl script interface 
to \gls{xindy} and \gls{makeindex} provided with the \styfmt{glossaries}
package. \TeX\ distributions on Windows convert the original
\texttt{makeglossaries} script into an executable
\texttt{makeglossaries.exe} for convenience (but Perl is still
required).}
}

\newglossaryentry{makeglossaries-lite.lua}{%
name={\appfmt{makeglossaries-lite}\index{makeglossaries-lite=\appfmt{makeglossaries-lite}|htextbf}},%
sort={makeglossaries-lite},%
text={\appfmt{makeglossaries-lite}\iapp{makeglossaries-lite}},%
description={A custom designed Lua script interface 
to \gls{xindy} and \gls{makeindex} provided with the \styfmt{glossaries}
package. This is a cut-down alternative to the Perl
\gls{makeglossaries} script. If you have Perl installed, use the
Perl script instead. This script is actually distributed with the
file name \texttt{makeglossaries-lite.lua}, but \TeX~Live 
(on Unix-like systems) creates a symbolic link
called \texttt{makeglossaries-lite} (without the \texttt{.lua}
extension) to the actual \texttt{makeglossaries-lite.lua} script.}
}

\longnewglossaryentry{makeglossariesgui}{%
name={\appfmt{makeglossariesgui}\index{makeglossariesgui=\appfmt{makeglossariesgui}|htextbf}},%
sort={makeglossariesgui},%
text={\appfmt{makeglossariesgui}\iapp{makeglossariesgui}}%
}%
{%
  A Java GUI alternative to \gls{makeglossaries} that
  also provides diagnostic tools. Available separately on 
  \href{http://ctan.org/pkg/makeglossariesgui}{CTAN}.
}

\newglossaryentry{numberlist}{%
name={Number list\itermdef{number list}},%
sort={number list},%
text={number list\iterm{number list}},%
description={A list of \glslink{entrylocation}{entry locations} (also 
called a location list). The number list can be suppressed using the 
\pkgopt{nonumberlist} package option.}
}

\newglossaryentry{entrylocation}{%
name={Entry location\itermdef{entry location}},%
sort={entry location},%
text={entry location\iterm{entry location}},%
description={The location of the entry in the document. This
defaults to the page number on which the entry appears. An entry may
have multiple locations.}
}

\newglossaryentry{locationlist}{%
name={Location list},%
text={location list},
sort={location list},%
description={A list of \glslink{entrylocation}{entry locations}.
See \gls{numberlist}.}%
}

\newglossaryentry{linktext}{%
name={Link text\itermdef{link text}},
sort={link text},%
text={link text\iterm{link text}},
description={The text produced by commands such as \ics{gls}. It may
or may not be a hyperlink to the glossary.}
}

\newglossaryentry{smallcaps}{%
  name={Small caps\itermdef{small caps}},
  sort={small caps},
  text={small caps\iterm{small caps}},
  description={Small capitals. The \LaTeX\ kernel provides
  \ics{textsc}\marg{text} to produce small capitals. This uses a
  font where lowercase letters have a small capital design.
  Uppercase letters have the standard height and there's no
  noticeable difference with uppercase characters in corresponding non-small caps fonts.  
  This means that for a small caps appearance, you need to use lowercase letters in the
  \meta{text} argument. The \isty{relsize} package provides
  \ics{textsmaller}\marg{text} which simulates small caps by reducing the size
  of the font, so in this case the contents of \meta{text} should be
  uppercase (otherwise the effect is simply smaller lowercase
  letters). Some fonts don't support small caps combined with bold or slanted
  properties. In this case, there will be a font substitution
  warning and one of the properties (such as small caps or slanted) will be
  dropped.}
}

\let\glsd\glsuseri
\let\glsation\glsuserii

\longnewglossaryentry{firstuse}{%
name={First use\ifirstuse},
sort={first use},%
text={first use},%
user1={first used}}
{%
  The first time a glossary entry is used (from the start of the 
  document or after a reset) with one of the
  following commands: \ics{gls}, \ics{Gls}, \ics{GLS}, \ics{glspl},
  \ics{Glspl}, \ics{GLSpl} or \ics{glsdisp}.
  \glsseeformat{firstuseflag,firstusetext}{}
}

\longnewglossaryentry{firstuseflag}{%
name={First use flag\ifirstuseflag},
sort={first use flag},%
text={first use flag}%
}
{%
  A conditional that determines whether or not the entry
  has been used according to the rules of \gls{firstuse}. Commands
  to unset or reset this conditional are described in 
  \sectionref{sec:glsunset}.
}

\newglossaryentry{firstusetext}{%
name={First use text\ifirstusetext},
sort={first use text},%
text={first use text},%
description={The text that is displayed on \gls{firstuse}, which is
governed by the \gloskey{first} and \gloskey{firstplural} keys of
\ics{newglossaryentry}. (May be overridden by
\ics{glsdisp} or by \ics{defglsentry}.)}%
}

\longnewglossaryentry{sanitize}{%
name={Sanitize\itermdef{sanitize}},%
sort={sanitize},
text={sanitize\iterm{sanitize}},%
user1={sanitized\protect\iterm{sanitize}},%
user2={sanitization\protect\iterm{sanitize}}%
}%
{%
  Converts command names into character sequences. That is, a command called,
  say, \cs{foo}, is converted into the sequence of characters:
  \cs{}, \texttt{f}, \texttt{o}, \texttt{o}. Depending on the font,
  the backslash character may appear as a dash when used in the
  main document text, so \cs{foo} will appear as: ---foo.

  Earlier versions of \styfmt{glossaries} used this technique to write
  information to the files used by the indexing applications to
  prevent problems caused by fragile commands. Now, this is only used
  for the \gloskey{sort} key.
}

\newglossaryentry{latinchar}{%
  name={Latin Character\itermdef{Latin character}},
  text={Latin character\iterm{Latin character}},
  sort={Latin character},
  description={One of the letters \texttt{a}, \ldots, \texttt{z}, 
  \texttt{A}, \ldots, \texttt{Z}\@.
  See also \gls{exlatinchar}.}
}

\newglossaryentry{exlatinchar}{%
  name={Extended Latin Character\itermdef{extended Latin character}},
  text={extended Latin character\iterm{extended Latin character}},
  sort={extended Latin character},
  description={A character that's created by combining \glspl{latinchar}
  to form ligatures (e.g.\ \ae) or by applying diacritical marks
  to a~\gls*{latinchar} or characters (e.g.\ \'a). 
  See also \gls{nonlatinchar}.}
}

\newglossaryentry{latexexlatinchar}{%
  name={Standard \LaTeX\ Extended Latin Character\itermdef{standard
\LaTeX\ extended Latin character}},
  text={standard \LaTeX\ extended Latin character\iterm{standard
\LaTeX\ extended Latin character}},
  sort={standard LaTeX extended Latin character},
  description={An \gls{exlatinchar} that can be created by a~core
\LaTeX\ command, such as \cs{o} (\o) or \cs{'}\texttt{e} (\'e). 
  That is, the character can be produced without the need to load 
  a~particular package.}
}

\newglossaryentry{nonlatinchar}{%
  name={Non-Latin Character\itermdef{non-Latin character}},
  text={non-Latin character\iterm{non-Latin character}},
  sort={non-Latin character},
  description={An \gls{exlatinchar} or a~character that isn't
  a~\gls{latinchar}.}
}

\newglossaryentry{latinalph}{%
  name={Latin Alphabet\itermdef{Latin alphabet}},
  text={Latin alphabet\iterm{Latin alphabet}},
  sort={Latin alphabet},
  description={The alphabet consisting of \glspl{latinchar}.
  See also \gls{exlatinalph}.}
}

\newglossaryentry{exlatinalph}{%
  name={Extended Latin Alphabet\itermdef{Extended Latin Alphabet}},
  text={extended Latin alphabet},
  sort={extended Latin alphabet},
  description={An alphabet consisting of \glspl{latinchar}
  and \glspl{exlatinchar}.}
}

\newglossaryentry{nonlatinalph}{%
  name={Non-Latin Alphabet\itermdef{Non-Latin Alphabet}},
  text={non-Latin alphabet},
  sort={non-Latin alphabet},
  description={An alphabet consisting of \glspl{nonlatinchar}.}
}

\newglossaryentry{glossaries-extra}{%
  name={\styfmt{glossaries-extra}},
  sort={glossaries-extra},
  description={A separate package that extends the
  \styfmt{glossaries} package, providing new features or improving
  existing features. If you want to use \styfmt{glossaries-extra}, 
  you must have both the \styfmt{glossaries} package and the 
  \styfmt{glossaries-extra} package installed.}
}


\doxitem{Option}{option}{package options}
\doxitem{GlsKey}{key}{glossary keys}
\doxitem{Style}{style}{glossary styles}
\doxitem{Counter}{counter}{glossary counters}

\setcounter{IndexColumns}{2}

\newcommand*{\tick}{\ding{51}}

\newcommand*{\yes}{\ding{52}}
\newcommand*{\no}{\ding{56}}

\newcommand*{\proyes}{\textcolor{green}{\yes}}
\newcommand*{\prono}{\textcolor{red}{\no}}

\newcommand*{\conyes}{\textcolor{red}{\yes}}
\newcommand*{\conno}{\textcolor{green}{\no}}

\makeatletter
\newcommand{\fnsymmark}[1]{#1}
\newcommand*{\fnsym}[1]{\textsuperscript{\fnsymmark{%
 \ifcase#1\or \textasteriskcentered \or \textdagger
 \or \textdaggerdbl \or \textsection
 \or $\lozenge$\or \textparagraph
 \or \#\or {\fontfamily{cmr}\selectfont\textreferencemark}%
 \or \@nlctdoc@if@usingtexht{\HCode{&\#x2051;}}{\shortstack{*\\[-1.5ex]*}}%
 \or $\star$%
 \or \ding{94}%
 \else
 \number#1
 \fi
}}}%
\newrobustcmd*{\optionlabel}[1]{\@glstarget{option#1}{Option~#1}}

\newcommand*{\plabel}[2][]{\linkanchor{#2}\protected@edef\@currentlabelname{#1}\label{#2}}
\makeatother

\newcounter{option}
\newcommand{\optionsec}[2][\opttitle]{%
 \def\opttitle{\appfmt{#2}}%
 \refstepcounter{option}%
 \pdfbookmark[2]{Option~\theoption\space (#2)}{option\theoption}%
 \subsection*{\linkanchor{option\theoption}\optionlabel{\theoption} (#1)}%
}

\newcommand*{\opt}[1]{\hyperlink{option#1}{Option~#1}}
\newcommand*{\optsor}[2]{Options~\hyperlink{option#1}{#1}
or~\hyperlink{option#2}{#2}}
\newcommand*{\optsand}[2]{Options~\hyperlink{option#1}{#1}
and~\hyperlink{option#2}{#2}}
\newcommand*{\optsto}[2]{Options~\hyperlink{option#1}{#1}--\hyperlink{option#2}{#2}}

\renewcommand*{\idxmarkedfont}{\xtrfont}

\newcommand*{\ifirstuse}{\iterm{first use}}
\newcommand*{\ifirstuseflag}{\iterm{first use>flag}}
\newcommand*{\ifirstusetext}{\iterm{first use>text}}

\newcommand*{\firstuse}{\gls{firstuse}}
\newcommand*{\firstuseflag}{\gls{firstuseflag}}
\newcommand*{\firstusetext}{\gls{firstusetext}}


\newcommand*{\istkey}[1]{\appfmt{#1}\index{makeindex=\appfmt{makeindex}>#1=\texttt{#1}|hyperpage}}
\newcommand*{\locfmt}[1]{\texttt{#1}\SpecialMainIndex{#1}}
\newcommand*{\mkidxspch}{\index{makeindex=\appfmt{makeindex}>special characters|hyperpage}}

\newcommand*{\mkidxopt}[1]{\texttt{-#1}\index{makeindex=\appfmt{makeindex}>#1=\texttt{-#1}|hyperpage}}

\newcommand*{\xdyopt}[1]{\texttt{-#1}\index{xindy=\appfmt{xindy}>#1=\texttt{-#1}|hyperpage}}

\newcommand*{\mkglsopt}[1]{\texttt{-#1}\index{makeglossaries=\appfmt{makeglossaries}>#1=\texttt{-#1}|hyperpage}}

\newcommand*{\bibglsopt}[1]{\xtrfont{\texttt{-{}#1}}\index{bib2gls=\doidxmarker\appfmt{bib2gls}>#1=\texttt{-{}#1}|hyperpage}}
\newcommand*{\bibglslongopt}[1]{\bibglsopt{-#1}}

\renewcommand{\csoptfmt}{\texttt}

\newcommand*{\igloskey}[2][newglossaryentry]{\icsopt{#1}{#2}}
\newcommand*{\gloskey}[2][newglossaryentry]{\csopt{#1}{#2}}

\newcommand*{\ixtrgloskey}[2][newglossaryentry]{\icsopt*{#1}{#2}}
\newcommand*{\xtrgloskey}[2][newglossaryentry]{\xtrfont{\csopt*{#1}{#2}}}

\newcommand*{\printglosskey}[2][]{\icsopt{printglossary}{#2}%
 \ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}%
}

\newcommand*{\printnoidxglosskey}[2][]{\icsopt{printnoidxglossary}{#2}%
 \ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}%
}

\newcommand*{\xtrprintglosskey}[2][]{\icsopt*{printglossary}{#2}%
 \xtrfont{\ifstrempty{#1}{\csoptfmt{#2}}{\csoptfmt{#2=#1}}}%
}

\newcommand*{\iresourceopt}[1]{\icsopt+{GlsXtrLoadResources}{#1}}
\newcommand*{\resourceopt}[2][]{%
  \xtrfont{\csoptfmt{#2}}\ifstrempty{#1}{}{\csoptfmt{\dequals#1}}%
  \icsopt+{GlsXtrLoadResources}{#2}%
}

\newcommand*{\atentry}[1]{\xtrfont{\texttt{@#1}}%
  \index{bib2gls entry types=\doidxmarker\appfmt{bib2gls} entry types>#1=\texttt{@#1}|hyperpage}}

\newcommand*{\xtrcs}[1]{\xtrfont{\cs{#1}}}

\newcommand*{\field}[1]{\csoptfmt{#1}\index{internal fields:>#1=\protect\csoptfmt{#1}|main}}
\newcommand*{\xtrfield}[1]{\xtrfont{\csoptfmt{#1}}\index{internal fields:>#1=\doidxmarker\protect\csoptfmt{#1}|main}}

\newcommand*{\glostyle}[1]{\textsf{#1}\index{glossary styles:>#1={\protect\ttfamily#1}|main}}

\newcommand*{\xtrglostyle}[1]{\xtrfont{\textsf{#1}}\index{glossary styles:>#1=\doidxmarker{\protect\ttfamily#1}|main}}

\newcommand*{\acrstyle}[1]{\textsf{#1}\index{acronym styles:>#1={\protect\ttfamily#1}|main}}
\newcommand*{\abbrstyle}[1]{\xtrfont{\textsf{#1}}\index{abbreviation styles:=\doidxmarker abbreviation styles:>#1={\protect\ttfamily#1}|main}}
\newcommand*{\cat}[1]{\xtrfont{\textsf{#1}}\index{categories=\doidxmarker categories>#1={\protect\ttfamily#1}|main}}

\makeatletter
\@nlctdoc@if@usingtexht
{
  \newcommand*{\icatattrs}[1][]{\index{category attributes=\doidxmarker category attributes#1|main}}
  \newcommand*{\ixindyattrs}[1][]{\index{xindy attributes=xindy attributes#1|main}}
  \index{attributes|see{category attributes or xindy attributes}}
}
{
\newcommand{\icatattrs}[1][]{\index{category attributes=\protect\doidxmarker\protect\glsdohypertarget{catattr}{category attributes}:#1|main}}

\newcommand*{\ixindyattrs}[1][]{\index{xindy attributes=\protect\glsdohypertarget{xindyattr}{xindy attributes}#1|main}}

\index{attributes|see{\protect\hyperlink{catattr}{category attributes} (\styfmt{glossaries-extra}) or \protect\hyperlink{xindyattr}{xindy attributes}\protect\hfill}}
}

\makeatletter

\newcommand*{\optfmt}[1]{\textsf{#1}}
\newcommand*{\attr}[1]{\xtrfont{\optfmt{#1}}\icatattrs[>#1=\optfmt{#1}]{}}
\newcommand*{\xindyattr}[1]{\texttt{#1}\ixindyattrs[>#1=\texttt{#1}]{}}

\newrobustcmd{\mirrorsamplefile}[1]{%
 \href{http://mirrors.ctan.org/macros/latex/contrib/glossaries/samples/#1}{\nolinkurl{#1}}%
}

\newcounter{sample}
\newcommand{\exitem}[2][sample]{%
  \par
  \pdfbookmark[2]{#1#2.tex}{exfile.#1#2}%
  \refstepcounter{sample}%
  \subsection*{\plabel[#1#2.tex]{ex:#1#2}\mirrorsamplefile{#1#2.tex}}%
}

\newcommand*{\samplefile}[2][sample]{%
  \hyperref[ex:#1#2]{\texttt{#1#2.tex}}}


\begin{document}
\MakeShortVerb{"}
\DeleteShortVerb{\|}

 \title{User Manual for glossaries.sty v4.46}
 \author{Nicola L.C. Talbot\\%
  \href{http://www.dickimaw-books.com/contact}{\nolinkurl{dickimaw-books.com/contact}}}

 \date{2020-03-19}
 \maketitle

\begin{abstract}
The \styfmt{glossaries} package provides a means to define terms or
abbreviations or symbols that can be referenced within your document.
Sorted lists with collated \glslink{entrylocation}{locations} can be 
generated either using \TeX\ or using a supplementary \gls{indexingapp}.
Sample documents are provided with the \styfmt{glossaries} package.
These are listed in \sectionref{sec:samples}.
\end{abstract}

\begin{xtr}
Additional features not provided here may be available through
the extension package \gls{glossaries-extra} which, if required,
needs to be installed separately. New features will be added to
\gls*{glossaries-extra}. Versions of the \styfmt{glossaries}
package after v4.21 will mostly be just bug fixes or minor
maintenance. Note that \gls{glossaries-extra} provides an extra indexing option
(\gls{bib2gls}) which isn't available with just the base \styfmt{glossaries} package.
\end{xtr}

If you require multilingual support you must also separately install 
the relevant language module. Each language module is distributed
under the name \texttt{glossaries-}\meta{language}, where \meta{language} is the
root language name. For example, \texttt{glossaries-french}
or \texttt{glossaries-german}. If a language module is required,
the \styfmt{glossaries} package will automatically try to load it and
will give a warning if the module isn't found. See
\sectionref{sec:languages} for further details.
If there isn't any support available for your language, use
the \pkgopt{nolangwarn} package option to suppress the warning
and provide your own translations. (For example, use
the \gloskey[printglossary]{title} key in \cs{printglossary}.)

The \styfmt{glossaries} package requires a number of other packages
including, but not limited to, \sty{tracklang}, \sty{mfirstuc},
\sty{etoolbox},
\sty{xkeyval} (at least version dated 2006/11/18), \sty{textcase},
\sty{xfor}, \sty{datatool-base} (part of the \sty{datatool} bundle) and \sty{amsgen}. These
packages are all available in the latest \TeX~Live and Mik\TeX\
distributions. If any of them are missing, please update your
\TeX\ distribution using your update manager.
For help on this see, for example,
\href{http://tex.stackexchange.com/questions/55437/how-do-i-update-my-tex-distribution}{How
do I update my \TeX\ distribution?}
or (for Linux users)
\href{http://tex.stackexchange.com/questions/14925/updating-tex-on-linux}{Updating
\TeX\ on Linux}.

Note that occasionally you may find that certain packages need to be
loaded \emph{after} packages that are required by \styfmt{glossaries}. For
example, a package \meta{X} might need to be loaded after \sty{amsgen}. In
which case, load the required package first (for example,
\sty{amsgen}), then \meta{X}, and finally load \styfmt{glossaries}.

\begin{important}
Documents have wide-ranging styles when it comes to presenting glossaries
or lists of terms or notation. People have their own preferences and
to a large extent this is determined by the kind of information that
needs to go in the glossary. They may just have symbols with
terse descriptions or they may have long technical words with
complicated descriptions. The \styfmt{glossaries} package is
flexible enough to accommodate such varied requirements, but this
flexibility comes at a price: a~big manual.

\aargh\ If you're freaking out at the size of this manual, start with
\texttt{glossariesbegin.pdf} (\qt{The glossaries package: a guide
for beginnners}). You should find it in the same directory as this
document or try \texttt{texdoc glossariesbegin.pdf}. Once you've got
to grips with the basics, then come back to this manual to find out
how to adjust the settings.
\end{important}

\noindent
The \styfmt{glossaries} bundle comes with the following documentation:
\begin{description}
\item[\url{glossariesbegin.pdf}] 
If you are a complete beginner, start with 
\htmldoc{The glossaries package: a guide for
beginners}{glossariesbegin}.

\item[\url{glossary2glossaries.pdf}] 
If you are moving over from the obsolete \sty{glossary} package,
read \htmldoc{Upgrading from the glossary package to the
glossaries package}{glossary2glossaries}.

\item[glossaries-user.pdf]
This document is the main user guide for the \styfmt{glossaries}
package.

\item[\url{glossaries-code.pdf}]
Advanced users wishing to know more about the inner workings of all the
packages provided in the \styfmt{glossaries} bundle should read
\qt{Documented Code for glossaries v4.46}.

\item[INSTALL] Installation instructions.

\item[CHANGES] Change log.

\item[README.md] Package summary.

\end{description}
Related resources:
\begin{itemize}
\item \bibglsbegin.

\item \href{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{\styfmt{glossaries}
FAQ}

\item \gallerytopic{glossaries}{\styfmt{glossaries} gallery}

\item
\gallery{glossaries-styles/}{a summary of all glossary styles provided by \styfmt{glossaries} and
\gls*{glossaries-extra}}

\item
\gallery{glossaries-performance.shtml}{\styfmt{glossaries}
performance} (comparing document build times for the different
options provided by \styfmt{glossaries} and \gls{glossaries-extra}).

\item \href{http://www.dickimaw-books.com/latex/thesis/}{Using LaTeX to Write a PhD Thesis}
(chapter 6).

\item
\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build}

\item The
\href{http://ctan.org/pkg/glossaries-extra}{\styfmt{glossaries-extra} package}

\item \href{http://ctan.org/pkg/bib2gls}{\appfmt{bib2gls}}
\end{itemize}

\begin{important*}
If you use \sty{hyperref} and \styfmt{glossaries}, you must load
\sty{hyperref} \emph{first} (although \sty{hyperref} should be
loaded after most other packages). Similarly the \sty{doc} package must
also be loaded before \styfmt{glossaries}. (If \sty{doc} is loaded,
the file extensions for the default main glossary are changed to
\filetype{gls2}, \filetype{glo2} and \filetype{glg2} to avoid
conflict with \sty{doc}'s changes
glossary.)\hypertarget{pdflatexnote}{}%

If you are using \sty{hyperref}, it's best to use \app{pdflatex}
rather than \app{latex} (DVI format) as \appfmt{pdflatex} deals with
hyperlinks much better. If you use the DVI format, you will
encounter problems where you have long hyperlinks or hyperlinks in
subscripts or superscripts. This is an issue with the DVI format not
with \styfmt{glossaries}. If you really need to use the DVI format
and have a problem with hyperlinks in maths mode, I recommend you use
\gls{glossaries-extra} with the \attr{hyperoutside} and
\attr{textformat} attributes set to appropriate values 
for problematic entries.
\end{important*}

\strong{The \styfmt{glossaries} package replaces the \styfmt{glossary}
package which is now obsolete.} Please see the document
\qtdocref{Upgrading from the glossary package to the glossaries
package}{glossary2glossaries} for assistance in upgrading.

\clearpage
\pdfbookmark[0]{Contents}{contents}
\tableofcontents
\clearpage
\pdfbookmark[0]{List of Examples}{examples}
\listofexamples
\clearpage
\pdfbookmark[0]{List of Tables}{tables}
\listoftables

\clearpage
\printglossaries

\glsresetall

 \chapter{Introduction}
\label{sec:intro}

The \styfmt{glossaries} package is provided to assist generating
lists of terms, symbols or abbreviations. (For convenience, these
lists are all referred to as glossaries in this manual. The terms,
symbols and abbreviations are collectively referred to as entries.) 
The package has a certain amount of flexibility, allowing the
user to customize the format of the glossary and define multiple
glossaries. It also supports glossary styles that
include an associated symbol (in addition to a name and description)
for each glossary entry.

There is provision for loading a database of glossary entries. Only
those entries indexed\footnote{That is, if the entry has been
referenced using any of the commands described in
\sectionref{sec:glslink} and \sectionref{sec:glsadd} or via
\ics{glssee} (or the \gloskey{see} key) or commands such as
\ics{acrshort} or \ics*{glsxtrshort}.}\ in the document will be displayed in the glossary.
(Unless you use \opt5, which doesn't use any indexing but will
instead list all defined entries in order of definition.)

It's not necessary to actually have a glossary in the document. You may be
interested in using this package just as means to consistently
format certain types of terms, such as abbreviations, or you may
prefer to have descriptions scattered about the document and be able
to easily link to the relevant description (\opt6).

The simplest document is one without a glossary:
\begin{verbatim}
\documentclass{article}
\usepackage[
  sort=none % no sorting or indexing required
]
{glossaries}

\newglossaryentry
 {cafe}% label
 {% definition:
   name={caf\'e},
   description={small restaurant selling refreshments}
 }

\setacronymstyle{long-short}

\newacronym
 {html}% label
 {HTML}% short form
 {hypertext markup language}% long form

\newglossaryentry
 {pi}% label
 {% definition:
   name={\ensuremath{\pi}},
   description={Archimedes' Constant}
 }

\newglossaryentry
 {distance}% label
 {% definition:
   name={distance},
   description={the length between two points},
   symbol={m}
 }

\begin{document}
First use: \gls{cafe}, \gls{html}, \gls{pi}.
Next use: \gls{cafe}, \gls{html}, \gls{pi}.

\Gls{distance} (\glsentrydesc{distance}) is measured in
\glssymbol{distance}.
\end{document}
\end{verbatim}
(This is a trivial example. For a real document I recommend you use
\sty{siunitx} for units.)

\glsxtrnote
The \gls{glossaries-extra} package, which is distributed as a
separate bundle, extends the capabilities of
the \styfmt{glossaries} package. The simplest document with a glossary can be
created with \gls{glossaries-extra} (which internally loads the
\styfmt{glossaries} package):
\begin{verbatim}
\documentclass{article}
\end{verbatim}
\begin{alltt}
\cs{usepackage}[
 sort=none,% no sorting or indexing required
 \xtrfont{abbreviations},% create list of abbreviations
 symbols,% create list of symbols
 \xtrfont{postdot}, % append a full stop after the descriptions
 \xtrfont{stylemods},style=index % set the default glossary style
]\mgroup{glossaries-extra}
\end{alltt}
\begin{verbatim}
\newglossaryentry % provided by glossaries.sty
 {cafe}% label
 {% definition:
   name={caf\'e},
   description={small restaurant selling refreshments}
 }
\end{verbatim}
\begin{alltt}
\% provided by glossaries-extra.sty:
\ics*{setabbreviationstyle}\mgroup{long-short}

\ics*{newabbreviation} \% provided by glossaries-extra.sty
 \mgroup{html}\% label
 \mgroup{HTML}\% short form
 \mgroup{hypertext markup language}\% long form

\% provided by glossaries-extra.sty 'symbols' option:
\ics*{glsxtrnewsymbol} 
 [description=\mgroup{Archimedes' constant}]\% options
 \mgroup{pi}\% label
 \mgroup{\cs{ensuremath}\mgroup{\cs{pi}}}\% symbol
\end{alltt}
\begin{verbatim}
\newglossaryentry % provided by glossaries.sty
 {distance}% label
 {% definition:
   name={distance},
   description={the length between two points},
   symbol={m}
 }

\begin{document}
First use: \gls{cafe}, \gls{html}, \gls{pi}.
Next use: \gls{cafe}, \gls{html}, \gls{pi}.

\Gls{distance} is measured in \glssymbol{distance}.
\end{verbatim}
\begin{alltt}
\ics*{printunsrtglossaries} \% list all defined entries
\cs{end}\mgroup{document}
\end{alltt}
Note the difference in the way the abbreviation (HTML) and symbol
(\ensuremath{\pi}) are defined in the two above examples. The
\pkgopt*{abbreviations}, \pkgopt*{postdot} and \pkgopt*{stylemods}
options are specific to \gls{glossaries-extra}. Other options are
passed to the base \styfmt{glossaries} package.

\begin{xtr}
In this document, commands and options displayed in teal, such as
\xtrcs{newabbreviation} and \pkgopt*{stylemods}, are only available with 
the \gls{glossaries-extra} package. There are also some commands and options (such
as \cs{makeglossaries} and \pkgopt{symbols}) that are provided by the
base \styfmt{glossaries} package but are redefined by the
\gls{glossaries-extra} package. See the \gls{glossaries-extra} user
manual for further details of those commands.
\end{xtr}

One of the strengths of the \styfmt{glossaries} package is its flexibility, however
the drawback of this is the necessity of having a large manual
that covers all the various settings. If you are daunted by the
size of the manual, try starting off with the much shorter
\docref{guide for beginners}{glossariesbegin}.

\begin{important}
There's a~common misconception that you have to have Perl installed
in order to use the \styfmt{glossaries} package. Perl is \emph{not}
a~requirement (as demonstrated by the above examples) but it does 
increase the available options, particularly if you use an \gls{exlatinalph} 
or a~\gls{nonlatinalph}.
\end{important}

This document uses the \styfmt{glossaries} package. For example,
when viewing the PDF version of this document in a
hyperlinked-enabled PDF viewer (such as Adobe Reader or Okular) if
you click on the word \qt{\gls{xindy}} you'll be taken to the entry
in the glossary where there's a brief description of
the term \qt{\gls*{xindy}}. This is the way the \styfmt{glossaries}
mechanism works. An \gls{indexingapp} is used to generated the
sorted list of terms. The \glspl{indexingapp} are \gls{cli} tools,
which means they can be run directly from a command prompt or terminal, or can
be integrated into some text editors, or you can use a build tool
such as \app{arara} to run them.

Neither of the above two examples require an \gls{indexingapp}. The
first is just using the \styfmt{glossaries} package for consistent
formatting, and there is no list. The second has lists but they are
unsorted (see \opt5).

The remainder of this introductory section covers the following:
\begin{itemize}
\item \sectionref{sec:indexingoptions} lists the available indexing
options.

\item \sectionref{sec:samples} lists the sample documents provided 
with this package.

\item \sectionref{sec:lipsum} lists the dummy glossary files that
may be used for testing. 

\item \sectionref{sec:languages} provides information for users who
wish to write in a language other than English.

\item \sectionref{sec:makeglossaries} describes how to use an
\gls{indexingapp} to create the sorted glossaries for your document
(\optsor23).

\end{itemize}

\section{Indexing Options}
\label{sec:indexingoptions}

The basic idea behind the \styfmt{glossaries} package is that you
first define your entries (terms, symbols or abbreviations). Then
you can reference these within your document (like \cs{cite} or
\cs{ref}).  You can also, optionally, display a~list of the entries
you have referenced in your document (the glossary). This last part,
displaying the glossary, is the part that most new users find
difficult. There are three options available with the base
\styfmt{glossaries} package (\optsto13). The \gls{glossaries-extra} extension
package provides two extra options for lists (\optsand45) as well as an option for
standalone descriptions within the document body (\opt6).

An overview of \optsto15 is given in \tableref{tab:options}.
\opt6 is omitted from the table as it doesn't produce a list.  For a
more detailed comparison of the various methods, see the
\gallery{glossaries-performance.shtml}{\styfmt{glossaries}
performance page}.

\begin{important}
If you are developing a class or package that loads
\styfmt{glossaries}, I recommend that you don't force the user into
a particular indexing method by adding an unconditional \cs{makeglossaries}
into your class or package code. Aside from forcing the user into a
particular indexing method, it means that they're unable to use any
commands that must come before \cs{makeglossaries} (such as
\cs{newglossary}) and they can't switch off the indexing whilst
working on a draft document.
\end{important}

Strictly speaking, \optsand56 aren't actually indexing options as no
indexing is performed. In the case of \opt5, all defined entries are
listed in order of definition. In the case of \opt6, the entry
hypertargets and descriptions are manually inserted at appropriate
points in the document. These two options are included here for
completeness and for comparison with the actual indexing options.

\begin{table}[htbp]
 \caption{Glossary Options: Pros and Cons}
 \label{tab:options}
 {%
 \renewcommand{\fnsymmark}[1]{\rlap{#1}}%
 \setlength{\tabcolsep}{3pt}%
 \centering
 \begin{tabular}{@{}>{\raggedright\small}p{0.35\textwidth}ccccc@{}}
   & \bfseries \opt1 & \bfseries \opt2 & \bfseries \opt3
   & \bfseries \opt4 & \bfseries \opt5\\
   Requires \gls{glossaries-extra}? &
   \conno & \conno & \conno & \conyes & \conyes\\
   Requires an external application? &
   \conno & \conyes & \conyes & \conyes & \conno\\
   Requires Perl? &
   \conno & \conno & \conyes & \conno & \conno\\
   Requires Java? &
   \conno & \conno & \conno & \conyes & \conno\\
   Can sort \glspl{exlatinalph}
   or \glspl{nonlatinalph}? &
   \prono\fnsym{1} & \prono & \proyes & \proyes & N/A\\
   Efficient sort algorithm? &
   \prono & \proyes & \proyes & \proyes & N/A\\
   Can use a different sort method for each glossary? &
   \proyes
   & \prono\fnsym{2}
   & \prono\fnsym{2} & \proyes & N/A\\
   Any problematic sort values? &
   \conyes & \conyes & \conyes & \conno & \conno\fnsym{3}\\
   Are entries with identical sort values treated as separate unique
   entries? &
   \proyes & \proyes & \prono\fnsym{4} & \proyes & \proyes\\
   Can automatically form ranges in the location lists? &
   \prono & \proyes & \proyes & \proyes & \prono\\
   Can have non-standard locations in the location lists? &
   \proyes & \prono
    & \proyes\fnsym{5}
    & \proyes
    & \proyes\fnsym{6}\\
   Maximum hierarchical depth (style-dependent) &
   $\infty$\fnsym{7} & 3 & $\infty$ & $\infty$ & $\infty$\\
   \ics{glsdisplaynumberlist} reliable? &
   \proyes & \prono & \prono & \proyes & \prono\\
   \ics{newglossaryentry} allowed in \env{document} environment?
   (Not recommended.) &
   \no & \yes & \yes & \no\fnsym{8} & \yes\fnsym{9}\\
   Requires additional write registers? &
   \conno & \conyes & \conyes & \conno & \conno\fnsym{10}\\
   Default value of \pkgopt{sanitizesort} package option &
   \texttt{false} & \texttt{true} & \texttt{true}
    & \texttt{true}\fnsym{11}
    & \texttt{true}\fnsym{11}
 \end{tabular}
 \par
 }\par
 \smallskip
 \hrulefill\par
 \smallskip\footnotesize
 \fnsym{1} Strips standard \LaTeX\ accents
(that is, accents generated by core \LaTeX\ commands) so,
for example, \ics{AA} is treated the same as A.\par
 \fnsym{2} Only with the hybrid method provided with \gls{glossaries-extra}.\par
 \fnsym{3} Provided \pkgopt[none]{sort} is used.\par
 \fnsym{4} Entries with the same sort value are merged.\par
 \fnsym{5} Requires some setting up.\par
 \fnsym{6} The locations must be set explicitly
through the custom \xtrfield{location} field provided by
\styfmt{glossaries-extra}.\par
 \fnsym{7} Unlimited but unreliable.\par
 \fnsym{8} Entries are defined in \filetype{bib}
format. \cs{newglossaryentry} should not be used explicitly.\par
 \fnsym{9} Provided \pkgopt+{true}{docdef} or
  \pkgopt+{restricted}{docdef} but not recommended.\par
 \fnsym{10} Provided \pkgopt+{false}{docdef} or
 \pkgopt+{restricted}{docdef}.\par
 \fnsym{11} Irrelevant with \pkgopt[none]{sort}. (The \pkgopt+{only}{record} 
 option automatically switches this on.)
\par
\end{table}

\optionsec[\TeX]{TeX}

Example Document:
\begin{verbatim}
\documentclass{article}
\usepackage{glossaries}
\end{verbatim}
\begin{alltt}
\strong{\ics{makenoidxglossaries}} \% use TeX to sort
\end{alltt}
\begin{verbatim}
\newglossaryentry{sample}{name={sample}, 
  description={an example}}
\begin{document}
\gls{sample}.
\end{verbatim}
\begin{alltt}
\strong{\ics{printnoidxglossary}}
\cs{end}\mgroup{document}
\end{alltt}
You can place all your entry definitions in a separate file
and load it in the preamble with \ics{loadglsentries} (\emph{after}
\ics{makenoidxglossaries}).

This option doesn't require an external \gls{indexingapp} but, with
the default alphabetic sorting, it's very slow with severe limitations.
If you want a sorted list, it doesn't work well for
\glspl{exlatinalph} or \glspl{nonlatinalph}.  However, if you use
the \pkgopt[false]{sanitizesort} package option (the default for
Option~1) then the \glslink{latexexlatinchar}{standard \LaTeX\
accent commands} will be ignored, so if an entry's name is set to
\verb|{\'e}lite| then the sort value will default to \texttt{elite} if
\pkgopt[false]{sanitizesort} is used and will default to
\verb|\'elite| if \pkgopt[true]{sanitizesort} is used. If you have
any other kinds of commands that don't expand to ASCII characters,
such as \cs{alpha} or \cs{si}, then you must use
\pkgopt[true]{sanitizesort} or change the sort method
(\pkgopt[use]{sort} or \pkgopt[def]{sort}) in the package options
or explicitly set the \gloskey{sort} key when you define the
relevant entries. For example:
\begin{alltt}
\ics{newglossaryentry}\mgroup{alpha}\mgroup{name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
 \strong{sort=\mgroup{alpha}},description=\mgroup{...}}
\end{alltt}
\begin{xtr}
The \gls{glossaries-extra} package has a modified \pkgopt{symbols}
package option that provides \ics*{glsxtrnewsymbol}, which automatically sets the
\gloskey{sort} key to the entry label (instead of the \gloskey{name}).
\end{xtr}

This option works best with the \pkgopt[def]{sort} or
\pkgopt[use]{sort} setting. For any
other setting, be prepared for a long document build time,
especially if you have a lot of entries defined. \strong{This
option is intended as a last resort for alphabetical sorting.}
This option allows a mixture of sort methods. (For example, 
sorting by word order for one glossary and order of use for another.)
This option is not suitable for hierarchical glossaries and does
not form ranges in the \glspl{numberlist}. If you really can't use an
\gls{indexingapp} consider using \opt{5} instead.

 \begin{enumerate}
   \item Add 
\begin{verbatim}
\makenoidxglossaries
\end{verbatim}
   to your preamble (before you start defining your entries, as described in
   \sectionref{sec:newglosentry}).

   \item Put
\begin{verbatim}
\printnoidxglossary
\end{verbatim}
   where you want your list of entries to appear (described in
  \sectionref{sec:printglossary}). Alternatively, to display all
   glossaries use the iterative command:
\begin{verbatim}
\printnoidxglossaries
\end{verbatim}

   \item Run \LaTeX\ twice on your document. (As you would do to
   make a~table of contents appear.) For example, click twice on
   the \qt{typeset} or \qt{build} or \qt{PDF\LaTeX} button in your editor.
 \end{enumerate}

\optionsec{makeindex}

Example document:
\begin{verbatim}
\documentclass{article}
\usepackage{glossaries}
\end{verbatim}
\begin{alltt}
\strong{\ics{makeglossaries}} \% open glossary files
\end{alltt}
\begin{verbatim}
\newglossaryentry{sample}{name={sample},
 description={an example}}
\begin{document}
\gls{sample}.
\end{verbatim}
\begin{alltt}
\strong{\ics{printglossary}}
\cs{end}\mgroup{document}
\end{alltt}
You can place all your entry definitions in a separate file
and load it in the preamble with \ics{loadglsentries} (\emph{after}
\ics{makeglossaries}).

This option uses a~\gls{cli} application called \gls{makeindex} to sort 
the entries. This application comes with all modern \TeX\ distributions, 
but it's hard-coded for the non-extended \gls{latinalph}. It can't
correctly sort accent commands (such as \cs{'} or \cs{c}) and fails
with UTF-8 characters, especially for any sort values that start
with a UTF-8 character (as it separates the octets resulting in an
invalid file encoding). This process involves making \LaTeX\ write
the glossary information to a temporary file which \gls{makeindex}
reads.  Then \gls{makeindex} writes a~new file containing the code
to typeset the glossary. Then \cs{printglossary} reads this file in
on the next run.

This option works best if you want to sort entries according to the
English alphabet and you don't want to install Perl or Java. This
method can also work with the restricted shell escape since
\gls{makeindex} is considered a trusted application. (So you should
be able to use the \pkgopt{automake} package option provided the
shell escape hasn't been completely disabled.)

This method can form ranges in the \gls{numberlist} but only
accepts limited number formats: \cs{arabic}, \cs{roman},
\cs{Roman}, \cs{alph} and \cs{Alph}. 

This option does not allow a mixture of sort methods. 
All glossaries must be sorted according to the same method: 
word\slash letter ordering or order of use or order of definition.
If you need word ordering for one glossary and letter ordering
for another you'll have to explicitly call \gls{makeindex} for 
each glossary type.

\begin{xtr}
The \gls{glossaries-extra} package allows a hybrid mix of
\optsand12 to provide word\slash letter ordering with \opt2 and order
of use\slash definition with \opt1. See the \gls{glossaries-extra}
documentation for further details. See also the
\gls{glossaries-extra} alternative to \samplefile{Sort} in
\sectionref{sec:samplessort}.
\end{xtr}

   \begin{enumerate}
    \item If you want to use \gls{makeindex}['s] \mkidxopt{g} option
    you must change the quote character using \ics{GlsSetQuote}. For example:
\begin{verbatim}
\GlsSetQuote{+}
\end{verbatim}
    This must be used before \cs{makeglossaries}.
    Note that if you are using \sty{babel}, the shorthands aren't
    enabled until the start of the document, so you won't be able to use
    the shorthands in definitions made in the preamble.

    \item Add 
\begin{verbatim}
\makeglossaries
\end{verbatim}
to your preamble (before you start
    defining your entries, as described in
    \sectionref{sec:newglosentry}).

    \item Put
\begin{verbatim}
\printglossary
\end{verbatim}
    where you want your list of entries to appear (described in
    \sectionref{sec:printglossary}). Alternatively, to display all
    glossaries use the iterative command:
\begin{verbatim}
\printglossaries
\end{verbatim}

    \item Run \LaTeX\ on your document. This creates files with the
    extensions \filetype{glo} and \filetype{ist} (for example, if your 
    \LaTeX\ document is called \texttt{myDoc.tex}, then you'll have 
    two extra files called \texttt{myDoc.glo} and \texttt{myDoc.ist}).
    If you look at your document at this point, you won't see the 
    glossary as it hasn't been created yet. (If you use
    \gls{glossaries-extra} you'll see the section heading and some 
    boilerplate text.)

    If you have used package options such as \pkgopt{symbols} there
    will also be other sets of files corresponding to the extra
    glossaries that were created by those options.

    \item\plabel{makeindex.run} Run \gls{makeindex} with the \texttt{.glo} file as the
    input file and the \texttt{.ist} file as the style so that
    it creates an output file with the extension \texttt{.gls}. If
    you have access to a terminal or a command prompt (for example, the
    MSDOS command prompt for Windows users or the bash console for
    Unix-like users) then you need to run the command:
\begin{prompt}
makeindex -s myDoc.ist -o myDoc.gls myDoc.glo
\end{prompt}
   (Replace \texttt{myDoc} with the base name of your \LaTeX\
    document file. Avoid spaces in the file name if possible. 
    The \textbf{\ttfamily\$} symbol indicates the command prompt and should be omitted.)

\begin{important}
The file extensions vary according to the glossary \gloskey{type}.
See \sectionref{sec:makeindexapp} for further details.
\gls{makeindex} must be called for each set of files.
\end{important}

    If you don't know how to use the command prompt, then you can probably access
    \gls{makeindex} via your text editor, but each editor has a
    different method of doing this. See \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
makeglossaries or makeglossaries-lite or bib2gls into the document
build} for some examples.

    Alternatively, run \gls{makeindex} indirectly via the
\gls{makeglossaries} script:
\begin{prompt}
makeglossaries myDoc
\end{prompt}
    Note that the file extension isn't supplied in this case.
    (Replace \gls{makeglossaries} with \gls{makeglossaries-lite.lua} if
    you don't have Perl installed.)
    This will pick up all the file extensions from the
    \filetype{aux} file and run \gls{makeindex} the appropriate number
    of times with all the necessary switches.

    The simplest approach is to use \app{arara} and add the following
    comment lines to the start of your document:
\begin{alltt}
\% arara: pdflatex
\% arara: makeglossaries
\% arara: pdflatex
\end{alltt}
    (Replace \texttt{makeglossaries} with \texttt{makeglossarieslite} in the 
     second line above if you don't have Perl installed. Note that
     there's no hyphen in this case.)

    The default sort is word order (\qt{sea lion} comes before \qt{seal}). 
    If you want letter ordering you need to add the \mkidxopt{l}
    switch:
\begin{prompt}
makeindex -l -s myDoc.ist -o myDoc.gls myDoc.glo
\end{prompt}
    (See \sectionref{sec:makeindexapp} for further details on using 
    \gls*{makeindex} explicitly.) If you use \gls{makeglossaries}
    or \gls{makeglossaries-lite.lua} then use the \pkgopt[letter]{order}
    package option and the \mkidxopt{l} option will be added
    automatically.

    \item\plabel{makeindex.relatex} Once you have successfully completed the previous step,
    you can now run \LaTeX\ on your document again.
   \end{enumerate}
You'll need to repeat the last step if you have used the
\pkgopt{toc} option (unless you're using \gls{glossaries-extra}) to
ensure the section heading is added to the table of contents.
You'll also need to repeat steps~\ref{makeindex.run} and~\ref{makeindex.relatex} 
if you have any cross-references which can't be indexed until the glossary file has
been created.

\optionsec{xindy}

Example document:
\begin{alltt}
\cs{documentclass}\mgroup{article}
\cs{usepackage}[\strong{xindy}]\mgroup{glossaries}
\strong{\ics{makeglossaries}} \% open glossary files
\end{alltt}
\begin{verbatim}
\newglossaryentry{sample}{name={sample},
 description={an example}}
\begin{document}
\gls{sample}.
\end{verbatim}
\begin{alltt}
\strong{\ics{printglossary}}
\cs{end}\mgroup{document}
\end{alltt}
You can place all your entry definitions in a separate file
and load it in the preamble with \ics{loadglsentries} (\emph{after}
\ics{makeglossaries}).

This option uses a~\gls{cli} application called
\gls{xindy} to sort the entries. This application is more flexible than 
\texttt{makeindex} and is able to sort \glspl{exlatinalph} or 
\glspl{nonlatinalph}, however it does still have some limitations.

The \gls{xindy} application comes with both \TeX~Live and
MiK\TeX, but since \gls{xindy} is a Perl script, you will also need
to install Perl, if you don't already have it.  In a~similar way to
\opt2, this option involves making \LaTeX\ write the glossary
information to a~temporary file which \gls{xindy} reads. Then
\gls{xindy} writes a~new file containing the code to typeset the
glossary. Then \cs{printglossary} reads this file in on the next run.

This is the best option with just the base \styfmt{glossaries}
package if you want to sort according to a~language other than 
English or if you want non-standard location lists, but it can 
require some setting up (see \sectionref{sec:xindy}). There are
some problems with certain sort values:
\begin{itemize}
   \item entries with the same sort value are merged by \gls*{xindy}
   into a single glossary line so you must make sure that each entry
   has a unique sort value;
   \item \gls*{xindy} forbids empty sort values;
   \item \gls*{xindy} automatically strips control sequences, the math-shift
   character \verb|$| and braces \verb|{}| from the sort value,
   which is usually desired but this can cause the sort value to
   collapse to an empty string which \gls*{xindy} forbids.
\end{itemize}
In these problematic cases, you must set the \gloskey{sort} field
explicitly. For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{alpha}\mgroup{name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
 \strong{sort=\mgroup{alpha},}description=\mgroup{...}}
\end{alltt}
\begin{xtr}
The \gls{glossaries-extra} package has a modified \pkgopt{symbols}
package option that provides \ics*{glsxtrnewsymbol}, which automatically sets the
\gloskey{sort} key to the entry label (instead of the \gloskey{name}).
\end{xtr}

All glossaries must be sorted according to the same method 
(word/letter ordering, order of use, or order of definition).

\begin{xtr}
The \gls{glossaries-extra} package allows a hybrid mix of
\optsand13 to provide word\slash letter ordering with \opt3 and order
of use\slash definition with \opt1. See the \gls{glossaries-extra}
documentation for further details.
\end{xtr}

\begin{enumerate}
     \item Add the \pkgopt{xindy} option to the \styfmt{glossaries}
package option list:
\begin{verbatim}
\usepackage[xindy]{glossaries}
\end{verbatim}
     If you are using a non-Latin script you'll also need to either
     switch off the creation of the number group:
\begin{verbatim}
\usepackage[xindy={glsnumbers=false}]{glossaries}
\end{verbatim}
      or use either \cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter} (to indicate the
first letter group to follow the digits) or
     \cs{GlsSetXdyNumberGroupOrder}\marg{spec} to indicate where the number
     group should be placed (see \sectionref{sec:xindy}).

     \item Add \cs{makeglossaries} to your preamble (before you start
     defining your entries, as described in \sectionref{sec:newglosentry}).

    \item Run \LaTeX\ on your document. This creates files with the
    extensions \filetype{glo} and \filetype{xdy} (for example, if your 
    \LaTeX\ document is called \texttt{myDoc.tex}, then you'll have 
    two extra files called \texttt{myDoc.glo} and \texttt{myDoc.xdy}).
    If you look at your document at this point, you won't see the 
    glossary as it hasn't been created yet. (If you're using the
    \gls{glossaries-extra} extension package, you'll see the section
    header and some boilerplate text.)

    If you have used package options such as \pkgopt{symbols} there
    will also be other sets of files corresponding to the extra
    glossaries that were created by those options.

    \item Run \gls{xindy} with the \texttt{.glo} file as the
    input file and the \texttt{.xdy} file as a~module so that
    it creates an output file with the extension \texttt{.gls}. You 
    also need to set the language name and input encoding. If
    you have access to a terminal or a command prompt (for example, the
    MSDOS command prompt for Windows users or the bash console for
    Unix-like users) then you need to run the command (all on one
    line):
\begin{prompt}
xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
\end{prompt}
    (Replace \texttt{myDoc} with the base name of your \LaTeX\
    document file. Avoid spaces in the file name. If necessary, also replace
    \texttt{english} with the name of your language and \texttt{utf8}
    with your input encoding, for example, 
    \xdyopt{L}\texttt{ german }\xdyopt{C}\texttt{ din5007-utf8}.)

\begin{important}
The file extensions vary according to the glossary \gloskey{type}.
See \sectionref{sec:xindyapp} for further details.
\gls{xindy} must be called for each set of files.
\end{important}

    It's much simpler to use \gls{makeglossaries} instead:
\begin{prompt}
makeglossaries myDoc
\end{prompt}
    Note that the file extension isn't supplied in this case.
    This will pick up all the file extensions from the
    \filetype{aux} file and run \gls{xindy} the appropriate number
    of times with all the necessary switches.

    There's no benefit in using \gls{makeglossaries-lite.lua} with \gls{xindy}.
    (Remember that \gls{xindy} is a Perl script so if you can use
    \gls{xindy} then you can also use \gls{makeglossaries}, and if
    you don't want to use \gls{makeglossaries} because you don't
    want to install Perl, then you can't use \gls{xindy} either.)
   
    If you don't know how to use the command prompt, then you can 
    probably access \gls{xindy} or \gls{makeglossaries} via your text editor,
    but each editor has a different method of doing this. See \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
makeglossaries or makeglossaries-lite or bib2gls into the document
build} for some examples.

    Again, a convenient method is to use \appfmt{arara} and add the follow comment
    lines to the start of your document:
\begin{alltt}
\% arara: pdflatex
\% arara: makeglossaries
\% arara: pdflatex
\end{alltt}

    The default sort is word order (\qt{sea lion} comes before \qt{seal}). 
    If you want letter ordering you need to add the
    \pkgopt[letter]{order} package option:
\begin{verbatim}
\usepackage[xindy,order=letter]{glossaries}
\end{verbatim}
    (and return to the previous step). This option is picked up
    by \gls{makeglossaries}. If you are explicitly using \gls{xindy}
    then you'll need to add \texttt{-M ord/letorder} to the options list.
    See \sectionref{sec:xindyapp} for further details on using 
    \gls*{xindy} explicitly.

    \item Once you have successfully completed the previous step,
    you can now run \LaTeX\ on your document again. As with
    \gls{makeindex} (\opt2), you may need to repeat the previous
    step and this step to ensure the table of contents and cross-references are resolved.

\end{enumerate}

\optionsec{bib2gls}

\glsxtrnote
This option is only available with the \gls{glossaries-extra} extension package. 
This method uses \gls{bib2gls} to both fetch entry definitions from
\filetype{bib} files and to hierarchically sort and collate.

Example document:
\begin{alltt}
\cs{documentclass}\mgroup{article}
\cs{usepackage}[\xtrfont{record=nameref}]\mgroup{glossaries-extra}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries}]
\cs{begin}\mgroup{document}
\cs{gls}\mgroup{sample}, \cs{gls}\mgroup{alpha}, \cs{gls}\mgroup{html}.
\ics*{printunsrtglossary}
\cs{end}\mgroup{document}
\end{alltt}
where the file \texttt{entries.bib} contains:
\begin{alltt}
\atentry{entry}\mgroup{sample,
  name=\mgroup{sample},
  description=\mgroup{an example}
}
\atentry{symbol}\mgroup{alpha,
  name=\mgroup{\cs{ensuremath}\mgroup{\cs{alpha}}},
  description=\mgroup{...}
}
\atentry{abbreviation}\mgroup{html,
  short=\mgroup{HTML},
  long=\mgroup{hypertext markup language}
}
\end{alltt}

All entries must be provided in one or more \filetype{bib} files.
See the \gls{bib2gls} user manual for the required format.

\begin{important}
Note that the \gloskey{sort} key should not be used. Each entry type
(\atentry{entry}, \atentry{symbol}, \atentry{abbreviation}) has a
particular field that's used for the sort value by default
(\gloskey{name}, the label, \gloskey{short}). You will break this
mechanism if you explicitly use the \gloskey{sort} key. See
\bibglsgallery{sorting} for examples.
\end{important}

The \gls{glossaries-extra} package needs to be loaded with the
\pkgopt*{record} package option:
\begin{alltt}
\cs{usepackage}[\xtrfont{record}]\mgroup{glossaries-extra}
\end{alltt}
or (equivalently)
\begin{alltt}
\cs{usepackage}[\xtrfont{record=only}]\mgroup{glossaries-extra}
\end{alltt}
or (with at least \gls{glossaries-extra} v1.37 and \gls{bib2gls} v1.8):
\begin{alltt}
\cs{usepackage}[\xtrfont{record=nameref}]\mgroup{glossaries-extra}
\end{alltt}
The \pkgopt+{nameref}{record} option is the best method.

(It's possible to use a hybrid of this method and \optsor23 with
\pkgopt+{alsoindex}{record} but in general there is little need
for this and it complicates the build process.)

Each resource set is loaded with \ics*{GlsXtrLoadResources}\oarg{options}.
For example:
\begin{alltt}
\ics*{GlsXtrLoadResources}
[\% definitions in entries1.bib and entries2.bib:
 \resourceopt{src}=\mgroup{entries1,entries2},
 \resourceopt{sort}=\mgroup{de-CH-1996}\% sort according to this locale
]
\end{alltt}
The \filetype{bib} files are identified as a comma-separated list in the
value of the \resourceopt{src} key. The \resourceopt{sort} option
identifies the sorting method. This may be a locale identifier for
alphabetic sorting, but there are other sort methods available, such
as character code or numeric. One resource set may cover multiple
glossaries or one glossary may be split across multiple resource
sets, forming logical sub-blocks.

If you want to ensure that all entries are selected, even if
they haven't been referenced in the document, then add the option
\resourceopt[all]{selection}. (There are also ways of filtering the
selection or you can even have a random selection by shuffling and
truncating the list. See the \gls{bib2gls} user manual for further details.)

The glossary is displayed using:
\begin{alltt}
\ics*{printunsrtglossary}
\end{alltt}
Alternatively all glossaries can be displayed using the iterative
command:
\begin{alltt}
\ics*{printunsrtglossaries}
\end{alltt}
The document is built using:
\begin{prompt}
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
\end{prompt}
If letter groups are required, you need the \bibglslongopt{group} switch:
\begin{prompt}
bib2gls -{}-group myDoc
\end{prompt}
or with \app{arara}:
\begin{alltt}
\% arara: bib2gls: \mgroup{ group: on }
\end{alltt}
(You will also need an appropriate glossary style.)

Unlike \optsand23, this method doesn't create a file containing
the typeset glossary but simply determines which entries are
needed for the document, their associated locations and (if
required) their associated letter group. This option allows
a mixture of sort methods. For example, sorting by word order
for one glossary and order of use for another or even sorting
one block of the glossary differently to another block in the
same glossary. See \bibglsgallery{sorting}.

This method supports Unicode and uses the Common Locale Data
Repository, which provides more extensive language support than
\gls{xindy}.\footnote{Except for Klingon, which is supported by
\gls{xindy}, but not by the CLDR.}\ The locations in the
\gls{numberlist} may be in any format. If \gls{bib2gls} can deduce a
numerical value it will attempt to form ranges otherwise it will
simply list the locations.

See \bibglsbegin\ or the \gls{bib2gls} user manual for further
details of this method, and
also \href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
makeglossaries or makeglossaries-lite or bib2gls into the document
build}.

\optionsec[no sorting]{no sorting}

\glsxtrnote
This option is only available with the extension package
\gls{glossaries-extra}. No \gls{indexingapp} is required. 

Example document:
\begin{verbatim}
\documentclass{article}
\usepackage[sort=none]{glossaries-extra}
\newglossaryentry{sample}{name={sample},
 description={an example}}
\newglossaryentry{alpha}{name={\ensuremath{\alpha}},
 description={...}}
\begin{document}
\gls{sample}.
\end{verbatim}
\begin{alltt}
\ics*{printunsrtglossary}
\cs{end}\mgroup{document}
\end{alltt}

This method is best used with the package option \pkgopt[none]{sort}
(as shown above). There's no \qt{activation} command (such as \cs{makeglossaries}
for \optsand23).

All entries must be defined before the glossary is displayed
(preferably in the preamble) in the required order, and child 
entries must be defined immediately after their parent entry 
if they must be kept together in the glossary. (Some glossary styles
indent entries that have a parent but it's the \gls{indexingapp}
that ensures the child entries are listed immediately after the
parent. If you're opting to use this manual approach then it's your
responsibility to define the entries in the correct order.) You can 
place all your entry definitions in a separate file
and load it in the preamble with \ics{loadglsentries}.

The glossary is displayed using:
\begin{alltt}
\ics*{printunsrtglossary}
\end{alltt}
Alternatively all glossaries can be displayed using the iterative
command:
\begin{alltt}
\ics*{printunsrtglossaries}
\end{alltt}
This will display \emph{all} defined entries, regardless of
whether or not they have been used in the document. The
\glspl{numberlist} have to be set explicitly otherwise they won't
appear. Note that this uses the same command for displaying the
glossary as \opt4. This is because \gls{bib2gls} takes advantage
of this method by defining the wanted entries in the required order and
setting the locations (and letter group information, if required).

Therefore, the above example document has a glossary containing the
entries: sample and $\alpha$ (in that order). Note that
the \texttt{alpha} entry has been included even though it wasn't
referenced in the document.

This just requires a single \LaTeX\ call:
\begin{prompt}
pdflatex myDoc
\end{prompt}
unless the glossary needs to appear in the table of contents, in which case
a second run is required:
\begin{prompt}
pdflatex myDoc
pdflatex myDoc
\end{prompt}
(Naturally if the document also contains citations, and so on, 
then additional steps are required. Similarly for all the other
options above.)

See the \gls{glossaries-extra} documentation for further details of this method.

\optionsec[standalone]{standalone}

\glsxtrnote
This option is only available with the \gls{glossaries-extra}
extension package.\footnote{You can just use the base
\styfmt{glossaries} package for the first case, but it's less
convenient. You'd have to manually insert the entry target before
the sectioning command and use \ics{glsentryname}\marg{label} or
\ics{Glsentryname}\marg{label} to display the entry name.} Instead
of creating a list, this has standalone definitions throughout the
document. The entry name may or may not be in a section heading.

You can either define entries in the document preamble (or in an external file loaded with
\ics{loadglsentries}), as with \opt5, for example:
\begin{verbatim}
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[sort=none,
   nostyles% <- no glossary styles are required
 ]{glossaries-extra}

\newglossaryentry{set}{name={set},
  description={a collection of any kind of objects},
  symbol={\ensuremath{\mathcal{S}}}
}

\newglossaryentry{function}{name={function},
  description={a rule that assigns every element in the 
  domain \gls{set} to an element in the range \gls{set}},
  symbol={\ensuremath{f(x)}}
}
\end{verbatim}
\begin{alltt}
\cs{newcommand}*\mgroup{\cs{termdef}}[1]\mgroup{\%
  \cs{section}\mgroup{\ics*{glsxtrglossentry}\mgroup{\#1} \ics{glsentrysymbol}\mgroup{\#1}}\%
  \cs{begin}\mgroup{quote}\cs{em}\ics{Glsentrydesc}\mgroup{\#1}.\cs{end}\mgroup{quote}\%
}
\end{alltt}
\begin{verbatim}
\begin{document}
\tableofcontents

\section{Introduction}
Sample document about \glspl{function} and \glspl{set}.

\termdef{set}

More detailed information about \glspl{set} with examples.

\termdef{function}

More detailed information about \glspl{function} with examples.

\end{document}
\end{verbatim}
Or you can use \gls{bib2gls} if you want to manage a large 
database of terms.  For example (requires \gls{glossaries-extra} v1.42, see below):
\begin{alltt}
\cs{documentclass}\mgroup{article}

\cs{usepackage}[colorlinks]\mgroup{hyperref}
\cs{usepackage}[\xtrfont{record},
   nostyles\% <- no glossary styles are required
  ]\mgroup{glossaries-extra}

\ics*{GlsXtrLoadResources}[\resourceopt{src}=terms,\resourceopt{sort}=none,\resourceopt{save-locations}=false]

\cs{newcommand}*\mgroup{\cs{termdef}}[1]\mgroup{\%
  \cs{section}\mgroup{\ics*{glsxtrglossentry}\mgroup{\#1} \strong{\ics{glossentrysymbol}}\mgroup{\#1}}\%
  \ics{glsadd}\mgroup{\#1}\% <- index this entry
  \cs{begin}\mgroup{quote}\cs{em}\ics{Glsentrydesc}\mgroup{\#1}.\cs{end}\mgroup{quote}\%
}
\end{alltt}
\begin{verbatim}
\begin{document}
\tableofcontents

\section{Introduction}
Sample document about \glspl{function} and \glspl{set}.

\termdef{set}

More detailed information about \glspl{set} with examples.

\termdef{function}

More detailed information about \glspl{function} with examples.

\end{document}
\end{verbatim}
Where the file \texttt{terms.bib} contains:
\begin{alltt}
\atentry{entry}\mgroup{set,
  name=\mgroup{set},
  description=\mgroup{a collection of any kind of objects},
  symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}}
}
\atentry{entry}\mgroup{function,
  name=\mgroup{function},
  description=\mgroup{a rule that assigns every element in the domain
  \cs{gls}\mgroup{set} to an element in the range \cs{gls}\mgroup{set}},
  symbol=\mgroup{\cs{ensuremath}\mgroup{f(x)}}
}
\end{alltt}
The advantage in this approach (with \ics{loadglsentries} or 
\gls{bib2gls}) is that you can use an existing database of
entries shared across multiple documents, ensuring consistent
notation for all of them.

In both cases, there's no need to load all the glossary styles
packages, as they're not required, so I've used the
\pkgopt{nostyles} package option to prevent them from being loaded.

In the first case, you need the \pkgopt[none]{sort} package option
(as in \opt5) and then define the terms in the preamble. No external tool is
required. Just run \LaTeX\ as normal. (Twice to ensure that the
table of contents is up to date.)
\begin{prompt}
pdflatex myDoc
pdflatex myDoc
\end{prompt}

In the second case, you need the \pkgopt*{record} package
option (as in \opt4) since \gls{bib2gls} is needed to select the
required entries, but you don't need a sorted list:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{terms},\strong{\xtrfont{sort}=none}]
\end{alltt}
This will ensure that any entries indexed in the document (through
commands like \ics{gls} or \ics{glsadd}) will be selected by 
\gls{bib2gls}, but it will skip the sorting step. 
(The chances are you probably also won't need location lists either.
If so, you can add the option \resourceopt[false]{save-locations}.)

Remember that for this second case you need to run \gls{bib2gls} as per \opt4:
\begin{prompt}
pdflatex myDoc
bib2gls myDoc
pdflatex myDoc
pdflatex myDoc
\end{prompt}

For both cases (with or without \gls{bib2gls}), instead of listing
all the entries using \xtrcs{printunsrtglossary}, you use
\ics*{glsxtrglossentry}\marg{label} where you want the name (and
anchor with \sty{hyperref}) to appear in the document.  This will
allow the \gls{linktext} created by commands like \cs{gls} to link
to that point in the document. The description can simply be
displayed with \ics{glsentrydesc}\marg{label} or
\ics{Glsentrydesc}\marg{label}, as in the above examples. In both
examples, I've defined a custom command \cs{termdef} to simplify the
code and ensure consistency.  Extra styling, such as placing the
description in a coloured frame, can be added to this custom
definition as required.

(Instead of using \cs{glsentrydesc} or \cs{Glsentrydesc}, you can use 
\ics{glossentrydesc}\marg{label}, which will obey attributes such as
\attr{glossdesc} and \attr{glossdescfont}. See the \gls{glossaries-extra} 
manual for further details.)

The symbol (if required) can be displayed with either
\ics{glsentrysymbol}\marg{label} or \ics{glossentrysymbol}\marg{label}.
In the first example, I've used \cs{glsentrysymbol}. In the
second I've used \ics{glossentrysymbol}. The latter is
necessary with \gls{bib2gls} if the symbol needs to go in a
section title as the entries aren't defined on the first \LaTeX\ run.

In normal document text, \cs{glsentrysymbol} will silently do nothing
if the entry hasn't been defined, but when used in a section heading
it will expand to an undefined internal command when written to the
\filetype{aux} file, which triggers an error. 

The \ics{glossentrysymbol} command performs an existence check,
which triggers a warning if the entry is undefined. (All entries
will be undefined before the first \gls{bib2gls} call.) You need at
least \gls{glossaries-extra} v1.42 to use this command in a section
title.\footnote{\cs{glossentrysymbol} is defined by the base
\styfmt{glossaries} package but is redefined by
\gls{glossaries-extra}.} If \sty{hyperref} has been loaded, this
will use \ics{texorpdfstring} to allow a simple expansion for the
PDF bookmarks (see the \gls{glossaries-extra} user manual for
further details).

If you want to test if the \gloskey{symbol} field has been set, you
need to use \ics{ifglshassymbol} outside of the section title. For
example:
\begin{alltt}
\cs{ifglshassymbol}\mgroup{\#1}\%
\mgroup{\cs{section}\mgroup{\xtrcs{glsxtrglossentry}\mgroup{\#1} \cs{glossentrysymbol}\mgroup{\#1}}}
\mgroup{\cs{section}\mgroup{\xtrcs{glsxtrglossentry}\mgroup{\#1}}}
\end{alltt}

In both of the above examples, the section titles start with a lowercase
character (because the \gloskey{name} value is all lowercase in
entry definitions). You can apply automatic case-change with the
\attr{glossname} attribute. For example:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossname}\mgroup{firstuc}
\end{alltt}
or (for title-case)
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossname}\mgroup{title}
\end{alltt}
However, this won't apply the case-change in the table of contents
or bookmarks.

In the second example, you can instead use \gls{bib2gls} to apply a
case-change:
\begin{alltt}
\cs{GlsXtrLoadResources}[\resourceopt{src}=terms,
 \resourceopt{sort}=none,\resourceopt{save-locations}=false\strong{,
 \resourceopt{replicate-fields}=\mgroup{name=text},
 \xtrfont{name-case-change}=firstuc}
]
\end{alltt}
(Or \resourceopt[title]{name-case-change} for title-case.)
This copies the \gloskey{name} value to the \gloskey{text} field and
then applies a case-change to the \gloskey{name} field (leaving the
\gloskey{text} field unchanged). The name in the section titles now
starts with a capital but the \gls{linktext} produced by commands like
\ics{gls} is still lowercase.

In the first example (without \gls{bib2gls}) you need to do this
manually. For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{set}\mgroup{name=\mgroup{\strong{S}et},\strong{text=\mgroup{set}},
  description=\mgroup{a collection of any kind of objects},
  symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}}
}
\end{alltt}

Note that if you use the default \resourceopt[true]{save-locations}
with \gls{bib2gls}, it's possible to combine \optsand46 to have both standalone
definitions and an index. Now I do need a glossary style. In this
case I'm going to use \xtrglostyle{bookindex}, which is provided in
the \sty{glossary-bookindex} package (bundled with
\gls{glossaries-extra}). I don't need any of the other style
packages, so I can still keep the \pkgopt{nostyles} option and just
load \sty{glossary-bookindex}:
\begin{alltt}
\cs{usepackage}[\xtrfont{record=nameref},\% <- using bib2gls
 nostyles,\% <- don't load default style packages
 \xtrfont{stylemods=bookindex},\% <- load glossary-bookindex.sty
 style=\xtrfont{bookindex}\% <- set the default style to 'bookindex'
]\mgroup{glossaries-extra}
\end{alltt}
I also need to sort the entries, so the resource command is now:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=terms,\% definitions in terms.bib
 \resourceopt{sort}=en-GB,\% sort by this locale
 \resourceopt{replicate-fields}=\mgroup{name=text},
 \xtrfont{name-case-change}=\mgroup{firstuc}
]
\end{alltt}
At the end of the document, I can add the glossary:
\begin{alltt}
\ics*{printunsrtglossary}[title=Index,target=false]
\end{alltt}
Note that I've had to switch off the hypertargets with
\xtrprintglosskey[false]{target} (otherwise there would be duplicate
targets). If you want letter group headings you need to use the
\bibglslongopt{group} switch:
\begin{prompt}
bib2gls -{}-group myDoc
\end{prompt}
or if you are using \app{arara}:
\begin{alltt}
\% arara: bib2gls: \mgroup{ group: on }
\end{alltt}

The \xtrglostyle{bookindex} style doesn't show the
description, so only the name and location is displayed. Remember
that the name has had a case-conversion so it now starts with an
initial capital. If you feel this is inappropriate for the index,
you can adjust the \xtrglostyle{bookindex} style so that it uses
the \gloskey{text} field instead. For example:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrbookindexname}}[1]\mgroup{\%
  \ics*{glossentrynameother}\mgroup{\#1}\mgroup{text}}
\end{alltt}
See the \gls{glossaries-extra} user manual for further details about
this style.

Note that on the first \LaTeX\ run none of the entries will be
defined. Once they are defined, the page numbers may shift due to
the increased amount of document text. You may therefore need to
repeat the document build to ensure the page numbers are correct.

If there are extra terms that need to be included in the index that
don't have a description, you can define them with \atentry{index}
in the \filetype{bib} file.  For example:
\begin{alltt}
\atentry{index}\mgroup{element}
\atentry{index}\mgroup{member,\xtrgloskey{alias}=\mgroup{element}}
\end{alltt}
They can be used in the document as usual:
\begin{verbatim}
The objects that make up a set are the \glspl{element}
or \glspl{member}.
\end{verbatim}
See \bibglsbegin\ or the \gls{bib2gls} user manual for further
details.

The \styfmt{glossaries} package comes with a number of sample
documents that illustrate the various functions. These are listed in
\sectionref{sec:samples}.

\section{Dummy Entries for Testing}
\label{sec:lipsum}

In addition to the sample files described above, \sty{glossaries}
also provides some files containing lorum ipsum dummy entries. These
are provided for testing purposes and are on \TeX's path (in
\texttt{tex\slash latex\slash glossaries\slash test-entries}) so
they can be included via \ics{input} or \ics{loadglsentries}. The
\gls{glossaries-extra} package provides \filetype{bib} versions of
all these files for use with \gls{bib2gls}. The files are as
follows:

\begin{description}
\item[example-glossaries-brief.tex] These entries all have brief
descriptions. For example:
\begin{verbatim}
\newglossaryentry{lorem}{name={lorem},description={ipsum}}
\end{verbatim}

\item[example-glossaries-long.tex] These entries all have long
descriptions. For example:
\begin{verbatim}
\newglossaryentry{loremipsum}{name={lorem ipsum},
description={dolor sit amet, consectetuer adipiscing 
elit. Ut purus elit, vestibulum ut, placerat ac, 
adipiscing vitae, felis. Curabitur dictum gravida 
mauris.}}
\end{verbatim}

\item[example-glossaries-multipar.tex] These entries all have
multi-paragraph descriptions. For example:
\begin{verbatim}
\longnewglossaryentry{loremi-ii}{name={lorem 1--2}}%
{%
Lorem ipsum ...

Nam dui ligula...
}
\end{verbatim}

\item[example-glossaries-symbols.tex] These entries all use the
\gloskey{symbol} key. For example:
\begin{verbatim}
\newglossaryentry{alpha}{name={alpha},
symbol={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}
\end{verbatim}

\item[example-glossaries-symbolnames.tex] Similar to the previous
file but the \gloskey{symbol} key isn't used. Instead the symbol
is stored in the \gloskey{name} key. For example:
\begin{verbatim}
\newglossaryentry{sym.alpha}{sort={alpha},
name={\ensuremath{\alpha}},
description={Quisque ullamcorper placerat ipsum.}}
\end{verbatim}

\item[example-glossaries-images.tex] These entries use the
\gloskey{user1} key to store the name of an image file. (The images
are provided by the \sty{mwe} package and should be on \TeX's path.) 
One entry doesn't have an associated image to help test for a~missing key.
The descriptions are long to allow for tests with the text wrapping
around the image. For example:
\begin{verbatim}
\longnewglossaryentry{sedfeugiat}{name={sed feugiat},
user1={example-image}}%
{%
Cum sociis natoque...

Etiam...
}
\end{verbatim}

\item[example-glossaries-acronym.tex] These entries are all
abbreviations.  For example:
\begin{verbatim}
\newacronym[type=\glsdefaulttype]{lid}{LID}{lorem ipsum 
dolor}
\end{verbatim}
\begin{xtr}
If you use the \gls{glossaries-extra} extension package, then
\ics{newacronym} is redefined to use \ics*{newabbreviation}
with the \xtrgloskey{category} key set to \texttt{acronym} (rather
than the default \texttt{abbreviation}). This means that you need to
set the abbreviation style for the \texttt{acronym} category. For
example:
\begin{verbatim}
\setabbreviationstyle[acronym]{long-short}
\end{verbatim}
\end{xtr}

\item[example-glossaries-acronym-desc.tex] This file contains
entries that are all
abbreviations that use the \gloskey{description} key.
For example:
\begin{verbatim}
\newacronym[type=\glsdefaulttype,
  description={fringilla a, euismod sodales,
  sollicitudin vel, wisi}]{ndl}{NDL}{nam dui ligula}
\end{verbatim}
\begin{xtr}
If you use the \gls{glossaries-extra} extension package, then
\ics{newacronym} is redefined to use \ics*{newabbreviation}
with the \xtrgloskey{category} key set to \texttt{acronym} (rather
than the default \texttt{abbreviation}). This means that you need to
set the abbreviation style for the \texttt{acronym} category. For
example:
\begin{verbatim}
\setabbreviationstyle[acronym]{long-short-desc}
\end{verbatim}
\end{xtr}

\item[example-glossaries-acronyms-lang.tex] These entries are all
abbreviations, where some of them have a~translation supplied in the
\gloskey{user1} key.
For example:
\begin{verbatim}
\newacronym[type=\glsdefaulttype,user1={love itself}]
 {li}{LI}{lorem ipsum}
\end{verbatim}
\begin{xtr}
If you use the \gls{glossaries-extra} extension package, then
\ics{newacronym} is redefined to use \ics*{newabbreviation}
with the \xtrgloskey{category} key set to \texttt{acronym} (rather
than the default \texttt{abbreviation}). This means that you need to
set the abbreviation style for the \texttt{acronym} category. For
example:
\begin{verbatim}
\setabbreviationstyle[acronym]{long-short-user}
\end{verbatim}
\end{xtr}

\item[example-glossaries-parent.tex] These are hierarchical entries
where the child entries use the \gloskey{name} key.
For example:
\begin{verbatim}
\newglossaryentry{sedmattis}{name={sed mattis},
description={erat sit amet}

\newglossaryentry{gravida}{parent={sedmattis},
  name={gravida},description={malesuada}}
\end{verbatim}

\item[example-glossaries-childnoname.tex] These are hierarchical entries
where the child entries don't use the \gloskey{name} key.
For example:
\begin{verbatim}
\newglossaryentry{scelerisque}{name={scelerisque},
  description={at}}

\newglossaryentry{vestibulum}{parent={scelerisque},
  description={eu, nulla}}
\end{verbatim}

\item[example-glossaries-cite.tex] These entries use the
\gloskey{user1} key to store a citation key (or comma-separated list
of citation keys). The citations are defined in \texttt{xampl.bib},
which should be available on all modern \TeX\ distributions.
One entry doesn't have an associated citation to help test for a~missing
key. 
For example:
\begin{verbatim}
\newglossaryentry{fusce}{name={fusce},
description={suscipit cursus sem},user1={article-minimal}}
\end{verbatim}

\item[example-glossaries-url.tex] These entries use the
\gloskey{user1} key to store an URL associated with the entry.
For example:
\begin{verbatim}
\newglossaryentry{aenean-url}{name={aenean},
 description={adipiscing auctor est},
 user1={http://uk.tug.org/}}
\end{verbatim}
\end{description}

The sample file \mirrorsamplefile{glossary-lipsum-examples.tex} in the 
\texttt{doc\slash latex\slash glossaries\slash samples} directory
uses all these files. See also \gallerytopic{glossaries}.

\glsxtrnote
The \gls{glossaries-extra} package provides the additional test
file:
\begin{description}
\item[example-glossaries-xr.tex] These entries use the \gloskey{see}
key provided by the base \styfmt{glossaries} package and also the
\xtrgloskey{alias} and \xtrgloskey{seealso} keys that require
\gls{glossaries-extra}. For example:
\begin{verbatim}
\newglossaryentry{alias-lorem}{name={alias-lorem},
 description={ipsum},alias={lorem}}

\newglossaryentry{amet}{name={amet},description={consectetuer},
 see={dolor}}

\newglossaryentry{arcu}{name={arcu},description={libero},
 seealso={placerat,vitae,curabitur}}
\end{verbatim}
\end{description}

\section{Multi-Lingual Support}
\label{sec:languages}

\begin{important}
The \styfmt{glossaries} package uses the \styfmt{tracklang} package
to determine the document languages. Unfortunately, because there
isn't a standard language identification framework provided with
\LaTeX, \styfmt{tracklang} isn't always able to detect the selected
languages either as a result of using an unknown interface or where
the interface doesn't provide a way of detecting the language.
See
\href{https://www.dickimaw-books.com/latex/tracklang/}{Localisation
with \texttt{tracklang.tex}} for further details.
\end{important}

As from version 1.17, the \styfmt{glossaries} package can be
used with \gls{xindy} as well as \gls{makeindex}. If you
are writing in a language that uses an \gls{exlatinalph} or
\gls{nonlatinalph} it's best to use \opt3 (\gls*{xindy}) 
or \opt4 (\gls{bib2gls})
as \gls*{makeindex} (\opt2) is hard-coded for the non-extended
\gls{latinalph} and \opt1 can only perform limited ASCII comparisons.

This means that with \optsor34 you are not restricted to the A,
\ldots, Z letter groups.  If you want to use \gls*{xindy}, remember
to use the \pkgopt{xindy} package option. For example:
\begin{verbatim}
\documentclass[frenchb]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage[xindy]{glossaries}
\end{verbatim}
If you want to use \gls*{bib2gls}, you need to use the
\pkgopt*{record} option with \gls{glossaries-extra} and supply the
definitions in \filetype{bib} files. (See the \gls{bib2gls} user
manual for further details.)

\begin{important}
Note that although a~\gls{nonlatinchar}, such as \'e, looks like a plain
character in your \filetype{tex} file, with standard \LaTeX\ it's actually a~macro and can therefore
cause expansion problems. You may need to switch off the field
expansions with \cs{glsnoexpandfields}. This issue doesn't occur
with \XeLaTeX\ or Lua\LaTeX.
\end{important}

With \sty{inputenc}, if you use a~\gls{nonlatinchar} (or other expandable) 
character at the start of an entry name, you must place it in a group, 
or it will cause a problem for commands that convert the first letter 
to upper case (e.g.\ \ics{Gls}). For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{name=\mgroup{\mgroup{\'e}lite},
description=\mgroup{select group or class}}
\end{alltt}
For further details, see the \qt{UTF-8} section in the
\sty{mfirstuc} user manual.

If you are using \gls{xindy} or \gls{bib2gls}, the application needs
to know the encoding of the \filetype{tex} file. This information
is added to the \filetype{aux} file and can be picked up by
\gls{makeglossaries} and \gls{bib2gls}. If you use
\gls{xindy} explicitly instead of via \gls*{makeglossaries},
you may need to specify the encoding using the \xdyopt{C} 
option. Read the \gls*{xindy} manual for further details of this
option.

As from v4.24, if you are writing in German (for example, using the \sty{ngerman}
package\footnote{deprecated, use \styfmt{babel} instead} or
\sty{babel} with the \pkgoptfmt{ngerman} package option),
and you want to use \gls{makeindex}['s] \mkidxopt{g} option, you'll
need to change \gls{makeindex}['s] quote character using:
\begin{definition}[\DescribeMacro\GlsSetQuote]
\cs{GlsSetQuote}\marg{character}
\end{definition}
Note that \meta{character} may not be one of \verb"?" (question
mark), \verb"|" (pipe) or \verb"!" (exclamation mark).
For example:
\begin{verbatim}
\GlsSetQuote{+}
\end{verbatim}
This must be done before \ics{makeglossaries} and any entry
definitions. It's only applicable for \app{makeindex}. This option
in conjunction with \sty{ngerman} will also cause
\app{makeglossaries} to use the \mkidxopt{g} switch when invoking
\app{makeindex}.

\begin{important}
Be careful of \sty{babel}'s shorthands. These aren't switched
on until the start of the document, so any entries defined
in the preamble won't be able to use those shorthands.
However, if you define the entries in the document and any
of those shorthands happen to be special characters for
\gls{makeindex} or \gls{xindy} (such as the double-quote)
then this will interfere with code that tries to escape
any of those characters that occur in the \gloskey{sort} key.
\end{important}

In general, it's best not to use \sty{babel}'s shorthands
in entry definitions. For example:
\begin{verbatim}
\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{glossaries}

\GlsSetQuote{+}

\makeglossaries

\newglossaryentry{rna}{name={ribonukleins\"aure},
  sort={ribonukleins"aure},
  description={eine Nukleins\"aure}}

\begin{document}
\gls{rna}

\printglossaries
\end{document}
\end{verbatim}

The \sty{ngerman} package has the shorthands on in the preamble, so
they can be used in definitions if \cs{GlsSetQuote} has been used to 
change the \gls{makeindex} quote character.  Example:
\begin{verbatim}
\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{glossaries}

\GlsSetQuote{+}

\makeglossaries

\newglossaryentry{rna}{name={ribonukleins"aure},
  description={eine Nukleins"aure}}

\begin{document}
\gls{rna}

\printglossaries
\end{document}
\end{verbatim}

\subsection{Changing the Fixed Names}
\label{sec:fixednames}

The fixed names are produced using the commands listed in 
\tableref{tab:predefinednames}. If you aren't using a language
package such as \sty{babel} or \sty{polyglossia} that uses caption
hooks, you can just redefine these commands as appropriate. If you
are using \sty{babel} or \sty{polyglossia}, you need to use their
caption hooks to change the defaults. See \href{https://texfaq.org/FAQ-latexwords}{changing
the words babel uses} or read the \sty{babel} or \sty{polyglossia}
documentation. If you have loaded \sty{babel}, then \sty{glossaries}
will attempt to load \sty{translator}, unless you have used the
\pkgopt{notranslate}, \pkgopt[false]{translate} or  \pkgopt[babel]{translate}
package options. If the \sty{translator} package is loaded, the
translations are provided by dictionary files (for example, 
\texttt{glossaries-dictionary-English.dict}). See the
\sty{translator} package for advice on changing translations provided by
\sty{translator} dictionaries. If you can't work out how to modify
these dictionary definitions, try switching to \sty{babel}'s
interface using \pkgopt[babel]{translate}:
\begin{verbatim}
\documentclass[english,french]{article}
\usepackage{babel}
\usepackage[translate=babel]{glossaries}
\end{verbatim}
and then use \sty{babel}'s caption hook mechanism. Note that if you
pass the language options directly to \sty{babel} rather that using
the document class options or otherwise passing the same options to
\sty{translator}, then \sty{translator} won't pick up the
language and no dictionaries will be loaded and \sty{babel}'s
caption hooks will be used instead.

\begin{table}[htbp]
\caption{Customised Text}
\label{tab:predefinednames}
\centering
\setlength{\tabcolsep}{3pt}
\begin{tabular}{@{}l>{\raggedright}p{0.3\linewidth}>{\raggedright}p{0.4\linewidth}@{}}
\bfseries Command Name & \bfseries Translator Key Word &
\bfseries Purpose\cr
\ics{glossaryname} & \texttt{Glossary} & Title of the main glossary.\cr
\ics{acronymname} & \texttt{Acronyms} & Title of the list of acronyms
(when used with package option \pkgopt{acronym}).\cr
\ics{entryname} & \texttt{Notation (glossaries)} & 
Header for first column in the glossary (for 2, 3 or 4 column glossaries 
that support headers).\cr
\ics{descriptionname} & \texttt{Description (glossaries)} &
Header for second column in the glossary (for 2, 3 or 4 column glossaries
that support headers).\cr
\ics{symbolname} & \texttt{Symbol (glossaries)} & Header for symbol
column in the glossary for glossary styles that support this option.\cr
\ics{pagelistname} & \texttt{Page List (glossaries)} & 
Header for page list column in the glossary for glossaries that support 
this option.\cr
\ics{glssymbolsgroupname} & \texttt{Symbols (glossaries)} & 
Header for symbols section of the glossary for glossary styles that 
support this option.\cr
\ics{glsnumbersgroupname} & \texttt{Numbers (glossaries)} & Header for
numbers section of the glossary for glossary styles that support
this option.
\end{tabular}
\end{table}

As from version 4.12, multilingual support is provided by separate
language modules that need to be installed in addition to installing
the \styfmt{glossaries} package. You only need to install the
modules for the languages that you require. If the language module
has an unmaintained status, you can volunteer to take over the
maintenance by contacting me at
\url{http://www.dickimaw-books.com/contact.html}. The
\sty{translator} dictionary files for \styfmt{glossaries} are now
provided by the appropriate language module. For further details
about information specific to a given language, please see the
documentation for that language module.

Examples of use:
\begin{itemize}
\item Using \sty{babel} and \sty{translator}:
\begin{verbatim}
\documentclass[english,french]{article}
\usepackage{babel}
\usepackage{glossaries}
\end{verbatim}
(\sty{translator} is automatically loaded).

\item Using \sty{babel}:
\begin{verbatim}
\documentclass[english,french]{article}
\usepackage{babel}
\usepackage[translate=babel]{glossaries}
\end{verbatim}
(\sty{translator} isn't loaded). The \gls{glossaries-extra} package
has \pkgopt[babel]{translate} as the default if \sty{babel} has been
loaded.

\item Using \sty{polyglossia}:
\begin{verbatim}
\documentclass{article}
\usepackage{polyglossia}
\setmainlanguage{english}
\usepackage{glossaries}
\end{verbatim}

\end{itemize}

Due to the varied nature of glossaries, it's likely that the
predefined translations may not be appropriate. If you are using the
\sty{babel} package and the \styfmt{glossaries} package option \pkgopt[babel]{translate}, you need to be familiar with the advice given in
\href{https://texfaq.org/FAQ-latexwords}{changing
the words babel uses}. If you are using the \sty{translator}
package, then you can provide your own dictionary with the necessary
modifications (using \cs{deftranslation}) and load it using
\cs{usedictionary}. If you simply want to change the title of a
glossary, you can use the \gloskey[printglossary]{title} key in
commands like \cs{printglossary} (but not the iterative commands
like \cs{printglossaries}).

\begin{important}
Note that the \sty{translator} dictionaries are loaded at the beginning of the
document, so it won't have any effect if you put \cs{deftranslation}
in the preamble. It should be put in your personal dictionary
instead (as in the example below). See the \sty{translator}
documentation for further details. (Now with \sty{beamer}
documentation.)
\end{important}

Your custom dictionary doesn't have to be just a translation from
English to another language. You may prefer to have a dictionary for
a particular type of document. For example, suppose your
institution's in-house reports have to have the glossary labelled as
\qt{Nomenclature} and the page list should be labelled
\qt{Location}, then you can create a file called, say,
\begin{verbatim}
myinstitute-glossaries-dictionary-English.dict
\end{verbatim}
that contains the following:
\begin{verbatim}
\ProvidesDictionary{myinstitute-glossaries-dictionary}{English}
\deftranslation{Glossary}{Nomenclature}
\deftranslation{Page List (glossaries)}{Location}
\end{verbatim}
You can now load it using:
\begin{verbatim}
\usedictionary{myinstitute-glossaries-dictionary}
\end{verbatim}
(Make sure that \texttt{myinstitute-glossaries-dictionary-English.dict}
can be found by \TeX.) If you want to share your custom dictionary,
you can upload it to \href{http://www.ctan.org/}{CTAN}.

If you are using \sty{babel} and don't want to use the
\sty{translator} interface, you can use the package
option \pkgopt[babel]{translate}. For example:
\begin{verbatim}
\documentclass[british]{article}

\usepackage{babel}
\usepackage[translate=babel]{glossaries}

\addto\captionsbritish{%
    \renewcommand*{\glossaryname}{List of Terms}%
    \renewcommand*{\acronymname}{List of Acronyms}%
}
\end{verbatim}

Note that \gls{xindy} and \gls{bib2gls} provide much better multi-lingual support
than \gls{makeindex}, so I~recommend that you use \optsor34
if you have glossary entries that contain 
\glspl{nonlatinchar}. See \sectionref{sec:xindy} for further
details on \gls{xindy}, and see the \gls{bib2gls} user manual for
further details of that application.

\subsubsection{Creating a New Language Module}
\label{sec:newlang}

The \styfmt{glossaries} package now uses the \sty{tracklang} package
to determine which language modules need to be loaded. If you want
to create a new language module, you should first read the 
\sty{tracklang} documentation.

To create a new language module, you need to at least create two
files called: \texttt{glossaries\dhyphen}\meta{lang}\texttt{.}\filetype{ldf} and
\texttt{glossaries-dictionary-}\meta{Lang}\texttt{.}\filetype{dict} where
\meta{lang} is the root language name (for example,
\texttt{english}) and \meta{Lang} is the language name used by
\sty{translator} (for example, \texttt{English}).

Here's an example of \texttt{glossaries-dictionary-English.dict}:
\begin{verbatim}
\ProvidesDictionary{glossaries-dictionary}{English}

\providetranslation{Glossary}{Glossary}
\providetranslation{Acronyms}{Acronyms}
\providetranslation{Notation (glossaries)}{Notation}
\providetranslation{Description (glossaries)}{Description}
\providetranslation{Symbol (glossaries)}{Symbol}
\providetranslation{Page List (glossaries)}{Page List}
\providetranslation{Symbols (glossaries)}{Symbols}
\providetranslation{Numbers (glossaries)}{Numbers}
\end{verbatim}
You can use this as a template for your dictionary file. Change
\texttt{English} to the \sty{translator} name for your language
(so that it matches the file name
\texttt{glossaries\dhyphen dictionary\dhyphen }\meta{Lang}\texttt{.dict})
and, for each \cs{providetranslation}, change the second argument to
the appropriate translation.

Here's an example of \texttt{glossaries-english.ldf}:
\begin{verbatim}
\ProvidesGlossariesLang{english}

\glsifusedtranslatordict{English}
{%
  \addglossarytocaptions{\CurrentTrackedLanguage}%
  \addglossarytocaptions{\CurrentTrackedDialect}%
}
{%
  \@ifpackageloaded{polyglossia}%
  {%
    \newcommand*{\glossariescaptionsenglish}{%
      \renewcommand*{\glossaryname}{\textenglish{Glossary}}%
      \renewcommand*{\acronymname}{\textenglish{Acronyms}}%
      \renewcommand*{\entryname}{\textenglish{Notation}}%
      \renewcommand*{\descriptionname}{\textenglish{Description}}%
      \renewcommand*{\symbolname}{\textenglish{Symbol}}%
      \renewcommand*{\pagelistname}{\textenglish{Page List}}%
      \renewcommand*{\glssymbolsgroupname}{\textenglish{Symbols}}%
      \renewcommand*{\glsnumbersgroupname}{\textenglish{Numbers}}%
    }%
  }%
  {%
    \newcommand*{\glossariescaptionsenglish}{%
      \renewcommand*{\glossaryname}{Glossary}%
      \renewcommand*{\acronymname}{Acronyms}%
      \renewcommand*{\entryname}{Notation}%
      \renewcommand*{\descriptionname}{Description}%
      \renewcommand*{\symbolname}{Symbol}%
      \renewcommand*{\pagelistname}{Page List}%
      \renewcommand*{\glssymbolsgroupname}{Symbols}%
      \renewcommand*{\glsnumbersgroupname}{Numbers}%
    }%
  }%
  \ifcsdef{captions\CurrentTrackedDialect}
  {%
    \csappto{captions\CurrentTrackedDialect}%
    {%
      \glossariescaptionsenglish
    }%
  }%
  {%
    \ifcsdef{captions\CurrentTrackedLanguage}
    {
      \csappto{captions\CurrentTrackedLanguage}%
      {%
        \glossariescaptionsenglish
      }%
    }%
    {%
    }%
  }%
  \glossariescaptionsenglish
}
\renewcommand*{\glspluralsuffix}{s}
\renewcommand*{\glsacrpluralsuffix}{\glspluralsuffix}
\renewcommand*{\glsupacrpluralsuffix}{\glstextup{\glspluralsuffix}}
\end{verbatim}
This is a somewhat longer file, but again you can use it as a
template. Replace \texttt{English} with the \sty{translator}
language label \meta{Lang} used for the dictionary file and
replace \texttt{english} with the root language name \meta{lang}. Within the
definition of \cs{glossariescaptions}\meta{lang}, replace the
English text (such as \qt{Glossaries}) with the appropriate
translation.

\importantpar
\label{pluralsuffix}%
The suffixes used to generate the plural forms when the plural
hasn't been specified are given by \cs{glspluralsuffix} (for general
entries). For abbreviations defined with \cs{newacronym},
\cs{glsupacrpluralsuffix} is used for acronyms where the suffix
needs to be set using \cs{glstextup} to counteract the effects of
\cs{textsc} and \cs{glsacrpluralsuffix} for other acronym styles.
There's no guarantee when these commands will be expanded. They may
be expanded on definition or they may be expanded on use, depending
on the \styfmt{glossaries} configuration.

\begin{important}
Therefore these plural suffix command definitions
aren't included in the caption mechanism as that's typically not switched on
until the start of the document. \strong{This means that the suffix in
effect will be for the last loaded language that redefined these
commands.} It's best to initialise these commands to the most common
suffix required in your document and use the \gloskey{plural},
\gloskey{longplural}, \gloskey{shortplural} etc keys to override
exceptions.
\end{important}

If you want to add a regional variation, create a file called 
\texttt{glossaries-}\meta{iso lang}\texttt{-}\meta{iso
country}\texttt{.ldf}, where \meta{iso lang} is the ISO language
code and \meta{iso country} is the ISO country code. For example,
\texttt{glossaries-en-GB.ldf}. This file can load the root
language file and make the appropriate changes, for example:
\begin{verbatim}
 \ProvidesGlossariesLang{en-GB}
 \RequireGlossariesLang{english}
 \glsifusedtranslatordict{British}
 {%
   \addglossarytocaptions{\CurrentTrackedLanguage}%
   \addglossarytocaptions{\CurrentTrackedDialect}%
 }
 {%
   \@ifpackageloaded{polyglossia}%
   {%
     % Modify \glossariescaptionsenglish as appropriate for
     % polyglossia
   }%
   {%
     % Modify \glossariescaptionsenglish as appropriate for
     % non-polyglossia
   }%
 }
\end{verbatim}

If the translations includes \glspl{nonlatinchar}, it's necessary to
provide code that's independent of the input encoding. Remember that
while some users may use UTF-8, others may use Latin-1 or any other
supported encoding, but while users won't appreciate you enforcing
your preference on them, it's useful to provide a UTF-8 version for
\XeLaTeX\ users.

The \texttt{glossaries-irish.ldf} file provides this as follows:
\begin{verbatim}
\ProvidesGlossariesLang{irish}

\glsifusedtranslatordict{Irish}
{%
  \addglossarytocaptions{\CurrentTrackedLanguage}%
  \addglossarytocaptions{\CurrentTrackedDialect}%
}
{%
  \ifdefstring{\inputencodingname}{utf8}
  {\input{glossaries-irish-utf8.ldf}}%
  {%
    \ifdef{\XeTeXinputencoding}% XeTeX defaults to UTF-8
    {\input{glossaries-irish-utf8.ldf}}%
    {\input{glossaries-irish-noenc.ldf}}
  }
  \ifcsdef{captions\CurrentTrackedDialect}
  {%
    \csappto{captions\CurrentTrackedDialect}%
    {%
      \glossariescaptionsirish
    }%
  }%
  {%
    \ifcsdef{captions\CurrentTrackedLanguage}
    {
      \csappto{captions\CurrentTrackedLanguage}%
      {%
        \glossariescaptionsirish
      }%
    }%
    {%
    }%
  }%
  \glossariescaptionsirish
}
\end{verbatim}
(Again you can use this as a template. Replace \texttt{irish} with
your root language label and \texttt{Irish} with the
\sty{translator} dictionary label.)

There are now two extra files: \nolinkurl{glossaries-irish-noenc.ldf}
(no encoding information)
and \nolinkurl{glossaries-irish-utf8.ldf} (UTF-8).

These both define \cs{glossariescaptionsirish} but the \texttt{*-noenc.ldf} uses
\LaTeX\ accent commands:
\begin{verbatim}
\@ifpackageloaded{polyglossia}%
{%
  \newcommand*{\glossariescaptionsirish}{%
    \renewcommand*{\glossaryname}{\textirish{Gluais}}%
    \renewcommand*{\acronymname}{\textirish{Acrainmneacha}}%
    \renewcommand*{\entryname}{\textirish{Ciall}}%
    \renewcommand*{\descriptionname}{\textirish{Tuairisc}}%
    \renewcommand*{\symbolname}{\textirish{Comhartha}}%
    \renewcommand*{\glssymbolsgroupname}{\textirish{Comhartha\'{\i}}}%
    \renewcommand*{\pagelistname}{\textirish{Leathanaigh}}%
    \renewcommand*{\glsnumbersgroupname}{\textirish{Uimhreacha}}%
  }%
}%
{%
  \newcommand*{\glossariescaptionsirish}{%
    \renewcommand*{\glossaryname}{Gluais}%
    \renewcommand*{\acronymname}{Acrainmneacha}%
    \renewcommand*{\entryname}{Ciall}%
    \renewcommand*{\descriptionname}{Tuairisc}%
    \renewcommand*{\symbolname}{Comhartha}%
    \renewcommand*{\glssymbolsgroupname}{Comhartha\'{\i}}%
    \renewcommand*{\pagelistname}{Leathanaigh}%
    \renewcommand*{\glsnumbersgroupname}{Uimhreacha}%
  }%
}
\end{verbatim}
whereas the \texttt{*-utf8.ldf} replaces the accent commands with
the appropriate UTF-8 characters.


\section{Generating the Associated Glossary Files}
\label{sec:makeglossaries}

\begin{important}
This section is only applicable if you have chosen \optsor23. You can
ignore this section if you have chosen any of the other options. If you want to
alphabetically sort your entries always remember to use the
\gloskey{sort} key if the \gloskey{name} contains any \LaTeX\
commands (except if you're using \gls{bib2gls}).
\end{important}

If this section seriously confuses you, and you can't work out how
to run external tools like \gls{makeglossaries} or \gls{makeindex}, you can try using
the \pkgopt{automake} package option, described in 
\sectionref{sec:pkgopts-sort}, but you will need \TeX's shell escape
enabled. See also
\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
makeglossaries or makeglossaries-lite or bib2gls into the document
build}.

In order to generate a sorted glossary with compact
\glspl{numberlist}, it is necessary to use an external
\gls{indexingapp} as an intermediate step (unless you have chosen
\opt1, which uses \TeX\ to do the sorting or \opt5, which doesn't
perform any sorting). It is this application
that creates the file containing the code required to typeset the
glossary. \strong{If this step is omitted, the glossaries will not
appear in your document.} The two \glspl*{indexingapp} that are most
commonly used with \LaTeX\ are \gls{makeindex} and \gls{xindy}. As
from version 1.17, the \styfmt{glossaries} package can be used with
either of these applications. Previous versions were designed to be
used with \gls*{makeindex} only. With the \gls{glossaries-extra} package, you
can also use \gls{bib2gls} as the indexing application. (See
the \gls{glossaries-extra} and \gls{bib2gls} user manuals for
further details.) Note that \gls*{xindy} and \gls*{bib2gls} have much
better multi-lingual support than \gls*{makeindex}, so \gls*{xindy}
or \gls*{bib2gls} are recommended if you're not writing in English. 
Commands that only have an effect when \gls*{xindy} is used are
described in \sectionref{sec:xindy}.

\begin{important}
This is a multi-stage process, but there are methods of automating
document compilation using applications such as \app{latexmk} and
\app{arara}. With \app{arara} you can just add special comments to
your document source:
\begin{alltt}
\% arara: pdflatex
\% arara: makeglossaries
\% arara: pdflatex
\end{alltt}
With \app{latexmk} you need to set up the required dependencies.
\end{important}

The \styfmt{glossaries} package comes with the Perl script
\gls{makeglossaries} which will run \gls{makeindex} or \gls{xindy}
on all the glossary files using a customized style file (which is
created by \ics{makeglossaries}). See
\sectionref{sec:makeglossariesapp} for further
details. Perl is stable, cross-platform, open source software that
is used by a number of \TeX-related applications (including
\gls*{xindy} and \app{latexmk}). Most Unix-like
operating systems come with a~Perl interpreter. \TeX~Live also comes
with a~Perl interpreter. MiK\TeX\ doesn't come with a~Perl
interpreter so if you are a~Windows MiK\TeX\ user you will need to
install Perl if you want to use \gls{makeglossaries} or \gls{xindy}.
Further information is available at \url{http://www.perl.org/about.html}
and
\href{http://tex.stackexchange.com/questions/158796/miktex-and-perl-scripts-and-one-python-script}{MiKTeX and Perl scripts (and one Python script)}.

The advantages of using \gls*{makeglossaries}:
\begin{itemize}
\item It automatically detects whether to use \gls*{makeindex} or
\gls*{xindy} and sets the relevant application switches.

\item One call of \gls*{makeglossaries} will run 
\gls*{makeindex}\slash\gls*{xindy} for each glossary type.

\item If things go wrong, \gls{makeglossaries} will scan the
messages from \gls{makeindex} or \gls{xindy} and attempt to diagnose
the problem in relation to the \styfmt{glossaries} package. This
will hopefully provide more helpful messages in some cases. If it
can't diagnose the problem, you will have to read the relevant transcript
file and see if you can work it out from the \gls*{makeindex} or
\gls*{xindy} messages.

\item If \gls{makeindex} warns about multiple encap values,
\gls{makeglossaries} will detect this and attempt to correct the
problem.\footnote{Added to version \gls{makeglossaries} 2.18.} This
correction is only provided by \gls{makeglossaries} when
\gls{makeindex} is used since \gls{xindy} uses the order of the
\ixindyattrs attributes list to determine which format should take precedence.
(see \sectionref{sec:xindyloc}.)

\end{itemize}

As from version 4.16, the \styfmt{glossaries} package also comes
with a~Lua script called \gls{makeglossaries-lite.lua}. This is a
\emph{trimmed-down} alternative to the \gls{makeglossaries} Perl
script. It doesn't have some of the options that the Perl version
has and it doesn't attempt to diagnose any problems, but since
modern \TeX\ distributions come with Lua\TeX\ (and therefore have
a~Lua interpreter) you don't need to install anything else in order
to use \gls{makeglossaries-lite.lua} so it's an alternative to
\gls{makeglossaries} if you want to use \opt2 (\gls{makeindex}).

If things go wrong and you can't work out why your glossaries
aren't being generated correctly, you can use
\gls{makeglossariesgui} as a diagnostic tool. Once you've
fixed the problem, you can then go back to using
\gls{makeglossaries} or \gls{makeglossaries-lite.lua}.

Whilst I strongly recommended that you use the \gls{makeglossaries}
Perl script or the \gls{makeglossaries-lite.lua} Lua script, it is
possible to use the \styfmt{glossaries} package without using those
applications. However, note that some commands and package options
have no effect if you explicitly run \gls{makeindex}\slash\gls{xindy}.  
These are listed in \tableref{tab:makeglossariesCmds}.

\begin{important}
If you are choosing not to use \gls*{makeglossaries} because you
don't want to install Perl, you will only be able to use
\gls*{makeindex} as \gls*{xindy} also requires Perl. (Other useful
Perl scripts include \appfmt{epstopdf} and \appfmt{latexmk}, so it's
well-worth the effort to install Perl.)
\end{important}

Note that if any of your entries use an entry
that is not referenced outside the glossary, you will need to
do an additional \gls{makeglossaries}, \gls{makeindex}
or \gls{xindy} run, as appropriate. For example,
suppose you have defined the following entries:\footnote{As from
v3.01 \ics{gls} is no longer fragile and doesn't need protecting.}
\begin{verbatim}
\newglossaryentry{citrusfruit}{name={citrus fruit},
description={fruit of any citrus tree. (See also 
\gls{orange})}}

\newglossaryentry{orange}{name={orange},
description={an orange coloured fruit.}}
\end{verbatim}
and suppose you have \verb|\gls{citrusfruit}| in your document
but don't reference the \texttt{orange} entry, then the
\texttt{orange} entry won't appear in your glossary until
you first create the glossary and then do another run
of \gls{makeglossaries}, \gls{makeindex} or \gls{xindy}.
For example, if the document is called \texttt{myDoc.tex}, then
you must do:
\begin{prompt}
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
\end{prompt}
(In the case of \opt4, \gls{bib2gls} will scan the description for
instances of commands like \cs{gls} to ensure they are selected but
an extra \gls{bib2gls} call is required to ensure the locations are
included, if locations lists are required. See the
and \gls{bib2gls} manual for further details.)

Likewise, an additional \gls{makeglossaries} and \LaTeX\ run
may be required if the document pages shift with re-runs. For
example, if the page numbering is not reset after the table of
contents, the insertion of the table of contents on the second
\LaTeX\ run may push glossary entries across page boundaries, which
means that the \glspl{numberlist} in the glossary may 
need updating.

The examples in this document assume that you are accessing
\gls{makeglossaries}, \gls{xindy} or \gls{makeindex} via a terminal.
Windows users can use the MSDOS Prompt which is usually accessed via
the \menu{Start}\submenu{All Programs} menu or
\menu{Start}\submenu{All Programs}\submenu{Accessories} menu.

Alternatively, your text editor may have the facility to create a
function that will call the required application. See
\href{https://www.dickimaw-books.com/latex/buildglossaries/}{Incorporating
makeglossaries or makeglossaries-lite or bib2gls into the document
build}.

If any problems occur, remember to check the transcript files 
(e.g.\ \filetype{glg} or \filetype{alg}) for messages.

\begin{table}[htbp]
\caption[Commands and package options that have no effect when
using xindy or makeindex explicitly]{Commands and package options that have no effect when
using \gls{xindy} or \gls{makeindex} explicitly}
\label{tab:makeglossariesCmds}
\vskip\baselineskip
\begin{tabular}{@{}lll@{}}
\bfseries Command or Package Option & \gls{makeindex} & 
\gls{xindy}\\
\pkgopt[letter]{order} & use \mkidxopt{l} &
 use \xdyopt{M}\texttt{ ord/letorder}\\
\pkgopt[word]{order} & default & default\\
\pkgopt{xindy}=\{\pkgoptfmt{language=}\meta{lang}\pkgoptfmt{,codename=}\meta{code}\} &
N/A & use \xdyopt{L} \meta{lang} \xdyopt{C} \meta{code}\\
\ics{GlsSetXdyLanguage}\marg{lang} & N/A &
use \xdyopt{L} \meta{lang}\\
\ics{GlsSetXdyCodePage}\marg{code} & N/A &
use \xdyopt{C} \meta{code}
\end{tabular}
\par
\end{table}


\subsection{Using the makeglossaries Perl Script}
\label{sec:makeglossariesapp}

The \gls{makeglossaries} script picks up the relevant information
from the auxiliary (\filetype{aux}) file and will either call
\gls{xindy} or \gls{makeindex}, depending on the supplied
information. Therefore, you only need to pass the document's name
without the extension to \gls*{makeglossaries}. For example, if your
document is called \texttt{myDoc.tex}, type the following in your
terminal:
\begin{prompt}
pdflatex myDoc
makeglossaries myDoc
pdflatex myDoc
\end{prompt}
You may need to explicitly load \gls{makeglossaries} into Perl:
\begin{prompt}
perl makeglossaries myDoc
\end{prompt}

Windows users: \TeX~Live on Windows has its own internal Perl
interpreter and provides \texttt{makeglossaries.exe} as a~convenient
wrapper for the \gls{makeglossaries} Perl script. MiKTeX also
provides a~wrapper \texttt{makeglossaries.exe} but doesn't provide
a~Perl interpreter, which is still required even if you run MiKTeX's
\texttt{makeglossaries.exe}, so with MiKTeX you'll need to install
Perl.\footnote{The batch file \texttt{makeglossaries.bat} has been
removed since the \TeX\ distributions for Windows provide
\texttt{makeglossaries.exe}.} There's more information about this at
\url{http://tex.stackexchange.com/q/158796/19862} on the TeX.SX
site. 

The \gls{makeglossaries} script attempts to fork the
\gls{makeindex}\slash\gls{xindy} process using \texttt{open()} on the
piped redirection \verb"2>&1 |" and parses the processor output to
help diagnose problems.  If this method fails \gls{makeglossaries}
will print an \qt{Unable to fork} warning and will retry without
redirection. If you run \gls{makeglossaries} on an operating system
that doesn't support this form of redirection, then you can use the
\mkglsopt{Q} switch to suppress this warning or you can use the
\mkglsopt{k} switch to make \gls{makeglossaries} automatically use
the fallback method without attempting the redirection. Without this
redirection, the \mkglsopt{q} (quiet) switch doesn't work as well.

You can specify in which directory the \filetype{aux}, 
\filetype{glo} etc files are located using the \texttt{-d} switch.
For example:
\begin{prompt}
pdflatex -output-directory myTmpDir myDoc
makeglossaries -d myTmpDir myDoc
\end{prompt}
Note that \gls*{makeglossaries} assumes by default that
\gls*{makeindex}\slash\gls*{xindy} is on your operating system's
path. If this isn't the case, you can specify the full pathname
using \mkglsopt{m} \meta{path/to/makeindex} for \gls*{makeindex}
or \mkglsopt{x} \meta{path/to/xindy} for \gls*{xindy}.

As from \gls{makeglossaries} v2.18, if you are using
\gls{makeindex}, there's a check for \gls*{makeindex}['s] multiple
encap warning. This is where different encap values (location formats) are 
used on the same location for the same entry. For example:
\begin{verbatim}
\documentclass{article}

\usepackage{glossaries}
\makeglossaries

\newglossaryentry{sample}{name={sample},description={an example}}

\begin{document}
\gls{sample}, \gls[format=textbf]{sample}.
\printglossaries
\end{document}
\end{verbatim}
If you explicitly use \gls{makeindex}, this will cause a warning and
the location list will be \qt{1, \textbf{1}}. That is, the page
number will be repeated with each format. As from v2.18,
\gls{makeglossaries} will check for this warning and, if found, will
attempt to correct the problem by removing duplicate locations and
retrying. There's no similar check for \gls{xindy} as \gls*{xindy}
won't produce any warning and will simply discard duplicates.

For a complete list of options do \texttt{makeglossaries -{}-help}.

\begin{important}
When upgrading the \styfmt{glossaries} package, make sure you also
upgrade your version of \gls{makeglossaries}. The current version is
4.45.
\end{important}

\subsection{Using the makeglossaries-lite Lua Script}
\label{sec:makeglossarieslua}

The Lua alternative to the \gls{makeglossaries} Perl script requires
a~Lua interpreter, which should already be available if you have
a~modern \TeX\ distribution that includes Lua\TeX. Lua is 
a~light-weight, cross-platform scripting language, but because it's
light-weight it doesn't have the full-functionality of heavy-weight
scripting languages, such as Perl. The \gls{makeglossaries-lite.lua}
script is therefore limited by this and some of the options
available to the \gls{makeglossaries} Perl script aren't available
here. (In particular the \mkglsopt{d} option.)

\begin{important}
Note that \TeX~Live on Unix-like systems creates a
symbolic link called \texttt{makeglossaries-lite} (without the
\filetype{lua} extension) to the actual
\texttt{makeglossaries-lite.lua} script, so you may not need to
supply the extension.
\end{important}

The \gls{makeglossaries-lite.lua} script can be invoked in the same way
as \gls{makeglossaries}. For example, if your document is called
\texttt{myDoc.tex}, then do
\begin{prompt}
makeglossaries-lite.lua myDoc
\end{prompt}
or
\begin{prompt}
makeglossaries-lite myDoc
\end{prompt}

\emph{Some} of the options available with the Perl
\gls{makeglossaries} script are also available with the Lua \gls{makeglossaries-lite.lua}
script. For a complete list of available options, do
\begin{prompt}
makeglossaries-lite.lua -{}-help
\end{prompt}


\subsection[Using xindy explicitly (Option~3)]{Using
\gls{xindy} explicitly (\ifpdf \opt3\else Option 3\fi)}
\label{sec:xindyapp}

\Gls{xindy} comes with \TeX~Live. It has also been added
to Mik\TeX, but if you don't have it installed, see
\href{http://tex.stackexchange.com/questions/71167/how-to-use-xindy-with-miktex}{How
to use Xindy with MikTeX} on
\urlfootref{http://www.stackexchange.com/}{\TeX\ on StackExchange}.

If you want to use \gls{xindy} to process the glossary
files, you must make sure you have used the 
\pkgopt{xindy} package option:
\begin{verbatim}
\usepackage[xindy]{glossaries}
\end{verbatim}
This is required regardless of whether you use \gls{xindy}
explicitly or whether it's called implicitly via applications such
as \gls{makeglossaries}. This causes the glossary 
entries to be written in raw \gls*{xindy} format, so you need to
use \xdyopt{I}\texttt{ xindy} \emph{not} \xdyopt{I}\texttt{ tex}.

To run \gls{xindy} type the following in your terminal 
(all on one line):
\begin{prompt}
xindy -L \meta{language} -C \meta{encoding} -I xindy -M \meta{style} -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo
\end{prompt}
where \meta{language} is the required language name, \meta{encoding}
is the encoding, \meta{base} is the name of the document without the
\filetype{tex} extension and \meta{style} is the name of the
\gls{xindy} style file without the \filetype{xdy} extension.
The default name for this style file is \meta{base}\filetype{xdy}
but can be changed via \ics{setStyleFile}\marg{style}. You may need
to specify the full path name depending on the current working
directory. If any of the file names contain spaces, you must delimit
them using double-quotes.

For example, if your document is called \texttt{myDoc.tex} and
you are using UTF8 encoding in English, then type the
following in your terminal:
\begin{prompt}
xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.glg -o myDoc.gls myDoc.glo
\end{prompt}

Note that this just creates the main glossary. You need to do
the same for each of the other glossaries (including the
list of acronyms if you have used the \pkgopt{acronym}
package option), substituting \filetype{glg}, \filetype{gls}
and \filetype{glo} with the relevant extensions. For example,
if you have used the \pkgopt{acronym} package option, then 
you would need to do:
\begin{prompt}
xindy -L english -C utf8 -I xindy -M myDoc -t myDoc.alg -o myDoc.acr myDoc.acn
\end{prompt}
For additional glossaries, the extensions are those supplied
when you created the glossary with \ics{newglossary}.

Note that if you use \gls{makeglossaries} instead, you can
replace all those calls to \gls{xindy} with just one call
to \gls*{makeglossaries}:
\begin{prompt}
makeglossaries myDoc
\end{prompt}
Note also that some commands and package options have no effect if 
you use \gls{xindy} explicitly instead of using 
\gls*{makeglossaries}. These are listed in 
\tableref{tab:makeglossariesCmds}.


\subsection[Using makeindex explicitly (Option~2)]{Using
\gls{makeindex} explicitly (\ifpdf \opt2\else Option 2\fi)}
\label{sec:makeindexapp}

If you want to use \gls{makeindex} explicitly, you must
make sure that you haven't used the \pkgopt{xindy} package
option or the glossary entries will be written in the wrong
format. To run \gls*{makeindex}, type the following in
your terminal:
\begin{prompt}
makeindex -s \meta{style}.ist -t \meta{base}.glg -o \meta{base}.gls \meta{base}.glo
\end{prompt}
where \meta{base} is the name of your document without the
\filetype{tex} extension and \meta{style}\filetype{ist} is the 
name of the \gls{makeindex} style file. By default, this is
\meta{base}\filetype{ist}, but may be changed via
\ics{setStyleFile}\marg{style}. Note that there are other options, 
such as \mkidxopt{l} (letter ordering). See the \gls*{makeindex}
manual for further details.

For example, if your document is called \texttt{myDoc.tex}, then
type the following at the terminal:
\begin{prompt}
makeindex -s myDoc.ist -t myDoc.glg -o myDoc.gls myDoc.glo
\end{prompt}
Note that this only creates the main glossary. If you have
additional glossaries (for example, if you have used the
\pkgopt{acronym} package option) then you must call 
\gls{makeindex} for each glossary, substituting 
\filetype{glg}, \filetype{gls} and \filetype{glo} with the
relevant extensions. For example, if you have used the
\pkgopt{acronym} package option, then you need to type the
following in your terminal:
\begin{prompt}
makeindex -s myDoc.ist -t myDoc.alg -o myDoc.acr myDoc.acn
\end{prompt}
For additional glossaries, the extensions are those supplied
when you created the glossary with \ics{newglossary}.

Note that if you use \gls{makeglossaries} instead, you can
replace all those calls to \gls{makeindex} with just one call
to \gls*{makeglossaries}:
\begin{prompt}
makeglossaries myDoc
\end{prompt}
Note also that some commands and package options have no effect if 
you use \gls*{makeindex} explicitly instead of using 
\gls{makeglossaries}. These are listed in 
\tableref{tab:makeglossariesCmds}.

\section{Note to Front-End and Script Developers}
\label{sec:notedev}

The information needed to determine whether to use \gls{xindy},
\gls{makeindex} or \gls{bib2gls} is stored in the \filetype{aux}
file. This information can be gathered by a front-end, editor or
script to make the glossaries where appropriate. This section
describes how the information is stored in the auxiliary file.

\subsection{MakeIndex and Xindy}
\label{sec:notedev.makeindex.xindy}

The file extensions used by each defined (but not ignored) glossary are given by
\begin{definition}[\DescribeMacro{\@newglossary}]
\cs{@newglossary}\marg{label}\marg{log}\marg{out-ext}\marg{in-ext}
\end{definition}
where \meta{in-ext} is the extension of the
\emph{\gls{indexingapp}['s]} input file (the output file from the
\styfmt{glossaries} package's point of view), \meta{out-ext} is the
extension of the \emph{\gls*{indexingapp}['s]} output file (the
input file from the \styfmt{glossaries} package's point of view) and
\meta{log} is the extension of the \gls*{indexingapp}['s] transcript
file. The label for the glossary is also given. This isn't required
with \gls{makeindex}, but with \gls{xindy} it's needed to pick up
the associated language and encoding (see below). For
example, the information for the default main glossary is written
as:
\begin{verbatim}
\@newglossary{main}{glg}{gls}{glo}
\end{verbatim}
If \gls{glossaries-extra}['s] hybrid method has been used (with 
\cs{makeglossaries}\oarg{sub-list}), then the sub-list
of glossaries that need to be processed will be identified with:
\begin{alltt}
\ics*{glsxtr@makeglossaries}\marg{list}
\end{alltt}

The \gls{indexingapp}['s] style file is specified by
\begin{definition}[\DescribeMacro{\@istfilename}]
\cs{@istfilename}\marg{filename}
\end{definition}
The file extension indicates whether to use \gls{makeindex}
(\filetype{ist}) or \gls{xindy} (\filetype{xdy}). Note that
the glossary information is formatted differently depending on
which \gls*{indexingapp} is supposed to be used, so it's 
important to call the correct one.

For example, with \app{arara} you can easily determine whether to run \gls{makeglossaries}:
\begin{alltt}
\% arara: makeglossaries if found("aux", "@istfilename")
\end{alltt}
It's more complicated if you want to explicitly run \gls{makeindex}
or \gls{xindy}

\begin{important}
Note that if you choose to explicitly call \gls{makeindex} or
\gls{xindy} then the user will miss out on the diagnostic
information and the encap-clash fix that \gls{makeglossaries} also
provides.
\end{important}

Word or letter ordering is specified by:
\begin{definition}[\DescribeMacro{\@glsorder}]
\cs{@glsorder}\marg{order}
\end{definition}
where \meta{order} can be either \texttt{word} or \texttt{letter}.

If \gls{xindy} should be used, the language and code page
for each glossary is specified by
\begin{definition}[\DescribeMacro{\@xdylanguage}\DescribeMacro{\@gls@codepage}]
\cs{@xdylanguage}\marg{label}\marg{language}\\
\cs{@gls@codepage}\marg{label}\marg{code}
\end{definition}
where \meta{label} identifies the glossary, \meta{language} is
the root language (e.g.\ \texttt{english}) and \meta{code}
is the encoding (e.g.\ \texttt{utf8}). These commands are omitted
if \gls{makeindex} should be used.

If \opt1 has been used, the \filetype{aux} file will contain
\begin{definition}[\DescribeMacro\@gls@reference]
\cs{@gls@reference}\marg{type}\marg{label}\marg{location}
\end{definition}
for every time an entry has been referenced. 

\subsection{Entry Labels}
\label{sec:notedev.labels}

If you need to gather labels for auto-completion, the
\pkgopt{writeglslabels} package option will create a file containing
the labels of all defined entries (regardless of whether or not the
entry has been used in the document). The \gls{glossaries-extra}
package also provides \pkgopt+{atom}{docdef}, which will create the
\filetype{glsdefs} file but will act like \pkgopt+{restricted}{docdef}.

\subsection{Bib2Gls}
\label{sec:notedev.bib2gls}

\bibglsnote
If \opt4 has been used, the \filetype{aux} file will contain one or more instances of
\begin{alltt}
\ics*{glsxtr@resource}\marg{options}\marg{basename}
\end{alltt}
where \meta{basename} is the basename of the \filetype{glstex} file
that needs to be created by \gls{bib2gls}. If \texttt{src\dequals\marg{bib
list}} isn't present in \meta{options} then \meta{basename} also
indicates the name of the associated \filetype{bib} file.

For example, with \app{arara} you can easily determine whether or
not to run \gls{bib2gls}:
\begin{alltt}
\% arara: bib2gls if found("aux", "glsxtr@resource")
\end{alltt}
(It gets more complicated if both \ics*{glsxtr@resource} and
\cs{@istfilename} are present as that indicates the hybrid
\pkgopt+{alsoindex}{record} option.)

Remember that with \gls{bib2gls}, the entries will never be defined
on the first \LaTeX\ call (because their definitions are contained
in the \filetype{glstex} file created by \gls{bib2gls}). You can
also pick up labels from the records in \filetype{aux} file, which
will be in the form:
\begin{alltt}
\ics*{glsxtr@record}\marg{label}\marg{h-prefix}\marg{counter}\marg{format}\marg{loc}
\end{alltt} 
or (with \pkgopt+{nameref}{record})
\begin{alltt}
\ics*{glsxtr@record@nameref}\marg{label}\marg{href prefix}\marg{counter}\marg{format}\marg{location}\marg{title}\marg{href anchor}\marg{href value}
\end{alltt}
or (with \cs{glssee})
\begin{alltt}
\ics*{glsxtr@recordsee}\marg{label}\marg{xr list}
\end{alltt}
You can also pick up the commands defined with
\ics*{glsxtrnewglslike}, which are added to the \filetype{aux} file
for \gls{bib2gls}['s] benefit:
\begin{alltt}
\ics*{@glsxtr@newglslike}\marg{label-prefix}\marg{cs}
\end{alltt}
If \ics*{GlsXtrSetAltModifier} is used, then the modifier is
identified with:
\begin{alltt}
\ics*{@glsxtr@altmodifier}\marg{character}
\end{alltt}
Label prefixes (for the \ics*{dgls} set of commands) are identified
with:
\begin{alltt}
\ics*{@glsxtr@prefixlabellist}\marg{list}
\end{alltt}

\chapter{Package Options}
\label{sec:pkgopts}

This section describes the available \styfmt{glossaries} package
options. You may omit the \texttt{=true} for boolean options. (For
example, \pkgopt{acronym} is equivalent to \pkgopt[true]{acronym}).

\begin{xtr}
The \gls{glossaries-extra} package has additional options described
in the \gls*{glossaries-extra} manual. The extension package also
has some different default settings to the base package. Those that
are available at the time of writing are included here. Future
versions of \gls{glossaries-extra} may have additional package
options or new values for existing settings that aren't listed here. 
\end{xtr}

\begin{important}
Note that \meta{key}=\meta{value} package options can't be passed via the
document class options. (This includes options where the
\meta{value} part may be omitted, such as \pkgopt{acronym}.) This is
a general limitation not restricted to the \styfmt{glossaries}
package. Options that aren't \meta{key}=\meta{value} (such as
\pkgopt{makeindex}) may be passed via the document class options.
\end{important}

\section{General Options}
\label{sec:pkgopts-general}

\pkgoptsec{nowarn} This suppresses all warnings generated by
the \styfmt{glossaries} package. Don't use this option if you're new to using
\styfmt{glossaries} as the warnings are designed to help detect
common mistakes (such as forgetting to use \ics{makeglossaries}).
Note that if you use \pkgopt{debug} with any value other than
\pkgoptfmt{false} it will override this option.

\pkgoptsec{nolangwarn} This suppresses the warning generated by
a missing language module.

\pkgoptsec{noredefwarn} If you load \styfmt{glossaries} with
a~class or another package that already defines glossary related
commands, by default \styfmt{glossaries} will warn you that it's
redefining those commands. If you are aware of the consequences of
using \styfmt{glossaries} with that class or package and you don't
want to be warned about it, use this option to suppress those
warnings. Other warnings will still be issued unless you use the
\pkgopt{nowarn} option described above. (This option is
automatically switched on by \gls{glossaries-extra}.)

\pkgoptsec[value]{debug} Introduced in version 4.24.  The default
setting is \pkgopt[false]{debug}.  The following values are
available: \pkgoptfmt{false}, \pkgoptfmt{true},
\pkgoptfmt{showtargets} (v4.32+) and \pkgoptfmt{showaccsupp}
(v4.45+). If no value is given, \pkgopt[true]{debug} is assumed.

\begin{xtr}
The \gls{glossaries-extra} package provides extra values
\pkgoptval*{showwrgloss}{debug}, that may be used to show where
the indexing is occurring, and \pkgoptval*{all}{debug}, which
switches on all debugging options. See the \gls{glossaries-extra}
manual for further details.
\end{xtr}

All values other than \pkgopt[false]{debug} switch on the debug mode
(and will automatically cancel the \pkgopt{nowarn} option).  The
\pkgopt[showtargets]{debug} option will additionally use:
\begin{definition}[\DescribeMacro\glsshowtarget]
\cs{glsshowtarget}\marg{target name}
\end{definition}
to show the hypertarget or hyperlink name when 
\cs{glsdohypertarget} is used by commands like \cs{glstarget}
and when \cs{glsdohyperlink} is used by commands like \cs{gls}.
In math mode or inner mode, this puts the target name in square
brackets just before the link or anchor. In outer mode it uses:
\begin{definition}[\DescribeMacro\glsshowtargetouter]
\cs{glsshowtargetouter}\marg{label}
\end{definition}
which by default places the target name in the margin. The font is
given by:
\begin{definition}[\DescribeMacro\glsshowtargetfont]
\cs{glsshowtargetfont}
\end{definition}
The default definition is \verb|\ttfamily\small|. This command is
included in the definition of \cs{glsshowtargetouter}, so if you
want to redefine that command remember to include the font. For
example:
\begin{verbatim}
\renewcommand*{\glsshowtargetouter}[1]{%
 {\glsshowtargetfont [#1]}}
\end{verbatim}

Similarly, the \pkgopt[showaccsupp]{debug} will add the
accessibility support information using:
\begin{definition}[\DescribeMacro\glsshowaccsupp]
\cs{glsshowaccsupp}\marg{options}\marg{tag}\marg{replacement text}
\end{definition}
This internally uses \ics{glsshowtarget}. This option is provided
for use with \sty{glossaries-accsupp}.

The purpose of the debug mode can be demonstrated with
the following example document:
\begin{alltt}
\cs{documentclass}\mgroup{article}
\cs{usepackage}\mgroup{glossaries}
\cs{newglossaryentry}\mgroup{sample1}\mgroup{name=\mgroup{sample1},description=\mgroup{example}}
\cs{newglossaryentry}\mgroup{sample2}\mgroup{name=\mgroup{sample2},description=\mgroup{example}}
\strong{\ics{glsadd}}\mgroup{sample2}\% <- does nothing here
\strong{\ics{makeglossaries}}
\cs{begin}\mgroup{document}
\cs{gls}\mgroup{sample1}.
\cs{printglossaries}
\cs{end}\mgroup{document}
\end{alltt}
In this case, only the \texttt{sample1} entry has been indexed, even
though \verb|\glsadd{sample2}| appears in the source code.
This is because \verb|\glsadd{sample2}| has been used before the
associated file is opened by \ics{makeglossaries}. Since the file
isn't open yet, the information can't be written to it, which is why
the \texttt{sample2} entry doesn't appear in the glossary.

Without \cs{makeglossaries} the indexing is suppressed with \optsand23 but, other
than that, commands like \cs{gls} behave as usual.

This situation doesn't cause any errors or warnings as it's
perfectly legitimate for a user to want to use \styfmt{glossaries}
to format the entries (e.g.\ abbreviation expansion) but not display
any lists of terms, abbreviations, symbols etc (or the user may
prefer to use the unsorted \optsor56).
It's also possible that the user may want to temporarily comment out
\cs{makeglossaries} in order to suppress the indexing while working
on a draft version to speed compilation, or the user may
prefer to use \optsor14 for indexing, which don't use \cs{makeglossaries}.

Therefore \cs{makeglossaries} can't be used to enable
\cs{newglossaryentry} and commands like \cs{gls} and \cs{glsadd}.
These commands must be enabled by default. (It does, however, enable
the \gloskey{see} key as that's a more common problem. See below.)

The debug mode, enabled with the \pkgopt{debug} option,
\begin{verbatim}
\usepackage[debug]{glossaries}
\end{verbatim}
will write information to the log file when the indexing
can't occur because the associated file isn't open.
The message is written in the form
\begin{quote}
Package glossaries Info: wrglossary(\meta{type})(\meta{text}) on
input line \meta{line number}.
\end{quote}
where \meta{type} is the glossary label and \meta{text} is the line
of text that would've been written to the associated file if
it had been open. So if any entries haven't appeared in the
glossary but you're sure you used commands like \cs{glsadd}
or \cs{glsaddall}, try switching on the \pkgopt{debug} option
and see if any information has been written to the log file.

\pkgoptsec[boolean]{savewrites} This is a boolean option to minimise the
number of write registers used by the \styfmt{glossaries} package.
The default is \pkgopt[false]{savewrites}. With \optsand23, one
write register is required per (non-ignored) glossary and one for
the style file.

With all options except \optsand14, another write register is
required if the \filetype{docdefs} file is needed to save document
definitions. With both \optsand14, no write registers are required
(document definitions aren't permitted and indexing information is
written to the \filetype{aux} file). If you really need document
definitions but you want to minimise the number of write registers
then consider using \pkgopt+{restricted}{docdef} with
\gls{glossaries-extra}.

There are only a limited number of write registers, and if you have
a large number of glossaries or if you are using a class or other
packages that create a lot of external files, you may exceed the
maximum number of available registers. If \pkgopt{savewrites} is
set, the glossary information will be stored in token registers
until the end of the document when they will be written to the
external files.

\begin{important}
This option can significantly slow document compilation and may
cause the indexing to fail.  Page numbers in the \gls{numberlist}
will be incorrect on page boundaries due to \TeX's asynchronous
output routine.  As an alternative, you can use the \sty{scrwfile}
package (part of the KOMA-Script bundle) and not use this option.
\end{important}

By way of comparison, \nolinkurl{sample-multi2.tex}
provided with \gls{bib2gls} has a total of 15 glossaries. With
\optsor23, this would require 46 associated files and 16
write registers.\footnote{These figures don't include standard files
and registers provided by the kernel or \sty{hyperref}, such as
\filetypefmt{aux} and \filetypefmt{out}.} With
\gls{bib2gls}, no write registers are required and there are only 10
associated files for that particular document (9 resource files and
1 transcript file).

\importantpar[-2][-1ex]
If you want to use \TeX's \ics{write18} mechanism to call
\gls{makeindex} or \gls{xindy} from your document and use
\pkgopt{savewrites}, you must create the external files with 
\cs{glswritefiles} before you call \gls*{makeindex}/\gls*{xindy}. Also set
\cs{glswritefiles} to nothing or \cs{relax} before the end of the
document to avoid rewriting the files. For example:
\begin{verbatim}
\glswritefiles
\write18{makeindex -s \istfilename\space 
-t \jobname.glg -o \jobname.gls \jobname}
\let\glswritefiles\relax
\end{verbatim}

\noindent
In general, this package option is best avoided.

\pkgoptsec[value]{translate} This can take the following values:

  \begin{description}
  \item[{\pkgoptval{true}{translate}}] If \sty{babel} has been loaded
  and the \sty{translator} package is installed, \sty{translator}
  will be loaded and the translations will be provided by the
  \sty{translator} package interface. You can modify the 
  translations by providing your own dictionary. If the 
  \sty{translator} package isn't installed and \sty{babel} is
  loaded, the \sty{glossaries-babel} package will 
  be loaded and the translations will be provided using \styfmt{babel}'s
  \cs{addto}\cs{caption}\meta{language} mechanism. If 
  \sty{polyglossia} has been loaded, \sty{glossaries-polyglossia}
  will be loaded.

  \item[{\pkgoptval{false}{translate}}] Don't provide translations, even
  if \sty{babel} or \sty{polyglossia} has been loaded.
  (Note that \sty{babel} provides the command \ics{glossaryname}
  so that will still be translated if you have loaded \sty{babel}.)

  \item[{\pkgoptval{babel}{translate}}] Don't load the \sty{translator}
package. Instead load \sty{glossaries-babel}.

\begin{important}
I recommend you use \pkgopt[babel]{translate} if you have any
problems with the translations or with PDF bookmarks, but to maintain backward
compatibility, if \sty{babel} has been loaded the default is
\pkgopt[true]{translate}.
\end{important}

  \end{description}

  If \pkgopt{translate} is specified without a value,
  \pkgopt[true]{translate} is assumed. If \pkgopt{translate} isn't
specified, \pkgopt[true]{translate} is assumed if \sty{babel}, 
\sty{polyglossia} or \sty{translator} have been loaded. Otherwise
\pkgopt[false]{translate} is assumed.

\begin{xtr}
With \gls{glossaries-extra}, if \sty{babel} is detected then
\pkgopt[babel]{translate} is automatically passed to the base
\sty{glossaries} package.
\end{xtr}

See \sectionref{sec:fixednames} for further details.

\pkgoptsec{notranslate} This is equivalent to
\pkgopt[false]{translate} and may be passed via the document class
options.

\pkgoptsec[boolean]{hyperfirst} This is a boolean option that specifies
whether each term has a hyperlink on \firstuse. The default is 
\pkgopt[true]{hyperfirst} (terms on \gls{firstuse} have a hyperlink, 
unless explicitly suppressed using starred versions of commands
such as \ics{gls*} or by identifying the glossary with 
\pkgopt{nohypertypes}, described above). Note that
\pkgopt{nohypertypes} overrides \pkgopt[true]{hyperfirst}.
This option only affects commands that check the \firstuseflag, such
as the \glslike\ commands (for example, \ics{gls} or
\ics{glsdisp}), but not the \glstextlike\ commands
(for example, \ics{glslink} or \ics{glstext}). 

The \pkgopt{hyperfirst} setting applies to
all glossary types (unless identified by \pkgopt{nohypertypes} or
defined with \ics{newignoredglossary}). It can be overridden on an
individual basis by explicitly setting the \gloskey[glslink]{hyper} key
when referencing an entry (or by using the plus or starred
version of the referencing command).

It may be that you only want to apply this to just the acronyms
(where the first use explains the meaning of the acronym) but not
for ordinary glossary entries (where the first use is identical to
subsequent uses). In this case, you can use \pkgopt[false]{hyperfirst} and
apply \cs{glsunsetall} to all the regular (non-acronym) glossaries.
For example:
\begin{verbatim}
 \usepackage[acronym,hyperfirst=false]{glossaries}
 % acronym and glossary entry definitions

 % at the end of the preamble
 \glsunsetall[main]
\end{verbatim}

Alternatively you can redefine the hook
\begin{definition}[\DescribeMacro\glslinkcheckfirsthyperhook]
\cs{glslinkcheckfirsthyperhook}
\end{definition}
which is used by the commands that check the \firstuseflag, such
as \ics{gls}. Within the definition of this command, you can use
\ics{glslabel} to reference the entry label and \ics{glstype} to
reference the glossary type. You can also use \ics{ifglsused}
to determine if the entry has been used. You can test if an entry is
an acronym by checking if it has the \gloskey{long} key set using
\ics{ifglshaslong}. For example, to switch off the hyperlink on
first use just for acronyms:
\begin{verbatim}
\renewcommand*{\glslinkcheckfirsthyperhook}{%
 \ifglsused{\glslabel}{}%
 {%
   \ifglshaslong{\glslabel}{\setkeys{glslink}{hyper=false}}{}%
 }%
}
\end{verbatim}

Note that this hook isn't used by the commands that don't check the
\firstuseflag, such as \ics{glstext}. (You can, instead, redefine
\ics{glslinkpostsetkeys}, which is used by both the \glslike\ and
\glstextlike\ commands.)

The \gls{glossaries-extra} package provides a method of disabling
the \gls{firstuse} hyperlink according to the entry's associated
category. For example, if you only to switch off the \gls{firstuse}
hyperlink for abbreviations and acronyms then you simply need to set
the \attr{nohyperfirst} attribute for the \texttt{abbreviation}
and \texttt{acronym} categories. (Instead of using the
\pkgopt{nohyperfirst} package option.) See the
\gls{glossaries-extra} manual for further details.

\pkgoptsec{writeglslabels} This is a valueless option that
will create a file called \cs{jobname}\texttt{.}\filetype{glslabels} at the end
of the document. This file simply contains a list of all defined
entry labels (including those in any ignored glossaries). It's
provided for the benefit of text editors that need to know labels
for \Index{auto-completion}. (See also \gls{glossaries-extra}['s]
\pkgopt+{atom}{docdef} package option.)

\begin{bib2gls}
Note that with \gls{bib2gls} the file will only contain the entries
that \gls{bib2gls} has selected from the \filetype{bib} files.
\end{bib2gls}

\xtrpkgoptsec[value]{undefaction}

The value may be one of:
\begin{description}
 \item[\pkgoptfmt{error}] generate an error if a referenced entry is
  undefined (default, and only available setting with just
  \styfmt{glossaries});
 \item[\pkgoptfmt{warn}] only warn if a referenced entry is
  undefined (automatically activated with \opt4).
\end{description}

\xtrpkgoptsec[value]{docdef}

This option governs the use of \cs{newglossaryentry}. Available
values:
\begin{description}
\item[\pkgoptfmt{false}] \cs{newglossaryentry} is not permitted in
the \env{document} environment (default with \gls{glossaries-extra}
and for \opt1 with just the base \styfmt{glossaries} package);

\item[\pkgoptfmt{restricted}] \cs{newglossaryentry} is only permitted in
the \env{document} environment if it occurs before
\cs{printglossary} (not available for some indexing options);

\item[\pkgoptfmt{atom}] as \pkgoptfmt{restricted} but creates the
\filetype{docdefs} file for use by \app{atom} (without the
limitations of \pkgopt+{true}{docdef});

\item[\pkgoptfmt{true}] \cs{newglossaryentry} is permitted in the
\env{document} environment where it would normally be permitted by
the base \styfmt{glossaries} package. This will create the
\filetype{docdefs} file if \cs{newglossaryentry} is found in the
\env{document} environment.
\end{description}

\section{Sectioning, Headings and TOC Options}
\label{sec:pkgopts-sec}

\pkgoptsec[boolean]{toc} Add the glossaries to the table of contents.
Note that an extra \LaTeX\ run is required with this option.
Alternatively, you can switch this function on and off using
\begin{definition}[\DescribeMacro{\glstoctrue}]
\cs{glstoctrue}
\end{definition}
and
\begin{definition}[\DescribeMacro{\glstocfalse}]
\cs{glstocfalse}
\end{definition}
The default value is \pkgopt[false]{toc} for the base
\styfmt{glossaries} package and \pkgopt[true]{toc} for
\gls{glossaries-extra}.

\pkgoptsec[boolean]{numberline} When used with the above
\pkgopt[true]{toc} option, this will
add \ics{numberline}\verb|{}| in the final argument of 
\ics{addcontentsline}. This will align the table of contents entry 
with the numbered section titles. Note that this option has no
effect if the \pkgopt{toc} option is omitted. If \pkgopt{toc} is
used without \pkgopt{numberline}, the title will be aligned with
the section numbers rather than the section titles.

\pkgoptsec[value]{section} 

This option indicates the sectional unit to use for the glossary.
The value should be the control sequence \emph{name} without the
leading backslash or following star (e.g.\ just \texttt{chapter}
not \cs{chapter} or \texttt{chapter*}).

The default behaviour is for the glossary heading to use
\cs{chapter}, if that command exists, or \cs{section} otherwise. The
starred or unstarred form is determined by the \pkgopt{numberedsection} option.

Example:
\begin{verbatim}
\usepackage[section=subsection]{glossaries}
\end{verbatim}
You can omit the value if you want to use \cs{section}, i.e.\
\begin{verbatim}
\usepackage[section]{glossaries}
\end{verbatim}
is equivalent to
\begin{verbatim}
\usepackage[section=section]{glossaries}
\end{verbatim}
You can change this value later in the document using
\begin{definition}[\DescribeMacro{\setglossarysection}]
\cs{setglossarysection}\marg{name}
\end{definition}
where \meta{name} is the sectional unit.

The start of each glossary adds information to the page header via
\begin{definition}[\DescribeMacro{\glsglossarymark}]
\cs{glsglossarymark}\marg{glossary title}
\end{definition}
By default this uses \cs{@mkboth}\footnote{unless \cls{memoir} is
loaded, which case it uses \ics{markboth}} but you may 
need to redefine it.
For example, to only change the right header:
\begin{verbatim}
\renewcommand{\glsglossarymark}[1]{\markright{#1}}
\end{verbatim}
or to prevent it from changing the headers:
\begin{verbatim}
\renewcommand{\glsglossarymark}[1]{}
\end{verbatim}
If you want \cs{glsglossarymark} to use \cs{MakeUppercase} in the header, use the
\pkgopt{ucmark} option described below.

Occasionally you may find that another package defines 
\cs{cleardoublepage} when it is not required. This may cause an 
unwanted blank page to appear before each glossary. This can
be fixed by redefining \DescribeMacro\glsclearpage\cs{glsclearpage}:
\begin{verbatim}
\renewcommand*{\glsclearpage}{\clearpage}
\end{verbatim}

\pkgoptsec[boolean]{ucmark} This is a boolean option. The default is
\pkgopt[false]{ucmark}, unless \cls{memoir} has been loaded, in
which case the default is \pkgopt[true]{ucmark}.

If set, \ics{glsglossarymark} uses
\ics{MakeTextUppercase}\footnote{Actually it uses
\ics{mfirstucMakeUppercase} which is set to \sty{textcase}'s \cs{MakeTextUppercase}
by the
\styfmt{glossaries} package. This makes it consistent with
\ics{makefirstuc}. (The \sty{textcase} package is automatically
loaded by \styfmt{glossaries}.)}.
You can test whether this option has been set or not using
\begin{definition}
\ics{ifglsucmark} \meta{true part}\cs{else} \meta{false part}\cs{fi}
\end{definition}
For example:
\begin{verbatim}
\renewcommand{\glsglossarymark}[1]{%
  \ifglsucmark
    \markright{\MakeTextUppercase{#1}}%
  \else
    \markright{#1}%
  \fi}
\end{verbatim}
If \cls{memoir} has been loaded and \pkgopt{ucmark} is set, then
\cls{memoir}'s \ics{memUChead} is used.

\pkgoptsec[value]{numberedsection}
The glossaries are placed in unnumbered sectional units by default,
but this can be changed using \pkgopt{numberedsection}. This option can take
one of the following values:
\begin{itemize}
\item \pkgoptval{false}{numberedsection}: no number, i.e.\ use starred form
of sectioning command (e.g.\ \cs{chapter*} or \cs{section*});

\item \pkgoptval{nolabel}{numberedsection}:
use a numbered section, i.e.\ the unstarred form of sectioning
command (e.g.\ \cs{chapter} or \cs{section}), but 
the section not labelled;

\item \pkgoptval{autolabel}{numberedsection}: numbered with automatic
labelling. Each glossary uses the unstarred form of a sectioning
command (e.g.\ \cs{chapter} or \cs{section}) and is assigned a label
(via \ics{label}). The label is formed from 
\begin{definition}[\DescribeMacro{\glsautoprefix}]
\cs{glsautoprefix} \meta{type}
\end{definition}
where 
\meta{type} is the label identifying that glossary. The default
value of \cs{glsautoprefix} is empty.  For example, if you load \styfmt{glossaries}
using:
\begin{verbatim}
\usepackage[section,numberedsection=autolabel]
  {glossaries}
\end{verbatim}
then each glossary will appear in a numbered section, and can
be referenced using something like:
\begin{verbatim}
The main glossary is in section~\ref{main} and 
the list of acronyms is in section~\ref{acronym}.
\end{verbatim}
If you can't decide whether to have the acronyms in the main
glossary or a separate list of acronyms, you can use
\ics{acronymtype} which is set to \texttt{main} if the
\pkgopt{acronym} option is not used and is set to \texttt{acronym}
if the \pkgopt{acronym} option is used. For example:
\begin{verbatim}
The list of acronyms is in section~\ref{\acronymtype}.
\end{verbatim}
You can redefine the prefix if the default label clashes with
another label in your document.
For example:
\begin{verbatim}
\renewcommand*{\glsautoprefix}{glo:}
\end{verbatim}
will add \texttt{glo:} to the automatically generated label, so
you can then, for example, refer to the list of acronyms as follows:
\begin{verbatim}
The list of acronyms is in 
section~\ref{glo:\acronymtype}.
\end{verbatim}
Or, if you are undecided on a prefix:
\begin{verbatim}
The list of acronyms is in 
section~\ref{\glsautoprefix\acronymtype}.
\end{verbatim}

\item \pkgoptval{nameref}{numberedsection}: this is like
\pkgoptval{autolabel}{numberedsection} but uses an unnumbered
sectioning command (e.g.\ \ics{chapter*} or \ics{section*}). It's
designed for use with the \sty{nameref} package. For example:
\begin{verbatim}
\usepackage{nameref}
\usepackage[numberedsection=nameref]{glossaries}
\end{verbatim}
Now \verb|\nameref{main}| will display the (TOC) section title
associated with the \texttt{main} glossary. As above, you can
redefine \cs{glsautoprefix} to provide a prefix for the label.
\end{itemize}

\section{Glossary Appearance Options}
\label{sec:pkgopts-printglos}

\pkgoptsec[boolean]{savenumberlist} This is a boolean option that
specifies whether or not to gather and store the \gls{numberlist}
for each entry. The default is \pkgopt[false]{savenumberlist}. (See
\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist} in
\sectionref{sec:glsnolink}.) This is always true if you
use \opt1.

\begin{bib2gls}
If you use the \pkgopt*{record} option (with either no value or
\pkgopt+{only}{record} or \pkgopt+{nameref}{record}) then this
package option has no effect. With \gls{bib2gls}, the
\glspl{numberlist} are automatically saved with the default
\resourceopt[true]{save-locations} and
\resourceopt[true]{save-loclist} resource settings.
\end{bib2gls}

\pkgoptsec[boolean]{entrycounter} This is a boolean option. (Default
is \pkgopt[false]{entrycounter}.) If set, each main (level~0)
glossary entry will be numbered when using the standard glossary
styles. This option creates the counter
\DescribeCounter{glossaryentry}\ctrfmt{glossaryentry}.

If you use this option, you can reference the entry number
within the document using
\begin{definition}[\DescribeMacro{\glsrefentry}]
\cs{glsrefentry}\marg{label}
\end{definition}
where \meta{label} is the label associated with that glossary entry.
The labelling systems uses \meta{prefix}\meta{label}, where
\meta{label} is the entry's label and \meta{prefix} is given by
\begin{definition}[\DescribeMacro\GlsEntryCounterLabelPrefix]
\cs{GlsEntryCounterLabelPrefix}
\end{definition}
(which defaults to \texttt{glsentry-}).

\begin{important}
If you use \cs{glsrefentry}, you must run \LaTeX\ twice after
creating the glossary files using \gls{makeglossaries},
\gls{makeindex} or \gls{xindy} to ensure the cross-references are
up-to-date.
\end{important}

\pkgoptsec[value]{counterwithin} This is a \meta{key}=\meta{value}
option where \meta{value} is the name of a counter. If used, this
option will automatically set \pkgopt[true]{entrycounter} and the
\ctr{glossaryentry} counter will be reset every time \meta{value} is
incremented.


\begin{important}
The \ctr{glossaryentry} counter isn't automatically reset at the
start of each glossary, except when glossary section numbering is on
and the counter used by \pkgopt{counterwithin} is the same as the
counter used in the glossary's sectioning command.
\end{important}

If you want the counter reset at the start of each glossary, you can
modify the glossary preamble (\ics{glossarypreamble}) to use
\begin{definition}[\DescribeMacro{\glsresetentrycounter}]
\cs{glsresetentrycounter}
\end{definition}
which sets \ctr{glossaryentry} to zero:
\begin{verbatim}
\renewcommand{\glossarypreamble}{%
  \glsresetentrycounter
}
\end{verbatim}
or if you are using \ics{setglossarypreamble}, add it to each
glossary preamble, as required. For example:
\begin{verbatim}
\setglossarypreamble[acronym]{%
  \glsresetentrycounter
  The preamble text here for the list of acronyms.
}
\setglossarypreamble{%
  \glsresetentrycounter
  The preamble text here for the main glossary.
}
\end{verbatim}

\pkgoptsec[boolean]{subentrycounter} This is a boolean option. (Default
is \pkgopt[false]{subentrycounter}.) If set, each level~1
glossary entry will be numbered when using the standard glossary
styles. This option creates the counter
\DescribeCounter{glossarysubentry}\ctrfmt{glossarysubentry}.
The counter is reset with each main (level~0) entry. Note that this
package option is independent of \pkgopt{entrycounter}. You can
reference the number within the document using
\ics{glsrefentry}\marg{label} where \meta{label} is the label
associated with the sub-entry.

\pkgoptsec[value]{style} This is a \meta{key}=\meta{value} option.
(Default is \pkgopt[list]{style}, unless \sty{classicthesis}
has been loaded, in which case the default is \pkgopt[index]{style}.) Its value should be the name of
the glossary style to use. This key may only be used for styles
defined in \sty{glossary-list}, \sty{glossary-long},
\sty{glossary-super} or \sty{glossary-tree}. Alternatively, you can
set the style using
\begin{definition}
\cs{setglossarystyle}\marg{style name}
\end{definition}
(See \sectionref{sec:styles} for further details.)

\pkgoptsec{nolong} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-long} (which means that
the \sty{longtable} package also won't be loaded). This reduces
overhead by not defining unwanted styles and commands. Note that if
you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-long} package (unless
you explicitly load \sty{glossary-long}).

\pkgoptsec{nosuper} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-super} (which means that
the \sty{supertabular} package also won't be loaded). This reduces
overhead by not defining unwanted styles and commands. Note that if
you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-super} package
(unless you explicitly load \sty{glossary-super}).

\pkgoptsec{nolist} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-list}. This reduces
overhead by not defining unwanted styles. Note that if
you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-list} package
(unless you explicitly load \sty{glossary-list}).
Note that since the default style is \glostyle{list} (unless
\sty{classicthesis} has been loaded), you will 
also need to use the \pkgopt{style} option to set the style to
something else.

\pkgoptsec{notree} This prevents the \styfmt{glossaries} package
from automatically loading \sty{glossary-tree}. This reduces
overhead by not defining unwanted styles. Note that if
you use this option, you won't be able to use any of the
glossary styles defined in the \styfmt{glossary-tree} package
(unless you explicitly load \sty{glossary-tree}). Note that if
\sty{classicthesis} has been loaded, the default style is
\glostyle{index}, which is provided by \sty{glossary-tree}.

\pkgoptsec{nostyles} This prevents all the predefined styles
from being loaded. If you use this option, you need to load a
glossary style package (such as \sty{glossary-mcols}). Also if you
use this option, you can't use the \pkgopt{style} package option.
Instead you must either use \ics{setglossarystyle}\marg{style} or the
\gloskey[printglossary]{style} key in the optional argument to
\ics{printglossary}. Example:
\begin{verbatim}
\usepackage[nostyles]{glossaries}
\usepackage{glossary-mcols}
\setglossarystyle{mcoltree}
\end{verbatim}

\pkgoptsec{nonumberlist} This option will suppress the 
associated \glspl{numberlist} in the glossaries (see also 
\sectionref{sec:numberlists}). Note that if you use \optsor23
(\gls{makeindex} or \gls{xindy}) then the locations must still be
valid. This package option merely prevents the \gls{numberlist}
from being displayed, but both \gls{makeindex} and \gls{xindy}
still require a location or cross-reference for each term that's
indexed. Remember that \gls{numberlist} includes any
cross-references, so suppressing the \gls{numberlist} will also hide
the cross-references (see below).

\pkgoptsec{seeautonumberlist} If you suppress the
\glspl{numberlist} with \pkgopt{nonumberlist}, described above, this
will also suppress any cross-referencing information supplied by the
\gloskey{see} key in \ics{newglossaryentry} or \ics{glssee}. If you
use \pkgopt{seeautonumberlist}, the \gloskey{see} key will
automatically implement \gloskey{nonumberlist=false} for that entry.
(Note this doesn't affect \cs{glssee}.) For further details see
\sectionref{sec:crossref}.

\pkgoptsec[value]{counter} This is a \meta{key}=\meta{value} option.
(Default is \pkgopt[page]{counter}.) The value should be the name of
the default counter to use in the \glspl{numberlist}
(see \sectionref{sec:numberlists}).

\pkgoptsec[boolean]{nopostdot} This is a boolean option. If no value is
specified, \pkgoptval{true}{nopostdot} is assumed. When set to
\pkgoptval{true}{nopostdot}, this option suppresses the default post
description dot used by some of the predefined styles.

The default setting is \pkgopt[false]{nopostdot} for the base
\styfmt{glossaries} package and \pkgopt[true]{nopostdot} for
\gls{glossaries-extra}.

\begin{xtr}
The \gls{glossaries-extra} package provides \pkgopt*{postdot}, which
is equivalent to \pkgopt[false]{nopostdot}, and also
\pkgopt*{postpunc}, which allows you to choose a different
punctuation character.
\end{xtr}

\pkgoptsec[boolean]{nogroupskip} This is a boolean option. If no value is
specified, \pkgoptfmt{true} is assumed. When set to \pkgoptfmt{true}, this
option suppresses the default vertical gap between letter groups used by
some of the predefined styles. The default setting is
\pkgopt[false]{nogroupskip}.

\begin{bib2gls}
If you are using \gls{bib2gls} without the \texttt{-{}-group} (or
\texttt{-g}) switch then you don't need to use 
\pkgoptfmt{nogroupskip\dequals true} as there won't be any letter
groups.
\end{bib2gls}

\xtrpkgoptsec[list]{stylemods}

Load the \sty{glossaries-extra-stylemods} package and patch the
predefined styles. The \meta{list} argument is optional. If present,
this will also load \styfmt{glossary-\meta{element}.sty} for each
\meta{element} in the comma-separated \meta{list}.

\section{Indexing Options}
\label{sec:pkgopts-indexing}

\pkgoptsec[value]{seenoindex} Introduced in version 4.24, this option
may take one of three values: \pkgoptfmt{error}, \pkgoptfmt{warn} or
\pkgoptfmt{ignore}. The \gloskey{see} key automatically indexes the
cross-referenced entry using \cs{glsadd}. This means that if this
key is used in an entry definition before the relevant
glossary file has been opened, the indexing can't be performed.
Since this is easy to miss, the \styfmt{glossaries} package by
default issues an error message if the \gloskey{see} key is used
before \ics{makeglossaries}. This option allows you to change the
error into just a warning (\pkgopt[warn]{seenoindex}) or 
ignore it (\pkgopt[ignore]{seenoindex}) if, for example, you want
to temporarily comment out \cs{makeglossaries} to speed up the
compilation of a draft document by omitting the indexing.

\pkgoptsec[boolean]{esclocations} This is a boolean option. The
default is \pkgopt[true]{esclocations}, which is needed for
\optsand23. With \opt1 \ics{makenoidxglossaries} changes it to
\pkgopt[false]{esclocations}. With \opt4 (\gls{bib2gls}), this
setting is ignored.

Both \gls{makeindex} and \gls{xindy} are fussy about the location
formats (\gls{makeindex} more so than \gls{xindy}) so the
\styfmt{glossaries} package tries to ensure that special characters
are escaped and allows for the location to be substituted for a
format that's more acceptable to the indexing application. This
requires a bit of trickery to circumvent the problem posed by \TeX's
asynchronous output routine, which can go wrong and also adds to the
complexity of the document build.

If you're sure that your locations will always expand to an
acceptable format (or you're prepared to post-process the glossary
file before passing it to the relevant indexing application) then
use \pkgopt[false]{esclocations} to avoid the complex escaping of
location values. (See \ifpdf section~\ref*{sec:wrgloss} \fi
\qt{Writing information to associated files} in the documented code
for further details.)

This isn't an issue for \optsor14 as the locations are written to
the \filetype{aux} file so no syntax conversion is required.

\pkgoptsec[boolean]{indexonlyfirst} This is a boolean option that specifies
whether to only add information to the external glossary file on
\gls{firstuse}. The default is \pkgopt[false]{indexonlyfirst}, 
which will add a line to the file every time one of the 
\glslike\ or \glstextlike\ commands are used. Note that \ics{glsadd}
will always add information to the external glossary
file\footnote{bug fix in v4.16 has corrected the code to ensure
this.}\ (since that's the purpose of that command).

\begin{important}
Resetting the \gls{firstuseflag} with commands like
\ics{glsreset} after an entry has been indexed will cause that entry to be 
indexed multiple times if it's used again after the reset.
Likewise unsetting the \gls{firstuseflag} before an entry has been
indexed will prevent it from being indexed (unless specifically
indexed with \cs{glsadd}).
\end{important}

You can customise this by redefining
\begin{definition}[\DescribeMacro\glswriteentry]
\cs{glswriteentry}\marg{label}\marg{wr-code}
\end{definition}
where \meta{label} is the entry's label and \meta{wr-code} is the
code that writes the entry's information to the external file.
The default definition of \cs{glswriteentry} is:
\begin{verbatim}
\newcommand*{\glswriteentry}[2]{%
  \ifglsindexonlyfirst
    \ifglsused{#1}{}{#2}%
  \else
    #2%
  \fi
}
\end{verbatim}
This checks the \pkgopt{indexonlyfirst} package option (using
\cs{ifglsindexonlyfirst}) and does \meta{wr-code} if this is
\pkgoptfmt{false} otherwise it only does \meta{wr-code} of the entry
hasn't been used.

For example, suppose you only want to index the first use for
entries in the \texttt{acronym} glossary and not in the
\texttt{main} (or any other) glossary:
\begin{verbatim}
\renewcommand*{\glswriteentry}[2]{%
 \ifthenelse{\equal{\glsentrytype{#1}}{acronym}}
 {\ifglsused{#1}{}{#2}}%
 {#2}%
}
\end{verbatim}
Here I've used \cs{ifthenelse} to ensure the arguments of
\cs{equal} are fully expanded before the comparison is made.

With the \gls{glossaries-extra} package it's possible to only index
\gls{firstuse} for particular categories. For example, if you only
want this enabled for abbreviations and acronyms then you can set
the \attr{indexonlyfirst} attribute for the \texttt{abbreviation}
and \texttt{acronym} categories. (Instead of using the
\pkgopt{indexonlyfirst} package option.) See the
\gls{glossaries-extra} manual for further details.

\xtrpkgoptsec[boolean]{indexcrossrefs}

If \pkgoptfmt{true}, this will automatically index any
cross-referenced entries that haven't been marked as used at the end
of the document. Increases document build time. See
\gls{glossaries-extra} manual for further details.

\xtrpkgoptsec[boolean]{autoseeindex}

If \pkgoptfmt{true}, makes the \gloskey{see} and
\xtrgloskey{seealso} keys automatically index the cross-reference
when the entry is defined (default, and the only option with just
the base \styfmt{glossaries} package).

\xtrpkgoptsec[value]{record}

If not \pkgoptfmt{off}, this option indicates that \gls{bib2gls}
is required. If the value is omitted, \pkgoptfmt{only} is assumed. Permitted values:
\begin{description}
\item[\pkgoptfmt{off}] \gls{bib2gls} isn't being used;

\item[\pkgoptfmt{only}] \gls{bib2gls} is being used to fetch entries
from a \filetype{bib} file, to sort the entries and collate the
\glspl{numberlist}, where the location information is the same as
for \optsto13;

\item[\pkgoptfmt{nameref}] like \pkgoptfmt{only} but provides extra
information that allows the associated title to be used instead of
the location number;

\item[\pkgoptfmt{alsoindex}] a hybrid approach where \gls{bib2gls}
is begin used to fetch entries from a \filetype{bib} file but
\gls{makeindex} or \gls{xindy} are used for the indexing. This
requires a more complicated document build and isn't recommended.
\end{description}
See \gls{glossaries-extra} manual for further details.

\xtrpkgoptsec[boolean]{equations}

If \pkgoptfmt{true}, this option will cause the default location
counter to automatically switch to \texttt{equation} when inside a
numbered equation environment.

\xtrpkgoptsec[boolean]{floats}

If \pkgoptfmt{true}, this option will cause the default location
counter to automatically switch to the corresponding counter when inside a
float. (Remember that with floats it's the \cs{caption} command that
increments the counter so the location will be incorrect if an entry
is indexed within the float before the caption.)

\xtrpkgoptsec{indexcounter}

This valueless option is primarily intended for use with
\gls{bib2gls} and \sty{hyperref} allowing the page location
hyperlink to the relevant point in the page (rather than the top of
the page). Unexpected results will occur with other indexing
methods. See \gls{glossaries-extra} manual for further details.

\section{Sorting Options}
\label{sec:pkgopts-sort}

This section is mostly for \optsand23. Only the \pkgopt{sort} and
\pkgopt{order} options are applicable for \opt1.

\begin{xtr}
With \optsto46, only \pkgopt[none]{sort} is applicable (and this is
automatically implemented by \pkgopt+{only}{record} and
\pkgopt+{nameref}{record}). With \gls{bib2gls}, the sort method 
is provided in the optional argument of \ics*{GlsXtrLoadResources} 
not with the \pkgoptfmt{sort} package option. There's no sorting
with \optsand56.
\end{xtr}

\pkgoptsec[boolean]{sanitizesort} This is a boolean option that
determines whether or not to \gls{sanitize} the sort value when
writing to the external glossary file. For example, suppose you
define an entry as follows:
\begin{verbatim}
\newglossaryentry{hash}{name={\#},sort={#},
 description={hash symbol}}
\end{verbatim}
The sort value (\verb|#|) must be sanitized before writing it to the
glossary file, otherwise \LaTeX\ will try to interpret it as a
parameter reference. If, on the other hand, you want the sort value
expanded, you need to switch off the sanitization. For example,
suppose you do:
\begin{verbatim}
\newcommand{\mysortvalue}{AAA}
\newglossaryentry{sample}{%
  name={sample},
  sort={\mysortvalue},
  description={an example}}
\end{verbatim}
and you actually want \cs{mysortvalue} expanded, so that the entry
is sorted according to \texttt{AAA}, then use the package option
\pkgopt[false]{sanitizesort}.

The default for \optsand23 is \pkgopt[true]{sanitizesort}, and the
default for \opt1 is \pkgopt[false]{sanitizesort}.

\pkgoptsec[value]{sort} If you use \optsor23, this package option is
the only way of specifying how to sort the glossaries. Only \opt1 
allows you to specify sort methods for individual glossaries
via the \gloskey[printnoidxglossary]{sort} key in the optional
argument of \ics{printnoidxglossary}. If you have multiple
glossaries in your document and you are using \opt1, only use
the package options
\pkgopt[def]{sort} or \pkgopt[use]{sort} if you want to set this
sort method for \emph{all} your glossaries.

This is a \meta{key}=\meta{value} option where
\meta{value} may be one of the following:
\begin{itemize}
\item \pkgoptval{standard}{sort} : entries are sorted according to
the value of the \gloskey{sort} key used in \ics{newglossaryentry}
(if present) or the \gloskey{name} key (if \gloskey{sort} key is
missing);

\item \pkgoptval{def}{sort} : entries are sorted in the order in
which they were defined (the \gloskey{sort} key in
\cs{newglossaryentry} is ignored);

\item \pkgoptval{use}{sort} : entries are sorted according to the
order in which they are used in the document (the \gloskey{sort} key
in \cs{newglossaryentry} is ignored).

Both \pkgopt[def]{sort} and \pkgopt[use]{sort} set the sort key to a
six digit number via
\begin{definition}[\DescribeMacro\glssortnumberfmt]
\cs{glssortnumberfmt}\marg{number}
\end{definition}
(padded with leading zeros, where necessary). This can be 
redefined, if required, before the entries are defined (in the
case of \pkgopt[def]{sort}) or before the entries are used
(in the case of \pkgopt[use]{sort}).

\item \pkgoptval{none}{sort} : this setting is new to version 4.30
and is only for documents that don't use \cs{makeglossaries} (\optsor23)
or \cs{makenoidxglossaries} (\opt1). It omits the code used to sanitize
or escape the sort value, since it's not required. This can help to
improve the document build speed, especially if there are a large
number of entries. 

This option
can't be used with \cs{printglossary} or \cs{printnoidxglossary}
(or the iterative versions \cs{printglossaries} or
\cs{printnoidxglossaries}). It may be used with
\gls{glossaries-extra}'s \cs{printunsrtglossary} (\opt5).
\end{itemize}
Note that the group styles (such as \glostyle{listgroup}) are
incompatible with the \pkgopt[use]{sort} and \pkgopt[def]{sort}
options.

The default is \pkgopt[standard]{sort}. When the standard sort
option is in use, you can hook into the sort mechanism by
redefining:
\begin{definition}[\DescribeMacro{\glsprestandardsort}]
\cs{glsprestandardsort}\marg{sort cs}\marg{type}\marg{label}
\end{definition}
where \meta{sort cs} is a temporary control sequence that stores the
sort value (which was either explicitly set via the \gloskey{sort}
key or implicitly set via the \gloskey{name} key) before any escaping of the
\gls{makeindex}\slash\gls{xindy} special characters is performed.
By default \cs{glsprestandardsort} just does:
\begin{definition}[\DescribeMacro{\glsdosanitizesort}]
\cs{glsdosanitizesort}
\end{definition}
which \gls{sanitize}[s] \meta{sort cs} if the \pkgopt{sanitizesort} package 
option is set (or does nothing if the package option 
\pkgopt[false]{sanitizesort} is used).

The other arguments, \meta{type} and \meta{label}, are the 
glossary type and the entry label for the current entry. Note that
\meta{type} will always be a control sequence, but \meta{label} will
be in the form used in the first argument of \ics{newglossaryentry}.

\begin{important}
Redefining \cs{glsprestandardsort} won't affect any entries that 
have already been defined and will have no effect at all if you 
are using \pkgopt[def]{sort} or \pkgopt[use]{sort}.
\end{important}

\begin{example}{Mixing Alphabetical and Order of Definition Sorting}{ex:diffsorts}
Suppose I have three glossaries: \texttt{main},
\texttt{acronym} and \texttt{notation}, and let's suppose
I want the \texttt{main} and \texttt{acronym} glossaries to be
sorted alphabetically, but the \texttt{notation} type should be
sorted in order of definition. 

For \opt1, the \gloskey[printnoidxglossary]{sort} option can be
used in \ics{printnoidxglossary}:
\begin{verbatim}
\printnoidxglossary[sort=word]
\printnoidxglossary[type=acronym,sort=word]
\printnoidxglossary[type=notation,sort=def]
\end{verbatim}

For \optsor23, I can set the sort to \texttt{standard}
(which is the default, but can be explicitly set via the
package option \pkgopt[standard]{sort}), and I can either define
all my \texttt{main} and \texttt{acronym} entries, then
redefine \cs{glsprestandardsort} to set \meta{sort cs} to
an incremented integer, and then define all my
\texttt{notation} entries. Alternatively, I can redefine
\cs{glsprestandardsort} to check for the glossary type and only
modify \meta{sort cs} if \meta{type} is \texttt{notation}.

The first option can be achieved as follows:
\begin{verbatim}
\newcounter{sortcount}

\renewcommand{\glsprestandardsort}[3]{%
  \stepcounter{sortcount}%
  \edef#1{\glssortnumberfmt{\arabic{sortcount}}}%
}
\end{verbatim}
The second option can be achieved as follows:
\begin{verbatim}
\newcounter{sortcount}

\renewcommand{\glsprestandardsort}[3]{%
  \ifdefstring{#2}{notation}%
  {%
     \stepcounter{sortcount}%
     \edef#1{\glssortnumberfmt{\arabic{sortcount}}}%
  }%
  {%
     \glsdosanitizesort
  }%
}
\end{verbatim}
(\cs{ifdefstring} is defined by the \sty{etoolbox} package.)
For a complete document, see the sample file \samplefile{Sort}.
\end{example}

\begin{example}{Customizing Standard Sort (Options 2 or 3)}{ex:customsort}
Suppose you want a glossary of people and you want the names listed
as \meta{first-name} \meta{surname} in the glossary, but you want the names
sorted by \meta{surname}, \meta{first-name}. You can do this by
defining a command called, say,
\cs{name}\marg{first-name}\marg{surname} that you can use in the
\gloskey{name} key when you define the entry, but hook into the
standard sort mechanism to temporarily redefine \cs{name} while the
sort value is being set.

First, define two commands to set the person's name:
\begin{verbatim}
\newcommand{\sortname}[2]{#2, #1}
\newcommand{\textname}[2]{#1 #2}
\end{verbatim}
and \cs{name} needs to be initialised to \cs{textname}:
\begin{verbatim}
\let\name\textname
\end{verbatim}
Now redefine \cs{glsprestandardsort} so that it temporarily sets
\cs{name} to \cs{sortname} and expands the sort value, then sets
\cs{name} to \cs{textname} so that the person's name appears as
\meta{first-name} \meta{surname} in the text:
\begin{verbatim}
\renewcommand{\glsprestandardsort}[3]{%
 \let\name\sortname
 \edef#1{\expandafter\expandonce\expandafter{#1}}%
 \let\name\textname
 \glsdosanitizesort
}
\end{verbatim}
(The somewhat complicate use of \cs{expandafter} etc helps to
protect fragile commands, but care is still needed.)

Now the entries can be defined:
\begin{verbatim}
\newglossaryentry{joebloggs}{name={\name{Joe}{Bloggs}},
  description={some information about Joe Bloggs}}

\newglossaryentry{johnsmith}{name={\name{John}{Smith}},
  description={some information about John Smith}}
\end{verbatim}
For a complete document, see the sample file \samplefile{People}.
\end{example}

\pkgoptsec[value]{order} This may take two values: 
\pkgoptval{word}{order} or \pkgoptval{letter}{order}. The default
is word ordering.

\begin{important}
Note that with \optsand23, the \pkgopt{order} option has no effect if you don't use 
\gls{makeglossaries}.
\end{important}

If you use \opt1, this setting will be used if you use 
\gloskey[printnoidxglossary]{sort}\texttt{=standard} in 
the optional argument of \ics{printnoidxglossary}:
\begin{verbatim}
\printnoidxglossary[sort=standard]
\end{verbatim}
Alternatively, you can specify the order for individual glossaries:
\begin{verbatim}
\printnoidxglossary[sort=word]
\printnoidxglossary[type=acronym,sort=letter]
\end{verbatim}

\begin{bib2gls}
With \gls{bib2gls}, use the \resourceopt{break-at} option
in \ics*{GlsXtrLoadResources} instead of \pkgoptfmt{order}.
\end{bib2gls}

\pkgoptsec{makeindex} (\opt2) The glossary information and
indexing style file will be written in \gls{makeindex} format. If
you use \gls{makeglossaries}, it will automatically detect that it
needs to call \gls*{makeindex}. If you don't use
\gls*{makeglossaries}, you need to remember to use \gls*{makeindex}
not \gls{xindy}. The indexing style file will been given 
a~\filetype{ist} extension.

You may omit this package option if you are using \opt2 as this is the
default. It's available in case you need to override the effect of an earlier
occurrence of \pkgopt{xindy} in the package option list.

\pkgoptsec{xindy} (\opt3) The glossary information and indexing style
file will be written in \gls{xindy} format. If you use
\gls{makeglossaries}, it will automatically detect that it needs to
call \gls*{xindy}. If you don't use \gls*{makeglossaries}, you need to
remember to use \gls*{xindy} not \gls{makeindex}. The indexing style
file will been given a \filetype{xdy} extension.

This package option may additionally have a value that
is a \meta{key}=\meta{value} comma-separated list to override the
language and codepage. For example:
\begin{verbatim}
\usepackage[xindy={language=english,codepage=utf8}]
  {glossaries}
\end{verbatim}
You can also specify whether you want a number group in the
glossary. This defaults to true, but can be suppressed. For example:
\begin{verbatim}
\usepackage[xindy={glsnumbers=false}]{glossaries}
\end{verbatim}
If no value is supplied to this package option (either simply
writing \texttt{xindy} or writing \verb|xindy={}|) then the
language, codepage and number group settings are unchanged.  See
\sectionref{sec:xindy} for further details on using \gls{xindy} with
the \styfmt{glossaries} package.

\pkgoptsec{xindygloss}  (\opt3) This is equivalent to
\verb|xindy={}| (that is, the \pkgopt{xindy} option without any value
supplied) and may be used as a document class option. The language
and code page can be set via \ics{GlsSetXdyLanguage} and
\ics{GlsSetXdyCodePage} (see \sectionref{sec:langenc}.)

\pkgoptsec{xindynoglsnumbers} (\opt3) This is equivalent to
\verb|xindy={glsnumbers=false}| and may be used as a document class
option.

\pkgoptsec[value]{automake} This is option was introduced to
version 4.08 as a boolean option. As from version 4.42 it may now
take three values: \texttt{false} (default), \texttt{true}
or \texttt{immediate}. If no option is supplied, \texttt{immediate}
is assumed.
The option \pkgopt[true]{automake} will attempt to run \gls{makeindex} or \gls{xindy} using
\TeX's \ics{write18} mechanism at the end of the document.
The option \pkgopt[immediate]{automake} will attempt to 
run \gls{makeindex} or \gls{xindy} at the start of
\ics{makeglossaries} using \cs{immediate} (before the glossary files have been opened).

In the case of \pkgopt[true]{automake}, the associated files
are created at the end of the document ready for the next \LaTeX\
run. Since there is a possibility of commands such as \cs{gls}
occurring on the last page of the document, it's not possible
to use \cs{immediate} to close the associated file or with
\cs{write18} since the writing of the final indexing lines may
have been delayed. In certain situations this can mean that
the \cs{write18} fails. In such cases, you will need to use
\pkgopt[immediate]{automake} instead.

With \pkgopt[immediate]{automake}, you will get a warning on
the first \LaTeX\ run as the associated glossary files don't exist
yet.

Since this mechanism can be a security risk, some \TeX\
distributions disable it completely, in which case this option won't
have an effect. (If this option doesn't appear to work, search the
log file for \qt{runsystem} and see if it is followed by
\qt{enabled} or \qt{disabled}.)

Some distributions allow \cs{write18} in a restricted mode.
This mode has a~limited number of trusted applications, which
usually includes \gls{makeindex} but may not include \gls{xindy}. So
if you have the restricted mode on, \pkgopt{automake} should work
with \gls*{makeindex} but may not work with \gls{xindy}.

However even in unrestricted mode this option may not work with
\gls*{xindy} as \gls*{xindy} uses language names that don't always
correspond with \ics{babel}'s language names. (The
\gls{makeglossaries} script applies mappings to assist you.)
Note that you still need at least two \LaTeX\ runs to ensure the document
is up-to-date with this setting.

Since this package option attempts to run the \gls{indexingapp} on
every \LaTeX\ run, its use should be considered a last resort for
those who can't work out how to incorporate the \gls*{indexingapp}
into their document build. The default value for this option is
\pkgopt[false]{automake}.

\pkgoptsec{disablemakegloss} This valueless option 
indicates that \ics{makeglossaries} and \ics{makenoidxglossaries}
should be disabled. This option is provided in the event that you
have to use a class or package that disregards the advice in
\sectionref{sec:indexingoptions} and automatically performs
\ics{makeglossaries} or \ics{makenoidxglossaries} but you don't want
this.  (For example, you want to use a different indexing method or 
you want to disable indexing while working on a draft
document.)

This option may be passed in the standard document class option list
or passed using \cs{PassOptionsToPackage} before \sty{glossaries} is
loaded. Note that this does nothing if
\ics{makeglossaries} or \ics{makenoidxglossaries} has already 
been used whilst enabled.

\pkgoptsec{restoremakegloss} Cancels the effect of
\pkgopt{disablemakegloss}. This option may be used in
\cs{setupglossaries}. It issues a warning if \ics{makeglossaries} or
\ics{makenoidxglossaries} has already been used whilst enabled. 
For example, suppose the class \clsfmt{customclass.cls}
automatically loads \styfmt{glossaries} and does \cs{makeglossaries}
but you need an extra glossary, which has to be defined before
\cs{makeglossaries}, then you can do:
\begin{verbatim}
\documentclass[disablemakegloss]{customclass}
\newglossary*{functions}{Functions}
\setupglossaries{restoremakegloss}
\makeglossaries
\end{verbatim}
or
\begin{verbatim}
\PassOptionsToPackage{disablemakegloss}{glossaries}
\documentclass{customclass}
\newglossary*{functions}{Functions}
\setupglossaries{restoremakegloss}
\makeglossaries
\end{verbatim}

Note that restoring these commands doesn't necessarily mean that they can be
used. It just means that their normal behaviour given the current
settings will apply. For example, if you use the \pkgopt+{only}{record}
or \pkgopt+{nameref}{record} options with \gls{glossaries-extra}
then you can't use \cs{makeglossaries} or \cs{makenoidxglossaries}
regardless of \pkgopt{restoremakegloss}.

\section{Glossary Type Options}
\label{sec:pkgopts-type}

\pkgoptsec[list]{nohypertypes} Use this option if you have multiple
glossaries and you want to suppress the entry hyperlinks for a
particular glossary or glossaries. The value of this option should
be a comma-separated list of glossary types where \ics{gls} etc
shouldn't have hyperlinks by default. Make sure you enclose the
value in braces if it contains any commas. Example:
\begin{verbatim}
\usepackage[acronym,nohypertypes={acronym,notation}]
  {glossaries}
\newglossary[nlg]{notation}{not}{ntn}{Notation}
\end{verbatim}
The values must be fully expanded, so \strong{don't} try
\texttt{nohypertypes\discretionary{}{}{}=\ics{acronymtype}}. You may also use
\begin{definition}
\ics{GlsDeclareNoHyperList}\marg{list}
\end{definition}
instead or additionally.
See \sectionref{sec:glslink} for further details.

\pkgoptsec{nomain} This suppresses the creation of the main
glossary and associated \filetype{glo} file, if unrequired. Note that
if you use this option, you must create another glossary in which to
put all your entries (either via the \pkgopt{acronym} (or
\pkgopt{acronyms}) package option described in
\sectionref{sec:pkgopts-acronym} or via the \pkgopt{symbols},
\pkgopt{numbers} or \pkgopt{index} options described in
\sectionref{sec:pkgopts-other} or via \ics{newglossary} described in
\sectionref{sec:newglossary}).

\begin{important}
If you don't use the main glossary and you don't use this option,
\gls{makeglossaries} will produce a warning.
\end{important}
\begin{alltt}
Warning: File '\emph{filename}.glo' is empty.
Have you used any entries defined in glossary 
'main'?
Remember to use package option 'nomain' if 
you don't want to use the main glossary.
\end{alltt}
If you did actually want to use the main glossary and you see this
warning, check that you have referenced the entries in that glossary
via commands such as \ics{gls}.

\pkgoptsec{symbols} This valueless option defines a new glossary type with
the label \texttt{symbols} via
\begin{verbatim}
\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
\end{verbatim}
It also defines
\begin{definition}[\DescribeMacro\printsymbols]
\cs{printsymbols}\oarg{options}
\end{definition}
which is a synonym for
\begin{alltt}
\ics{printglossary}[type=symbols,\meta{options}]
\end{alltt}

If you use \opt1, you need to use:
\begin{alltt}
\ics{printnoidxglossary}[type=symbols,\meta{options}]
\end{alltt}
to display the list of symbols.

\begin{important}
Remember to use the \pkgopt{nomain} package option if you're only
interested in using this \texttt{symbols} glossary and don't intend
to use the \texttt{main} glossary.
\end{important}

\begin{xtr}
The \gls{glossaries-extra} package has a slightly modified
version of this option which additionally provides \ics*{glsxtrnewsymbol}
as a convenient shortcut method for defining symbols. See the
\gls{glossaries-extra} manual for further details.
\end{xtr}

\pkgoptsec{numbers} This valueless option defines a new glossary type with
the label \texttt{numbers} via
\begin{verbatim}
\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}
\end{verbatim}
It also defines
\begin{definition}[\DescribeMacro\printnumbers]
\cs{printnumbers}\oarg{options}
\end{definition}
which is a synonym for
\begin{alltt}
\ics{printglossary}[type=numbers,\meta{options}]
\end{alltt}

If you use \opt1, you need to use:
\begin{alltt}
\ics{printnoidxglossary}[type=numbers,\meta{options}]
\end{alltt}
to display the list of numbers.

\begin{important}
Remember to use the \pkgopt{nomain} package option if you're only
interested in using this \texttt{numbers} glossary and don't intend
to use the \texttt{main} glossary.
\end{important}

\begin{xtr}
The \gls{glossaries-extra} package has a slightly modified
version of this option which additionally provides \ics*{glsxtrnewnumber}
as a convenient shortcut method for defining numbers. See the
\gls{glossaries-extra} manual for further details.
\end{xtr}

\pkgoptsec{index} This valueless option defines a new glossary type with
the label \texttt{index} via
\begin{verbatim}
\newglossary[ilg]{index}{ind}{idx}{\indexname}%
\end{verbatim}
It also defines
\begin{definition}[\DescribeMacro\newterm]
\cs{newterm}\oarg{options}\marg{term}
\end{definition}
which is a synonym for
\begin{alltt}
\ics{newglossaryentry}\marg{term}[type=index,name=\marg{term},%
description=\ics{nopostdesc},\meta{options}]
\end{alltt}
and
\begin{definition}[\DescribeMacro\printindex]
\cs{printindex}\oarg{options}
\end{definition}
which is a synonym for
\begin{alltt}
\ics{printglossary}[type=index,\meta{options}]
\end{alltt}

If you use \opt1, you need to use:
\begin{alltt}
\ics{printnoidxglossary}[type=index,\meta{options}]
\end{alltt}
to display this glossary.

\begin{important}
Remember to use the \pkgopt{nomain} package option if you're only
interested in using this \texttt{index} glossary and don't intend to
use the \texttt{main} glossary. Note that you
can't mix this option with \ics{index}. Either use
\styfmt{glossaries} for the indexing or use a~custom indexing
package, such as \sty{makeidx}, \sty{index} or \sty{imakeidx}.
(You can, of course, load one of those packages and 
load \styfmt{glossaries} without the \pkgopt{index} package option.)
\end{important}

Since the index isn't designed for terms with descriptions, you
might also want to disable the hyperlinks for this glossary using
the package option \pkgopt[index]{nohypertypes} or the command
\begin{display}
\ics{GlsDeclareNoHyperList}\verb|{index}|
\end{display}

The example file \samplefile{-index} illustrates the use of the
\pkgopt{index} package option.

\pkgoptsec{noglossaryindex} This valueless option switches off \pkgopt{index}
if \pkgopt{index} has been passed implicitly (for example,
through global document options). This option can't be used
in \cs{setupglossaries}.


\section{Acronym and Abbreviation Options}
\label{sec:pkgopts-acronym}

\pkgoptsec[boolean]{acronym} If true, this creates a new glossary with the
label \texttt{acronym}. This is equivalent to:
\begin{verbatim}
\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
\end{verbatim}
It will also define
\begin{definition}[\DescribeMacro\printacronyms]
\cs{printacronyms}\oarg{options}
\end{definition}
that's equivalent to
\begin{alltt}
\ics{printglossary}[type=acronym,\meta{options}]
\end{alltt}
(unless that command is already defined before the beginning of the
document or the package option \pkgopt{compatible-3.07} is used).

If you are using \opt1, you need to use
\begin{alltt}
\ics{printnoidxglossary}[type=acronym,\meta{options}]
\end{alltt}
to display the list of acronyms.

If the \pkgopt{acronym} package option is used, \ics{acronymtype}
is set to \texttt{acronym} otherwise it is set to 
\texttt{main}.\footnote{Actually it sets \ics{acronymtype} to
\ics{glsdefaulttype} if the \pkgopt{acronym} package option is
not used, but \ics{glsdefaulttype} usually has the value
\texttt{main} unless the \pkgopt{nomain} option has been used.} 
Entries that are defined using \ics{newacronym} are placed in
the glossary whose label is given by \ics{acronymtype}, unless
another glossary is explicitly specified.

\begin{important}
Remember to use the \pkgopt{nomain} package option if you're only
interested in using this \texttt{acronym} glossary. (That is, you
don't intend to use the \texttt{main} glossary.)
\end{important}

\begin{xtr}
The \gls{glossaries-extra} extension package comes with an analogous
\pkgopt*{abbreviations} option, which creates a new glossary with
the label \texttt{abbreviations} and sets the command
\ics*{glsxtrabbrvtype} to this. If the \pkgopt{acronym} option hasn't
also been used, then \ics{acronymtype} will be set to
\ics*{glsxtrabbrvtype}. This enables both \ics{newacronym} and
\ics*{newabbreviation} to use the same glossary.

Make sure you have at least v1.42 of \gls{glossaries-extra} if you
use the \pkgopt{acronym} (or \pkgopt{acronyms}) package option with
the extension package to avoid a bug that interferes with the
abbreviation style.
\end{xtr}

\pkgoptsec{acronyms} This is equivalent to
\pkgopt[true]{acronym} and may be used in the document class option
list.

\xtrpkgoptsec{abbreviations}

This valueless option creates a new glossary type using:
\begin{verbatim}
\newglossary[glg-abr]{abbreviations}{gls-abr}{glo-abr}{\abbreviationsname}
\end{verbatim}
The label can be accessed with \ics*{glsxtrabbrvtype}, which is
analogous to \cs{acronymtype}. See \gls{glossaries-extra} manual for
further details.

\pkgoptsec[value]{acronymlists} By default, only the \cs{acronymtype}
glossary is considered to be a list of acronyms. If you have other
lists of acronyms, you can specify them as a comma-separated list
in the value of \pkgopt{acronymlists}. For example, if you use the
\pkgopt{acronym} package option but you also want the \texttt{main} 
glossary to also contain a list of acronyms, you can do:
\begin{verbatim}
\usepackage[acronym,acronymlists={main}]{glossaries}
\end{verbatim}
No check is performed to determine if the listed glossaries exist,
so you can add glossaries you haven't defined yet. For example:
\begin{verbatim}
\usepackage[acronym,acronymlists={main,acronym2}]
  {glossaries}
\newglossary[alg2]{acronym2}{acr2}{acn2}%
  {Statistical Acronyms}
\end{verbatim}
You can use
\begin{definition}[\DescribeMacro\DeclareAcronymList]
\cs{DeclareAcronymList}\marg{list}
\end{definition}
instead of or in addition to the \pkgopt{acronymlists} option.
This will add the glossaries given in \meta{list} to the list of glossaries
that are identified as lists of acronyms. To replace the list of acronym lists
with a new list use:
\begin{definition}[\DescribeMacro\SetAcronymLists]
\cs{SetAcronymLists}\marg{list}
\end{definition}

You can determine if a glossary has been identified as being a list
of acronyms using:
\begin{definition}[\DescribeMacro\glsIfListOfAcronyms]
\cs{glsIfListOfAcronyms}\marg{label}\marg{true part}\marg{false part}
\end{definition}

\begin{xtr}
This option is incompatible with \gls{glossaries-extra}['s]
abbreviation mechanism.
\end{xtr}

\pkgoptsec{shortcuts} This option provides shortcut commands
for acronyms.  See \sectionref{sec:acronyms} for further details.
Alternatively you can use:
\begin{definition}[\DescribeMacro\DefineAcronymSynonyms]
\cs{DefineAcronymSynonyms}
\end{definition}

\begin{xtr}
The \gls{glossaries-extra} package provides additional shortcuts.
\end{xtr}

\subsection{Deprecated Acronym Style Options}
\label{sec:pkgopts-old-acronym}

The package options listed in this section are now deprecated but
are kept for backward-compatibility. Use \ics{setacronymstyle}
instead. See \sectionref{sec:acronyms} for further details.

\deppkgoptsec{description} This option changes the definition of
\ics{newacronym} to allow a description.
This option may be replaced by
\begin{verbatim}
\setacronymstyle{long-short-desc}
\end{verbatim}
or (with \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{long-sc-short-desc}
\end{verbatim}
or (with \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{long-sm-short-desc}
\end{verbatim}
or (with \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-desc}
\end{verbatim}
or (with \deprecatedpkgopt{footnote} and \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
or (with \deprecatedpkgopt{footnote} and \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}
or (with \deprecatedpkgopt{dua})
\begin{verbatim}
\setacronymstyle{dua-desc}
\end{verbatim}

\deppkgoptsec{smallcaps} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed. 
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{long-sc-short}
\end{verbatim}
or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{long-sc-short-desc}
\end{verbatim}
or (with \deprecatedpkgopt{description} and \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}

\deppkgoptsec{smaller} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed.
\begin{important}
If you use this option, you will need to include the \sty{relsize}
package or otherwise define \ics{textsmaller} or redefine
\ics{acronymfont}.
\end{important}
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{long-sm-short}
\end{verbatim}
or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{long-sm-short-desc}
\end{verbatim}
or (with \deprecatedpkgopt{description} and \deprecatedpkgopt{footnote})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}

\deppkgoptsec{footnote} This option changes the definition of
\ics{newacronym} and the way that acronyms are displayed.
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{footnote}
\end{verbatim}
or (with \deprecatedpkgopt{smallcaps})
\begin{verbatim}
\setacronymstyle{footnote-sc}
\end{verbatim}
or (with \deprecatedpkgopt{smaller})
\begin{verbatim}
\setacronymstyle{footnote-sm}
\end{verbatim}
or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-desc}
\end{verbatim}
or (with \deprecatedpkgopt{smallcaps} and \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
or (with \deprecatedpkgopt{smaller} and \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{footnote-sm-desc}
\end{verbatim}

\deppkgoptsec{dua} This option changes the definition of
\ics{newacronym} so that acronyms are always expanded. 
This option may be replaced by:
\begin{verbatim}
\setacronymstyle{dua}
\end{verbatim}
or (with \deprecatedpkgopt{description})
\begin{verbatim}
\setacronymstyle{dua-desc}
\end{verbatim}

\section{Other Options}
\label{sec:pkgopts-other}

Other available options that don't fit any of the above categories
are described below.

\xtrpkgoptsec{accsupp}

Load the \sty{glossaries-accsupp} package.

\xtrpkgoptsec{prefix}

Load the \sty{glossaries-prefix} package.

\xtrpkgoptsec[boolean]{nomissingglstext}

This option may be used to suppress the boilerplate text generated
by \cs{printglossary} if the glossary file is missing.

\pkgoptsec[boolean]{compatible-2.07} Compatibility mode for old documents
created using version 2.07 or below.

\pkgoptsec[boolean]{compatible-3.07} Compatibility mode for old documents
created using version 3.07 or below.

\pkgoptsec[value]{kernelglossredefs} As a legacy from the precursor
\sty{glossary} package, the standard glossary commands provided
by the \LaTeX\ kernel (\cs{makeglossary} and \cs{glossary}) are
redefined in terms of the \styfmt{glossaries} package's commands.
However, they were never documented in this user manual, and the
conversion guide (\htmldoc{Upgrading from the glossary package to the
glossaries package}{glossary2glossaries}) explicitly discourages
their use.

The use of those kernel commands (instead of the appropriate
commands documented in this user guide) are deprecated, and you will
now get a warning if you try using them.

In the event that you require the original form of these kernel
commands, for example, if you need to use the \styfmt{glossaries}
package with another class or package that also performs 
glossary-style indexing, then you can restore these commands to
their previous definition (that is, their definitions prior to
loading the \styfmt{glossaries} package) with the package option
\pkgopt[false]{kernelglossredefs}. You may also need to use the 
\pkgopt{nomain} option in the event of file extension conflicts.
(In which case, you must provide a new default glossary for use with
the \sty{glossaries} package.)

This option may take one of three values: \pkgoptfmt{true}
(redefine with warnings, default), \pkgoptfmt{false} (restore
previous definitions) or \pkgoptfmt{nowarn} (redefine without
warnings, not recommended).

The only glossary-related commands provided by the \LaTeX\
kernel are \cs{makeglossary} and \cs{glossary}. Other packages
or classes may provide additional glossary-related commands or
environments that conflict with \styfmt{glossaries} (such as
\cs{printglossary} and \env{theglossary}). These non-kernel commands
aren't affected by this package option, and you will have to find
some way to resolve the conflict if you require both glossary
mechanisms. (The \sty{glossaries} package will override the existing
definitions of \cs{printglossary} and \env{theglossary}.)

In general, if possible, it's best to stick with just one package that
provides a glossary mechanism. (The \styfmt{glossaries} package does
check for the \sty{doc} package and patches \cs{PrintChanges}.)

\section{Setting Options After the Package is Loaded}
\label{sec:setupglossaries}

Some of the options described above may also be set after the
\styfmt{glossaries} package has been loaded using
\begin{definition}[\DescribeMacro{\setupglossaries}]
\cs{setupglossaries}\marg{key-val list}
\end{definition}
The following package options \strong{can't} be used in
\cs{setupglossaries}: \pkgopt{xindy}, \pkgopt{xindygloss},
\pkgopt{xindynoglsnumbers}, \pkgopt{makeindex},
\pkgopt{nolong}, \pkgopt{nosuper}, \pkgopt{nolist},
\pkgopt{notree}, \pkgopt{nostyles}, \pkgopt{nomain},
\pkgopt{compatible-2.07}, \pkgopt{translate}, \pkgopt{notranslate}, 
\pkgopt{acronym}. These options have to be set while the package is
loading, except for the \pkgopt{xindy} sub-options which can be set
using commands like \ics{GlsSetXdyLanguage} (see
\sectionref{sec:xindy} for further details).

\begin{important}
If you need to use this command, use it as soon as
possible after loading \styfmt{glossaries} otherwise you might 
end up using it too late for the change to take effect. For example, 
if you try changing the acronym styles (such as \deprecatedpkgopt{smallcaps}) 
after you have started defining your acronyms, you are likely to get 
unexpected results. If you try changing the sort option after you have 
started to define entries, you may get unexpected results.
\end{important}

\chapter{Setting Up}
\label{sec:setup}

In the preamble you need to indicate whether you want to use \opt1,
\opt2 or \opt3. It's not possible to mix these options within
a~document, although some combinations are possible with
\gls*{glossaries-extra}. (For \optsand45 see the \gls{bib2gls} and 
\gls{glossaries-extra} manuals.)

\section[Option 1]{\ifpdf\opt1\else Option 1\fi}
\label{sec:setupopt1}

The command
\begin{definition}[\DescribeMacro{\makenoidxglossaries}]
\cs{makenoidxglossaries}
\end{definition}
must be placed in the preamble. This sets up the internal commands
required to make \opt1 work.
\strong{If you omit \cs{makenoidxglossaries} none of
the glossaries will be displayed.}

\section[Options 2 and 3]{\ifpdf\optsand23\else Options 2 and 3\fi}
\label{sec:setupopt23}

The command
\begin{definition}[\DescribeMacro{\makeglossaries}]
\cs{makeglossaries}
\end{definition}
must be placed in the preamble in order to create the customised
\gls{makeindex} (\filetype{ist}) or \gls{xindy} (\filetype{xdy})
style file (for \optsor23, respectively) and to ensure that glossary 
entries are written to the appropriate output files. 
\strong{If you omit \cs{makeglossaries} none of
the glossary files will be created.}

\begin{xtr}
If you are using \gls{glossaries-extra}, \cs{makeglossaries} has an
optional argument that allows you to have a hybrid of \optsor12 or
\optsor13. See \gls{glossaries-extra} manual for further details.
\end{xtr}

\importantpar
Note that some of the commands provided by the \styfmt{glossaries}
package must not be used after \cs{makeglossaries} as they are
required when creating the customised style file. If you attempt
to use those commands after \cs{makeglossaries} you will generate
an error.
Similarly, there are some commands that must not be used before
\cs{makeglossaries}.

You can suppress the creation of the customised \gls{xindy}
or \gls{makeindex} style file using
\begin{definition}[\DescribeMacro{\noist}]
\cs{noist}
\end{definition}
That this command must not be used after \cs{makeglossaries}.
\begin{important}
Note that if you have a custom \filetype{xdy} file created when using 
\styfmt{glossaries} version 2.07 or below, you will need to use the
\pkgopt{compatible-2.07} package option with it.
\end{important}

The default name for the customised style file is given by
\ics{jobname}\filetype{ist} (\opt2) or 
\ics{jobname}\filetype{xdy} (\opt3). This name may be
changed using:
\begin{definition}[\DescribeMacro{\setStyleFile}]
\cs{setStyleFile}\marg{name}
\end{definition}
where \meta{name} is the name of the style file without the 
extension. Note that this command must not be used after
\cs{makeglossaries}.

Each glossary entry is assigned a \gls{numberlist} that lists all 
the locations in the document where that entry was used. By default,
the location refers to the page number but this may be overridden
using the \pkgopt{counter} package option. The default form of
the location number assumes a full stop compositor (e.g.\ 1.2),
but if your location numbers use a different compositor (e.g. 1-2)
you need to set this using
\begin{definition}[\DescribeMacro{\glsSetCompositor}]
\cs{glsSetCompositor}\marg{symbol}
\end{definition}
For example:
\begin{verbatim}
\glsSetCompositor{-}
\end{verbatim}
This command must not be used after \cs{makeglossaries}.

If you use \opt3, you can have a different compositor for page
numbers starting with an upper case alphabetical character using:
\begin{definition}[\DescribeMacro{\glsSetAlphaCompositor}]
\cs{glsSetAlphaCompositor}\marg{symbol}
\end{definition}
This command has no effect if you use \opt2. For example, if you want 
\glspl{numberlist} containing a mixture of A-1 and 2.3 style
formats, then do:
\begin{verbatim}
\glsSetCompositor{.}\glsSetAlphaCompositor{-}
\end{verbatim}
See \sectionref{sec:numberlists} for further information about
\glspl{numberlist}.

\chapter{Defining Glossary Entries}
\label{sec:newglosentry}

All glossary entries must be defined before they are used, so it is
better to define them in the preamble to ensure this. In fact, some
commands such as \cs{longnewglossaryentry}
may only be used in the preamble. See \sectionref{sec:docdefs} for
a discussion of the problems with defining entries within the
document instead of in the preamble. (The \gls{glossaries-extra}
package has an option that provides a restricted form of document 
definitions that avoids some of the issues discussed in 
\sectionref{sec:docdefs}.)
\begin{important}
\opt1 enforces the preamble-only restriction on
\ics{newglossaryentry}. \opt4 requires that definitions are provided
in \filetype{bib} format. \opt5 requires either preamble-only
definitions or the use of the \gls{glossaries-extra} package option
\optfmt{docdef=restricted}.
\end{important}

Only those entries that are indexed in the document 
(using any of the commands described in
\sectionref{sec:glslink}, \sectionref{sec:glsadd} or
\sectionref{sec:crossref}) will appear in the glossary. See
\sectionref{sec:printglossary} to find out how to display the
glossary.


New glossary entries are defined using the command:
\begin{definition}[\DescribeMacro{\newglossaryentry}]
\cs{newglossaryentry}\marg{label}\marg{key=value list}
\end{definition}
This is a short command, so values in \meta{key-val list} can't
contain any paragraph breaks. Take care to enclose values containing
any commas (\texttt{,}) or equal signs (\texttt{=}) with braces to hide them
from the key=value list parser.

If you have a long description that
needs to span multiple paragraphs, use
\begin{definition}[\DescribeMacro{\longnewglossaryentry}]
\cs{longnewglossaryentry}\marg{label}\marg{key=value
list}\marg{long description}
\end{definition}
instead. Note that this command may only be used in the preamble.
Be careful of unwanted spaces. \cs{longnewglossaryentry} 
will remove trailing spaces in the description (via \cs{unskip})
but won't remove leading spaces. This command also appends
\cs{nopostdesc} to the end of the description, which suppresses the
post-description hook. The \gls{glossaries-extra} package provides
a starred version of \cs{longnewglossaryentry} that doesn't append
either \cs{unskip} or \cs{nopostdesc}.

There are also commands that will only define the entry if it
hasn't already been defined:
\begin{definition}[\DescribeMacro\provideglossaryentry]
\cs{provideglossaryentry}\marg{label}\marg{key=value list}
\end{definition}
and
\begin{definition}[\DescribeMacro\longprovideglossaryentry]
\cs{longprovideglossaryentry}\marg{label}\marg{key=value
list}\marg{long description}
\end{definition}
(These are both preamble-only commands.)

For all the above commands, the first argument, \meta{label}, must be 
a~unique label with which to identify this entry. \strong{This can't contain
any non-expandable commands or active characters.} The reason for
this restriction is that the label is used to construct internal commands
that store the associated information (similarly to commands
like \cs{label}) and therefore must be able to expand to a valid
control sequence name.

\begin{important}
Note that although an \gls{exlatinchar} or other \gls{nonlatinchar}, 
such as \'e or \ss, looks like a plain character in your
\texttt{.tex} file, it's actually a~macro (an active character) and
therefore can't be used in the label. (This applies to \LaTeX\
rather than \XeLaTeX.) Also be careful of
\sty{babel}'s options that change certain punctuation characters
(such as \texttt{:} or \texttt{-}) to active characters.
\end{important}

The second argument, \meta{key=value list}, is
a \meta{key}=\meta{value} list that supplies the relevant
information about this entry. There are two required fields:
\gloskey{description} and either \gloskey{name} or \gloskey{parent}.
The description is set in the third argument of
\cs{longnewglossaryentry} and \cs{longprovideglossaryentry}. With
the other commands it's set via the \gloskey{description} key.
As is typical with \meta{key}=\meta{value} lists, values that contain 
a comma or equal sign must be enclosed in braces. Available fields
are listed below. Additional fields are provided by the
supplementary packages \sty{glossaries-prefix}
(\sectionref{sec:prefix}) and \sty{glossaries-accsupp}
(\sectionref{sec:accsupp}) and also by \gls{glossaries-extra}.
You can also define your own custom keys (see
\sectionref{sec:addkey}).

\begin{description}
\item[{\gloskey{name}}] The name of the entry (as it will appear in 
the glossary). If this key is omitted and the \gloskey{parent}
key is supplied, this value will be the same as the parent's name.

\begin{important}
If the \gloskey{name} key contains any commands, you must also
use the \gloskey{sort} key (described below) if you intend sorting the entries
alphabetically, otherwise the entries can't be sorted correctly.
\end{important}

\item[{\gloskey{description}}] A brief description of this term (to
appear in the glossary). Within this value, you can use:
\begin{definition}[\DescribeMacro{\nopostdesc}]
\cs{nopostdesc}
\end{definition}
to suppress the
description terminator for this entry. For example, if this
entry is a parent entry that doesn't require a description, you
can do \texttt{description\dequals\mgroup{\cs{nopostdesc}}}. If you want a paragraph
break in the description use:
\begin{definition}[\DescribeMacro{\glspar}]
\cs{glspar}
\end{definition}
or, better, use \cs{longnewglossaryentry}.
However, note that not all glossary styles support multi-line
descriptions. If you are using one of the tabular-like glossary
styles that permit multi-line descriptions, use \ics{newline}
not \verb"\\" if you want to force a line break.

\begin{xtr}
With \gls{glossaries-extra}, use \ics*{glsxtrnopostpunc} instead of
\cs{nopostdesc} to suppress the post-description punctuation.
\end{xtr}

\item[{\gloskey{parent}}] The label of the parent entry. Note that
the parent entry must be defined before its sub-entries.
See \sectionref{sec:subentries} for further details.

\item[{\gloskey{descriptionplural}}] The plural form of the
description, if required. If omitted, the value
is set to the same as the \gloskey{description} key.

\item[{\gloskey{text}}] How this entry will appear in the document text
when using \ics{gls} (or one of its upper case variants). If this
field is omitted, the value of the \gloskey{name} key is used.

\item[{\gloskey{first}}] How the entry will appear in the document text
on \firstuse\ with \ics{gls} (or one of its upper case
variants). If this field is omitted, the value of the \gloskey{text}
key is used. Note that if you use \ics{glspl}, \ics{Glspl},
\ics{GLSpl}, \ics{glsdisp} before using \ics{gls}, the
\gloskey{firstplural} value won't be used with \ics{gls}.

\item[{\gloskey{plural}}] How the entry will appear in the document text
when using \ics{glspl} (or one of its upper case variants).  If this
field is omitted, the value is obtained by appending
\ics{glspluralsuffix} to the value of the \gloskey{text} field.  The
default value of \ics{glspluralsuffix} is the letter \qt{s}.

\item[{\gloskey{firstplural}}] How the entry will appear in the
document text on \firstuse\ with \ics{glspl} (or one of its
upper case variants). If this field is omitted, the value is obtained
from the \gloskey{plural} key, if the \gloskey{first} key is omitted,
or by appending \ics{glspluralsuffix} to the value of the
\gloskey{first} field, if the \gloskey{first} field is present. Note
that if you use \ics{gls}, \ics{Gls}, \ics{GLS}, \cs{glsdisp} before
using \ics{glspl}, the \gloskey{firstplural} value won't be used
with \ics{glspl}.

\importantpar
Note: prior to version 1.13, the default value of 
\gloskey{firstplural} was always taken by appending \qt{s} to the
\gloskey{first} key, which meant that you had to specify both
\gloskey{plural} and \gloskey{firstplural}, even if you hadn't
used the \gloskey{first} key.

\item[{\gloskey{symbol}}] This field is provided to allow the user
to specify an associated symbol. If omitted, the value is set to
\cs{relax}. Note that not all glossary styles display the symbol.

\item[{\gloskey{symbolplural}}] This is the plural form of the
symbol (as passed to \ics{glsdisplay} and \ics{glsdisplayfirst}
by \ics{glspl}, \ics{Glspl} and \ics{GLSpl}). If omitted, the value
is set to the same as the \gloskey{symbol} key.

\item[{\gloskey{sort}}] This value indicates how this entry should
be sorted. If omitted, the value is given
by the \gloskey{name} field unless one of the package options
\pkgopt[def]{sort} and \pkgopt[use]{sort} have been used. In
general, it's best to use the \gloskey{sort} key if the
\gloskey{name} contains commands (e.g.\ \verb|\ensuremath{\alpha}|).
You can also override the \gloskey{sort} key by redefining
\ics{glsprestandardsort} (see \sectionref{sec:pkgopts-sort}).

\begin{bib2gls}
The \gloskey{sort} key shouldn't be used with \gls{bib2gls}. It has
a system of fallbacks that allow different types of entries to
obtain the sort value from the most relevant field. See the
\gls{bib2gls} manual for further details and see also
\bibglsgallery{sorting}.
\end{bib2gls}

\opt1 by default strips the \glslink{latexexlatinchar}{standard
\LaTeX\ accents} (that is, accents generated by core \LaTeX\ commands) from the
\gloskey{name} key when it sets the \gloskey{sort} key. So with
\opt1:
\begin{verbatim}
\newglossaryentry{elite}{%
  name={{\'e}lite},
  description={select group of people}
}
\end{verbatim}
This is equivalent to:
\begin{verbatim}
\newglossaryentry{elite}{%
  name={{\'e}lite},
  description={select group of people},
  sort={elite}
}
\end{verbatim}
Unless you use the package option \pkgopt[true]{sanitizesort}, in
which case it's equivalent to:
\begin{verbatim}
\newglossaryentry{elite}{%
  name={{\'e}lite},
  description={select group of people},
  sort={\'elite}
}
\end{verbatim}
This will place the entry before the \qt{A} letter group since the
sort value starts with a symbol.

Similarly if you use the \sty{inputenc} package:
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
  name=\mgroup{\mgroup{\'e}lite},
  description=\mgroup{select group of people}
}
\end{alltt}
This is equivalent to
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
  name=i\mgroup{\mgroup{\'e}lite},
  description=\mgroup{select group of people},
  sort=elite
}
\end{alltt}
Unless you use the package option \pkgopt[true]{sanitizesort}, in
which case it's equivalent to:
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
  name=\mgroup{\mgroup{\'e}lite},
  description=\mgroup{select group of people},
  sort=\'elite
}
\end{alltt}
Again, this will place the entry before the \qt{A} group.

With \optsand23, the default value of \gloskey{sort} will either be
set to the \gloskey{name} key (if \pkgopt[true]{sanitizesort}) or it
will set it to the expansion of the \gloskey{name} key (if
\pkgopt[false]{sanitizesort}).

\begin{important}
Take care with \gls{xindy} (\opt3): if you have entries with the same
\gloskey{sort} value they will be treated as the
same entry. If you use \gls{xindy} and aren't using the \texttt{def}
or \texttt{use} sort methods, \strong{always} use the \gloskey{sort}
key for entries where the name just consists of a control sequence
(for example \texttt{name=\{\cs{alpha}\}}).

Take care if you use \opt1 and the \gloskey{name} contains fragile
commands. You will either need to explicitly set the \gloskey{sort}
key or use the \pkgopt[true]{sanitizesort} package option (unless
you use the \texttt{def} or \texttt{use} sort methods).
\end{important}

\item[{\gloskey{type}}] This specifies the label of the glossary in 
which this entry belongs. If omitted, the default glossary is 
assumed unless \ics{newacronym} is used (see
\sectionref{sec:acronyms}).

\item[{\gloskey{user1}, \ldots, \gloskey{user6}%
\igloskey{user2}\igloskey{user3}\igloskey{user4}\igloskey{user5}}]
Six keys provided for any additional information the user may want
to specify.  (For example, an associated dimension or an alternative
plural or some other grammatical construct.) Alternatively, you can
add new keys using \ics{glsaddkey} or \ics{glsaddstoragekey} (see \sectionref{sec:addkey}).

\item[{\gloskey{nonumberlist}}] A boolean key. If the value is
missing or is \texttt{true}, this will suppress the \gls{numberlist} just for
this entry. Conversely, if you have used the package option
\pkgopt{nonumberlist}, you can activate the \gls*{numberlist} just
for this entry with \gloskey{nonumberlist=false}.
(See \sectionref{sec:numberlists}.)

\item[{\gloskey{see}}] Cross-reference another entry. Using the
\gloskey{see} key will \emph{automatically add this entry to the
glossary}, but will not automatically add the cross-referenced entry.
The referenced entry should be supplied as the value to this key.
If you want to override the \qt{see} tag, you can supply the new
tag in square brackets before the label. For example
\verb|see=[see also]{anotherlabel}|. \strong{Note that if you have
suppressed the \gls{numberlist}, the cross-referencing information
won't appear in the glossary, as it forms part of the
\gls*{numberlist}.} You can override this for individual
glossary entries using \gloskey{nonumberlist=false} (see above).
Alternatively, you can use the \pkgopt{seeautonumberlist} package
option.  For further details, see \sectionref{sec:crossref}.

This key essentially provides a convenient shortcut that performs
\begin{alltt}
\cs{glssee}\oarg{tag}\marg{label}\marg{xr-label list}
\end{alltt}
after the entry has been defined.

\begin{important}
For \optsand23, \ics{makeglossaries} must be used before any occurrence of
\ics{newglossaryentry} that contains the \gloskey{see} key. This key
should not be used with entries defined in the \env{document} environment.
\end{important}
Since it's useful to suppress the indexing while working on a draft
document, consider using the \pkgopt{seenoindex} package option to
warn or ignore the \gloskey{see} key while \cs{makeglossaries} is
commented out.

If you use the \gloskey{see} key, you may want to consider using the
\gls{glossaries-extra} package which additionally
provides a \texttt{seealso} and \texttt{alias} key. If you want to
avoid the automatic indexing triggered by the \gloskey{see} key,
consider using \opt4.

\item[{\xtrgloskey{seealso}}]
This key is only available with \gls{glossaries-extra} and is
similar to \gloskey{see} but it doesn't allow for the optional tag.
The \gls{glossaries-extra} package provides \ics*{seealsoname} and
\texttt{seealso=\marg{list}} is essentially like
\texttt{see=[\ics*{seealsoname}]\meta{list}} (\optsand34 may treat
these differently).

\item[{\xtrgloskey{alias}}]
This key is only available with \gls{glossaries-extra} and is
another form of cross-referencing.  An entry can be aliased to
another entry with \texttt{alias=\marg{label}}. This behaves like
\texttt{see=\marg{label}} but also alters the behaviour of commands
like \cs{gls} so that they index the entry given by \meta{label}
instead of the original entry. More variations with the key are
available with \gls{bib2gls}.

\item[\xtrgloskey{category}]
This key is only available with \gls{glossaries-extra} and is used
to assign a category to the entry. The value should be a label that
can be used to identify the category. See
\gls{glossaries-extra} manual for further details.

\end{description}

The following keys are reserved for \ics{newacronym} (see
\sectionref{sec:acronyms}) and also for \ics*{newabbreviation} (see the
\gls{glossaries-extra} manual): \gloskey{long}, \gloskey{longplural},
\gloskey{short} and \gloskey{shortplural}.

\begin{bib2gls}
There are also special internal field names used by \gls{bib2gls}.
See the \gls{bib2gls} manual for further details.
\end{bib2gls}

The supplementary packages \styfmt{glossaries-prefix} (\sectionref{sec:prefix}) and
\styfmt{glossaries-accsupp} (\sectionref{sec:accsupp}) provide additional keys.

\begin{important}
Avoid using any of the \glslike\ or \glstextlike\ commands within
the \gloskey{text}, \gloskey{first}, \gloskey{short} or
\gloskey{long} keys (or their plural equivalent) or any
other key that you plan to access through those commands.
(For example, the \gloskey{symbol} key if you intend to use
\cs{glssymbol}.) Otherwise you end up with nested links, which
can cause complications and they won't work with the case-changing
commands. You can use them within the value of keys 
that won't be accessed through those commands. For example,
the \gloskey{description} key if you don't use \cs{glsdesc}.
Additionally, they'll confuse the entry formatting commands, such as
\cs{glslabel}.
\end{important}

Note that if the name starts with 
\gls{nonlatinchar}, you must group the character, otherwise it will 
cause a problem for commands like \ics{Gls} and \ics{Glspl}. 
For example:
\begin{verbatim}
\newglossaryentry{elite}{name={{\'e}lite},
description={select group or class}}
\end{verbatim}
Note that the same applies if you are using the \sty{inputenc}
package:
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{name=\mgroup{\mgroup{\'e}lite},
description=\mgroup{select group or class}}
\end{alltt}
(This doesn't apply for \XeLaTeX\ documents using the \sty{fontspec}
package. For further details, see the \qt{UTF-8} section in the
\sty{mfirstuc} user manual.)

Note that in both of the above examples, you will also need to
supply the \gloskey{sort} key if you are using \opt2
whereas \gls{xindy} (\opt3) is usually able to sort
\glspl{nonlatinchar}
correctly. \opt1 discards accents from 
\glspl{latexexlatinchar} unless you use the \pkgopt[true]{sanitizesort}.


\section{Plurals}
\label{sec:plurals}

You may have noticed from above that you can specify the plural form
when you define a term. If you omit this, the plural will be 
obtained by appending 
\begin{definition}[\DescribeMacro{\glspluralsuffix}]
\cs{glspluralsuffix}
\end{definition}
to the singular form. This command defaults to the letter \qt{s}. 
For example:
\begin{verbatim}
\newglossaryentry{cow}{name=cow,description={a fully grown
female of any bovine animal}}
\end{verbatim}
defines a new entry whose singular form is \qt{cow} and plural form
is \qt{cows}. However, if you are writing in archaic English, you
may want to use \qt{kine} as the plural form, in which case you
would have to do:
\begin{verbatim}
\newglossaryentry{cow}{name=cow,plural=kine,
description={a fully grown female of any bovine animal}}
\end{verbatim}

If you are writing in a language that supports
multiple plurals (for a given term) then use the \gloskey{plural} key
for one of them and one of the user keys to specify the
other plural form. For example:
\begin{verbatim}
\newglossaryentry{cow}{%
  name=cow,%
  description={a fully grown female of any bovine animal 
               (plural cows, archaic plural kine)},%
  user1={kine}}
\end{verbatim}
You can then use \verb|\glspl{cow}| to produce \qt{cows} and 
\verb|\glsuseri{cow}| to produce \qt{kine}. You can, of course,
define an easy to remember synonym. For example:
\begin{verbatim}
\let\glsaltpl\glsuseri
\end{verbatim}
Then you don't have to remember which key you used to store the
second plural. Alternatively, you can define your own keys using
\ics{glsaddkey}, described in \sectionref{sec:addkey}.

If you are using a language that usually forms plurals
by appending a different letter, or sequence of letters, you can
redefine \cs{glspluralsuffix} as required. However, this must be
done \emph{before} the entries are defined. For languages that don't
form plurals by simply appending a suffix, all the plural forms must be 
specified using the \gloskey{plural} key (and the \gloskey{firstplural}
key where necessary). 

\section{Other Grammatical Constructs}
\label{sec:grammar}

You can use the six user keys to provide alternatives, such as
participles. For example:
\begin{verbatim}
\let\glsing\glsuseri
\let\glsd\glsuserii

\newcommand*{\ingkey}{user1}
\newcommand*{\edkey}{user2}

\newcommand*{\newword}[3][]{%
  \newglossaryentry{#2}{%
   name={#2},%
   description={#3},%
   \edkey={#2ed},%
   \ingkey={#2ing},#1%
  }%
}
\end{verbatim}
With the above definitions, I can now define terms like this:
\begin{verbatim}
\newword{play}{to take part in activities for enjoyment}
\newword[\edkey={ran},\ingkey={running}]{run}{to move fast using 
the legs}
\end{verbatim}
and use them in the text:
\begin{verbatim}
Peter is \glsing{play} in the park today.

Jane \glsd{play} in the park yesterday.

Peter and Jane \glsd{run} in the park last week.
\end{verbatim}

Alternatively, you can define your own keys using
\ics{glsaddkey}, described below in \sectionref{sec:addkey}.

\section{Additional Keys}
\label{sec:addkey}

You can now also define your own custom keys using the
commands described in this section. There are two types of keys:
those for use within the document and those to store information
used behind the scenes by other commands.

For example, if you want to add a key that indicates the associated
unit for a~term, you might want to reference this unit in your
document. In this case use \cs{glsaddkey} described in 
\sectionref{sec:glsaddkey}. If, on the other hand, you want to add a
key to indicate to a glossary style or acronym style that this entry
should be formatted differently to other entries, then you can use
\cs{glsaddstoragekey} described in \sectionref{sec:glsaddstoragekey}.

In both cases, a new command \meta{no link cs} will be defined that
can be used to access the value of this key (analogous to commands
such as \cs{glsentrytext}). This can be used in an expandable
context (provided any fragile commands stored in the key have been
protected). The new keys must be added using \cs{glsaddkey} or
\cs{glsaddstoragekey} before glossary entries are defined.

\subsection{Document Keys}
\label{sec:glsaddkey}

A custom key that can be used in the document is defined using:
\begin{definition}[\DescribeMacro\glsaddkey]
\cs{glsaddkey}\marg{key}%
\marg{default value}%
\marg{no link cs}%
\marg{no link ucfirst cs}%
\marg{link cs}%
\marg{link ucfirst cs}%
\marg{link allcaps cs}
\end{definition}
where:
\begin{description}
\item[\meta{key}] is the new key to use in \ics{newglossaryentry}
(or similar commands such as \ics{longnewglossaryentry});
\item[\meta{default value}] is the default value to use if this key
isn't used in an entry definition (this may reference the current
entry label via \cs{glslabel}, but you will have to switch on
expansion via the starred version of \cs{glsaddkey} and protect
fragile commands);
\item[\meta{no link cs}] is the control sequence to use analogous
to commands like \ics{glsentrytext};
\item[\meta{no link ucfirst cs}] is the control sequence to use analogous
to commands like \ics{Glsentrytext};
\item[\meta{link cs}] is the control sequence to use analogous
to commands like \ics{glstext};
\item[\meta{link ucfirst cs}] is the control sequence to use analogous
to commands like \ics{Glstext};
\item[\meta{link allcaps cs}] is the control sequence to use analogous
to commands like \ics{GLStext}.
\end{description}
The starred version of \cs{glsaddkey} switches on expansion for this
key. The unstarred version doesn't override the current expansion
setting.

\begin{example}{Defining Custom Keys}{ex:addkey}
Suppose I want to define two new keys, \texttt{ed} and \texttt{ing},
that default to the entry text followed by \qt{ed} and \qt{ing},
respectively. The default value will need expanding in both cases, so 
I need to use the starred form:
\begin{verbatim}
 % Define "ed" key:
 \glsaddkey*
  {ed}% key
  {\glsentrytext{\glslabel}ed}% default value
  {\glsentryed}% command analogous to \glsentrytext
  {\Glsentryed}% command analogous to \Glsentrytext
  {\glsed}% command analogous to \glstext
  {\Glsed}% command analogous to \Glstext
  {\GLSed}% command analogous to \GLStext

 % Define "ing" key:
 \glsaddkey*
  {ing}% key
  {\glsentrytext{\glslabel}ing}% default value
  {\glsentrying}% command analogous to \glsentrytext
  {\Glsentrying}% command analogous to \Glsentrytext
  {\glsing}% command analogous to \glstext
  {\Glsing}% command analogous to \Glstext
  {\GLSing}% command analogous to \GLStext
\end{verbatim}
Now I can define some entries:
\begin{verbatim}
 % No need to override defaults for this entry:

 \newglossaryentry{jump}{name={jump},description={}}

 % Need to override defaults on these entries:

 \newglossaryentry{run}{name={run},%
   ed={ran},%
   ing={running},%
   description={}}

 \newglossaryentry{waddle}{name={waddle},%
   ed={waddled},%
   ing={waddling},%
   description={}}
\end{verbatim}

These entries can later be used in the document:
\begin{verbatim}
The dog \glsed{jump} over the duck.

The duck was \glsing{waddle} round the dog.

The dog \glsed{run} away from the duck.
\end{verbatim}
For a complete document, see the sample file \samplefile{-newkeys}.
\end{example}

\subsection{Storage Keys}
\label{sec:glsaddstoragekey}

A custom key that can be used for simply storing information is 
defined using:
\begin{definition}[\DescribeMacro\glsaddstoragekey]
\cs{glsaddstoragekey}\marg{key}\marg{default value}\marg{no link cs}
\end{definition}
where the arguments are as the first three arguments of
\cs{glsaddkey}, described above in \sectionref{sec:glsaddkey}.

This is essentially the same as \cs{glsaddkey} except that it
doesn't define the additional commands. You can access or update
the value of your new field using the commands described in 
\sectionref{sec:fetchset}.

\begin{example}{Defining Custom Storage Key (Acronyms and Initialisms)}{ex:addstoragekey}
Suppose I want to define acronyms and other forms of abbreviations,
such as initialisms, but I want them all in the same glossary and I
want the acronyms on first use to be displayed with the short form followed by
the long form in parentheses, but the opposite way round for other
forms of abbreviations. (The \gls{glossaries-extra} package
provides a simpler way of achieving this.)

Here I can define a new key that determines whether the term is
actually an acronym rather than some other form of abbreviation. I'm
going to call this key \texttt{abbrtype} (since \texttt{type}
already exists):
\begin{verbatim}
\glsaddstoragekey
 {abbrtype}% key/field name
 {word}% default value if not explicitly set
 {\abbrtype}% custom command to access the value if required
\end{verbatim}

Now I can define a style that looks up the value of this new key to
determine how to display the full form:
\begin{verbatim}
\newacronymstyle
 {mystyle}% style name
 {% Use the generic display
   \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
 }
 {% Put the long form in the description
   \renewcommand*{\GenericAcronymFields}{%
       description={\the\glslongtok}}%
   % For the full format, test the value of the "abbrtype" key.
   % If it's set to "word" put the short form first with
   % the long form in brackets.
   \renewcommand*{\genacrfullformat}[2]{%
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\glsentryshort{##1}}##2\space
       (\glsentrylong{##1})%
    }
    {% is another form of abbreviation
     \glsentrylong{##1}##2\space
      (\protect\firstacronymfont{\glsentryshort{##1}})%
    }%
  }%
  % first letter upper case version:
   \renewcommand*{\Genacrfullformat}[2]{%
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\Glsentryshort{##1}}##2\space
       (\glsentrylong{##1})%
    }
    {% is another form of abbreviation
     \Glsentrylong{##1}##2\space
      (\protect\firstacronymfont{\glsentryshort{##1}})%
    }%
  }%
  % plural
   \renewcommand*{\genplacrfullformat}[2]{%
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\glsentryshortpl{##1}}##2\space
       (\glsentrylong{##1})%
    }
    {% is another form of abbreviation
     \glsentrylongpl{##1}##2\space
      (\protect\firstacronymfont{\glsentryshortpl{##1}})%
    }%
  }%
  % plural and first letter upper case
  \renewcommand*{\Genplacrfullformat}[2]{%
    \ifglsfieldeq{##1}{abbrtype}{word}
    {% is a proper acronym
      \protect\firstacronymfont{\Glsentryshortpl{##1}}##2\space
       (\glsentrylong{##1})%
    }
    {% is another form of abbreviation
     \Glsentrylongpl{##1}##2\space
      (\protect\firstacronymfont{\glsentryshortpl{##1}})%
    }%
  }%
  % Just use the short form as the name part in the glossary:
  \renewcommand*{\acronymentry}[1]{%
     \acronymfont{\glsentryshort{##1}}}%
  % Sort by the short form:
  \renewcommand*{\acronymsort}[2]{##1}%
  % Just use the surrounding font for the short form:
  \renewcommand*{\acronymfont}[1]{##1}%
  % Same for first use:
  \renewcommand*{\firstacronymfont}[1]{\acronymfont{##1}}%
  % Default plural suffix if the plural isn't explicitly set
  \renewcommand*{\acrpluralsuffix}{\glspluralsuffix}%
 }
\end{verbatim}
Remember that the new style needs to be set before defining any
terms:
\begin{verbatim}
\setacronymstyle{mystyle}
\end{verbatim}

Since it's a bit confusing to use \ics{newacronym} for something
that's not technically an acronym, let's define a new command for
initialisms:
\begin{verbatim}
\newcommand*{\newinitialism}[4][]{%
  \newacronym[abbrtype=initialism,#1]{#2}{#3}{#4}%
}
\end{verbatim}
Now the entries can all be defined:
\begin{verbatim}
\newacronym{radar}{radar}{radio detecting and ranging}
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\newacronym{scuba}{scuba}{self-contained underwater breathing
apparatus}
\newinitialism{dsp}{DSP}{digital signal processing}
\newinitialism{atm}{ATM}{automated teller machine}
\end{verbatim}
On \gls{firstuse}, \verb|\gls{radar}| will produce \qt{radar (radio
detecting and ranging)} but \verb|\gls{dsp}| will produce \qt{DSP
(digital signal processing)}.

For a complete document, see the sample file
\samplefile{-storage-abbr}.
\end{example}

In the above example, if \cs{newglossaryentry} is explicitly used
(instead of through \cs{newacronym}) the \texttt{abbrtype} key will
be set to its default value of \qt{word} but the \cs{ifglshaslong}
test in the custom acronym style will be false (since the
\gloskey{long} key hasn't been set) so the display style will switch
to that given by \cs{glsgenentryfmt} and they'll be no test
performed on the \texttt{abbrtype} field.

\begin{example}{Defining Custom Storage Key (Acronyms and
Non-Acronyms with Descriptions)}{ex:addstoragekey2}
The previous example can be modified if the \gloskey{description}
also needs to be provided. Here I've changed \qt{word} to
\qt{acronym}:
\begin{verbatim}
\glsaddstoragekey
 {abbrtype}% key/field name
 {acronym}% default value if not explicitly set
 {\abbrtype}% custom command to access the value if required
\end{verbatim}
This may seem a little odd for non-abbreviated entries defined using
\cs{newglossaryentry} directly, but \ics{ifglshaslong} can be used
to determine whether or not to reference the value of this new
\texttt{abbrtype} field.

The new acronym style has a~minor modification that forces the user
to specify a description. In the previous example, the line:
\begin{verbatim}
   \renewcommand*{\GenericAcronymFields}{%
     description={\the\glslongtok}}%
\end{verbatim}
needs to be changed to:
\begin{verbatim}
   \renewcommand*{\GenericAcronymFields}{}%
\end{verbatim}
Additionally, to accommodate the change in the default value of the
\texttt{abbrtype} key, all instances of 
\begin{verbatim}
    \ifglsfieldeq{##1}{abbrtype}{word}
\end{verbatim}
need to be changed to:
\begin{verbatim}
    \ifglsfieldeq{##1}{abbrtype}{acronym}
\end{verbatim}

Once this new style has been set, the new acronyms can be defined
using the optional argument to set the description:
\begin{verbatim}
\newacronym[description={system for detecting the position and
speed of aircraft, ships, etc}]{radar}{radar}{radio detecting
and ranging}
\end{verbatim}

No change is required for the definition of \cs{newinitialism} but
again the optional argument is required to set the description:
\begin{verbatim}
\newinitialism[description={mathematical manipulation of an
information signal}]{dsp}{DSP}{digital signal processing}
\end{verbatim}

We can also accommodate contractions in a similar manner to the
initialisms:
\begin{verbatim}
\newcommand*{\newcontraction}[4][]{%
  \newacronym[abbrtype=contraction,#1]{#2}{#3}{#4}%
}
\end{verbatim}
The contractions can similarly been defined using this new command:
\begin{verbatim}
\newcontraction[description={front part of a ship below the
deck}]{focsle}{fo'c's'le}{forecastle}
\end{verbatim}

Since the custom acronym style just checks if \texttt{abbrtype} is
\texttt{acronym}, the contractions will be treated the same as the
initialisms, but the style could be modified by a further test of
the \texttt{abbrtype} value if required.

To test regular non-abbreviated entries, I've also defined a simple
word:
\begin{verbatim}
\newglossaryentry{apple}{name={apple},description={a fruit}}
\end{verbatim}

Now for a new glossary style that provides information about the
abbreviation (in addition to the description):
\begin{verbatim}
\newglossarystyle
 {mystyle}% style name
 {% base it on the "list" style
   \setglossarystyle{list}%
   \renewcommand*{\glossentry}[2]{%
     \item[\glsentryitem{##1}%
          \glstarget{##1}{\glossentryname{##1}}]
       \ifglshaslong{##1}%
       { (\abbrtype{##1}: \glsentrylong{##1})\space}{}%
       \glossentrydesc{##1}\glspostdescription\space ##2}%
 }
\end{verbatim}
This uses \ics{ifglshaslong} to determine whether or not the term is
an abbreviation. If it has an abbreviation, the full form is
supplied in parentheses and \cs{abbrtype} (defined by
\cs{glsaddstoragekey} earlier) is used to indicate the type of
abbreviation.

With this style set, the \texttt{apple} entry is simply displayed in
the glossary as
\begin{description}
\item[apple] a fruit.
\end{description}
but the abbreviations are displayed in the form
\begin{description}
\item[laser] (acronym: light amplification by
stimulated emission of radiation) device that creates a narrow beam
of intense light.
\end{description}
(for acronyms) or
\begin{description}
\item[DSP] (initialism: digital signal processing) mathematical
manipulation of an information signal.
\end{description}
(for initalisms) or
\begin{description}
\item[fo'c's'le] (contraction: forecastle) front part of a ship
below the deck.
\end{description}
(for contractions).

For a complete document, see \samplefile{-storage-abbr-desc}.
\end{example}

\section{Expansion}
\label{sec:expansion}

When you define new glossary entries expansion is performed by
default, except for the \gloskey{name}, \gloskey{description},
\gloskey{descriptionplural}, \gloskey{symbol}, \gloskey{symbolplural}
and \gloskey{sort} keys (these keys all have expansion suppressed via
\cs{glssetnoexpandfield}).

You can switch expansion on or off for individual keys using
\begin{definition}[\DescribeMacro\glssetexpandfield]
\cs{glssetexpandfield}\marg{field}
\end{definition}
or
\begin{definition}[\DescribeMacro\glssetnoexpandfield]
\cs{glssetnoexpandfield}\marg{field}
\end{definition}
respectively, where \meta{field} is the field tag corresponding to
the key. In most cases, this is the same as the name of the key
except for those listed in \tableref{tab:fieldmap}.

\begin{table}[htbp]
\caption{Key to Field Mappings}
\label{tab:fieldmap}
\centering
\begin{tabular}{ll}
\bfseries Key & \bfseries Field\\
\gloskey{sort} & \ttfamily sortvalue\\
\gloskey{firstplural} & \ttfamily firstpl\\
\gloskey{description} & \ttfamily desc\\
\gloskey{descriptionplural} & \ttfamily descplural\\
\gloskey{user1} & \ttfamily useri\\
\gloskey{user2} & \ttfamily userii\\
\gloskey{user3} & \ttfamily useriii\\
\gloskey{user4} & \ttfamily useriv\\
\gloskey{user5} & \ttfamily userv\\
\gloskey{user6} & \ttfamily uservi\\
\gloskey{longplural} & \ttfamily longpl\\
\gloskey{shortplural} & \ttfamily shortpl
\end{tabular}
\end{table}

Any keys that haven't had the expansion explicitly set using
\cs{glssetexpandfield} or \cs{glssetnoexpandfield} are governed by
\begin{definition}[\DescribeMacro\glsexpandfields]
\cs{glsexpandfields}
\end{definition}
and
\begin{definition}[\DescribeMacro\glsnoexpandfields]
\cs{glsnoexpandfields}
\end{definition}

If your entries contain any fragile commands, I recommend you switch
off expansion via \cs{glsnoexpandfields}. (This should be used
before you define the entries.)

\section{Sub-Entries}
\label{sec:subentries}

As from version 1.17, it is possible to specify sub-entries. These
may be used to order the glossary into categories, in which case the
sub-entry will have a different name to its parent entry, or it may
be used to distinguish different definitions for the same word, in
which case the sub-entries will have the same name as the parent
entry. Note that not all glossary styles support hierarchical
entries and may display all the entries in a flat format. Of the
styles that support sub-entries, some display the sub-entry's name
whilst others don't. Therefore you need to ensure that you use a
suitable style. (See \sectionref{sec:styles} for a list of predefined
styles.) As from version 3.0, level~1 sub-entries are automatically
numbered in the predefined styles if you use the
\pkgopt{subentrycounter} package option (see
\sectionref{sec:pkgopts-printglos} for further details).

Note that the parent entry will automatically be added to the
glossary if any of its child entries are used in the document.
If the parent entry is not referenced in the document, it will not
have a \gls{numberlist}. Note also that \gls{makeindex} has a
restriction on the maximum sub-entry depth.

\subsection{Hierarchical Categories}
\label{sec:hierarchical}

To arrange a glossary with hierarchical categories, you need to
first define the category and then define the sub-entries using the
relevant category entry as the value of the \gloskey{parent} key.

\begin{example}{Hierarchical Categories---Greek and Roman 
Mathematical Symbols}{ex:hierarchical}

Suppose I want a glossary of mathematical symbols that
are divided into Greek letters and Roman letters. Then I can define
the categories as follows:
\begin{verbatim}
\newglossaryentry{greekletter}{name={Greek letters},
description={\nopostdesc}}

\newglossaryentry{romanletter}{name={Roman letters},
description={\nopostdesc}}
\end{verbatim}

Note that in this example, the category entries don't need a
description so I have set the descriptions to \ics{nopostdesc}.
This gives a blank description and suppresses the
description terminator.

I can now define my sub-entries as follows:
\begin{verbatim}
\newglossaryentry{pi}{name={\ensuremath{\pi}},sort={pi},
description={ratio of the circumference of a circle to 
the diameter},
parent=greekletter}

\newglossaryentry{C}{name={\ensuremath{C}},sort={C},
description={Euler's constant},
parent=romanletter}
\end{verbatim}
For a complete document, see the sample file \samplefile{tree}.
\end{example}

\subsection{Homographs}
\label{sec:homographs}

Sub-entries that have the same name as the parent entry, don't need
to have the \gloskey{name} key. For example, the word \qt{glossary}
can mean a list of technical words or a collection of glosses. In
both cases the plural is \qt{glossaries}. So first define the parent
entry:
\begin{verbatim}
\newglossaryentry{glossary}{name=glossary,
description={\nopostdesc},
plural={glossaries}}
\end{verbatim}
Again, the parent entry has no description, so the description
terminator needs to be suppressed using \ics{nopostdesc}.

Now define the two different meanings of the word:
\begin{verbatim}
\newglossaryentry{glossarylist}{
description={list of technical words},
sort={1},
parent={glossary}}

\newglossaryentry{glossarycol}{
description={collection of glosses},
sort={2},
parent={glossary}}
\end{verbatim}
Note that if I reference the parent entry, the location will be
added to the parent's \gls{numberlist}, whereas if I reference any
of the child entries, the location will be added to the child
entry's number list. Note also that since the sub-entries have the
same name, the \gloskey{sort} key is required unless you are using
the \pkgopt[use]{sort} or \pkgopt[def]{sort} package options (see
\sectionref{sec:pkgopts-sort}). You
can use the \pkgopt{subentrycounter} package option to automatically
number the first-level child entries. See
\sectionref{sec:pkgopts-printglos} for further details.

In the above example, the plural form for both of the child entries
is the same as the parent entry, so the \gloskey{plural} key was
not required for the child entries. However, if the sub-entries
have different plurals, they will need to be specified. For example:
\begin{verbatim}
\newglossaryentry{bravo}{name={bravo},
description={\nopostdesc}}

\newglossaryentry{bravocry}{description={cry of approval 
(pl.\ bravos)},
sort={1},
plural={bravos},
parent=bravo}

\newglossaryentry{bravoruffian}{description={hired 
ruffian or killer (pl.\ bravoes)},
sort={2},
plural={bravoes},
parent=bravo}
\end{verbatim}


\section{Loading Entries From a File}
\label{sec:loadglsentries}

You can store all your glossary entry definitions in another
file and use:
\begin{definition}[\DescribeMacro{\loadglsentries}]
\cs{loadglsentries}\oarg{type}\marg{filename}
\end{definition}
where \meta{filename} is the name of the file containing all the
\ics{newglossaryentry} or \ics{longnewglossaryentry} commands. 
The optional argument
\meta{type} is the name of the glossary to which those entries
should belong, for those entries where the \gloskey{type} key has 
been omitted (or, more specifically, for those entries whose
type has been specified by \ics{glsdefaulttype}, which is what
\ics{newglossaryentry} uses by default).

This is a~preamble-only command. You may also use \ics{input} to load
the file but don't use \ics{include}. If you find that your file is
becoming unmanageably large, you may want to consider switching to
\gls{bib2gls} and use an application such as JabRef to manage the
entry definitions.

\begin{important}
If you want to use \ics{AtBeginDocument} to \cs{input} all your entries
automatically at the start of the document, add the
\cs{AtBeginDocument} command \emph{before} you load the
\sty{glossaries} package (and \sty{babel}, if you are also loading
that) to avoid the creation of the
\filetype{glsdefs} file and any associated problems that are caused
by defining commands in the \env{document} environment.
(See \sectionref{sec:docdefs}.)
\end{important}

\begin{example}{Loading Entries from Another File}{ex:loadgls}
Suppose I have a file called \texttt{myentries.tex} which contains:
\begin{verbatim}
\newglossaryentry{perl}{type=main,
name={Perl},
description={A scripting language}}

\newglossaryentry{tex}{name={\TeX},
description={A typesetting language},sort={TeX}}

\newglossaryentry{html}{type=\glsdefaulttype,
name={html},
description={A mark up language}}
\end{verbatim}
and suppose in my document preamble I use the command:
\begin{verbatim}
\loadglsentries[languages]{myentries}
\end{verbatim}
then this will add the entries \texttt{tex} and \texttt{html}
to the glossary whose type is given by \texttt{languages}, but
the entry \texttt{perl} will be added to the main glossary, since
it explicitly sets the type to \texttt{main}.
\end{example}

\importantpar
Note: if you use \ics{newacronym} (see \sectionref{sec:acronyms}) the type is set as
\verb|type=\acronymtype| unless you explicitly override it. For
example, if my file \texttt{myacronyms.tex} contains:
\begin{verbatim}
\newacronym{aca}{aca}{a contrived acronym}
\end{verbatim}
then (supposing I have defined a new glossary type called
\texttt{altacronym})
\begin{verbatim}
\loadglsentries[altacronym]{myacronyms}
\end{verbatim}
will add \texttt{aca} to the glossary type \texttt{acronym}, if the
package option \pkgopt{acronym} has been specified, or will add
\texttt{aca} to the glossary type \texttt{altacronym}, if the
package option \pkgopt{acronym} is not specified.\footnote{This is
because \ics{acronymtype} is set to \ics{glsdefaulttype} if the
\pkgopt{acronym} package option is not used.}

If you have used the \pkgopt{acronym} package option,
there are two possible solutions to this problem:
\begin{enumerate}
\item Change \texttt{myacronyms.tex} so that entries are defined in
the form:
\begin{verbatim}
\newacronym[type=\glsdefaulttype]{aca}{aca}{a 
contrived acronym}
\end{verbatim}
and do:
\begin{verbatim}
\loadglsentries[altacronym]{myacronyms}
\end{verbatim}

\item Temporarily change \cs{acronymtype} to the target glossary:
\begin{verbatim}
\let\orgacronymtype\acronymtype
\renewcommand{\acronymtype}{altacronym}
\loadglsentries{myacronyms}
\let\acronymtype\orgacronymtype
\end{verbatim}
\end{enumerate}

Note that only those entries that have been used
in the text will appear in the relevant glossaries.
Note also that \cs{loadglsentries} may only be used in the 
preamble.

Remember that you can use \ics{provideglossaryentry} rather than
\ics{newglossaryentry}. Suppose you want to maintain a large database
of acronyms or terms that you're likely to use in your documents,
but you may want to use a modified version of some of those entries.
(Suppose, for example, one document may require a more detailed
description.) Then if you define the entries using
\cs{provideglossaryentry} in your database file, you can override
the definition by simply using \cs{newglossaryentry} before loading
the file. For example, suppose your file (called, say,
\texttt{terms.tex}) contains:
\begin{verbatim}
\provideglossaryentry{mallard}{name=mallard,
 description={a type of duck}}
\end{verbatim}
but suppose your document requires a more detailed description, you
can do:
\begin{verbatim}
\usepackage{glossaries}
\makeglossaries

\newglossaryentry{mallard}{name=mallard,
 description={a dabbling duck where the male has a green head}}

\loadglsentries{terms}
\end{verbatim}
Now the \texttt{mallard} definition in the \texttt{terms.tex} file
will be ignored.

\section{Moving Entries to Another Glossary}
\label{sec:moveentry}

As from version~3.02, you can move an entry from one glossary to
another using:
\begin{definition}[\DescribeMacro{\glsmoveentry}]
\cs{glsmoveentry}\marg{label}\marg{target glossary label}
\end{definition}
where \meta{label} is the unique label identifying the required
entry and \meta{target glossary label} is the unique label
identifying the glossary in which to put the entry.

Note that no check is performed to determine the existence of
the target glossary. If you want to move an entry to a glossary
that's skipped by \ics{printglossaries}, then define an ignored
glossary with \ics{newignoredglossary}. (See
\sectionref{sec:newglossary}.)

\begin{important}
Unpredictable results may occur if you move an entry to a different
glossary from its parent or children.
\end{important}

\section{Drawbacks With Defining Entries in the Document Environment}
\label{sec:docdefs}

Originally, \ics{newglossaryentry} (and \ics{newacronym}) could only be 
used in the preamble. I reluctantly removed this restriction in version 1.13,
but there are issues with defining commands in the \env{document}
environment instead of the preamble, which is why the restriction is
maintained for newer commands. This restriction is also reimposed
for \cs{newglossaryentry} by the new \opt1. (The
\gls{glossaries-extra} package automatically reimposes this restriction for
\optsand23 but provides a package option to allow document
definitions.)

\subsection{Technical Issues}
\label{sec:techissues}

\begin{enumerate}
 \item If you define an entry mid-way through your document, but
subsequently shuffle sections around, you could end up using an
entry before it has been defined.

 \item Entry information is required when displaying the glossary.
If this occurs at the start of the document, but the entries aren't
defined until later, then the entry details are
being looked up before the entry has been defined.

 \item If you use a package, such as \sty{babel}, that makes
certain characters active at the start of the \env{document}
environment, there will be a~problem if those characters have
a~special significance when defining glossary entries.
These characters include the double-quote \verb|"| character, the
exclamation mark \texttt{!} character, the question mark \verb|?|
character, and the pipe \verb"|" character. They
must not be active when defining a~glossary entry where they occur
in the \gloskey{sort} key (and they should be avoided in the label
if they may be active at any point in the document). Additionally, 
the comma \texttt{,} character and the equals \texttt{=} character
should not be active when using commands that have
\meta{key}=\meta{value} arguments.

\end{enumerate}

To overcome the first two problems, as from version 4.0 the
\styfmt{glossaries} package modifies the definition of
\cs{newglossaryentry} at the beginning of the \env{document}
environment so that the definitions are written to an external file
(\cs{jobname}\filetype{glsdefs}) which is then read in at the start
of the document on the next run. The entry will then only be defined
in the \env{document} environment if it doesn't already exist. This
means that the entry can now be looked up in the glossary, even if
the glossary occurs at the beginning of the document.

There are drawbacks to this mechanism: if you modify an entry
definition, you need a second run to see the effect of your
modification; this method requires an extra \cs{newwrite}, which may
exceed \TeX's maximum allocation; unexpected expansion issues could
occur; the \gloskey{see} key isn't stored, which means it can't be
added to the \filetype{glsdefs} file when it's created at the end of the 
document (and therefore won't be present on subsequent runs).

The \gls{glossaries-extra} package provides a setting (but only for
\optsand23) that allows \cs{newglossaryentry} to occur in the
document environment but doesn't create the \filetype{glsdefs}
file. This circumvents some problems but it means that you can't
display any of the glossaries before all the entries have been
defined (so it's all right if all the glossaries are at the end of
the document but not if any occur in the front matter).

\subsection{Good Practice Issues}
\label{sec:goodpractice}

The above section covers technical issues that can cause your document to have
compilation errors or produce incorrect output. This section
focuses on good writing practice. The main reason cited by users
wanting to define entries within the \env{document} environment rather
than in the preamble is that they want to write the definition as
they type in their document text. This suggests a \qt{stream of
consciousness} style of writing that may be acceptable in certain
literary genres but is inappropriate for factual documents.

When you write technical documents, regardless of whether it's a PhD
thesis or an article for a~journal or proceedings, you must plan what you write
in advance. If you plan in advance, you should have a fairly good
idea of the type of terminology that your document will contain,
so while you are planning, create a new file with all your entry
definitions. If, while you're writing your document, you remember
another term you need, then you can switch over to your definition file and
add it. Most text editors have the ability to have more than one
file open at a time. The other advantage to this approach is that if
you forget the label, you can look it up in the definition file
rather than searching through your document text to find the
definition.

\chapter{Number lists}
\label{sec:numberlists}

Each entry in the glossary has an associated \gls{numberlist}.
By default, these numbers refer to the pages on which that entry has
been indexed (using any of the commands described in
\sectionref{sec:glslink} and \sectionref{sec:glsadd}). The number
list can be suppressed using the \pkgopt{nonumberlist} package
option, or an alternative counter can be set as the default using
the \pkgopt{counter} package option. The number list is also
referred to as the location list\index{location list|see{number list}}.

\Glspl{numberlist} are more common with indexes rather than
glossaries (although you can use the \styfmt{glossaries} package for
indexes as well). However, the \styfmt{glossaries} package makes use
of \gls{makeindex} or \gls{xindy} to hierarchically sort and collate the
entries since they are readily available with most modern \TeX\
distributions. Since these are both designed as \glspl{indexingapp}
they both require that terms either have a valid location or a
cross-reference. Even if you use \pkgopt{nonumberlist}, the
locations must still be provided and acceptable to the
\gls{indexingapp} or they will cause an error during the indexing
stage, which will interrupt the document build. However, if you're
not interested in the locations, each entry only needs to be indexed
once, so consider using \pkgopt{indexonlyfirst}, which can improve the
document build time by only indexing the \gls{firstuse} of each term.

The \ics{glsaddall} command (see \sectionref{sec:glsadd}), which is used to
automatically index all entries, iterates over all defined entries
and does \cs{glsadd}\marg{label} for each entry (where \meta{label}
is that entry's label). This means that \cs{glsaddall} automatically
adds the same location to every entry's \gls{numberlist}, which
looks weird if the \gls*{numberlist} hasn't been suppressed.

With \opt4, the indexing is performed by \gls{bib2gls}, which was
specifically designed for the \gls{glossaries-extra} package. So it
will allow any location format, and its \texttt{selection=all}
option will select all entries without adding an unwanted location to the
\gls{numberlist}. If \gls{bib2gls} can deduce a numerical value for
a location, it will attempt to form a range over consecutive
locations, otherwise it won't try to form a range and the
location will just form an individual item in the list.
\opt1 also allows any location but it doesn't form ranges.

\section{Encap Values}
\label{sec:encap}

Each location in the \gls{numberlist} is encapsulated with a
command formed from the \termdef{encap} value.  By
default this is the \ics{glsnumberformat} command, which corresponds
to the encap \texttt{glsnumberformat}, but this may be
overridden using the \gloskey[glslink]{format} key in the optional
argument to commands like \cs{gls}. (See \sectionref{sec:glslink}.)
For example, you may want the location to appear in bold to indicate
the principle use of a term or symbol. If the encap starts with an
open parenthesis~\verb|(| this signifies the start of a range and if
the encap starts with close parenthesis~\verb|)| this signifies the
end of a range. These must always occur in matching pairs.

The \styfmt{glossaries} package provides the command \ics{glsignore}
which ignores its argument. This is the format used by
\cs{glsaddallunused} to suppress the location, which works fine as
long as no other locations are added to the \gls{numberlist}. For
example, if you use \verb|\gls{sample}| on page~2 then reset the
\gls{firstuseflag} and then use \cs{glsaddallunused} on page~10, the
\gls{numberlist} for \texttt{sample} will be \verb|2, \glsignore{10}| 
which will result in \qt{2,~} which has a spurious comma.

This isn't a problem with \gls{bib2gls} because you'd use
\texttt{selection=all} instead of \cs{glsaddallunused}, but even if
you explicitly had, for example, 
\cs{gls}\texttt{[format=glsignore]}\marg{label}
for some reason, \gls{bib2gls} will recognise \texttt{glsignore} as
a special encap indicating an ignored location, so it will select
the entry but not add that location to the \gls{numberlist}. It's a
problem for all the other options (except \opt5, which doesn't
perform any indexing).

Complications can arise if you use different encap values for the
same location. For example, suppose on page~10 you have both the
default \texttt{glsnumberformat} and \texttt{textbf} encaps.  While it may
seem apparent that \texttt{textbf} should override \texttt{glsnumberformat}
in this situation, the \gls{indexingapp} may not know it.
This is therefore something you need to be careful about if you use the
\gloskey[glslink]{format} key or if you use a command that
implicitly sets it.

In the case of \gls{xindy}, it only accepts one encap (according to
the order of precedence given in the \gls{xindy} module) and discards the
others for identical locations (for the same entry). This can cause
a problem if a discarded location forms the start or end of a range. 

In the case of \gls{makeindex}, it accepts different encaps for the
same location, but warns about it.  This leads to a \gls{numberlist}
with the same location repeated in different formats.  If you use
the \gls{makeglossaries} Perl script with \opt2 it will detect
\gls{makeindex}'s warning and attempt to fix the problem, ensuring
that the \texttt{glsnumberformat} encap always has the least precedence
unless it includes a range identifier. Other conflicting encaps will
have the last one override earlier ones for the same location with
range identifiers taking priority.

No discard occurs with \opt1 so again you get the same location
repeated in different formats. With \opt4, \gls{bib2gls} will discard
according to order of precedence, giving priority to start and end
range encaps.  (See the \gls{bib2gls} manual for further details.)

\section{Locations}
\label{sec:locationsyntax}

Neither \opt1 nor \opt4 care about the location syntax as long as
it's valid \LaTeX\ code (and doesn't contain fragile commands). In
both cases, the indexing is performed by writing a line to the
\filetype{aux} file. The write operation is deferred to avoid the
problems associated with \TeX's asynchronous output routine.
(See, for example,
\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=oddpage}{Finding
if you're on an odd or an even page} for more details on this issue.)
Unfortunately \optsand23 are far more problematic and need some
complex code to deal with awkward locations.

If you know that your locations will always expand to a format
acceptable to your chosen \gls{indexingapp} then use the package
option \pkgopt[false]{esclocations} to bypass this operation. This setting
only affects \optsand23 as the problem doesn't arise with the other
indexing options.

Both \gls{makeindex} and \gls{xindy} are fussy about the syntax of
the locations. In the case of \gls{makeindex}, only the numbering
system obtained with \cs{arabic}, \cs{roman}, \cs{Roman}, \cs{alph}
and \cs{Alph} or composites formed from them with the same separator
(set with \cs{glsSetCompositor}\marg{char}) are accepted.
(\gls{makeindex} won't accept an empty location.) In the case of
\gls{xindy}, you can define your own location classes, but if the
location contains a robust command then the leading backslash must
be escaped. The \sty{glossaries} package tries to do this, but it's
caught between two conflicting requirements:
\begin{enumerate}
\item The location must be fully expanded before \verb|\| can be
converted to \verb|\\| (there's no point converting \verb|\thepage|
to \verb|\\thepage|);
\item The page number can't be expanded until the deferred write
operation (so \verb|\c@page| mustn't expand in the previous step
but \verb|\the\c@page| mustn't be converted to \verb|\\the\\c@page| 
and \verb|\number\c@page| mustn't be converted to
\verb|\\number\\c@page| etc).
\end{enumerate}
There's a certain amount of trickery needed to deal with this
conflict and the code requires the location to be in a form that
doesn't embed the counter's internal register in commands like
\cs{value}.  For example, suppose you have a robust command called
\cs{tallynum} that takes a number as the argument and an expandable
command called \cs{tally} that converts a counter name into the
associated register or number to pass to \cs{tallynum}. Let's
suppose that this command is used to represent the page number:
\begin{verbatim}
\renewcommand{\thepage}{\tally{page}}
\end{verbatim}
Now let's suppose that a term is indexed at the beginning of page~2
at the end of a paragraph that started on page~1. With \gls{xindy},
the location \verb|\tally{page}| needs to be written to the file
as \verb|\\tallynum{2}|. If it's written as \verb|\tallynum{2}| then
\gls{xindy} will interpret \verb|\t| as the character \qt{t}
(which means the location would appear as \qt{tallynum2}). So
\sty{glossaries} tries to expand \cs{thepage} without expanding
\cs{c@page} and then escapes all the backslashes, except for the
page counter's internal command. The following definitions of
\cs{tally} will work:
\begin{itemize}
\item In the following, \cs{arabic} works as its internal command \cs{c@arabic} is
temporarily redefined to check for \cs{c@page}:
\begin{verbatim}
\newcommand{\tally}[1]{\tallynum{\arabic{#1}}}
\end{verbatim}

\item The form \verb|\expandafter\the\csname c@|\meta{counter}\verb|\endcsname|
also works (provided \cs{the} is allowed to be temporarily redefined, 
see below):
\begin{verbatim}
\newcommand{\tally}[1]{%
 \tallynum{\expandafter\the\csname c@#1\endcsname}}
\end{verbatim}

\item \verb|\expandafter\the\value|\marg{counter} now also works
(with the same condition as above):
\begin{verbatim}
\newcommand{\tally}[1]{\tallynum{\expandafter\the\value{#1}}}
\end{verbatim}

\item Another variation that will work:
\begin{verbatim}
\newcommand{\tally}[1]{%
  \expandafter\tallynum\expandafter{\the\csname c@#1\endcsname}}
\end{verbatim}

\item and also:
\begin{verbatim}
\newcommand{\tally}[1]{\tallynum{\the\csname c@#1\endcsname}}
\end{verbatim}
\end{itemize}
The following \emph{don't work}:
\begin{itemize}
\item This definition leads to the premature expansion of \cs{c@page}
to \qt{1} when, in this case, it should be \qt{2}:
\begin{verbatim}
\newcommand{\tally}[1]{\tallynum{\the\value{#1}}}
\end{verbatim}
\item This definition leads to \verb|\\c@page| in the glossary file:
\begin{verbatim}
\newcommand{\tally}[1]{\tallynum{\csname c@#1\endcsname}}
\end{verbatim}
\end{itemize}
If you have a numbering system where 
\verb|\|\meta{cs name}\verb|{page}| expands to
\verb|\|\meta{internal cs name}\cs{c@page} (for example, if
\verb|\tally{page}| expands to \verb|\tallynum\c@page|) then you
need to use:
\begin{definition}[\DescribeMacro\glsaddprotectedpagefmt]
\cs{glsaddprotectedpagefmt}\marg{internal cs name}
\end{definition}
Note that the backslash must be omitted from \meta{internal cs name}
and the corresponding command must be able to process a count
register as the (sole) argument.

For example, suppose you have a style \texttt{samplenum} that is
implemented as follows:
\begin{verbatim}
 \newcommand*{\samplenum}[1]{%
   \expandafter\@samplenum\csname c@#1\endcsname}
 \newcommand*{\@samplenum}[1]{\two@digits{#1}}

\end{verbatim}
(That is, it displays the value of the counter as a two-digit
number.) Then to ensure the location is correct for entries in 
page-spanning paragraphs, you need to do:
\begin{verbatim}
\glsaddprotectedpagefmt{@samplenum}
\end{verbatim}
(If you are using a different counter for the location, such as
\texttt{section} or \texttt{equation}, you don't need to worry about
this provided the inner command is expandable.)

If the inner macro (as given by \verb|\|\meta{internal cs name}) contains
non-expandable commands then you may need to redefine
\cs{gls}\meta{internal cs name}\texttt{page} after using
\begin{alltt}
\cs{glsaddprotectedpagefmt}\marg{internal cs name}
\end{alltt}
This command doesn't take any arguments
as \emph{the location is assumed to be given by \cs{c@page}} because
that's the only occasion this command should be used. For example, 
suppose now my page counter format uses small caps Roman numerals:
\begin{verbatim}
 \newcommand*{\samplenum}[1]{%
  \expandafter\@samplenum\csname c@#1\endcsname}
 \newcommand*{\@samplenum}[1]{\textsc{\romannumeral#1}}
\end{verbatim}
Again, the inner macro needs to be identified using:
\begin{verbatim}
\glsaddprotectedpagefmt{@samplenum}
\end{verbatim}
However, since \cs{textsc} isn't fully expandable, the location
is written to the file as \verb|\textsc  {i}| (for page~1), 
\verb|\textsc  {ii}| (for page~2), etc. This format may cause a problem for
the \gls{indexingapp} (particularly for \gls{makeindex}).
To compensate for this, the \cs{gls}\meta{internal cs
name}\texttt{page} command may be redefined so that it expands to a
format that's acceptable to the \gls*{indexingapp}. For example:
\begin{verbatim}
\renewcommand*{\gls@samplenumpage}{\romannumeral\c@page}
\end{verbatim}
While this modification means that the \gls{numberlist} in the glossary
won't exactly match the format of the page numbers (displaying
lower case Roman numbers instead of small cap Roman numerals)
this method will at least work correctly for both \gls{makeindex}
and \gls{xindy}. If you are using \gls{xindy}, the following
definition:
\begin{verbatim}
 \renewcommand*{\gls@samplenumpage}{%
   \glsbackslash\string\textsc{\romannumeral\c@page}}
\end{verbatim}
combined with
\begin{verbatim}
\GlsAddXdyLocation{romansc}{:sep "\string\textsc\glsopenbrace"
 "roman-numbers-lowercase" :sep "\glsclosebrace"}
\end{verbatim}
will now have lowercase Roman numerals in the location list
(see \sectionref{sec:xindyloc} for further details on that command).
Take care of the backslashes. The location (which ends up in 
the \xindyattr{:locref} attribute) needs \verb|\\| but the location class
(identified with \cs{GlsAddXdyLocation}) just has a single
backslash.  Note that this example will cause problems if your
locations should be hyperlinks.

Another possibility that may work with both \gls{makeindex} and
\gls{xindy} is to redefine \cs{gls}\meta{internal cs
name}\texttt{page} (\cs{gls@samplenumpage} in this example)
to just expand to the decimal page number (\verb|\number\c@page|) and redefine
\ics{glsnumberformat} to change the displayed format:
\begin{verbatim}
\renewcommand*{\gls@samplenumpage}{\number\c@page}
\renewcommand*{\glsnumberformat}[1]{\textsc{\romannumeral#1}}
\end{verbatim}

\begin{important}
If you redefine \cs{gls}\meta{internal cs name}\texttt{page},
you must make sure that \cs{c@page} is expanded when it's written to
the file. (So don't, for example, hide \cs{c@page} inside a robust
command.)
\end{important}

The mechanism that allows this to work temporarily redefines
\ics{the} and \ics{number} while it processes the location. If this
causes a problem you can disallow it using
\begin{definition}[\DescribeMacro\glswrallowprimitivemodsfalse]
\cs{glswrallowprimitivemodsfalse}
\end{definition}
but you will need to find some other way to ensure the location expands
correctly.

\section{Range Formations}
\label{sec:ranges}

Both \gls{makeindex} and \gls{xindy} (\optsand23) concatenate a
sequence of~3 or more consecutive pages into~a range. With 
\gls*{xindy} (\opt3) you can vary the minimum sequence length using
\ics{GlsSetXdyMinRangeLength}\marg{n} where \meta{n} is either
an integer or the keyword \texttt{none} which indicates that there
should be no range formation (see \sectionref{sec:xindyloc} for
further details).

\begin{important}
Note that \cs{GlsSetXdyMinRangeLength} must be used before
\ics{makeglossaries} and has no effect if \ics{noist} is used.
\end{important}

With both \gls{makeindex} and \gls{xindy} (\optsand23), you can replace
the separator and the closing number in the range using:
\begin{definition}[\DescribeMacro{\glsSetSuffixF}]
\cs{glsSetSuffixF}\marg{suffix}
\end{definition}
\begin{definition}[\DescribeMacro{\glsSetSuffixFF}]
\cs{glsSetSuffixFF}\marg{suffix}
\end{definition}
where the former command specifies the suffix to use for a 2 page
list and the latter specifies the suffix to use for longer lists.
For example:
\begin{verbatim}
\glsSetSuffixF{f.}
\glsSetSuffixFF{ff.}
\end{verbatim}
Note that if you use \gls{xindy} (\opt3), you will also need to
set the minimum range length to 1 if you want to change these
suffixes:
\begin{verbatim}
\GlsSetXdyMinRangeLength{1}
\end{verbatim}
Note that if you use the \sty{hyperref} package, you will need
to use \ics{nohyperpage} in the suffix to ensure that the hyperlinks
work correctly. For example:
\begin{verbatim}
\glsSetSuffixF{\nohyperpage{f.}}
\glsSetSuffixFF{\nohyperpage{ff.}}
\end{verbatim}

\begin{important}
Note that \cs{glsSetSuffixF} and \cs{glsSetSuffixFF} must be used 
before \ics{makeglossaries} and have no effect if \ics{noist} is 
used.
\end{important}

It's also possible to concatenate a sequence of consecutive
locations into a range or have suffixes with \opt4, but with
\gls{bib2gls} these implicit ranges can't be merged with explicit
ranges (created with the \verb|(| and \verb|)| encaps). See
the \gls{bib2gls} manual for further details.

\opt1 doesn't form ranges. However, with this option you
can iterate over an entry's \gls{numberlist} using:
\begin{definition}[\DescribeMacro\glsnumberlistloop]
\cs{glsnumberlistloop}\marg{label}\marg{handler cs}\marg{xr handler
cs}
\end{definition}
where \meta{label} is the entry's label and \meta{handler cs} is a
handler control sequence of the form:
\begin{definition}
\meta{handler cs}\marg{prefix}\marg{counter}\marg{format}\marg{location}
\end{definition}
where \meta{prefix} is the \sty{hyperref} prefix, \meta{counter} is
the name of the counter used for the location, \meta{format} is the
format used to display the location (e.g.\ \texttt{textbf})
and \meta{location} is the location. The third argument is the
control sequence to use for any cross-references in the list. This
handler should have the syntax:
\begin{definition}
\meta{xr handler cs}\oarg{tag}\marg{xr list}
\end{definition}
where \meta{tag} is the cross-referenced text (e.g.\ \qt{see}) and
\meta{xr list} is a~comma-separated list of labels. (This actually
has a third argument but it's always empty when used with \opt1.)

For example, if on page~12
I~have used
\begin{verbatim}
\gls[format=textbf]{apple}
\end{verbatim}
and on page~18 I~have used
\begin{verbatim}
\gls[format=emph]{apple}
\end{verbatim}
then
\begin{verbatim}
\glsnumberlistloop{apple}{\myhandler}
\end{verbatim}
will be equivalent to:
\begin{verbatim}
\myhandler{}{page}{textbf}{12}%
\myhandler{}{page}{emph}{18}%
\end{verbatim}
There is a predefined handler that's used to display the
\gls{numberlist} in the glossary:
\begin{definition}[\DescribeMacro\glsnoidxdisplayloc]
\cs{glsnoidxdisplayloc}\marg{prefix}\marg{counter}\marg{format}\marg{location}
\end{definition}
The predefined handler used for the cross-references in the glossary is:
\begin{definition}
\cs{glsseeformat}\oarg{tag}\marg{xr list}\marg{location}
\end{definition}
which is described in \sectionref{sec:customxr}.

\begin{important}
\cs{glsnumberlistloop} is not available for \optsand23.
\end{important}

\section{Style Hook}
\label{sec:isthook}

As from version 4.24, there's a hook that's used near the end of
\ics{writeist} before the file is closed. You can set the code 
to be performed then using:
\begin{definition}[\DescribeMacro\GlsSetWriteIstHook]
\cs{GlsSetWriteIstHook}\marg{code}
\end{definition}
If you want the \meta{code} to write any information to the 
file, you need to use
\begin{definition}[\DescribeMacro\glswrite]
\cs{write}\cs{glswrite}\marg{style information}
\end{definition}
Make sure you use the correct format within \meta{style
information}. For example, if you are using \app{makeindex}:
\begin{verbatim}
\GlsSetWriteIstHook{%
 \write\glswrite{page_precedence "arnAR"}%
 \write\glswrite{line_max 80}%
}
\end{verbatim}
This changes the page type precedence\index{page type precedence|main} and the maximum line length
used by \app{makeindex}.

Remember that if you switch to \app{xindy}, this will no longer be
valid code.

\chapter{Links to Glossary Entries}
\label{sec:glslink}

Once you have defined a glossary entry using \ics{newglossaryentry}
(\sectionref{sec:newglosentry}) or \ics{newacronym} (see
\sectionref{sec:acronyms}), you can refer to that entry in the
document using one of the commands listed in
\sectionref{sec:gls-like} or \sectionref{sec:glstext-like}. The text
which appears at that point in the document when using one of these
commands is referred to as the \gls{linktext} (even if there are no
hyperlinks). These commands also add a line to an external file that
is used to generate the relevant entry in the glossary. This
information includes an associated location that is added to the
\gls{numberlist} for that entry. By default, the location refers to
the page number. For further information on number lists, see
\sectionref{sec:numberlists}.  These external files need to be
post-processed by \gls{makeindex} or \gls{xindy} unless you have
chosen \optsor14. If you don't use \ics{makeglossaries} these external
files won't be created. (\optsand14 write the information to the
\filetype{aux} file.)

Note that repeated use of these commands for the same entry can
cause the \gls{numberlist} to become quite long, which may not be
particular helpful to the reader. In this case, you can use the
non-indexing commands described in \sectionref{sec:glsnolink} or
you can use the supplemental \gls{glossaries-extra} package, which
provides a means to suppress the automated indexing of the commands listed
in this chapter.

\begin{important}
I strongly recommend that you don't use the commands
defined in this chapter in the arguments of sectioning or caption
commands or any other command that has a moving argument.

Aside from problems with expansion issues, PDF bookmarks and
possible nested hyperlinks in the table of contents (or list of
whatever) any use of the commands described in \sectionref{sec:gls-like}
will have their \firstuseflag\ unset when they appear in the table
of contents (or list of whatever).
\end{important}

The above warning is particularly important if you are using the
\styfmt{glossaries} package in conjunction with the \sty{hyperref}
package. Instead, use one of the \emph{expandable} commands listed in
\sectionref{sec:glsnolink} (such as \ics{glsentrytext} \emph{but
not} the non-expandable
case changing versions like \ics{Glsentrytext}). Alternatively, provide an
alternative via the optional argument to the sectioning\slash caption
command or use \sty{hyperref}'s \ics{texorpdfstring}. Examples:
\begin{verbatim}
\chapter{An overview of \glsentrytext{perl}}
\chapter[An overview of Perl]{An overview of \gls{perl}}
\chapter{An overview of \texorpdfstring{\gls{perl}}{Perl}}
\end{verbatim}
If you want to retain the formatting that's available through
commands like \cs{acrshort} (for example, if you are using one of
the small caps styles), then you might want to consider the
\gls{glossaries-extra} package which provides commands
for this purpose.

If you want the \gls{linktext} to produce a hyperlink to the
corresponding entry details in the glossary, you should load the
\sty{hyperref} package \emph{before} the \styfmt{glossaries}
package. That's what I've done in this document, so if you see a
hyperlinked term, such as \gls{linktext}, you can click on the word
or phrase and it will take you to a brief description in this
document's glossary.

\begin{important}
If you use the \sty{hyperref} package, I strongly recommend you use
\app{pdflatex} rather than \app{latex} to compile your document, if
possible. The DVI format of \LaTeX\ has limitations with the
hyperlinks that can cause a problem when used with the
\styfmt{glossaries} package. Firstly, the DVI format can't break a
hyperlink across a line whereas PDF\LaTeX\ can. This means that long
glossary entries (for example, the full form of an acronym) won't be
able to break across a line with the DVI format. Secondly, the DVI
format doesn't correctly size hyperlinks in subscripts or
superscripts. This means that if you define a term that may be used
as a subscript or superscript, if you use the DVI format, it won't
come out the correct size.

These are limitations of the DVI format not of the \sty{glossaries}
package.
\end{important}

It may be that you only want terms in certain glossaries to have
hyperlinks, but not for other glossaries. In this case, you can use the
package option \pkgopt{nohypertypes} to identify the glossary lists
that shouldn't have hyperlinked \gls{linktext}. See 
\sectionref{sec:pkgopts-general} for further details.

The way the \gls{linktext} is displayed depends on 
\begin{definition}[\DescribeMacro{\glstextformat}]
\cs{glstextformat}\marg{text}
\end{definition}
For example, to make all \gls{linktext} appear in a sans-serif
font, do:
\begin{verbatim}
\renewcommand*{\glstextformat}[1]{\textsf{#1}}
\end{verbatim}
Further customisation can be done via \ics{defglsentryfmt} or by
redefining \ics{glsentryfmt}. See \sectionref{sec:glsdisplay} for
further details.

Each entry has an associated conditional referred to as the
\firstuseflag. Some of the commands described in this chapter
automatically unset this flag and can also use it
to determine what text should be displayed. These types of commands
are the \glslike\ commands and are described in
\sectionref{sec:gls-like}. The commands that don't reference or change
the \firstuseflag\ are \glstextlike\ commands and are described
in \sectionref{sec:glstext-like}.  See \sectionref{sec:glsunset} for 
commands that unset (mark the entry as having been used) or reset
(mark the entry as not used) the \firstuseflag\ without referencing
the entries.

The \glslike\ and \glstextlike\ commands all take a first
optional argument that is a comma-separated list of
\meta{key}=\meta{value} options, described below. They also have a
star-variant, which inserts \texttt{hyper=false} at the start of the
list of options and a plus-variant, which inserts
\texttt{hyper=true} at the start of the list of options. For example
\verb|\gls*{sample}| is the same as \verb|\gls[hyper=false]{sample}|
and \verb|\gls+{sample}| is the same as
\verb|\gls[hyper=true]{sample}|, whereas just \verb|\gls{sample}|
will use the default hyperlink setting which depends on a number of
factors (such as whether the entry is in a glossary that has been
identified in the \pkgopt{nohypertypes} list).  You can override the
\gloskey[glslink]{hyper} key in the variant's optional argument, for
example, \verb|\gls*[hyper=true]{sample}| but this creates
redundancy and is best avoided. The \gls{glossaries-extra} package
provides the option to add a third custom variant.

\begin{important}
Avoid nesting these commands. For example don't do
\cs{glslink}\marg{label}\texttt{\{\cs{gls}\marg{label2}\}}
as this is likely to cause problems. By implication, this
means that you should avoid using any of these commands within
the \gloskey{text}, \gloskey{first}, \gloskey{short} or
\gloskey{long} keys (or their plural equivalent) or any
other key that you plan to access through these commands.
(For example, the \gloskey{symbol} key if you intend to use
\cs{glssymbol}.)
\end{important}

The keys listed below are available for the optional argument.
The \gls{glossaries-extra} package provides additional keys.
(See the \gls*{glossaries-extra} manual for further details.)
\begin{description}
\item[{\gloskey[glslink]{hyper}}] This is a boolean key which can
be used to enable\slash disable the hyperlink to the relevant entry
in the glossary. If this key is omitted, the value is determined by current
settings, as indicated above. For example, when used with a \glslike\ command, if this is the first
use and the \pkgopt[false]{hyperfirst} package option has been used,
then the default value is \texttt{hyper=false}. The hyperlink can be
forced on using \texttt{hyper=true} unless the hyperlinks have been
suppressed using \ics{glsdisablehyper}. You must load the
\sty{hyperref} package before the \sty{glossaries} package to
ensure the hyperlinks work.

\item[{\gloskey[glslink]{format}}] This specifies how to format the
associated location number for this entry in the glossary. This 
value is equivalent to the \gls{makeindex} encap value, and (as
with \ics{index}) the value needs to be the name of a command
\emph{without} the initial backslash. As with \ics{index}, the
characters \verb"(" and \verb")" can also be used to specify the
beginning and ending of a number range and they must be in matching
pairs. (For example, \verb|\gls[format={(}]{sample}| on one page
to start the range and later \verb|\gls[format={)}]{sample}| to close 
the range.)  Again as with \ics{index}, the command should be the
name of a command which takes an argument (which will be the
associated location).  Be careful not to use a declaration (such as
\texttt{bfseries}) instead of a text block command (such as
\texttt{textbf}) as the effect is not guaranteed to be localised. If
you want to apply more than one style to a given entry (e.g.\
\textbf{bold} and \emph{italic}) you will need to create a command
that applies both formats, e.g.\ 
\begin{verbatim}
\newcommand*{\textbfem}[1]{\textbf{\emph{#1}}}
\end{verbatim}
and use that command.

In this document, the standard formats refer to the standard text
block commands such as \ics{textbf} or \ics{emph} or any of the
commands listed in \tableref{tab:hyperxx}. You can combine a range
and format using \verb|(|\meta{format}  to start the range and
\verb|)|\meta{format} to end the range.  The \meta{format} part must
match. For example, \verb|format={(emph}| and \verb|format={)emph}|.

\begin{important}
If you use \gls{xindy} instead of \gls{makeindex}, you
must specify any non-standard formats that you want to use
with the \gloskey[glslink]{format} key using
\ics{GlsAddXdyAttribute}\marg{name}. So if you use
\gls*{xindy} with the above example, you would need to add:
\begin{verbatim}
\GlsAddXdyAttribute{textbfem}
\end{verbatim}
See \sectionref{sec:xindy} for further details.
\end{important}

If you are using hyperlinks and you want to change the font of the
hyperlinked location, don't use \ics{hyperpage} (provided by the
\sty{hyperref} package) as the locations may not refer to a page
number.  Instead, the \styfmt{glossaries} package provides number
formats listed in \tableref{tab:hyperxx}. These commands are
designed to work with the particular location formats created by
\gls{makeindex} and \gls{xindy} and shouldn't be used in other
contexts.

\begin{table}[htbp]
\caption{Predefined Hyperlinked Location Formats}
\label{tab:hyperxx}
\centering
\vskip\baselineskip
\begin{tabular}{ll}
\locfmt{hyperrm} & serif hyperlink\\
\locfmt{hypersf} & sans-serif hyperlink\\
\locfmt{hypertt} & monospaced hyperlink\\
\locfmt{hyperbf} & bold hyperlink\\
\locfmt{hypermd} & medium weight hyperlink\\
\locfmt{hyperit} & italic hyperlink\\
\locfmt{hypersl} & slanted hyperlink\\
\locfmt{hyperup} & upright hyperlink\\
\locfmt{hypersc} & small caps hyperlink\\
\locfmt{hyperemph} & emphasized hyperlink
\end{tabular}
\par
\end{table}

Note that if the \ics{hyperlink} command hasn't been defined, the
\texttt{hyper}\meta{xx} formats are equivalent to the analogous
\texttt{text}\meta{xx} font commands (and \texttt{hyperemph} is
equivalent to \texttt{emph}). If you want to make a new format, you
will need to define a command which takes one argument and use that.
For example, if you want the location number to be in a bold
sans-serif font, you can define a command called, say,
\ics{hyperbsf}:
\begin{verbatim}
\newcommand{\hyperbsf}[1]{\textbf{\hypersf{#1}}}
\end{verbatim}
and then use \texttt{hyperbsf} as the value for the \gloskey[glslink]{format}
key.\footnote{See also \ifpdf section~\ref*{sec:code:printglos} \fi
\qt{Displaying the glossary} in the documented code,
\texttt{glossaries-code.pdf}.} 

\begin{important}
When defining a custom location format command that uses one of the
\csmeta{hyper}{xx}{} commands, make sure that the argument of
\csmeta{hyper}{xx}{} is just the location. Any formatting must be
outside of \csmeta{hyper}{xx}{} (as in the above \cs{hyperbfsf}
example).
\end{important}

Remember that if you use \gls{xindy}, you
will need to add this to the list of location \ixindyattrs attributes:
\begin{verbatim}
\GlsAddXdyAttribute{hyperbsf}
\end{verbatim}

\item[{\gloskey[glslink]{counter}}] This specifies which counter
to use for this location. This overrides the default counter
used by this entry. (See also \sectionref{sec:numberlists}.)

\item[{\gloskey[glslink]{local}}] This is a boolean key that only
makes a difference when used with \glslike\ commands that change the
entry's \gls{firstuseflag}. If \texttt{local=true}, the change to
the \gls*{firstuseflag} will be localised to the current scope. The
default is \texttt{local=false}.

\item[{\xtrgloskey[glslink]{noindex}}] This is a boolean key that
suppresses the indexing. Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{hyperoutside}}] This is a boolean key that
determines whether to put the hyperlink outside of \ics{glstextformat}. 
Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{wrgloss}}] This key determines
whether to index before (\texttt{wrgloss\dequals before}) or after
(\texttt{wrgloss\dequals after}) the \gls{linktext}.
Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{textformat}}] This key identifies the
name of the control sequence to encapsulate the \gls{linktext}
instead of the default \ics{glstextformat}.
Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{prefix}}] This key locally redefines
\ics{glolinkprefix} to the given value.
Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{thevalue}}] This key explicitly sets the
location.
Only available with \gls{glossaries-extra}.

\item[{\xtrgloskey[glslink]{theHvalue}}] This key explicitly sets the
hyperlink location.
Only available with \gls{glossaries-extra}.

\end{description}

\begin{important}
The \gls{linktext} isn't scoped by default with just the base
\styfmt{glossaries} package. Any unscoped
declarations in the \gls{linktext} may affect subsequent text.
\end{important}

\section{The \cs{gls}-Like Commands (First Use Flag Queried)}
\label{sec:gls-like}

This section describes the commands that unset (mark as used) the \firstuseflag\ on
completion, and in most cases they use the current state of the flag
to determine the text to be displayed. As described above, these
commands all have a star-variant (\texttt{hyper=false}) and 
a plus-variant (\texttt{hyper=true}) and have an
optional first argument that is a \meta{key}=\meta{value} list.
These commands use \ics{glsentryfmt} or the equivalent definition provided by
\ics{defglsentryfmt} to determine the automatically generated text
and its format (see \sectionref{sec:glsdisplay}).

Apart from \ics{glsdisp}, the commands described in this section
also have a \emph{final} optional argument \meta{insert} which may
be used to insert material into the automatically generated text.

\begin{important}
Since the commands have a final optional argument, take care if
you actually want to display an open square bracket after the command
when the final optional argument is absent. Insert an empty set of
braces \verb|{}| immediately before the opening square bracket to
prevent it from being interpreted as the final argument. For
example:
\begin{verbatim}
\gls{sample} {}[Editor's comment]
\end{verbatim}

Don't use any of the \glslike\ or \glstextlike\ commands in the 
\meta{insert} argument.
\end{important}

Take care using these commands within commands or environments that
are processed multiple times as this can confuse the first use flag
query and state change. This includes frames with overlays in
\cls{beamer} and the \envfmt{tabularx} environment provided by \sty{tabularx}. 
The \styfmt{glossaries} package automatically deals with this issue
in \sty{amsmath}'s \envfmt{align} environment. You can apply a patch
to \sty{tabularx} by placing the following command (new to v4.28) in 
the preamble:
\begin{definition}[\DescribeMacro\glspatchtabularx]
\cs{glspatchtabularx}
\end{definition}
This does nothing if \sty{tabularx} hasn't been loaded. There's no
patch available for \cls{beamer}. See \sectionref{sec:glsunset} for
more details.

\begin{definition}[\DescribeMacro{\gls}]
\cs{gls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command typically determines the \gls{linktext} from the values
of the \gloskey{text} or \gloskey{first} keys supplied when the
entry was defined using \ics{newglossaryentry}. However, if the
entry was defined using \ics{newacronym} and \ics{setacronymstyle} was 
used, then the \gls*{linktext} will usually be determined from the \gloskey{long} or
\gloskey{short} keys.

There are two upper case variants:
\begin{definition}[\DescribeMacro{\Gls}]
\cs{Gls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
and
\begin{definition}[\DescribeMacro{\GLS}]
\cs{GLS}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
which make the first letter of the link text or all the link text
upper case, respectively. For the former, the uppercasing of the
first letter is performed by \ics{makefirstuc}.

\begin{important}
The first letter uppercasing command \cs{makefirstuc} has
limitations which must be taken into account if you use \cs{Gls} or
any of the other commands that convert the first letter to
uppercase. 
\end{important}
The upper casing is performed as follows:
\begin{itemize}
\item If the first thing in the \gls{linktext} is a command follow
by a group, the upper casing is performed on the first object of the
group. For example, if an entry has been defined as
\begin{verbatim}
\newglossaryentry{sample}{
 name={\emph{sample} phrase},
 sort={sample phrase},
 description={an example}}
\end{verbatim}
Then \cs{Gls}\verb|{sample}| will set the \gls{linktext}
to\footnote{I've used \cs{MakeUppercase} in all the examples for clarity, but it
will actually use \cs{mfirstucMakeUppercase}.}
\begin{verbatim}
\emph{\MakeUppercase sample} phrase
\end{verbatim}
which will appear as \emph{\MakeUppercase sample} phrase.

\item If the first thing in the \gls{linktext} isn't a command or is
a command but isn't followed by a group, then the upper casing will
be performed on that first thing. For example, if an entry has been
defined as:
\begin{verbatim}
\newglossaryentry{sample}{
  name={\oe-ligature},
  sort={oe-ligature},
  description={an example}
}
\end{verbatim}
Then \cs{Gls}\verb|{sample}| will set the \gls{linktext} to
\begin{verbatim}
\MakeUppercase \oe-ligature
\end{verbatim}
which will appear as \MakeUppercase \oe-ligature.

\item If you have \sty{mfirstuc} v2.01 or above, an extra case is
added. If the first thing is \cs{protect} it will be discarded and
the above rules will then be tried.

\end{itemize}
(Note the use of the \gloskey{sort} key in the above examples.)

There are hundreds of \LaTeX\ packages that altogether define
thousands of commands with various syntax and it's impossible for
\sty{mfirstuc} to take them all into account. The above rules are quite
simplistic and are designed for \gls{linktext} that starts with
a~text-block command (such as \cs{emph}) or a command that produces 
a character (such as \cs{oe}). This means that if your \gls{linktext}
starts with something that doesn't adhere to \sty{mfirstuc}'s assumptions
then things are likely to go wrong.

For example, starting with a math-shift symbol:
\begin{verbatim}
\newglossaryentry{sample}{
  name={$a$},
  sort={a},
  description={an example}
}
\end{verbatim}
This falls into case~2 above, so the \gls{linktext} will be set to
\begin{verbatim}
\MakeUppercase $a$
\end{verbatim}
This attempts to uppercase the math-shift \verb|$|, which will go
wrong. In this case it's not appropriate to perform any
case-changing, but it may be that you want to use \cs{Gls}
programmatically without checking if the text contains any maths.
In this case, the simplest solution is to insert an empty brace at
the start:
\begin{verbatim}
\newglossaryentry{sample}{
  name={{}$a$},
  sort={a},
  description={an example}
}
\end{verbatim}
Now the \gls{linktext} will be set to
\begin{verbatim}
\MakeUppercase{}$a$
\end{verbatim}
and the \cs{uppercase} becomes harmless.

Another issue occurs when the \gls{linktext} starts with a command
followed by an argument (case~1) but the argument is a label,
identifier or something else that shouldn't have a case-change.
A common example is when the \gls{linktext} starts with one of the
commands described in this chapter. (But you haven't done that, have
you? What with the warning not to do it at the beginning of the chapter.)
Or when the \gls{linktext} starts with one of the non-linking
commands described in \sectionref{sec:glsnolink}. For example:
\begin{verbatim}
\newglossaryentry{sample}{name={sample},description={an example}}
\newglossaryentry{sample2}{
   name={\glsentrytext{sample} two},
   sort={sample two},
   description={another example}
 }
\end{verbatim}
Now the \gls{linktext} will be set to:
\begin{verbatim}
\glsentrytext{\MakeUppercase sample} two
\end{verbatim}
This will generate an error because there's no entry with the label
\qt{\texttt{\cs{MakeUppercase} sample}}. The best solution here is to 
write the term out in the \gloskey{text} field and use the command
in the \gloskey{name} field. If you don't use \cs{glsname} anywhere
in your document, you can use \cs{gls} in the \gloskey{name} field:
\begin{verbatim}
\newglossaryentry{sample}{name={sample},description={an example}}
\newglossaryentry{sample2}{
   name={\gls{sample} two},
   sort={sample two},
   text={sample two},
   description={another example}
 }
\end{verbatim}

If the \gls{linktext} starts with a command that has an optional
argument or with multiple arguments where the actual text isn't in
the first argument, then \cs{makefirstuc} will also fail. For
example:
\begin{verbatim}
\newglossaryentry{sample}{
 name={\textcolor{blue}{sample} phrase},
 sort={sample phrase},
 description={an example}}
\end{verbatim}
Now the \gls{linktext} will be set to:
\begin{verbatim}
\textcolor{\MakeUppercase blue}{sample} phrase
\end{verbatim}
This won't work because \verb|\MakeUppercase blue| isn't a recognised
colour name. In this case you will have to define a helper command where
the first argument is the text. For example:
\begin{verbatim}
\newglossaryentry{sample}{
\newcommand*{\blue}[1]{\textcolor{blue}{#1}}
 name={\blue{sample} phrase},
 sort={sample phrase},
 description={an example}}
\end{verbatim}
In fact, since the whole design ethos of \LaTeX\ is the separation
of content and style, it's better to use a semantic command. For
example:
\begin{verbatim}
\newglossaryentry{sample}{
\newcommand*{\keyword}[1]{\textcolor{blue}{#1}}
 name={\keyword{sample} phrase},
 sort={sample phrase},
 description={an example}}
\end{verbatim}
For further details see the \sty{mfirstuc} user manual.

There are plural forms that are analogous to \cs{gls}:
\begin{definition}[\DescribeMacro{\glspl}]
\cs{glspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\Glspl}]
\cs{Glspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSpl}]
\cs{GLSpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
These typically determine the link text from the \gloskey{plural} or
\gloskey{firstplural} keys supplied when the entry was 
defined using \ics{newglossaryentry} or, if the entry is an
abbreviation and \cs{setacronymstyle} was used, from the \gloskey{longplural} or
\gloskey{shortplural} keys.

\begin{important}
Be careful when you use glossary entries in math mode especially if you 
are using \sty{hyperref} as it can affect the spacing of subscripts and
superscripts. For example, suppose you have defined the following
entry:
\begin{verbatim}
\newglossaryentry{Falpha}{name={F_\alpha},
description=sample}
\end{verbatim}
and later you use it in math mode:
\begin{verbatim}
$\gls{Falpha}^2$
\end{verbatim}
This will result in $F_\alpha{}^2$ instead of $F_\alpha^2$. In this
situation it's best to bring the superscript into the hyperlink using
the final \meta{insert} optional argument:
\begin{verbatim}
$\gls{Falpha}[^2]$
\end{verbatim}
\end{important}

\begin{definition}[\DescribeMacro{\glsdisp}]
\cs{glsdisp}\oarg{options}\marg{label}\marg{link text}
\end{definition}
This behaves in the same way as the above commands, except
that the \meta{link text} is explicitly set. There's no final
optional argument as any inserted material can be added to the
\meta{link text} argument.

\begin{important}
Don't use any of the \glslike\ or \glstextlike\ commands in the 
\meta{link text} argument of \cs{glsdisp}.
\end{important}

\section{The \cs{glstext}-Like Commands (First Use Flag Not Queried)}
\label{sec:glstext-like}

This section describes the commands that don't change or reference
the \firstuseflag. As described above, these commands all have a
star-variant (\texttt{hyper=false}) and a plus-variant
(\texttt{hyper=true}) and have an optional first argument
that is a \meta{key}=\meta{value} list. These commands also don't
use \ics{glsentryfmt} or the equivalent definition provided by
\ics{defglsentryfmt} (see \sectionref{sec:glsdisplay}). 
Additional commands for abbreviations are described in
\sectionref{sec:acronyms}.

Apart from \ics{glslink}, the commands described in this section
also have a \emph{final} optional argument \meta{insert} which may
be used to insert material into the automatically generated text.
See the caveat above in \sectionref{sec:gls-like}.

\begin{definition}[\DescribeMacro{\glslink}]
\cs{glslink}\oarg{options}\marg{label}\marg{link text}
\end{definition}
This command explicitly sets the \gls{linktext} as given in the
final argument.

\begin{important}
Don't use any of the \glslike\ or \glstextlike\ commands in the 
argument of \cs{glslink}. By extension, this means that you can't
use them in the value of fields that are used to form
\gls{linktext}.
\end{important}

\begin{definition}[\DescribeMacro{\glstext}]
\cs{glstext}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{text} key as the
\gls{linktext}.

There are also analogous commands:
\begin{definition}[\DescribeMacro{\Glstext}]
\cs{Glstext}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLStext}]
\cs{GLStext}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
These convert the first character or all the characters to
uppercase, respectively. See the note on \cs{Gls} above for details
on the limitations of converting the first letter to upper case.

There's no equivalent command for title-casing, but you
can use the more generic command \ics{glsentrytitlecase}
in combination with \cs{glslink}. For example:
\begin{verbatim}
\glslink{sample}{\glsentrytitlecase{sample}{text}}
\end{verbatim}
(See \sectionref{sec:glsnolink}.)

\begin{definition}[\DescribeMacro{\glsfirst}]
\cs{glsfirst}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{first} key as the
\gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsfirst}]
\cs{Glsfirst}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSfirst}]
\cs{GLSfirst}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{important}
The value of the \gloskey{first} key (and \gloskey{firstplural} key)
doesn't necessarily match the text produced by \ics{gls} (or \ics{glspl}) on
\firstuse\ as the \gls{linktext} used by \ics{gls} may be modified
through commands like \ics{defglsentry}. (Similarly, the value of the
\gloskey{text} and \gloskey{plural} keys don't necessarily match
the \gls*{linktext} used by \cs{gls} or \cs{glspl} on subsequent
use.)
\end{important}

\begin{definition}[\DescribeMacro{\glsplural}]
\cs{glsplural}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{plural} key as the
\gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsplural}]
\cs{Glsplural}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSplural}]
\cs{GLSplural}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsfirstplural}]
\cs{glsfirstplural}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{firstplural} key as the
\gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsfirstplural}]
\cs{Glsfirstplural}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSfirstplural}]
\cs{GLSfirstplural}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsname}]
\cs{glsname}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{name} key as the
\gls{linktext}. Note that this may be different from the values of
the \gloskey{text} or \gloskey{first} keys. In general it's better
to use \cs{glstext} or \cs{glsfirst} instead of \cs{glsname}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsname}]
\cs{Glsname}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSname}]
\cs{GLSname}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{important}
In general it's best to avoid \cs{Glsname} with acronyms. Instead,
consider using \cs{Acrlong}, \cs{Acrshort} or \cs{Acrfull}.
\end{important}

\begin{definition}[\DescribeMacro{\glssymbol}]
\cs{glssymbol}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{symbol} key as the
\gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glssymbol}]
\cs{Glssymbol}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSsymbol}]
\cs{GLSsymbol}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsdesc}]
\cs{glsdesc}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the \gloskey{description} key as the
\gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsdesc}]
\cs{Glsdesc}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSdesc}]
\cs{GLSdesc}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

If you want the title case version you can use
\begin{verbatim}
\glslink{sample}{\glsentrytitlecase{sample}{desc}}
\end{verbatim}

\begin{definition}[\DescribeMacro{\glsuseri}]
\cs{glsuseri}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user1} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuseri}]
\cs{Glsuseri}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuseri}]
\cs{GLSuseri}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsuserii}]
\cs{glsuserii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user2} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuserii}]
\cs{Glsuserii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuserii}]
\cs{GLSuserii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsuseriii}]
\cs{glsuseriii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user3} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuseriii}]
\cs{Glsuseriii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuseriii}]
\cs{GLSuseriii}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsuseriv}]
\cs{glsuseriv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user4} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuseriv}]
\cs{Glsuseriv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuseriv}]
\cs{GLSuseriv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsuserv}]
\cs{glsuserv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user5} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuserv}]
\cs{Glsuserv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuserv}]
\cs{GLSuserv}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\begin{definition}[\DescribeMacro{\glsuservi}]
\cs{glsuservi}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
This command always uses the value of the 
\gloskey{user6} key as the \gls{linktext}.

There are also analogous uppercasing commands:
\begin{definition}[\DescribeMacro{\Glsuservi}]
\cs{Glsuservi}\oarg{options}\marg{text}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\GLSuservi}]
\cs{GLSuservi}\oarg{options}\marg{text}\oarg{insert}
\end{definition}

\section{Changing the format of the link text}
\label{sec:glsdisplay}

\begin{xtr}
The \gls{glossaries-extra} package provides ways of altering the
format according to the category. See the \gls{glossaries-extra}
manual for further details.
\end{xtr}

The default format of the \gls{linktext} for the \glslike\ commands 
is governed by\footnote{\ics{glsdisplayfirst} and \ics{glsdisplay} are now
deprecated. Backwards compatibility should be preserved but
you may need to use the \pkgopt{compatible-3.07} option}:
\begin{definition}[\DescribeMacro{\glsentryfmt}]
\cs{glsentryfmt}
\end{definition}
This may be redefined but if you only want the change the display style 
for a given glossary, then you need to use
\begin{definition}[\DescribeMacro{\defglsentryfmt}]
\cs{defglsentryfmt}\oarg{type}\marg{definition}
\end{definition}
instead of redefining \cs{glsentryfmt}. The optional first argument 
\meta{type} is the glossary type. This defaults to
\ics{glsdefaulttype} if omitted. The second argument is the
entry format definition.

\begin{important}
Note that \cs{glsentryfmt} is the default display format for
entries. Once the display format has been changed for an individual
glossary using \ics{defglsentryfmt}, redefining \cs{glsentryfmt}
won't have an effect on that glossary, you must instead use
\cs{defglsentryfmt} again. Note that glossaries that have
been identified as lists of acronyms (via the package option
\pkgopt{acronymlists} or the command \ics{DeclareAcronymList}, 
see \sectionref{sec:pkgopts-acronym}) use 
\cs{defglsentryfmt} to set their display style.
\end{important}

Within the \meta{definition} argument of \cs{defglsentryfmt}, or if you
want to redefine \cs{glsentryfmt}, you may use the following
commands:

\begin{definition}[\DescribeMacro{\glslabel}]
\cs{glslabel}
\end{definition}
This is the label of the entry being referenced. As from version
4.08, you can also access the glossary entry type using:
\begin{definition}[\DescribeMacro{\glstype}]
\cs{glstype}
\end{definition}
This is defined using \ics{edef} so the replacement text is the
actual glossary type rather than \verb|\glsentrytype{\glslabel}|.

\begin{definition}[\DescribeMacro{\glscustomtext}]
\cs{glscustomtext}
\end{definition}
This is the custom text supplied in \cs{glsdisp}. It's always empty
for \ics{gls}, \ics{glspl} and their upper case variants. (You can 
use \sty{etoolbox}'s \cs{ifdefempty} to determine if
\cs{glscustomtext} is empty.) 

\begin{definition}[\DescribeMacro{\glsinsert}]
\cs{glsinsert}
\end{definition}
The custom text supplied in the final optional argument to \cs{gls},
\cs{glspl} and their upper case variants.

\begin{definition}[\DescribeMacro{\glsifplural}]
\cs{glsifplural}\marg{true text}\marg{false text}
\end{definition}
If \cs{glspl}, \cs{Glspl} or \cs{GLSpl} was used, this command does 
\meta{true text} otherwise it does \meta{false text}.

\begin{definition}[\DescribeMacro{\glscapscase}]
\cs{glscapscase}\marg{no case}\marg{first uc}\marg{all caps}
\end{definition}
If \cs{gls}, \cs{glspl} or \cs{glsdisp} were used, this does \meta{no
case}. If \cs{Gls} or \cs{Glspl} were used, this does \meta{first
uc}. If \cs{GLS} or \cs{GLSpl} were used, this does \meta{all caps}.

\begin{definition}[\DescribeMacro\glsifhyperon]
\cs{glsifhyperon}\marg{hyper true}\marg{hyper false}
\end{definition}
This will do \meta{hyper true} if the hyperlinks are on for the
current reference, otherwise it will do \meta{hyper false}. The
hyperlink may be off even if it wasn't explicitly switched off with
the \gloskey[glslink]{hyper} key or the use of a starred command.
It may be off because the \sty{hyperref} package hasn't been loaded
or because \ics{glsdisablehyper} has been used or because the entry
is in a glossary type that's had the hyperlinks switched off (using
\pkgopt{nohypertypes}) or because it's the \firstuse\ and the
hyperlinks have been suppressed on first use.

\begin{important}
The \cs{glsifhyperon} command should be used instead of 
\ics{glsifhyper}, which is now deprecated (and no longer documented). 
\end{important}

If you want to know if the command used to reference
this entry was used with the star or plus variant, you can use:
\begin{definition}[\DescribeMacro\glslinkvar]
\cs{glslinkvar}\marg{unmodified}\marg{star}\marg{plus}
\end{definition} 
This will do \meta{unmodified} if the unmodified version was used,
or will do \meta{star} if the starred version was used, or
will do \meta{plus} if the plus version was used.
Note that this doesn't take into account if the 
\gloskey[glslink]{hyper} key was used to override the default
setting, so this command shouldn't be used to guess whether or not
the hyperlink is on for this reference.

Note that you can also use commands such as \ics{ifglsused} within
the definition of \cs{glsentryfmt} (see \sectionref{sec:glsunset}).

The commands \ics{glslabel}, \ics{glstype}, \ics{glsifplural},
\ics{glscapscase}, \ics{glsinsert} and \ics{glscustomtext} are
typically updated at the start of the \glslike\ and \glstextlike\
commands so they can usually be accessed in the hook user commands,
such as \ics{glspostlinkhook} and \ics{glslinkpostsetkeys}.

\begin{important}
This means that using commands like \ics{gls} within the fields
that are accessed using the \glslike\ or \glstextlike\ commands
(such as the \gloskey{first}, \gloskey{text}, \gloskey{long}
or \gloskey{short} keys) will cause a problem. The entry formatting
performed by \cs{glsentryfmt} and related commands isn't scoped
(otherwise if would cause problems for \cs{glspostlinkhook} which
may need to look ahead as well as look behind).
This means that any nested commands will, at the very least, change 
the label stored in \cs{glslabel}.
\end{important}

If you only want to make minor modifications to \cs{glsentryfmt},
you can use
\begin{definition}[\DescribeMacro{\glsgenentryfmt}]
\cs{glsgenentryfmt}
\end{definition}
This uses the above commands to display just the \gloskey{first}, 
\gloskey{text}, \gloskey{plural} or \gloskey{firstplural} keys 
(or the custom text) with the insert text appended.

Alternatively, if you want to change the entry format for abbreviations
(defined via \ics{newacronym}) you can use:
\begin{definition}[\DescribeMacro{\glsgenacfmt}]
\cs{glsgenacfmt}
\end{definition}
This uses the values from the \gloskey{long}, \gloskey{short},
\gloskey{longplural} and \gloskey{shortplural} keys, rather than
using the \gloskey{text}, \gloskey{plural}, \gloskey{first} 
and \gloskey{firstplural} keys. The first use singular text is obtained via:
\begin{definition}[\DescribeMacro{\genacrfullformat}]
\cs{genacrfullformat}\marg{label}\marg{insert}
\end{definition}
instead of from the \gloskey{first} key, and the first use plural
text is obtained via:
\begin{definition}[\DescribeMacro{\genplacrfullformat}]
\cs{genplacrfullformat}\marg{label}\marg{insert}
\end{definition}
instead of from the \gloskey{firstplural} key.
In both cases, \meta{label} is the entry's label and \meta{insert}
is the insert text provided in the final optional argument of
commands like \ics{gls}. The default behaviour is to do the long
form (or plural long form) followed by \meta{insert} and a~space and the short form (or plural
short form) in parentheses, where the short form is in the argument
of \ics{firstacronymfont}. There are also first letter upper case
versions:
\begin{definition}[\DescribeMacro{\Genacrfullformat}]
\cs{Genacrfullformat}\marg{label}\marg{insert}
\end{definition}
and
\begin{definition}[\DescribeMacro{\Genplacrfullformat}]
\cs{Genplacrfullformat}\marg{label}\marg{insert}
\end{definition}
By default these perform a protected expansion on their no-case-change
equivalents and then use \ics{makefirstuc} to convert the first
character to upper case. If there are issues caused by this
expansion, you will need to redefine those commands to explicitly
use commands like \ics{Glsentrylong} (which is what the predefined
acronym styles, such as \acrstyle{long-short}, do). Otherwise, you
only need to redefine \ics{genacrfullformat} and
\ics{genplacrfullformat} to change the behaviour of
\ics{glsgenacfmt}. See \sectionref{sec:acronyms} for further details
on changing the style of acronyms.

\begin{important}
Note that \cs{glsentryfmt} (or the formatting given by \cs{defglsentryfmt}) 
is not used by the \glstextlike\ commands.
\end{important}

As from version 4.16, both the \glslike\ and \glstextlike\ commands
use
\begin{definition}[\DescribeMacro\glslinkpostsetkeys]
\cs{glslinkpostsetkeys}
\end{definition}
after the \meta{options} are set. This macro does nothing by default
but can be redefined. (For example, to switch off the hyperlink
under certain conditions.) This version also introduces
\begin{definition}[\DescribeMacro\glspostlinkhook]
\cs{glspostlinkhook}
\end{definition}
which is done after the link text has been displayed and also
\emph{after} the \firstuseflag\ has been unset (see
example~\ref{ex:dotabbr}).

\begin{example}{Custom Entry Display in Text}{ex:customfmt}
Suppose you want a glossary of measurements and
units, you can use the \gloskey{symbol} key to store the unit:
\begin{verbatim}
\newglossaryentry{distance}{name=distance,
description={The length between two points},
symbol={km}}
\end{verbatim}
and now suppose you want \verb|\gls{distance}| to produce
\qt{distance (km)} on \firstuse, then you can redefine
\ics{glsentryfmt} as follows:
\begin{verbatim}
\renewcommand*{\glsentryfmt}{%
  \glsgenentryfmt
  \ifglsused{\glslabel}{}{\space (\glsentrysymbol{\glslabel})}%
}
\end{verbatim}

(Note that I've used \ics{glsentrysymbol} rather than \ics{glssymbol}
to avoid nested hyperlinks.)

Note also that all of the \gls{linktext} will be formatted according
to \ics{glstextformat} (described earlier). So if you do, say:
\begin{verbatim}
\renewcommand{\glstextformat}[1]{\textbf{#1}}
\renewcommand*{\glsentryfmt}{%
  \glsgenentryfmt
  \ifglsused{\glslabel}{}{\space(\glsentrysymbol{\glslabel})}%
}
\end{verbatim}
then \verb|\gls{distance}| will produce \qt{\textbf{distance (km)}}.

For a complete document, see the sample file \samplefile{-entryfmt}.
\end{example}

\begin{example}{Custom Format for Particular Glossary}{ex:defglsentryfmt}
Suppose you have created a new glossary called
\texttt{notation} and you want to change the way the entry is
displayed on \firstuse\ so that it includes the symbol, you can do:
\begin{verbatim}
\defglsentryfmt[notation]{\glsgenentryfmt
 \ifglsused{\glslabel}{}{\space
   (denoted \glsentrysymbol{\glslabel})}}
\end{verbatim}
Now suppose you have defined an entry as follows:
\begin{verbatim}
\newglossaryentry{set}{type=notation,
  name=set,
  description={A collection of objects},
  symbol={$S$}
}
\end{verbatim}
The \glslink{firstuse}{first time} you reference this entry it will be displayed as:
\qt{set (denoted $S$)} (assuming \ics{gls} was used).

Alternatively, if you expect all the symbols to be set in math mode,
you can do:
\begin{verbatim}
\defglsentryfmt[notation]{\glsgenentryfmt
 \ifglsused{\glslabel}{}{\space
   (denoted $\glsentrysymbol{\glslabel}$)}}
\end{verbatim}
and define entries like this:
\begin{verbatim}
\newglossaryentry{set}{type=notation,
  name=set,
  description={A collection of objects},
  symbol={S}
}
\end{verbatim}
\end{example}

Remember that if you use the \gloskey{symbol} key, you need to use a
glossary style that displays the symbol, as many of the styles
ignore it.

\section{Enabling and disabling hyperlinks to glossary entries}
\label{sec:disablehyperlinks}

If you load the \sty{hyperref} or \sty{html} packages prior to
loading the \styfmt{glossaries} package, the \glslike\ and
\glstextlike\ commands will automatically have hyperlinks
to the relevant glossary entry, unless the \gloskey[glslink]{hyper}
option has been switched off (either explicitly or through 
implicit means, such as via the \pkgopt{nohypertypes} package option).

You can disable or enable links using:
\begin{definition}[\DescribeMacro{\glsdisablehyper}]
\cs{glsdisablehyper}
\end{definition}
and
\begin{definition}[\DescribeMacro{\glsenablehyper}]
\cs{glsenablehyper}
\end{definition}
respectively. The effect can be localised by placing the commands
within a group. Note that you should only use \cs{glsenablehyper}
if the commands \ics{hyperlink} and \ics{hypertarget} have been
defined (for example, by the \sty{hyperref} package).

You can disable just the \gls{firstuse} links using the package
option \pkgopt[false]{hyperfirst}. Note that this option only
affects the \glslike\ commands that recognise the \firstuseflag.

\begin{example}{First Use With Hyperlinked Footnote Description}{ex:hyperdesc}
Suppose I want the \gls*{firstuse} to have a hyperlink to the
description in a footnote instead of hyperlinking to the relevant
place in the glossary. First I need to disable the hyperlinks on
first use via the package option \pkgopt[false]{hyperfirst}:
\begin{verbatim}
\usepackage[hyperfirst=false]{glossaries}
\end{verbatim}
Now I need to redefine \ics{glsentryfmt} (see
\sectionref{sec:glsdisplay}):
\begin{verbatim}
\renewcommand*{\glsentryfmt}{%
  \glsgenentryfmt
  \ifglsused{\glslabel}{}{\footnote{\glsentrydesc{\glslabel}}}%
}
\end{verbatim}

Now the first use won't have hyperlinked text, but will be followed
by a footnote.
See the sample file \samplefile{-FnDesc} for a complete document.
\end{example}

Note that the \pkgopt{hyperfirst} option applies to all defined glossaries.  It
may be that you only want to disable the hyperlinks on
\gls{firstuse} for glossaries that have a different form on
\gls*{firstuse}. This can be achieved by noting that since the
entries that require hyperlinking for all instances have identical
first and subsequent text, they can be unset via \ics{glsunsetall}
(see \sectionref{sec:glsunset}) so that the \pkgopt{hyperfirst}
option doesn't get applied.

\begin{example}{Suppressing Hyperlinks on First Use Just For
Acronyms}{ex:hyperfirst}
Suppose I want to suppress the hyperlink on \gls{firstuse} for
acronyms but not for entries in the main glossary.  I~can load
the \styfmt{glossaries} package using:
\begin{verbatim}
\usepackage[hyperfirst=false,acronym]{glossaries}
\end{verbatim}
Once all glossary entries have been defined I~then do:
\begin{verbatim}
\glsunsetall[main]
\end{verbatim}

\end{example}

For more complex requirements, you might find it easier to switch
off all hyperlinks via \ics{glsdisablehyper} and put the hyperlinks
(where required) within the definition of \ics{glsentryfmt} (see
\sectionref{sec:glsdisplay}) via \ics{glshyperlink} (see
\sectionref{sec:glsnolink}).

\begin{example}{Only Hyperlink in Text Mode Not Math
Mode}{ex:nomathhyper}
This is a bit of a contrived example, but suppose, for some reason,
I only want the \glslike\ commands to have
hyperlinks when used in text mode, but not in math mode. I~can do
this by adding the glossary to the list of nohypertypes and redefining 
\ics{glsentryfmt}:
\begin{verbatim}
\GlsDeclareNoHyperList{main}

\renewcommand*{\glsentryfmt}{%
  \ifmmode
    \glsgenentryfmt
  \else
    \glsifhyperon
    {\glsgenentryfmt}% hyperlink already on
    {\glshyperlink[\glsgenentryfmt]{\glslabel}}%
  \fi
}
\end{verbatim}
Note that this doesn't affect the \glstextlike\ commands, which will
have the hyperlinks off unless they're forced on using the plus
variant.

See the sample file \samplefile{-nomathhyper} for a complete
document.
\end{example}

\begin{example}{One Hyper Link Per Entry Per Chapter}{ex:chap-hyperfirst}
Here's a more complicated example that will only have the hyperlink
on the first time an entry is used per chapter. This doesn't involve
resetting the \firstuseflag. Instead it adds a~new key using
\ics{glsaddstoragekey} (see \sectionref{sec:glsaddstoragekey}) that
keeps track of the chapter number that the entry was last used in:
\begin{verbatim}
\glsaddstoragekey{chapter}{0}{\glschapnum}
\end{verbatim}
This creates a new user command called \cs{glschapnum} that's
analogous to \cs{glsentrytext}. The default value for this key is~0.
I~then define my glossary entries as usual.

Next I redefine the hook \ics{glslinkpostsetkeys}
(see \sectionref{sec:glsdisplay}) so that it determines the current
chapter number (which is stored in \cs{currentchap} using
\cs{edef}). This value is then compared with the value of the
entry's \texttt{chapter} key that I defined earlier. If they're the
same, this entry has already been used in this chapter so the
hyperlink is switched off using \sty{xkeyval}'s \cs{setkeys}
command. If the chapter number isn't the same, then this entry
hasn't been used in the current chapter. The \texttt{chapter} field
is updated using \ics{glsfieldxdef} (\sectionref{sec:fetchset})
provided the user hasn't switched off the hyperlink.
(This test is performed using \cs{glsifhyperon}.
\begin{verbatim}
\renewcommand*{\glslinkpostsetkeys}{%
 \edef\currentchap{\arabic{chapter}}%
 \ifnum\currentchap=\glschapnum{\glslabel}\relax
  \setkeys{glslink}{hyper=false}%
 \else
  \glsifhyperon{\glsfieldxdef{\glslabel}{chapter}{\currentchap}}{}%
 \fi
}
\end{verbatim}
Note that this will be confused if you use \cs{gls} etc when the
chapter counter is~0. (That is, before the first \cs{chapter}.)

See the sample file \samplefile{-chap-hyperfirst} for a complete
document.
\end{example}

\chapter{Adding an Entry to the Glossary Without Generating Text}
\label{sec:glsadd}

It is possible to add a line to the glossary file without
generating any text at that point in the document using:
\begin{definition}[\DescribeMacro{\glsadd}]
\cs{glsadd}\oarg{options}\marg{label}
\end{definition}
This is similar to the \glstextlike\ commands, only it doesn't produce
any text (so therefore, there is no \gloskey[glslink]{hyper} key
available in \meta{options} but all the other options that can
be used with \glstextlike\ commands can be passed to \cs{glsadd}).
For example, to add a page range to the glossary number list for the
entry whose label is given by \texttt{set}:
\begin{verbatim}
\glsadd[format=(]{set}
Lots of text about sets spanning many pages.
\glsadd[format=)]{set}
\end{verbatim}

To add all entries that have been defined, use:
\begin{definition}[\DescribeMacro{\glsaddall}]
\cs{glsaddall}\oarg{options}
\end{definition}
The optional argument is the same as for \cs{glsadd}, except
there is also a key \gloskey[glsaddall]{types} which can be
used to specify which glossaries to use. This should be a
comma-separated list. For example, if you only want to add
all the entries belonging to the list of acronyms (specified by
the glossary type \ics{acronymtype}) and a list of
notation (specified by the glossary type \texttt{notation}) then you can
do:
\begin{verbatim}
\glsaddall[types={\acronymtype,notation}]
\end{verbatim}
If you are using \gls{bib2gls} with \gls{glossaries-extra}, you
can't use \cs{glsaddall}. Instead use the \optfmt{selection=all}
resource option to select all entries in the given \filetype{bib} files.

\begin{important}
Note that \cs{glsadd} and \cs{glsaddall} add the current location to
the \gls{numberlist}. In the case of \cs{glsaddall}, all entries in the
glossary will have the same location in the number list. If you want
to use \cs{glsaddall}, it's best to suppress the number list with
the \pkgopt{nonumberlist} package option. (See
sections~\ref{sec:pkgopts-printglos} and~\ref{sec:numberlists}.)
\end{important}

There is now a variation of \cs{glsaddall} that skips any entries
that have already been used:
\begin{definition}[\DescribeMacro\glsaddallunused]
\cs{glsaddallunused}\oarg{list}
\end{definition}
This command uses \cs{glsadd}\texttt{[format=glsignore]} which will
ignore this location in the number list. The optional argument
\meta{list} is a comma-separated list of glossary types. If omitted,
it defaults to the list of all defined glossaries.

\begin{important}
If you want to use \cs{glsaddallunused}, it's best to place the
command at the end of the document to ensure that all the commands
you intend to use have already been used. Otherwise you could end up
with a spurious comma or dash in the location list.
\end{important}

With \gls{glossaries-extra} and \gls{bib2gls}, \texttt{glsignore}
indicates an \qt{ignored location} which influences selection but
isn't added to the location list. In this case, if you use
\optfmt{selection=all} then only those entries that have been
explicitly indexed in the document will have location lists. The
other entries that were selected as a result of
\optfmt{selection=all} won't have location lists.

Base \sty{glossaries} package only:
\begin{verbatim}
\documentclass{article}
\usepackage{glossaries}
\makeglossaries
\newglossaryentry{cat}{name={cat},description={feline}}
\newglossaryentry{dog}{name={dog},description={canine}}
\begin{document}
\gls{cat}.
\printglossaries
\glsaddallunused % <- make sure dog is also listed
\end{document}
\end{verbatim}
Corresponding \gls{glossaries-extra} and \gls{bib2gls} document code:
\begin{verbatim}
\documentclass{article}
\usepackage[record]{glossaries-extra}
\GlsXtrLoadResources[src={entries},selection=all]
\begin{document}
\gls{cat}.
\printunsrtglossaries
\end{document}
\end{verbatim}
With the file \texttt{entries.bib}:
\begin{verbatim}
@entry{cat,name={cat},description={feline}}
@entry{dog,name={dog},description={canine}}
\end{verbatim}

\begin{example}{Dual Entries}{ex:dual}
The example file \samplefile{-dual} makes use of \cs{glsadd} to
allow for an entry that should appear both in the main glossary and
in the list of acronyms. This example sets up the list of acronyms
using the \pkgopt{acronym} package option:
\begin{verbatim}
\usepackage[acronym]{glossaries}
\end{verbatim}
A new command is then defined to make it easier to define dual
entries:
\begin{verbatim}
\newcommand*{\newdualentry}[5][]{%
  \newglossaryentry{main-#2}{name={#4},%
  text={#3\glsadd{#2}},%
  description={#5},%
  #1
  }%
  \newacronym{#2}{#3\glsadd{main-#2}}{#4}%
}
\end{verbatim}
This has the following syntax:
\begin{alltt}
\ics{newdualentry}\oarg{options}\marg{label}\marg{abbrv}\marg{long}\marg{description}
\end{alltt}
You can then define a new dual entry:
\begin{verbatim}
\newdualentry{svm}% label
  {SVM}% abbreviation
  {support vector machine}% long form
  {Statistical pattern recognition technique}% description
\end{verbatim}
Now you can reference the acronym with \verb|\gls{svm}| or you can
reference the entry in the main glossary with \verb|\gls{main-svm}|.

Note that with \gls{bib2gls}, there are special dual entry types
that implement this behaviour. That is, if an entry is referenced
then its corresponding dual entry will automatically be selected as
well. So there is less need for \cs{glsadd} with \gls{bib2gls}.
(Although it can still be useful, as shown in \opt6.)
\end{example}

\chapter{Cross-Referencing Entries}
\label{sec:crossref}

\begin{important}
You must use \ics{makeglossaries} (\optsor23) or
\ics{makenoidxglossaries} (\opt1) \emph{before} defining any
terms that cross-reference entries. If any of the terms that you have
cross-referenced don't appear in the glossary, check that you have
put \cs{makeglossaries}\slash\cs{makenoidxglossaries} before all 
entry definitions. The \gls{glossaries-extra} package provides
better cross-reference handling.
\end{important}

There are several ways of cross-referencing entries in the 
glossary: 

\begin{enumerate}
\item You can use commands such as \ics{gls} in the
entries description. For example:
\begin{verbatim}
\newglossaryentry{apple}{name=apple,
description={firm, round fruit. See also \gls{pear}}}
\end{verbatim}
Note that with this method, if you don't use the cross-referenced term 
in the main part of the document, you will need two runs of
\gls{makeglossaries}:
\begin{prompt}
pdflatex filename
makeglossaries filename
pdflatex filename
makeglossaries filename
pdflatex filename
\end{prompt}

\item As described in \sectionref{sec:newglosentry}, you can use the
\gloskey{see} key when you define the entry. For example:
\begin{verbatim}
\newglossaryentry{MaclaurinSeries}{name={Maclaurin 
series},
description={Series expansion},
see={TaylorsTheorem}}
\end{verbatim}
Note that in this case, the entry with the \gloskey{see} key will
automatically be added to the glossary, but the cross-referenced
entry won't. You therefore need to ensure that you use the
cross-referenced term with the commands described in
\sectionref{sec:glslink} or \sectionref{sec:glsadd}.

The \qt{see} tag is produce using \ics{seename}, but can be
overridden in specific instances using square brackets
at the start of the \gloskey{see} value. For example:
\begin{verbatim}
\newglossaryentry{MaclaurinSeries}{name={Maclaurin 
series},
description={Series expansion},
see=[see also]{TaylorsTheorem}}
\end{verbatim}
Take care if you want to use the optional argument of commands such
as \ics{newacronym} or \ics{newterm} as the value will need to be
grouped. For example:
\begin{verbatim}
\newterm{seal}
\newterm[see={[see also]seal}]{sea lion}
\end{verbatim}
Similarly if the value contains a list. For example:
\begin{verbatim}
\glossaryentry{lemon}{
  name={lemon},
  description={Yellow citrus fruit}
}
\glossaryentry{lime}
{
  name={lime},
  description={Green citrus fruit}
}
\glossaryentry{citrus}
{
  name={citrus},
  description={Plant in the Rutaceae family},
  see={lemon,lime}
}
\end{verbatim}

\item After you have defined the entry, use
\begin{definition}[\DescribeMacro{\glssee}]
\cs{glssee}\oarg{tag}\marg{label}\marg{xr label list}
\end{definition}
where \meta{xr label list} is a comma-separated list of entry 
labels to be cross-referenced, \meta{label} is the label of the
entry doing the cross-referencing and \meta{tag} is the \qt{see} tag.
(The default value of \meta{tag} is \ics{seename}.)
For example:
\begin{verbatim}
\glssee[see also]{series}{FourierSeries,TaylorsTheorem}
\end{verbatim}
Note that this automatically adds the entry given by \meta{label} to
the glossary but doesn't add the cross-referenced entries (specified
by \meta{xr label list}) to the glossary.
\end{enumerate}

In both cases~2 and 3 above, the cross-referenced information
appears in the \gls{numberlist}, whereas in case~1, the
cross-referenced information appears in the description. (See the
\samplefile{-crossref} example file that comes with this package.)
This means that in cases~2 and~3, the cross-referencing information
won't appear if you have suppressed the \gls*{numberlist}. In this
case, you will need to activate the \gls*{numberlist} for the given
entries using \gloskey{nonumberlist=false}. Alternatively, if you
just use the \gloskey{see} key instead of \ics{glssee}, you can
automatically activate the \gls*{numberlist} using the
\pkgopt{seeautonumberlist} package option.

\section{Customising Cross-reference Text}
\label{sec:customxr}

When you use either the \gloskey{see} key or the command
\cs{glssee}, the cross-referencing information will be typeset in the 
glossary according to:
\begin{definition}[\DescribeMacro{\glsseeformat}]
\cs{glsseeformat}\oarg{tag}\marg{label-list}\marg{location}
\end{definition}
The default definition of \cs{glsseeformat} is:
\begin{display}
\cs{emph}\marg{tag} \cs{glsseelist}\marg{label-list}
\end{display}
Note that the location is always ignored.\footnote{\gls{makeindex}
will always assign a location number, even if it's not needed, so it
needs to be discarded.} For example, if you want the tag to appear
in bold, you can do:\footnote{If you redefine \cs{glsseeformat},
keep the default value of the optional argument as \ics{seename} as
both \gloskey{see} and \cs{glssee} explicitly write
\texttt[\cs{seename}\texttt] in the output file if no optional
argument is given.}
\begin{verbatim}
\renewcommand*{\glsseeformat}[3][\seename]{\textbf{#1} 
 \glsseelist{#2}}
\end{verbatim}


The list of labels is dealt with by \cs{glsseelist}, which iterates
through the list and typesets each entry in the label. The entries
are separated by
\begin{definition}[\DescribeMacro{\glsseesep}]
\cs{glsseesep}
\end{definition}
or (for the last pair)
\begin{definition}[\DescribeMacro{\glsseelastsep}]
\cs{glsseelastsep}
\end{definition}
These default to ``",\space"'' and
\qt{\cs{space}\ics{andname}\cs{space}} respectively. The list entry text
is displayed using:
\begin{definition}[\DescribeMacro{\glsseeitemformat}]
\cs{glsseeitemformat}\marg{label}
\end{definition}
This defaults to \ics{glsentrytext}\marg{label}.\footnote{In
versions before 3.0, \cs{glsentryname} was used, but this could cause
problems when the \gloskey{name} key was \glsd{sanitize}.} For example, to
make the cross-referenced list use small caps:
\begin{verbatim}
\renewcommand{\glsseeitemformat}[1]{%
  \textsc{\glsentrytext{#1}}}
\end{verbatim}

\begin{important}
You can use \ics{glsseeformat} and \ics{glsseelist} in the main body
of the text, but they won't automatically add the cross-referenced
entries to the glossary. If you want them added with that location,
you can do:
\begin{verbatim}
Some information (see also 
\glsseelist{FourierSeries,TaylorsTheorem}%
\glsadd{FourierSeries}\glsadd{TaylorsTheorem}).
\end{verbatim}
\end{important}

\chapter{Using Glossary Terms Without Links}
\label{sec:glsnolink}

The commands described in this section display entry details without
adding any information to the glossary. They don't use
\ics{glstextformat}, they don't have any optional arguments, they
don't affect the \firstuseflag\ and, apart from \ics{glshyperlink},
they don't produce hyperlinks.

\begin{important}
Commands that aren't expandable will be ignored by PDF bookmarks, so
you will need to provide an alternative via \sty{hyperref}'s
\cs{texorpdfstring} if you want to use them in sectioning commands.
(This isn't specific to the \styfmt{glossaries} package.) See the
\sty{hyperref} documentation for further details. All the commands
that convert the first letter to upper case aren't expandable.
The other commands depend on whether their corresponding keys were
assigned non-expandable values.
\end{important}

If you want to title case a field, you can use:
\begin{definition}[\DescribeMacro\glsentrytitlecase]
\cs{glsentrytitlecase}\marg{label}\marg{field}
\end{definition}
where \meta{label} is the label identifying the glossary entry,
\meta{field} is the field label (see \tableref{tab:fieldmap}).
For example:
\begin{verbatim}
\glsentrytitlecase{sample}{desc}
\end{verbatim}
(If you want title-casing in your glossary style, you might want to
investigate the \gls{glossaries-extra} package.) This command will
trigger an error if the entry is undefined.

Note that this command has the same limitations as \cs{makefirstuc} which is
used by commands like \cs{Gls} and \cs{Glsentryname} to upper-case
the first letter (see the notes about \cs{Gls} in \sectionref{sec:gls-like}).

\begin{definition}[\DescribeMacro{\glsentryname}]
\cs{glsentryname}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryname}]
\cs{Glsentryname}\marg{label}
\end{definition}
These commands display the name of the glossary entry given by
\meta{label}, as specified by the \gloskey{name} key.
\cs{Glsentryname} makes the first letter upper case.
Neither of these commands check for the existence of \meta{label}.
The first form \cs{glsentryname} is expandable (unless the name
contains unexpandable commands). Note that this may be different from the values of
the \gloskey{text} or \gloskey{first} keys. In general it's better
to use \cs{glsentrytext} or \cs{glsentryfirst} instead of
\cs{glsentryname}.

\begin{important}
In general it's best to avoid \cs{Glsentryname} with abbreviations. Instead,
consider using \cs{Glsentrylong}, \cs{Glsentryshort} or \cs{Glsentryfull}.
\end{important}

\begin{definition}[\DescribeMacro{\glossentryname}]
\cs{glossentryname}\marg{label}
\end{definition}
This is like \cs{glsnamefont}\{\cs{glsentryname\marg{label}}\}
but also checks for the existence of \meta{label}. This command is
not expandable. It's used in the predefined glossary styles, so if
you want to change the way the name is formatted in the glossary,
you can redefine \cs{glsnamefont} to use the required fonts. For
example:
\begin{verbatim}
\renewcommand*{\glsnamefont}[1]{\textmd{\sffamily #1}}
\end{verbatim}
\begin{definition}[\DescribeMacro{\Glossentryname}]
\cs{Glossentryname}\marg{label}
\end{definition}
This is like \cs{glossentryname} but makes the first letter of the
name upper case.

\begin{definition}[\DescribeMacro{\glsentrytext}]
\cs{glsentrytext}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrytext}]
\cs{Glsentrytext}\marg{label}
\end{definition}
These commands display the subsequent use text for the glossary
entry given by \meta{label}, as specified by the \gloskey{text} key.
\cs{Glsentrytext} makes the first letter upper case.
The first form is expandable (unless the text contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glsentryplural}]
\cs{glsentryplural}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryplural}]
\cs{Glsentryplural}\marg{label}
\end{definition}
These commands display the subsequent use plural text for the
glossary entry given by \meta{label}, as specified by the
\gloskey{plural} key. \cs{Glsentryplural} makes the first letter
upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glsentryfirst}]
\cs{glsentryfirst}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryfirst}]
\cs{Glsentryfirst}\marg{label}
\end{definition}
These commands display the \firstusetext\ for the glossary entry
given by \meta{label}, as specified by the \gloskey{first} key.
\cs{Glsentryfirst} makes the first letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glsentryfirstplural}]
\cs{glsentryfirstplural}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryfirstplural}]
\cs{Glsentryfirstplural}\marg{label}
\end{definition}
These commands display the plural form of the \firstusetext\ for the
glossary entry given by \meta{label}, as specified by the
\gloskey{firstplural} key. \cs{Glsentryfirstplural} makes the first
letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glsentrydesc}]
\cs{glsentrydesc}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrydesc}]
\cs{Glsentrydesc}\marg{label}
\end{definition}
These commands display the description for the glossary entry given
by \meta{label}. 

\cs{Glsentrydesc} makes the first letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glossentrydesc}]
\cs{glossentrydesc}\marg{label}
\end{definition}
This is like \cs{glsentrydesc}\marg{label}
but also checks for the existence of \meta{label}. This command is
not expandable. It's used in the predefined glossary styles to
display the description.
\begin{definition}[\DescribeMacro{\Glossentrydesc}]
\cs{Glossentrydesc}\marg{label}
\end{definition}
This is like \cs{glossentrydesc} but converts the first letter to
upper case. This command is not expandable.

\begin{definition}[\DescribeMacro{\glsentrydescplural}]
\cs{glsentrydescplural}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrydescplural}]
\cs{Glsentrydescplural}\marg{label}
\end{definition}
These commands display the plural description for the glossary entry
given by \meta{label}. \cs{Glsentrydescplural} makes the first
letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.


\begin{definition}[\DescribeMacro{\glsentrysymbol}]
\cs{glsentrysymbol}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrysymbol}]
\cs{Glsentrysymbol}\marg{label}
\end{definition}
These commands display the symbol for the glossary entry given by
\meta{label}.

\cs{Glsentrysymbol} makes the first letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.


\begin{definition}[\DescribeMacro\glsletentryfield]
\cs{glsletentryfield}\marg{cs}\marg{label}\marg{field}
\end{definition}
This command doesn't display anything. It merely fetches the
value associated with the given field (where the available field names 
are listed in \tableref{tab:fieldmap}) and stores the result
in the control sequence \meta{cs}. For example, to store
the description for the entry whose label is \qt{apple} in the
control sequence \verb|\tmp|:
\begin{verbatim}
\glsletentryfield{\tmp}{apple}{desc}
\end{verbatim}

\begin{definition}[\DescribeMacro{\glossentrysymbol}]
\cs{glossentrysymbol}\marg{label}
\end{definition}
This is like \cs{glsentrysymbol}\marg{label}
but also checks for the existence of \meta{label}. This command is
not expandable. It's used in some of the predefined glossary styles to
display the symbol.
\begin{definition}[\DescribeMacro{\Glossentrysymbol}]
\cs{Glossentrysymbol}\marg{label}
\end{definition}
This is like \cs{glossentrysymbol} but converts the first letter to
upper case. This command is not expandable.

\begin{definition}[\DescribeMacro{\glsentrysymbolplural}]
\cs{glsentrysymbolplural}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrysymbolplural}]
\cs{Glsentrysymbolplural}\marg{label}
\end{definition}
These commands display the plural symbol for the glossary entry
given by \meta{label}. \cs{Glsentrysymbolplural} makes the first
letter upper case.
The first form is expandable (unless the value of that key contains unexpandable
commands). The second form is not expandable. Neither checks for the
existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glsentryuseri}]
\cs{glsentryuseri}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuseri}]
\cs{Glsentryuseri}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryuserii}]
\cs{glsentryuserii}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuserii}]
\cs{Glsentryuserii}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryuseriii}]
\cs{glsentryuseriii}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuseriii}]
\cs{Glsentryuseriii}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryuseriv}]
\cs{glsentryuseriv}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuseriv}]
\cs{Glsentryuseriv}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryuserv}]
\cs{glsentryuserv}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuserv}]
\cs{Glsentryuserv}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryuservi}]
\cs{glsentryuservi}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryuservi}]
\cs{Glsentryuservi}\marg{label}
\end{definition}
These commands display the value of the user keys for the glossary
entry given by \meta{label}.
The lower case forms are expandable (unless the value of the key
contains unexpandable commands). The commands beginning with an
upper case letter convert the first letter of the required value to
upper case and are not expandable. None of these commands check for
the existence of \meta{label}.

\begin{definition}[\DescribeMacro{\glshyperlink}]
\cs{glshyperlink}\oarg{link text}\marg{label}
\end{definition}
This command provides a hyperlink to the glossary entry given by
\meta{label} \strong{but does not add any information to the
glossary file}. The link text is given by
\ics{glsentrytext}\marg{label} by default\footnote{versions before
3.0 used \ics{glsentryname} as the default, but this could cause
problems when \gloskey{name} had been \glsd{sanitize}.}, but can be
overridden using the optional argument. Note that the hyperlink will
be suppressed if you have used \ics{glsdisablehyper} or if you
haven't loaded the \sty{hyperref} package.

\begin{important}
If you use \cs{glshyperlink}, you need to ensure that the relevant
entry has been added to the glossary using any of the commands
described in \sectionref{sec:glslink} or \sectionref{sec:glsadd}
otherwise you will end up with an undefined link.
\end{important}

The next two commands are only available with \opt1 or with the
\pkgopt{savenumberlist} package option:
\begin{definition}[\DescribeMacro{\glsentrynumberlist}]
\cs{glsentrynumberlist}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsdisplaynumberlist}]
\cs{glsdisplaynumberlist}\marg{label}
\end{definition}
Both display the \gls{numberlist} for the entry given by
\meta{label}. When used with \opt1 a~rerun is required to ensure
this list is up-to-date, when used with \optsor23
a run of \gls{makeglossaries} (or \gls{makeindex}\slash\gls{xindy})
followed by one or two runs of \LaTeX\ is required.

The first command, \cs{glsentrynumberlist}, simply displays
the number list as is. The second command,
\cs{glsdisplaynumberlist}, formats the list using:
\begin{definition}[\DescribeMacro{\glsnumlistsep}]
\cs{glsnumlistsep}
\end{definition}
as the separator between all but the last two elements and
\begin{definition}[\DescribeMacro{\glsnumlistlastsep}]
\cs{glsnumlistlastsep}
\end{definition}
between the final two elements. The defaults are
\verb*|, | and \verb*| \& |, respectively.

\begin{important}
\cs{glsdisplaynumberlist} is fairly experimental. It works with
\opt1, but for \optsor23 it only works when the default counter
format is used (that is, when the \gloskey[glslink]{format} key is
set to \texttt{glsnumberformat}).  This command will only work with
\sty{hyperref} if you choose \opt1.  If you try using this command
with \optsor23 and \sty{hyperref}, \cs{glsentrynumberlist} will be
used instead.
\end{important}

For further information see \ifpdf section~\ref*{sec:code:glsnolink}
\fi \qt{Displaying entry details without adding information to the
glossary} in the documented code (\texttt{glossaries-code.pdf}).

\chapter{Displaying a glossary}
\label{sec:printglossary}

All defined glossaries may be displayed using:
\begin{description}
\item[\opt1:]
(Must be used with \ics{makenoidxglossaries} in the preamble.)
\begin{definition}[\DescribeMacro\printnoidxglossaries]
\cs{printnoidxglossaries}
\end{definition}

\item[\optsand23:]
(Must be used with \ics{makeglossaries} in the preamble.)
\begin{definition}[\DescribeMacro\printglossaries]
\cs{printglossaries}
\end{definition}
\end{description}

These commands will display all the glossaries in the order in which
they were defined. 

Note that, in the case of \optsand23, no glossaries will appear
until you have either used the Perl script \gls{makeglossaries} or
Lua script \gls{makeglossaries-lite.lua} or have directly used
\gls{makeindex} or \gls{xindy} (as described in
\sectionref{sec:makeglossaries}). 

\begin{important}
While the external files are missing, \cs{printglossary} will just do
\ics{null} for each missing glossary to assist dictionary style
documents that just use \cs{glsaddall} without inserting any text.  
This use of \ics{null} ensures that all indexing information is
written before the final page is shipped out. Once the external
files are present \cs{null} will no longer be used. This can cause a
spurious blank page on the first \LaTeX\ run before the glossary
files have been created. Once these files are present, \cs{null}
will no longer be used and so shouldn't cause interference for the
final document.
\end{important}

\begin{xtr}
If you use \gls{glossaries-extra}, it will insert a heading and boilerplate text when the
external files are missing. The extension package also provides
\cs{printunsrtglossaries} as an alternative. See the
\gls{glossaries-extra} manual for further details.
\end{xtr}

If the glossary still does not appear after you re-\LaTeX\ your
document, check the \gls*{makeindex}\slash\gls*{xindy} log files to
see if there is a problem.  With \opt1, you just need two \LaTeX\
runs to make the glossaries appear, but you may need further runs to
make the \glspl{numberlist} up-to-date.

An individual glossary can be displayed using:
\begin{description}
\itempar{\opt1:}
\begin{definition}[\DescribeMacro{\printnoidxglossary}]
\cs{printnoidxglossary}\oarg{options}
\end{definition}
(Must be used with \ics{makenoidxglossaries} in the preamble.)

\itempar{\optsand23:}
\begin{definition}[\DescribeMacro{\printglossary}]
\cs{printglossary}\oarg{options}
\end{definition}
(Must be used with \ics{makeglossaries} in the preamble.)
\end{description}
where \meta{options} is a \meta{key}=\meta{value} list of options. 
(Again, when the associated external file is missing, \cs{null} is
inserted into the document.)

The following keys are available:
\begin{description}
\item[{\gloskey[printglossary]{type}}] The value of this key
specifies which glossary to print. If omitted, the default
glossary is assumed. For example, to print the list of acronyms:
\begin{verbatim}
\printglossary[type=\acronymtype]
\end{verbatim}
Note that you can't display an ignored glossary, so don't try
setting \gloskey[printglossary]{type} to the name of a glossary that
was defined using \ics{newignoredglossary}, described in
\sectionref{sec:newglossary}. (You can display an ignored glossary
with \cs{printunsrtglossary} provided by \gls{glossaries-extra}.)

\item[{\gloskey[printglossary]{title}}] This is the glossary's
title (overriding the title specified when the glossary was 
defined).

\item[{\gloskey[printglossary]{toctitle}}] This is the title
to use for the table of contents (if the \pkgopt{toc} package
option has been used). It may also be used for the page header,
depending on the page style. If omitted, the value of 
\gloskey[printglossary]{title} is used.

\item[{\gloskey[printglossary]{style}}] This specifies which
glossary style to use for this glossary, overriding the effect
of the \pkgopt{style} package option or \ics{glossarystyle}.

\item[{\gloskey[printglossary]{numberedsection}}] This specifies
whether to use a numbered section for this glossary, overriding
the effect of the \pkgopt{numberedsection} package option. This
key has the same syntax as the \pkgopt{numberedsection} package
option, described in \sectionref{sec:pkgopts-sec}.

\item[{\gloskey[printglossary]{nonumberlist}}] This is a boolean
key. If true (\verb|nonumberlist=true|) the numberlist is suppressed
for this glossary. If false (\verb|nonumberlist=false|) the
numberlist is displayed for this glossary.

\item[{\gloskey[printglossary]{nogroupskip}}] This is a boolean
key. If true the vertical gap between groups 
is suppressed for this glossary.

\item[{\gloskey[printglossary]{nopostdot}}] This is a boolean
key. If true the full stop after the description 
is suppressed for this glossary.

\item[{\gloskey[printglossary]{entrycounter}}] This is a boolean
key. Behaves similar to the package option of the same name.
The corresponding package option must be used to make \ics{glsrefentry}
work correctly.

\item[{\gloskey[printglossary]{subentrycounter}}] This is a boolean
key. Behaves similar to the package option of the same name.  If you
want to set both \gloskey{entrycounter} and
\gloskey{subentrycounter}, make sure you specify
\gloskey{entrycounter} first.  The corresponding package option must
be used to make \ics{glsrefentry} work correctly.

\item[{\gloskey[printnoidxglossary]{sort}}] This key is only
available for \opt1. Possible values are: \texttt{word} (word
order), \texttt{letter} (letter order), \texttt{standard} (word or
letter ordering taken from the \pkgopt{order} package option),
\texttt{use} (order of use), \texttt{def} (order of definition)
\texttt{nocase} (case-insensitive) or \texttt{case} (case-sensitive).
Note that the word and letter comparisons (that is, everything other
than \texttt{sort=use} and \texttt{sort=def}) just use a simple
character code comparison. For a locale-sensitive sort, you must use
either \gls{xindy} (\opt3) or \gls{bib2gls} (\opt4). Note that \gls{bib2gls}
provides many other sort options.

\begin{important}
If you use the \texttt{use} or \texttt{def} values make sure
that you select a glossary style that doesn't have a visual
indicator between groups, as the grouping no longer makes sense.
Consider using the \pkgopt{nogroupskip} option.
\end{important}

{\raggedright
The word and letter order sort methods use
\sty{datatool}'s
\ics{dtlwordindexcompare} and \ics{dtlletterindexcompare} handlers.
The case-insensitive sort method uses \sty{datatool}'s
\ics{dtlicompare} handler.  The case-sensitive sort method uses 
\sty{datatool}'s \ics{dtlcompare} handler. See the \sty{datatool}
documentation for further details.
\par}

If you don't get an error with \texttt{sort=use} and
\texttt{sort=def} but you do get an error with one of the other sort
options, then you probably need to use the
\pkgopt[true]{sanitizesort} package option or make sure none of the
entries have fragile commands in their \gloskey{sort} field.

\item[{\xtrprintglosskey[\marg{label}]{label}}]
This key is only available with \gls{glossaries-extra} and labels
the glossary with \cs{label}\marg{label}. This is an alternative to
the package option \pkgopt[autolabel]{numberedsection}

\item[\xtrprintglosskey{target}] This is a boolean key only
available with \gls{glossaries-extra}, which can be used to switch
off the automatic hypertarget for each entry. (This refers to the
target used by commands like \cs{gls} and \cs{glslink}.)

This option is useful with \ics*{printunsrtglossary} as it allows
the same list (of sub-list) of entries to be displayed multiple
times without causing duplicate hypertarget names.

\item[{\xtrprintglosskey[\marg{prefix}]{prefix}}]
This key is only available with \gls{glossaries-extra} and provides
another way of avoiding duplicate hypertarget names is to use a
different prefix for those names. This locally redefines
\ics{glolinkprefix} but note this will also affect the target for any entry
referenced within the glossary with commands like \cs{gls},
\cs{glslink} or \cs{glshypertarget}.

\item[{\xtrprintglosskey[\marg{prefix}]{targetnameprefix}}]
This key is only available with \gls{glossaries-extra}.
This is similar to the \pkgoptfmt{prefix} option, but it alters the prefix of
the hypertarget anchors without changing \ics{glslinkprefix} (so it
won't change the hyperlinks for any entries referenced in the
glossary).

\end{description}

By default, the glossary is started either by \ics{chapter*} or by
\ics{section*}, depending on whether or not \ics{chapter} is defined.
This can be overridden by the \pkgopt{section} package option or the
\ics{setglossarysection} command. Numbered sectional units can be
obtained using the \pkgopt{numberedsection} package option. Each
glossary sets the page header via the command
\begin{definition}[\DescribeMacro\glsglossarymark]
\ics{glsglossarymark}\marg{title}
\end{definition}
If this mechanism is unsuitable for your chosen class file or page
style package, you will need to redefine \ics{glsglossarymark}. Further
information about these options and commands is given in
\sectionref{sec:pkgopts-sec}.

Information can be added to the start of the glossary (after the
title and before the main body of the glossary) by redefining
\begin{definition}[\DescribeMacro{\glossarypreamble}]
\cs{glossarypreamble}
\end{definition}
For example:
\begin{verbatim}
\renewcommand{\glossarypreamble}{Numbers in italic 
indicate primary definitions.}
\end{verbatim}
This needs to be done before the glossary is displayed.

If you want a different preamble per glossary you can use
\begin{definition}[\DescribeMacro{\setglossarypreamble}]
\cs{setglossarypreamble}\oarg{type}\marg{preamble text}
\end{definition}
If \meta{type} is omitted, \cs{glsdefaulttype} is used.

For example:
\begin{verbatim}
\setglossarypreamble{Numbers in italic 
indicate primary definitions.}
\end{verbatim}
This will print the given preamble text for the main glossary,
but not have any preamble text for any other glossaries.

There is an analogous command to \cs{glossarypreamble} called
\begin{definition}[\DescribeMacro{\glossarypostamble}]
\cs{glossarypostamble}
\end{definition}
which is placed at the end of each glossary.

\begin{example}{Switch to Two Column Mode for Glossary}{ex:twocolumn}
Suppose you are using the \glostyle{superheaderborder}
style\footnote{you can't use the \glostyle{longheaderborder} style
for this example as you can't use the \env{longtable} environment in
two column mode.}, and you want the glossary to be in two columns,
but after the glossary you want to switch back to one column mode,
you could do:
\begin{verbatim}
\renewcommand*{\glossarysection}[2][]{%
  \twocolumn[{\chapter*{#2}}]%
  \setlength\glsdescwidth{0.6\linewidth}%
  \glsglossarymark{\glossarytoctitle}%
}

\renewcommand*{\glossarypostamble}{\onecolumn}
\end{verbatim}

\end{example}

Within each glossary, each entry name is formatted according to
\begin{definition}[\DescribeMacro{\glsnamefont}]
\cs{glsnamefont}\marg{name}
\end{definition}
which takes one argument: the entry name. This command is always
used regardless of the glossary style. By default, \cs{glsnamefont}
simply displays its argument in whatever the surrounding font
happens to be. This means that in the list-like glossary styles
(defined in the \sty{glossary-list} style file) the name will appear
in bold, since the name is placed in the optional argument of
\cs{item}, whereas in the tabular styles (defined in the
\sty{glossary-long} and \sty{glossary-super} style files) the name
will appear in the normal font. The hierarchical glossary styles
(defined in the \sty{glossary-tree} style file) also set the name in
bold.

If you want to change the font for the description, or if you
only want to change the name font for some types of entries
but not others, you might want to consider using the
\gls{glossaries-extra} package.

\begin{example}{Changing the Font Used to Display Entry Names in the
Glossary}{ex:glsnamefont}
Suppose you want all the entry names to appear in 
medium weight small caps in your glossaries, then you can do:
\begin{verbatim}
\renewcommand{\glsnamefont}[1]{\textsc{\mdseries #1}}
\end{verbatim}
\end{example}

\chapter[Xindy (Option 3)]{Xindy (\ifpdf\opt3\else Option 3\fi)}
\label{sec:xindy}

If you want to use \gls{xindy} to sort the glossary, you
must use the package option \pkgopt{xindy}:
\begin{verbatim}
\usepackage[xindy]{glossaries}
\end{verbatim}
This ensures that the glossary information is written in 
\gls*{xindy} syntax.

\sectionref{sec:makeglossaries} covers how to use the external
\gls{indexingapp}, and \sectionref{sec:locationsyntax} covers the
issues involved in the location syntax. This section covers the
commands provided by the \styfmt{glossaries} package that allow you
to adjust the \gls{xindy} style file (\filetype{xdy}) and
parameters.

To assist writing information to the \gls{xindy} style
file, the \styfmt{glossaries} package provides the following
commands:
\begin{definition}[\DescribeMacro{\glsopenbrace}]
\cs{glsopenbrace}
\end{definition}
\begin{definition}[\DescribeMacro{\glsclosebrace}]
\cs{glsclosebrace}
\end{definition}
which produce an open and closing brace. (This is needed because
\verb|\{| and \verb|\}| don't expand to a simple brace character
when written to a file.) Similarly, you can write a percent
character using:
\begin{definition}[\DescribeMacro{\glspercentchar}]
\cs{glspercentchar}
\end{definition}
and a tilde character using:
\begin{definition}[\DescribeMacro{\glstildechar}]
\cs{glstildechar}
\end{definition}
For example, a newline character is specified in a \gls{xindy} style
file using \verb|~n| so you can use \texttt{\cs{glstildechar} n}
to write this correctly (or you can do \verb|\string~n|).
A backslash can be written to a file using
\begin{definition}[\DescribeMacro{\glsbackslash}]
\cs{glsbackslash}
\end{definition}

In addition, if you are using a package that makes the double
quote character active (e.g. \sty{ngerman}) you can use:
\begin{definition}[\DescribeMacro{\glsquote}]
\cs{glsquote}\marg{text}
\end{definition}
which will produce \verb|"|\meta{text}\verb|"|. Alternatively,
you can use \verb|\string"| to write the double-quote character. 
This document assumes that the double quote character has not been
made active, so the examples just use \verb|"| for clarity.

If you want greater control over the \gls{xindy} style file than is
available through the \LaTeX\ commands provided by the
\styfmt{glossaries} package, you will need to edit the \gls*{xindy}
style file. In which case, you must use \ics{noist} to prevent the
style file from being overwritten by the \styfmt{glossaries}
package. For additional information about \gls*{xindy}, read the
\gls*{xindy} documentation. I'm sorry I can't provide any assistance
with writing \gls*{xindy} style files. If you need help, I recommend
you ask on the \gls*{xindy} mailing list
(\url{http://xindy.sourceforge.net/mailing-list.html}).

\section{Language and Encodings}
\label{sec:langenc}

When you use \gls{xindy}, you need to specify the language
and encoding used (unless you have written your own custom
\gls*{xindy} style file that defines the relevant alphabet
and sort rules). If you use \gls{makeglossaries},
this information is obtained from the document's auxiliary 
(\filetype{aux}) file.  The \gls{makeglossaries} script attempts to 
find the root language given your document settings, but in the 
event that it gets it wrong or if \gls*{xindy} doesn't support 
that language, then you can specify the required language using:
\begin{definition}[\DescribeMacro{\GlsSetXdyLanguage}]
\cs{GlsSetXdyLanguage}\oarg{glossary type}\marg{language}
\end{definition}
where \meta{language} is the name of the language. The
optional argument can be used if you have multiple glossaries
in different languages. If \meta{glossary type} is omitted, it
will be applied to all glossaries, otherwise the language
setting will only be applied to the glossary given by
\meta{glossary type}.

If the \sty{inputenc} package is used, the encoding will be
obtained from the value of \ics{inputencodingname}. 
Alternatively, you can specify the encoding using:
\begin{definition}[\DescribeMacro{\GlsSetXdyCodePage}]
\cs{GlsSetXdyCodePage}\marg{code}
\end{definition}
where \meta{code} is the name of the encoding. For example:
\begin{verbatim}
\GlsSetXdyCodePage{utf8}
\end{verbatim}

Note that you can also specify the language and encoding using
the package option 
\verb|xindy={language=|\meta{lang}\verb|,codepage=|\meta{code}\verb|}|.
For example:
\begin{verbatim}
\usepackage[xindy={language=english,codepage=utf8}]{glossaries}
\end{verbatim}

If you write your own custom \gls{xindy} style file that 
includes the language settings, you need to set the language
to nothing:
\begin{verbatim}
\GlsSetXdyLanguage{}
\end{verbatim}
(and remember to use \ics{noist} to prevent the style file from
being overwritten).

\begin{important}
The commands \cs{GlsSetXdyLanguage} and \cs{GlsSetXdyCodePage}
have no effect if you don't use \gls{makeglossaries}. If
you call \gls{xindy} without \gls*{makeglossaries} you
need to remember to set the language and encoding using the
\xdyopt{L} and \xdyopt{C} switches.
\end{important}

\section{Locations and Number lists}
\label{sec:xindyloc}

If you use \pkgopt{xindy}, the \styfmt{glossaries} package needs to
know which counters you will be using in the \gls{numberlist} in order to correctly format the \gls{xindy} style
file. Counters specified using the \pkgopt{counter} package option
or the \meta{counter} option of \ics{newglossary} are
automatically taken care of, but if you plan to use a different
counter in the \gloskey[glslink]{counter} key for commands like 
\ics{glslink}, then you need to identify these counters \emph{before} 
\ics{makeglossaries} using:
\begin{definition}[\DescribeMacro{\GlsAddXdyCounters}]
\cs{GlsAddXdyCounters}\marg{counter list}
\end{definition}
where \meta{counter list} is a comma-separated list of counter names.

The most likely \ixindyattrs attributes used in the \gloskey[glslink]{format} 
key (\locfmt{textrm}, \locfmt{hyperrm} etc) are automatically added 
to the \gls{xindy} style file, but if you want to use another 
attribute, you need to add it using:
\begin{definition}[\DescribeMacro{\GlsAddXdyAttribute}]
\cs{GlsAddXdyAttribute}\marg{name}
\end{definition}
where \meta{name} is the name of the attribute, as used in
the \gloskey[glslink]{format} key. 

Take care if you have multiple instances of the same location with
different formats. The duplicate locations will be discarded
according to the order in which the \ixindyattrs attributes are listed. Consider
defining semantic commands to use for primary references. For
example:
\begin{verbatim}
\newcommand*{\primary}[1]{\textbf{#1}}
\GlsAddXdyAttribute{primary}
\end{verbatim}
Then in the document:
\begin{verbatim}
A \gls[format=primary]{duck} is an aquatic bird.
There are lots of different types of \gls{duck}.
\end{verbatim}
This will give the \verb|format=primary| instance preference over
the next use that doesn't use the \gloskey[glslink]{format} key.

\begin{example}{Custom Font for Displaying a Location}{ex:hyperbfit}
Suppose I want a bold, italic, hyperlinked location. I first need to define a
command that will do this:
\begin{verbatim}
\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
\end{verbatim}
but with \gls{xindy}, I also need to add this as an allowed
\ixindyattrs attribute:
\begin{verbatim}
\GlsAddXdyAttribute{hyperbfit}
\end{verbatim}
Now I can use it in the optional argument of commands like
\ics{gls}:
\begin{verbatim}
Here is a \gls[format=hyperbfit]{sample} entry.
\end{verbatim}
(where \texttt{sample} is the label of the required entry).
\end{example}

\begin{important}
Note that \cs{GlsAddXdyAttribute} has no effect if \ics{noist} is
used or if \ics{makeglossaries} is omitted.
\cs{GlsAddXdyAttribute} must be used before \ics{makeglossaries}.
Additionally, \cs{GlsAddXdyCounters} must come before
\cs{GlsAddXdyAttribute}.
\end{important}

If the location numbers include formatting commands, then
you need to add a location style in the appropriate format using
\begin{definition}[\DescribeMacro{\GlsAddXdyLocation}]
\cs{GlsAddXdyLocation}\oarg{prefix-location}\marg{name}\marg{definition}
\end{definition}
where \meta{name} is the name of the format and \meta{definition} is
the \gls{xindy} definition. The optional argument \meta{prefix-location}
is needed if \cs{theH}\meta{counter} either isn't defined or is
different from \cs{the}\meta{counter}.
Be sure to also read \sectionref{sec:locationsyntax} for some issues
that you may encounter.

\begin{important}
Note that \cs{GlsAddXdyLocation} has no effect if \ics{noist} is
used or if \ics{makeglossaries} is omitted.
\cs{GlsAddXdyLocation} must be used before \ics{makeglossaries}.
\end{important}

\begin{example}{Custom Numbering System for Locations}{ex:customloc}
Suppose I decide to use a somewhat eccentric numbering
system for sections where I redefine \cs{thesection} as follows:
\begin{verbatim}
\renewcommand*{\thesection}{[\thechapter]\arabic{section}}
\end{verbatim}
If I haven't done "counter=section" in the package
option, I need to specify that the counter will be used as a
location number:
\begin{verbatim}
\GlsAddXdyCounters{section}
\end{verbatim}
Next I need to add the location style (\cs{thechapter} is assumed to
be the standard \verb"\arabic{chapter}"):
\begin{verbatim}
\GlsAddXdyLocation{section}{:sep "[" "arabic-numbers" :sep "]"
  "arabic-numbers"
}
\end{verbatim}
Note that if I have further decided to use the \sty{hyperref}
package and want to redefine \cs{theHsection} as:
\begin{verbatim}
\renewcommand*{\theHsection}{\thepart.\thesection}
\renewcommand*{\thepart}{\Roman{part}}
\end{verbatim}
then I need to modify the \cs{GlsAddXdyLocation} code above to:
\begin{verbatim}
\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "[" 
  "arabic-numbers" :sep "]" "arabic-numbers"
}
\end{verbatim}
Since \ics{Roman} will result in an empty string if the counter is
zero, it's a good idea to add an extra location to catch this:
\begin{verbatim}
\GlsAddXdyLocation{zero.section}{:sep "[" 
  "arabic-numbers" :sep "]" "arabic-numbers"
}
\end{verbatim}
This example is illustrated in the sample file
\samplefile{xdy2}.
\end{example}

\begin{example}{Locations as Dice}{ex:dice}
Suppose I want a rather eccentric page numbering system that's
represented by the number of dots on dice. The \sty{stix} package
provides \cs{dicei}, \ldots, \cs{dicevi} that represent the six
sides of a die. I can define a command that takes a number as its
argument. If the number is less than seven, the appropriate
\cs{dice}\meta{n} command is used otherwise it does \cs{dicevi} the
required number of times with the leftover in a final
\cs{dice}\meta{n}. For example, the number 16 is represented by
\verb|\dicevi\dicevi\diceiv| ($6+6+4=16$). I've called this command
\cs{tallynum} to match the example given earlier in 
\sectionref{sec:locationsyntax}:
\begin{verbatim}
\newrobustcmd{\tallynum}[1]{%
 \ifnum\number#1<7
  $\csname dice\romannumeral#1\endcsname$%
 \else
  $\dicevi$%
  \expandafter\tallynum\expandafter{\numexpr#1-6}%
 \fi
}
\end{verbatim}
Here's the counter command:
\begin{verbatim}
newcommand{\tally}[1]{\tallynum{\arabic{#1}}}
\end{verbatim}
The \ctr{page} counter representation (\cs{thepage}) needs to be
changed to use this command:
\begin{verbatim}
\renewcommand*{\thepage}{\tally{page}}
\end{verbatim}
The \cs{tally} command expands to \cs{tallynum} \marg{number} so
this needs a location class that matches this format:
\begin{verbatim}
\GlsAddXdyLocation{tally}{% 
 :sep "\string\tallynum\space\glsopenbrace"
 "arabic-numbers"
 :sep "\glsclosebrace"
}
\end{verbatim}
The space between \cs{tallynum} and \marg{number} is
significant to \gls{xindy} so \cs{space} is required.

Note that \cs{GlsAddXdyLocation}\marg{name}\marg{definition} will define 
commands in the form:
\begin{definition}
\cs{glsX}\meta{counter}"X"\meta{name}\marg{Hprefix}\marg{location}
\end{definition}
for each counter that has been identified either by the
\pkgopt{counter} package option, the \meta{counter} option for
\ics{newglossary} or in the argument of \ics{GlsAddXdyCounters}.
The first argument \meta{Hprefix} is only relevant when used with
the \sty{hyperref} package and indicates that \cs{theH}\meta{counter}
is given by \cs{Hprefix}"."\cs{the}\meta{counter}. 

The sample file \samplefile{xdy}, which comes with the \styfmt{glossaries}
package, uses the default \ctr{page} counter for locations, and it
uses the default \ics{glsnumberformat} and a custom \cs{hyperbfit}
format. A new \gls{xindy} location called \texttt{tallynum}, as
illustrated above, is defined to make the page numbers appear as
dice. In order for the location numbers to
hyperlink to the relevant pages, I~need to redefine the necessary
\cs{glsX}\meta{counter}"X"\meta{format} commands:
\begin{verbatim}
\renewcommand{\glsXpageXglsnumberformat}[2]{%
 \linkpagenumber#2%
}

\renewcommand{\glsXpageXhyperbfit}[2]{%
 \textbf{\em\linkpagenumber#2}%
}

\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}}
\end{verbatim}
Note that the second argument of \cs{glsXpageXglsnumberformat} is
in the format \cs{tallynum}\marg{n} so the line
\begin{verbatim}
 \linkpagenumber#2%
\end{verbatim}
does
\begin{alltt}
 \cs{linkpagenumber}\cs{tallynum}\marg{number}
\end{alltt}
so \cs{tallynum} is the first argument of \cs{linkpagenumber}
and \meta{number} is the second argument.
\end{example}

\begin{important}
This method is very sensitive to the internal definition of the
location command.
\end{important}

\begin{example}{Locations as Words not Digits}{ex:fmtcount}
Suppose I want the page numbers written as words
rather than digits and I~use the \sty{fmtcount} package to
do this. I~can redefine \ics{thepage} as follows:
\begin{verbatim}
\renewcommand*{\thepage}{\Numberstring{page}}
\end{verbatim}
This \emph{used} to get expanded to \verb|\protect \Numberstringnum |\marg{n}
where \meta{n} is the Arabic page number. This means that I~needed to
define a new location with the form:
\begin{verbatim}
\GlsAddXdyLocation{Numberstring}{:sep "\string\protect\space
  \string\Numberstringnum\space\glsopenbrace"
  "arabic-numbers" :sep "\glsclosebrace"}
\end{verbatim}
and if I'd used the \cs{linkpagenumber} command from the previous
example, it would need \emph{three} arguments (the first being
\cs{protect}):
\begin{verbatim}
\newcommand{\linkpagenumber}[3]{\hyperlink{page.#3}{#1#2{#3}}}
\end{verbatim}

The internal definition of \cs{Numberstring} has since changed
so that it now expands to \verb|\Numberstringnum |\marg{n}
(no \cs{protect}). This means that the location class definition
must be changed to:
\begin{verbatim}
\GlsAddXdyLocation{Numberstring}{% no \protect now!
  :sep "\string\Numberstringnum\space\glsopenbrace"
  "arabic-numbers" :sep "\glsclosebrace"}
\end{verbatim}
and \cs{linkpagenumber} goes back to only two arguments:
\begin{verbatim}
\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}}
\end{verbatim}
The other change is that \cs{Numberstring} uses
\begin{alltt}
\cs{the}\cs{value}\marg{counter}
\end{alltt}
instead of
\begin{alltt}
\cs{expandafter}\cs{the}\cs{csname} c@\meta{counter}\cs{endcsname}
\end{alltt}
so it hides \cs{c@page} from the location escaping mechanism 
(see \sectionref{sec:locationsyntax}). This means that the page
number may be incorrect if the indexing occurs during the output
routine.

A more recent change to \sty{fmtcount} (v3.03) now puts three
instances of \cs{expandafter} before \verb|\the\value| which
no longer hides \cs{c@page} from the location escaping mechanism, so
the page numbers should once more be correct. Further changes
to the \sty{fmtcount} package may cause a problem again.

\begin{important}
When dealing with custom formats where the internal definitions
are outside of your control and liable to change, it's best
to provide a wrapper command.
\end{important}

Instead of directly using \cs{Numberstring} in the definition of
\cs{thepage}, I can provide a custom command in the same form
as the earlier \cs{tally} command:
\begin{verbatim}
\newcommand{\customfmt}[1]{\customfmtnum{\arabic{#1}}}
\newrobustcmd{\customfmtnum}[1]{\Numberstringnum{#1}}
\end{verbatim}
This ensures that the location will always be written to
the indexing file in the form:
\begin{alltt}
:locref "\glsopenbrace\glsclosebrace\glsopenbrace\string\\customfmtnum \marg{n}\glsclosebrace"
\end{alltt}
So the location class can be defined as:
\begin{verbatim}
\GlsAddXdyLocation{customfmt}{
 :sep "\string\customfmtnum\space\glsopenbrace"
 "arabic-numbers" 
 :sep "\glsclosebrace"}
\end{verbatim}

The sample file
\samplefile{xdy3} illustrates this.
\end{example}

In the \gls{numberlist}, the locations are sorted according to the list
of provided location classes. The default ordering is:
\texttt{roman-page-numbers} (i, ii, \ldots), \texttt{arabic-page-numbers}
(1, 2, \ldots), \texttt{arabic-section-numbers} (for example, 1.1 if the
compositor is a full stop or 1-1 if the compositor is a
hyphen\footnote{see \ics{glsSetCompositor} described in
\sectionref{sec:setup}}), \texttt{alpha-page-numbers} (a, b, \ldots),
\texttt{Roman-page-numbers} (I, II, \ldots), \texttt{Alpha-page-numbers}
(A, B, \ldots), \texttt{Appendix-page-numbers} (for example, A.1 if the Alpha
compositor is a full stop or A-1 if the Alpha compositor is a
hyphen\footnote{see \ics{glsSetAlphaCompositor} described in
\sectionref{sec:setup}}), user defined location names (as specified
by \ics{GlsAddXdyLocation} in the order in which they were defined),
and finally \texttt{see} (cross-referenced entries).\footnote{With
\gls{glossaries-extra} \texttt{seealso} is appended to the end of
the list.} This ordering can be changed using:

\begin{definition}[\DescribeMacro\GlsSetXdyLocationClassOrder]
\cs{GlsSetXdyLocationClassOrder}\marg{location names}
\end{definition}
where each location name is delimited by double quote marks and
separated by white space. For example:
\begin{verbatim}
\GlsSetXdyLocationClassOrder{
  "arabic-page-numbers"
  "arabic-section-numbers"
  "roman-page-numbers"
  "Roman-page-numbers"
  "alpha-page-numbers"
  "Alpha-page-numbers"
  "Appendix-page-numbers"
  "see"
}
\end{verbatim}
(Remember to add \verb|"seealso"| if you're using
\gls{glossaries-extra}.)

\begin{important}
Note that \cs{GlsSetXdyLocationClassOrder} has no effect if 
\ics{noist} is used or if \ics{makeglossaries} is omitted.
\cs{GlsSetXdyLocationClassOrder} must be used before 
\ics{makeglossaries}.
\end{important}

If a \gls{numberlist} consists of a sequence of consecutive 
numbers, the range will be concatenated. The 
number of consecutive locations that causes a range formation 
defaults to 2, but can be changed using:

\begin{definition}[\DescribeMacro\GlsSetXdyMinRangeLength]
\cs{GlsSetXdyMinRangeLength}\marg{n}
\end{definition}
For example:
\begin{verbatim}
\GlsSetXdyMinRangeLength{3}
\end{verbatim}
The argument may also be the keyword \texttt{none}, to indicate that
there should be no range formations. See the \gls{xindy}
manual for further details on range formations.

\begin{important}
Note that \cs{GlsSetXdyMinRangeLength} has no effect if \ics{noist}
is used or if \ics{makeglossaries} is omitted.
\cs{GlsSetXdyMinRangeLength} must be used before 
\ics{makeglossaries}.
\end{important}
See also \sectionref{sec:ranges}.

\section{Glossary Groups}
\label{sec:groups}

The glossary is divided into groups according to the first
letter of the sort key. The \styfmt{glossaries} package also adds
a number group by default, unless you suppress it in the
\pkgopt{xindy} package option. For example:
\begin{verbatim}
\usepackage[xindy={glsnumbers=false}]{glossaries}
\end{verbatim}
Any entry that doesn't go in one of the letter groups or the
number group is placed in the default group. If you want \gls{xindy}
to sort the number group numerically (rather than by a string sort)
then you need to use \gls{xindy}['s] \texttt{numeric-sort} module:
\begin{verbatim}
\GlsAddXdyStyle{numeric-sort}
\end{verbatim}

If you don't use \texttt{glsnumbers=false}, the default behaviour is to locate
the number group before the \qt{A} letter group. If you are not using a
Roman alphabet, you need to change this using:


\begin{definition}[\DescribeMacro\GlsSetXdyFirstLetterAfterDigits]
\cs{GlsSetXdyFirstLetterAfterDigits}\marg{letter}
\end{definition}
where \meta{letter} is the first letter of your alphabet. Take care
if you're using \sty{inputenc} as non-ASCII characters are actually
active characters that expand. (This isn't a problem with the native
UTF-8 engines and \sty{fontspec}.) The starred form will sanitize
the argument to prevent expansion.
Alternatively you can use:


\begin{definition}[\DescribeMacro\GlsSetXdyNumberGroupOrder]
\cs{GlsSetXdyNumberGroupOrder}\marg{relative location}
\end{definition}
to change the default
\begin{alltt}
:before \cs{string}"\meta{letter}\cs{string}"
\end{alltt}
to \meta{relative location}. For example:
\begin{verbatim}
\GlsSetXdyNumberGroupOrder{:after \string"Z\string"}
\end{verbatim}
will put the number group after the \qt{Z} letter group.
Again take care of active characters. There's a starred version
that sanitizes the argument (so don't use \cs{string} in it).
\begin{alltt}
\cs{GlsSetXdyNumberGroupOrder}*\{:after "\"O"\}
\end{alltt}

\begin{important}
Note that these commands have no effect if 
\ics{noist} is used or if \ics{makeglossaries} is omitted.
\cs{GlsSetXdyFirstLetterAfterDigits} must be used before 
\ics{makeglossaries}.\par
\end{important}


\chapter{Defining New Glossaries}
\label{sec:newglossary}

A new glossary can be defined using:
\begin{definition}[\DescribeMacro{\newglossary}]
\cs{newglossary}\oarg{log-ext}\marg{name}\marg{in-ext}\marg{out-ext}\linebreak\marg{title}\oarg{counter}
\end{definition}
where \meta{name} is the label to assign to this glossary.
The arguments \meta{in-ext} and \meta{out-ext} specify the extensions to
give to the input and output files for that glossary, \meta{title}
is the default title for this new glossary and the final optional
argument \meta{counter} specifies which counter to use for the
associated \glspl{numberlist} (see also
\sectionref{sec:numberlists}). The first optional argument specifies
the extension for the \gls{makeindex} (\opt2) or \gls{xindy} (\opt3)
transcript file (this information is only used by
\gls{makeglossaries} which picks up the information from the
auxiliary file).  If you use \opt1, the \meta{log-ext},
\meta{in-ext} and \meta{out-ext} arguments are ignored.

\begin{important}
The glossary label \meta{name} must not contain any active
characters. It's generally best to stick with just characters that
have category code~11 (typically the non-extended \glspl{latinchar}
for standard \LaTeX).
\end{important}

There is also a starred version (new to v4.08):
\begin{definition}[\DescribeMacro{\newglossary*}]
\cs{newglossary*}\marg{name}\marg{title}\oarg{counter}
\end{definition}
which is equivalent to
\begin{alltt}
\cs{newglossary}[\meta{name}-glg]\marg{name}\{\meta{name}-gls\}\{\meta{name}-glo\}\ifpdf\linebreak\fi\marg{title}\oarg{counter}
\end{alltt}
or you can also use:
\begin{definition}[\DescribeMacro{\altnewglossary}]
\cs{altnewglossary}\marg{name}\marg{tag}\marg{title}\oarg{counter}
\end{definition}
which is equivalent to
\begin{alltt}
\cs{newglossary}[\meta{tag}-glg]\marg{name}\{\meta{tag}-gls\}\{\meta{tag}-glo\}\marg{title}\oarg{counter}
\end{alltt}

It may be that you have some terms that are so common
that they don't need to be listed. In this case, you can define 
a~special type of glossary that doesn't create any associated files.
This is referred to as an \qt{ignored glossary} and it's ignored by
commands that iterate over all the glossaries, such as
\ics{printglossaries}. To define an ignored glossary, use
\begin{definition}[\DescribeMacro\newignoredglossary]
\cs{newignoredglossary}\marg{name}
\end{definition}
where \meta{name} is the name of the glossary (as above). This
glossary type will automatically be added to the
\pkgopt{nohypertypes} list, since there are no hypertargets for
the entries in an ignored glossary.
(The sample file \samplefile{-entryfmt} defines an ignored glossary.)

\begin{xtr}
The \gls{glossaries-extra} package provides a starred version of
this command that allows hyperlinks (since ignored glossaries can be
useful with \gls{bib2gls}). There is also an analogous 
\ics*{provideignoredglossary} command.
\end{xtr}

You can test if a glossary is an ignored one using:
\begin{definition}[\DescribeMacro\ifignoredglossary]
\cs{ifignoredglossary}\marg{name}\marg{true}\marg{false}
\end{definition}
This does \meta{true} if \meta{name} was defined as an ignored
glossary, otherwise it does \meta{false}.

Note that the main (default) glossary is automatically created as:
\begin{verbatim}
\newglossary{main}{gls}{glo}{\glossaryname}
\end{verbatim}
so it can be identified by the label \texttt{main} (unless the
\pkgopt{nomain} package option is used). Using the
\pkgopt{acronym} package option is equivalent to:
\begin{verbatim}
\newglossary[alg]{acronym}{acr}{acn}{\acronymname}
\end{verbatim}
so it can be identified by the label \texttt{acronym}. If you are
not sure whether the \pkgopt{acronym} option has been used, you
can identify the list of acronyms by the command 
\DescribeMacro{\acronymtype}\cs{acronymtype} which is set to
\texttt{acronym}, if the \pkgopt{acronym} option has been used,
otherwise it is set to \texttt{main}. Note that if you are using
the main glossary as your list of acronyms, you need to declare
it as a list of acronyms using the package option 
\pkgopt{acronymlists}.

The \pkgopt{symbols} package option creates a new glossary with the
label \texttt{symbols} using:
\begin{verbatim}
\newglossary[slg]{symbols}{sls}{slo}{\glssymbolsgroupname}
\end{verbatim}
The \pkgopt{numbers} package option creates a new glossary with
the label \texttt{numbers} using:
\begin{verbatim}
\newglossary[nlg]{numbers}{nls}{nlo}{\glsnumbersgroupname}
\end{verbatim}
The \pkgopt{index} package option creates a new glossary with
the label \texttt{index} using:
\begin{verbatim}
\newglossary[ilg]{index}{ind}{idx}{\indexname}
\end{verbatim}

\begin{important}
\optsand23: all glossaries must be defined before \ics{makeglossaries} to 
ensure that the relevant output files are opened.

See \sectionref{sec:fixednames} if you want to redefine \cs{glossaryname}, 
especially if you are using \sty{babel} or \sty{translator}.
(Similarly for \cs{glssymbolsgroupname} and
\cs{glsnumbersgroupname}.) If you want to redefine \ics{indexname},
just follow the advice in
\href{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=fixnam}{How to
change LaTeX’s \qt{fixed names}}.
\end{important}

\chapter{Acronyms and Other Abbreviations}
\label{sec:acronyms}

\begin{xtr}
The \gls{glossaries-extra} package provides superior
abbreviation handling. You may want to consider using that
package instead of the commands described here.
\end{xtr}

\begin{important}
Note that although this chapter uses the term \qt{acronym}, you can also
use the commands described here for initialisms or contractions
(as in the case of some of the examples given below).
If the glossary title is no longer applicable (for example, it
should be \qt{Abbreviations} rather than \qt{Acronyms}) then
you can change the title either by redefining \ics{acronymname} (see
\sectionref{sec:languages}) or by using the \gloskey[printglossary]{title}
in the optional argument of \ics{printglossary} (or
\ics{printacronyms}). Alternatively consider using the
\gls{glossaries-extra} package's \pkgopt*{abbreviations}
option instead.
\end{important}

You may have noticed in \sectionref{sec:newglosentry} that when you
specify a new entry, you can specify alternate text to use when the
term is \glsd{firstuse} in the document. This provides a
useful means to define abbreviations. For convenience, the
\styfmt{glossaries} package defines the command:
\begin{definition}[\DescribeMacro{\newacronym}]
\cs{newacronym}\oarg{key-val list}\marg{label}\marg{abbrv}\marg{long}
\end{definition}

This uses \ics{newglossaryentry} to create an entry with the given
label in the glossary given by \ics{acronymtype}. You can specify a
different glossary using the \gloskey{type} key within the optional
argument. The \cs{newacronym} command also uses the \gloskey{long},
\gloskey{longplural}, \gloskey{short} and \gloskey{shortplural} keys
in \cs{newglossaryentry} to store the long and abbreviated forms and
their plurals. 

Note that the same restrictions on the entry \meta{label}
in \ics{newglossaryentry} also apply to \cs{newacronym}
(see \sectionref{sec:newglosentry}).

\begin{important}
If you haven't identified the specified glossary type as a list of
acronyms (via the package option
\pkgopt{acronymlists} or the command \ics{DeclareAcronymList}, 
see \sectionref{sec:pkgopts-acronym}) \cs{newacronym} will add it to
the list and \emph{reset the display style} for that glossary via
\ics{defglsentryfmt}. If you have a mixture of acronyms and regular
entries within the same glossary, care is needed if you want to
change the display style: you must first identify that glossary as a
list of acronyms and then use \ics{defglsentryfmt} (not redefine
\ics{glsentryfmt}) before defining your entries.
\end{important}

The optional argument \marg{key-val list} allows you to specify
additional information. Any key that can be used in the second
argument of \ics{newglossaryentry} can also be used here in \meta{key-val
list}.
For example, \gloskey{description} (when used with one of the styles that
require a description, described in
\sectionref{sec:setacronymstyle}) or you can
override plural forms of \meta{abbrv} or \meta{long} using the
\gloskey{shortplural} or \gloskey{longplural} keys.
For example:
\begin{verbatim}
\newacronym[longplural={diagonal matrices}]%
  {dm}{DM}{diagonal matrix}
\end{verbatim}
If the \firstuse\ uses the plural form, \verb|\glspl{dm}| will
display: diagonal matrices (DMs). If you want to use
the \gloskey{longplural} or \gloskey{shortplural} keys, I recommend
you use \ics{setacronymstyle} to set the display style rather than
using one of the pre-version 4.02 acronym styles.

As with \gloskey{plural} and \gloskey{firstplural}, if
\gloskey{longplural} is missing, it's obtained by appended 
\ics{glspluralsuffix} to the singular form. The short plural
\gloskey{shortplural} is obtained (is not explicitly set) by appending
\ics{glsacrpluralsuffix} to the short form. These commands may be
changed by the associated language files, but they can't be added to
the usual caption hooks as there's no guarantee when they'll be
expanded (as \hyperref[pluralsuffix]{discussed earlier}).
A different approach is used by \styfmt{glossaries-extra}, which has
\icatattrs category attributes to determine whether or not to append a suffix
when forming the default value of \gloskey{shortplural}.

Since \ics{newacronym} uses \ics{newglossaryentry}, you can use
commands like \ics{gls} and \ics{glsreset} as with any other
glossary entry.

\begin{important}
Since \cs{newacronym} sets \verb|type=\acronymtype|,
if you want to load a file containing acronym definitions using
\ics{loadglsentries}\oarg{type}\marg{filename}, the optional argument
\meta{type} will not have an effect unless you explicitly set the
type as \verb|type=\glsdefaulttype| in the optional argument to
\ics{newacronym}. See \sectionref{sec:loadglsentries}.
\end{important}

\begin{example}{Defining an Abbreviation}{ex:newacronym}
The following defines the abbreviation IDN:
\begin{verbatim}
\newacronym{idn}{IDN}{identification number}
\end{verbatim}
\verb|\gls{idn}| will produce \qt{identification number (IDN)} on
\firstuse\ and \qt{IDN} on subsequent uses. If you want to use one
of the \gls{smallcaps} acronym styles, described in
\sectionref{sec:setacronymstyle}, you need to use lower case
characters for the shortened form:
\begin{verbatim}
\newacronym{idn}{idn}{identification number}
\end{verbatim}
Now \verb|\gls{idn}| will produce \qt{identification number
(\textsc{idn})} on \firstuse\ and \qt{\textsc{idn}} on subsequent
uses.
\end{example}

\begin{important}
Avoid nested definitions.
\end{important}

Recall from the warning in 
\sectionref{sec:newglosentry} that you should avoid using
the \glslike\ and \glstextlike\ commands within the value of
keys like \gloskey{text} and \gloskey{first} due to complications
arising from nested links. The same applies to abbreviations
defined using \cs{newacronym}.

For example, suppose you have defined:
\begin{verbatim}
\newacronym{ssi}{SSI}{server side includes}
\newacronym{html}{HTML}{hypertext markup language}
\end{verbatim}
you may be tempted to do:
\begin{verbatim}
\newacronym{shtml}{S\gls{html}}{\gls{ssi} enabled \gls{html}}
\end{verbatim}
\strong{Don't!} This will break the case-changing commands, such
as \ics{Gls}, it will cause inconsistencies on \firstuse, and,
if hyperlinks are enabled, will cause nested hyperlinks. It will
also confuse the commands used by the entry formatting (such as
\ics{glslabel}).

Instead, consider doing:
\begin{verbatim}
\newacronym
 [description={\gls{ssi} enabled \gls{html}}]
 {shtml}{SHTML}{SSI enabled HTML}
\end{verbatim}
or
\begin{verbatim}
\newacronym
 [description={\gls{ssi} enabled \gls{html}}]
 {shtml}{SHTML}
 {server side includes enabled hypertext markup language}
\end{verbatim}
Similarly for the \glstextlike\ commands.

Other approaches are available with \gls{glossaries-extra}.
See the section \qt{Nested Links} in the \styfmt{glossaries-extra}
user manual.

\begin{important}
The commands described below are similar to the \glstextlike\
commands in that they don't modify the \firstuseflag.
However, their display is governed by \ics{defentryfmt} with
\ics{glscustomtext} set as appropriate. All caveats that apply to
the \glstextlike\ commands also apply to the following commands.
(Including the warning immediately above this box.)
\end{important}

The optional arguments are the same as those for the \glstextlike\
commands, and there are similar star and plus variants that switch
off or on the hyperlinks. As with the \glstextlike\ commands, the
\gls{linktext} is placed in the argument of \ics{glstextformat}.

\begin{definition}[\DescribeMacro{\acrshort}]
\cs{acrshort}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This sets the \gls{linktext} to the short form (within the argument
of \ics{acronymfont}) for the entry given by \meta{label}. The short
form is as supplied by the \gloskey{short} key, which
\ics{newacronym} implicitly sets.

There are also analogous upper case variants:
\begin{definition}[\DescribeMacro{\Acrshort}]
\cs{Acrshort}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\ACRshort}]
\cs{ACRshort}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
There are also plural versions:
\begin{definition}[\DescribeMacro\acrshortpl]
\cs{acrshortpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro\Acrshortpl]
\cs{Acrshortpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro\ACRshortpl]
\cs{ACRshortpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
The short plural form is as supplied
by the \gloskey{shortplural} key, which \ics{newacronym} implicitly sets.

\begin{definition}[\DescribeMacro{\acrlong}]
\cs{acrlong}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This sets the \gls{linktext} to the long form for the entry given by 
\meta{label}. The long form is as supplied
by the \gloskey{long} key, which \ics{newacronym} implicitly sets.

There are also analogous upper case variants:
\begin{definition}[\DescribeMacro{\Acrlong}]
\cs{Acrlong}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\ACRlong}]
\cs{ACRlong}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
Again there are also plural versions:
\begin{definition}[\DescribeMacro{\acrlongpl}]
\cs{acrlongpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\Acrlongpl}]
\cs{Acrlongpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\ACRlongpl}]
\cs{ACRlongpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
The long plural form is as supplied by the \gloskey{longplural} key,
which \ics{newacronym} implicitly sets.

The commands below display the full form of the acronym, but note
that this isn't necessarily the same as the form used on \firstuse.
These full-form commands are shortcuts that use the above commands,
rather than creating the \gls{linktext} from the complete full form.
These full-form commands have star and plus variants and optional
arguments that are passed to the above commands.

\begin{definition}[\DescribeMacro{\acrfull}]
\cs{acrfull}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This is a shortcut for
\begin{definition}[\DescribeMacro{\acrfullfmt}]
\cs{acrfullfmt}\marg{options}\marg{label}\marg{insert}
\end{definition}
which by default does
\begin{alltt}
\cs{acrfullformat}
 \mgroup{\cs{acrlong}\oarg{options}\marg{label}\marg{insert}}
 \mgroup{\cs{acrshort}\oarg{options}\marg{label}}
\end{alltt}
where
\begin{definition}[\DescribeMacro\acrfullformat]
\cs{acrfullformat}\marg{long}\marg{short}
\end{definition}
by default does \meta{long} (\meta{short}). This command is now
deprecated for new acronym styles but is used by the default for
backward compatibility if \cs{setacronymstyle}
(\sectionref{sec:setacronymstyle}) hasn't been used.  (For further
details of these format commands see \ifpdf
section~\ref*{sec:code:acronym} in \fi the documented code,
\texttt{glossaries-code.pdf}.)

There are also analogous upper case variants:
\begin{definition}[\DescribeMacro{\Acrfull}]
\cs{Acrfull}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro{\ACRfull}]
\cs{ACRfull}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
and plural versions:
\begin{definition}[\DescribeMacro\acrfullpl]
\cs{acrfullpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro\Acrfullpl]
\cs{Acrfullpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
\begin{definition}[\DescribeMacro\ACRfullpl]
\cs{ACRfullpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}

If you find the above commands too cumbersome to write, you can use
the \pkgopt{shortcuts} package option to activate the shorter
command names listed in \tableref{tab:shortcuts}.

\begin{table}[htbp]
\caption{Synonyms provided by the package option \pkgoptfmt{shortcuts}}
\label{tab:shortcuts}
\vskip\baselineskip
\centering
\begin{tabular}{ll}
\bfseries Shortcut Command & \bfseries Equivalent Command\\
\ics{acs} & \ics{acrshort}\\
\ics{Acs} & \ics{Acrshort}\\
\ics{acsp} & \ics{acrshortpl}\\
\ics{Acsp} & \ics{Acrshortpl}\\
\ics{acl} & \ics{acrlong}\\
\ics{Acl} & \ics{Acrlong}\\
\ics{aclp} & \ics{acrlongpl}\\
\ics{Aclp} & \ics{Acrlongpl}\\
\ics{acf} & \ics{acrfull}\\
\ics{Acf} & \ics{Acrfull}\\
\ics{acfp} & \ics{acrfullpl}\\
\ics{Acfp} & \ics{Acrfullpl}\\
\ics{ac} & \ics{gls}\\
\ics{Ac} & \ics{Gls}\\
\ics{acp} & \ics{glspl}\\
\ics{Acp} & \ics{Glspl}
\end{tabular}
\end{table}

It is also possible to access the long and short forms without
adding information to the glossary using commands analogous to
\ics{glsentrytext} (described in \sectionref{sec:glsnolink}).

\begin{important}
The commands that convert the first letter to upper case come with
the same caveats as those for analogous commands like
\ics{Glsentrytext} (non-expandable, can't be used in PDF bookmarks,
care needs to be taken if the first letter is an accented character
etc). See \sectionref{sec:glsnolink}.
\end{important}

The long form can be accessed using:
\begin{definition}[\DescribeMacro{\glsentrylong}]
\cs{glsentrylong}\marg{label}
\end{definition}
or, with the first letter converted to upper case:
\begin{definition}[\DescribeMacro{\Glsentrylong}]
\cs{Glsentrylong}\marg{label}
\end{definition}
Plural forms:
\begin{definition}[\DescribeMacro{\glsentrylongpl}]
\cs{glsentrylongpl}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentrylongpl}]
\cs{Glsentrylongpl}\marg{label}
\end{definition}

Similarly, to access the short form:
\begin{definition}[\DescribeMacro{\glsentryshort}]
\cs{glsentryshort}\marg{label}
\end{definition}
or, with the first letter converted to upper case:
\begin{definition}[\DescribeMacro{\Glsentryshort}]
\cs{Glsentryshort}\marg{label}
\end{definition}
Plural forms:
\begin{definition}[\DescribeMacro{\glsentryshortpl}]
\cs{glsentryshortpl}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryshortpl}]
\cs{Glsentryshortpl}\marg{label}
\end{definition}

And the full form can be obtained using:
\begin{definition}[\DescribeMacro{\glsentryfull}]
\cs{glsentryfull}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryfull}]
\cs{Glsentryfull}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glsentryfullpl}]
\cs{glsentryfullpl}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\Glsentryfullpl}]
\cs{Glsentryfullpl}\marg{label}
\end{definition}
These again use \ics{acrfullformat} by default, but
the new styles described in the section below use different
formatting commands.

\section{Changing the Abbreviation Style}
\label{sec:setacronymstyle}

It may be that the default style doesn't suit your requirements in
which case you can switch to another style using
\begin{definition}[\DescribeMacro{\setacronymstyle}]
\cs{setacronymstyle}\marg{style name}
\end{definition}
where \meta{style name} is the name of the required style.

\begin{important}
You must use \cs{setacronymstyle} \emph{before} you define the
acronyms with \cs{newacronym}.
\end{important}

For example:
\begin{verbatim}
\usepackage[acronym]{glossaries}

\makeglossaries

\setacronymstyle{long-sc-short}

\newacronym{html}{html}{hypertext markup language}
\newacronym{xml}{xml}{extensible markup language}
\end{verbatim}
Unpredictable results can occur if you try to use multiple styles.

\begin{important}
If you need multiple abbreviation styles, then try
using the \gls{glossaries-extra} package, which has better
abbreviation management.
\end{important}

Unlike the default behaviour of \cs{newacronym}, the
styles used via \cs{setacronymstyle} don't use the \gloskey{first}
or \gloskey{text} keys, but instead they use \ics{defglsentryfmt} to
set a~custom format that uses the \gloskey{long} and \gloskey{short}
keys (or their plural equivalents). This means that these styles
cope better with plurals that aren't formed by simply appending the
singular form with the letter \qt{s}. In fact, most of the predefined
styles use \ics{glsgenacfmt} and modify the definitions of commands
like \ics{genacrfullformat}.

Note that when you use \cs{setacronymstyle} the \gloskey{name} key
is set to
\begin{definition}[\DescribeMacro{\acronymentry}]
\cs{acronymentry}\marg{label}
\end{definition}
and the \gloskey{sort} key is set to
\begin{definition}[\DescribeMacro{\acronymsort}]
\cs{acronymsort}\marg{short}\marg{long}
\end{definition}
These commands are redefined by the acronym styles. However, you can
redefine them again after the style has been set but before you use
\cs{newacronym}. Protected expansion is performed on \cs{acronymsort}
when the entry is defined.

\subsection{Predefined Acronym Styles}
\label{sec:predefinedacrstyles}

The \styfmt{glossaries} package provides a~number of predefined
styles. These styles apply
\begin{definition}[\DescribeMacro{\firstacronymfont}]
\cs{firstacronymfont}\marg{text}
\end{definition}
to the short form on first use and
\begin{definition}[\DescribeMacro{\acronymfont}]
\cs{acronymfont}\marg{text}
\end{definition}
on subsequent use. The styles modify the definition of
\cs{acronymfont} as required, but \ics{firstacronymfont} is only set
once by the package when it's loaded. By default
\ics{firstacronymfont}\marg{text} is the same as
\ics{acronymfont}\marg{text}.
If you want the short form displayed differently on first use, you
can redefine \ics{firstacronymfont} independently of the acronym
style.

The predefined styles that contain \texttt{sc} in their name (for
example \acrstyle{long-sc-short}) redefine \cs{acronymfont} to use
\ics{textsc}, which means that the short form needs to be specified
in lower case. \ifpdf Remember that \verb|\textsc{abc}| produces
\textsc{abc} but \verb|\textsc{ABC}| produces \textsc{ABC}.\fi

\hypertarget{boldsc}{}%
\begin{important}%
Some fonts don't support bold \gls{smallcaps}, so you may need to redefine 
\ics{glsnamefont} (see \sectionref{sec:printglossary}) to switch to
medium weight if you are using a glossary style that displays entry
names in bold and you have chosen an acronym style that uses
\ics{textsc}.
\end{important}

The predefined styles that contain \texttt{sm} in their name
(for example \acrstyle{long-sm-short}) redefine \cs{acronymfont} to
use \ics{textsmaller}.  

\hypertarget{smaller}{}%
\begin{important}
Note that the \styfmt{glossaries} package doesn't define or load any package that
defines \ics{textsmaller}. If you use one of the acronym styles that
set \ics{acronymfont} to \cs{textsmaller} you must
explicitly load the \sty{relsize} package or otherwise define
\cs{textsmaller}.
\end{important}

The remaining predefined styles redefine \cs{acronymfont}\marg{text}
to simply do its argument \meta{text}. 

\begin{important}
In most cases, the predefined styles adjust \ics{acrfull} and
\ics{glsentryfull} (and their plural and upper case variants) to
reflect the style. The only exceptions to this are the 
\acrstyle{dua} and \acrstyle{footnote} styles (and their variants).
\end{important}

The following styles are supplied by the \styfmt{glossaries}
package:
\begin{itemize}
\item \acrstyle{long-short}, \acrstyle{long-sc-short},
\acrstyle{long-sm-short}, \acrstyle{long-sp-short}:

With these three styles, acronyms are displayed in the form
\begin{definition}
\meta{long} (\ics{firstacronymfont}\marg{short})
\end{definition}
on first use and
\begin{definition}
\ics{acronymfont}\marg{short}
\end{definition}
on subsequent use.
They also set \cs{acronymsort}\marg{short}\marg{long} to just
\meta{short}.  This means that the acronyms are sorted according to
their short form.  In addition, \cs{acronymentry}\marg{label} is set
to just the short form (enclosed in \cs{acronymfont}) and the
\gloskey{description} key is set to the long form.

The \acrstyle{long-sp-short} style was introduced in version~4.16
and uses
\begin{definition}[\DescribeMacro\glsacspace]
\cs{glsacspace}\marg{label}
\end{definition}
for the space between the long and short forms. This defaults to
a~non-breakable space (\verb|~|) if 
(\cs{acronymfont}\marg{short}) is less than 3em, otherwise it uses
a~normal space. This may be redefined as required. For example, to
always use a~non-breakable space:
\begin{verbatim}
\renewcommand*{\glsacspace}[1]{~}
\end{verbatim}

\item \acrstyle{short-long}, \acrstyle{sc-short-long},
\acrstyle{sm-short-long}:

These three styles are analogous to the above three styles, except
the display order is swapped to
\begin{definition}
\ics{firstacronymfont}\marg{short} (\meta{long})
\end{definition}
on first use.

Note, however, that \ics{acronymsort} and \ics{acronymentry} are the
same as for the \meta{long} (\meta{short}) styles above, so the
acronyms are still sorted according to the short form.

\item \acrstyle{long-short-desc}, \acrstyle{long-sc-short-desc},
\acrstyle{long-sm-short-desc}, \acrstyle{long-sp-short-desc}:

These are like the \acrstyle{long-short}, \acrstyle{long-sc-short},
\acrstyle{long-sm-short} and \acrstyle{long-sp-short} styles described above, except that the
\gloskey{description} key must be supplied in the optional argument
of \ics{newacronym}. They also redefine \ics{acronymentry} to
\marg{long} (\cs{acronymfont}\marg{short}) and redefine
\ics{acronymsort}\marg{short}\marg{long} to just \meta{long}.
This means that the acronyms are sorted according to the long form,
and in the list of acronyms the name field has the long form
followed by the short form in parentheses. I~recommend you use
a~glossary style such as \glostyle{altlist} with these acronym
styles to allow for the long name field.

\item \acrstyle{short-long-desc}, \acrstyle{sc-short-long-desc},
\acrstyle{sm-short-long-desc}:

These styles are analogous to the above three styles, but the first
use display style is:
\begin{definition}
\cs{firstacronymfont}\marg{short} (\meta{long})
\end{definition}
The definitions of \cs{acronymsort} and \cs{acronymentry} are the
same as those for \acrstyle{long-short-desc} etc.

\item \acrstyle{dua}, \acrstyle{dua-desc}:

With these styles, the \glslike\ commands always display the long form 
regardless of whether the entry has been used or not. However, \ics{acrfull}
and \ics{glsentryfull} will display \meta{long} (\cs{acronymfont}\marg{short}). In the case
of \acrstyle{dua}, the \gloskey{name} and \gloskey{sort} keys are set to
the short form and the description is set to the long form. In the
case of \acrstyle{dua-desc}, the \gloskey{name} and \gloskey{sort}
keys are set to the long form and the description is supplied in the
optional argument of \ics{newacronym}.

\item \acrstyle{footnote}, \acrstyle{footnote-sc},
\acrstyle{footnote-sm}:

With these three styles, on first use the \glslike\ commands display:
\begin{definition}
\cs{firstacronymfont}\marg{short}\ics{footnote}\marg{long}
\end{definition}
However, \ics{acrfull} and \ics{glsentryfull} are set to 
\cs{acronymfont}\marg{short} (\meta{long}). On subsequent use the display is:
\begin{definition}
\cs{acronymfont}\marg{short}
\end{definition}
The \gloskey{sort} and \gloskey{name} keys are set to
the short form, and the \gloskey{description} is set to the long
form.

\begin{important}
In order to avoid nested hyperlinks on \firstuse\ the footnote
styles automatically implement \pkgopt[false]{hyperfirst} for the
acronym lists.
\end{important}

\item \acrstyle{footnote-desc}, \acrstyle{footnote-sc-desc},
\acrstyle{footnote-sm-desc}:

These three styles are similar to the previous three styles, but the
description has to be supplied in the optional argument of
\ics{newacronym}. The \gloskey{name} key is set to the long form
followed by the short form in parentheses and the \gloskey{sort} key
is set to the long form. This means that the acronyms will be sorted
according to the long form. In addition, since the \gloskey{name}
will typically be quite wide it's best to choose a glossary style
that can accommodate this, such as \glostyle{altlist}.

\end{itemize}

\begin{example}{Adapting a Predefined Acronym Style}{ex:acrstyle}
Suppose I~want to use the \acrstyle{footnote-sc-desc} style, but 
I~want the \gloskey{name} key set to the short form followed by the
long form in parentheses and the \gloskey{sort} key set to the short
form. Then I need to specify the \acrstyle{footnote-sc-desc} style:
\begin{verbatim}
\setacronymstyle{footnote-sc-desc}
\end{verbatim}
and then redefine \ics{acronymsort} and \ics{acronymentry}:
\begin{verbatim}
\renewcommand*{\acronymsort}[2]{#1}% sort by short form
\renewcommand*{\acronymentry}[1]{%
  \acronymfont{\glsentryshort{#1}}\space (\glsentrylong{#1})}%
\end{verbatim}
(I've used \cs{space} for extra clarity, but you can just use an
actual space instead.)

Note that the default Computer Modern fonts don't support bold
\gls{smallcaps}, so another font is required. For example:
\begin{verbatim}
\usepackage[T1]{fontenc}
\end{verbatim}
The alternative is to redefine \ics{acronymfont} so that it
always switches to medium weight to ensure the \gls{smallcaps} setting is
used. For example:
\begin{verbatim}
\renewcommand*{\acronymfont}[1]{\textmd{\scshape #1}}
\end{verbatim}

The sample file \samplefile{FnAcrDesc} illustrates this
example.
\end{example}

\subsection{Defining A Custom Acronym Style}
\label{sec:customacronym}

You may find that the predefined acronyms styles that come with the
\styfmt{glossaries} package don't suit your requirements. In this
case you can define your own style using:
\begin{definition}[\DescribeMacro{\newacronymstyle}]
\cs{newacronymstyle}\marg{style name}\marg{display}\marg{definitions}
\end{definition}
where \meta{style name} is the name of the new style (avoid active
characters). The second argument, \meta{display}, is equivalent to
the mandatory argument of \ics{defglsentryfmt}. You can simply use
\ics{glsgenacfmt} or you can customize the display using commands
like \ics{ifglsused}, \ics{glsifplural} and \ics{glscapscase}.
(See \sectionref{sec:glsdisplay} for further details.)
If the style is likely to be used with a mixed glossary (that is entries in
that glossary are defined both with \ics{newacronym} and
\ics{newglossaryentry}) then you can test if the entry is an acronym
and use \ics{glsgenacfmt} if it is or \ics{glsgenentryfmt} if it
isn't. For example, the \acrstyle{long-short} style sets
\meta{display} as
\begin{verbatim}
\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
\end{verbatim}
(You can use \ics{ifglshasshort} instead of \ics{ifglshaslong} to
test if the entry is an acronym if you prefer.)

The third argument, \meta{definitions}, can be used to redefine the
commands that affect the display style, such as \ics{acronymfont}
or, if \meta{display} uses \cs{glsgenacfmt}, \ics{genacrfullformat}
and its variants.

Note that \ics{setacronymstyle} redefines \ics{glsentryfull} and
\ics{acrfullfmt} to use \ics{genacrfullformat} (and similarly for
the plural and upper case variants). If this isn't appropriate for the
style (as in the case of styles like \acrstyle{footnote} and
\acrstyle{dua}) \cs{newacronymstyle} should redefine these commands
within \meta{definitions}.


Within \cs{newacronymstyle}'s \meta{definitions} argument you 
can also redefine
\begin{definition}[\DescribeMacro{\GenericAcronymFields}]
\cs{GenericAcronymFields}
\end{definition}
This is a list of additional fields to be set in \ics{newacronym}.
You can use the following token registers to access the entry label,
long form and short form: \DescribeMacro{\glslabeltok}\cs{glslabeltok}, 
\DescribeMacro{\glslongtok}\cs{glslongtok} and 
\DescribeMacro{\glsshorttok}\cs{glsshorttok}. As with all \TeX\
registers, you can access their values by preceding the register
with \ics{the}.  For example, the \acrstyle{long-short} style does:
\begin{verbatim}
\renewcommand*{\GenericAcronymFields}{%
   description={\the\glslongtok}}%
\end{verbatim}
which sets the \gloskey{description} field to the long form of the
acronym whereas the \acrstyle{long-short-desc} style does:
\begin{verbatim}
\renewcommand*{\GenericAcronymFields}{}%
\end{verbatim}
since the description needs to be specified by the user.

It may be that you want to define a new acronym style that's based
on an existing style. Within \meta{display} you can use
\begin{definition}[\DescribeMacro\GlsUseAcrEntryDispStyle]
\cs{GlsUseAcrEntryDispStyle}\marg{style name}
\end{definition}
to use the \meta{display} definition from the style given by
\meta{style name}. Within \meta{definitions} you can use
\begin{definition}[\DescribeMacro{\GlsUseAcrStyleDefs}]
\cs{GlsUseAcrStyleDefs}\marg{style name}
\end{definition}
to use the \meta{definitions} from the style given by \meta{style
name}. For example, the \acrstyle{long-sc-short} acronym style is
based on the \acrstyle{long-short} style with minor
modifications (remember to use \verb|##| instead of \verb|#| within
\meta{definitions}):
\begin{verbatim}
\newacronymstyle{long-sc-short}%
{% use the same display as "long-short"
  \GlsUseAcrEntryDispStyle{long-short}%
}%
{% use the same definitions as "long-short"
  \GlsUseAcrStyleDefs{long-short}%
  % Minor modifications:
  \renewcommand{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
}
\end{verbatim}
(\DescribeMacro{\glstextup}\cs{glstextup} is used to cancel the effect 
of \ics{textsc}. This defaults to \ics{textulc}, if defined,
otherwise \ics{textup}. For example, the plural of \textsc{svm}
should be rendered as \textsc{svm}s rather than \textsc{svms}.)

\begin{example}{Defining a Custom Acronym Style}{ex:customacrstyle}
Suppose I want my acronym on \firstuse\ to have the
short form in the text and the long form with the description in a
footnote. Suppose also that I want the short form to be put in small
caps in the main body of the document, but I want it in normal
capitals in the list of acronyms. In my list of acronyms, I want the
long form as the name with the short form in brackets followed by
the description. That is, in the text I want \ics{gls} on \gls{firstuse}
to display:
\begin{display}
\ics{textsc}\marg{abbrv}\cs{footnote}"{"\meta{long}: \meta{description}"}"
\end{display}
on subsequent use:
\begin{display}
\ics{textsc}\marg{abbrv}
\end{display}
and in the list of acronyms, each entry will be displayed in the
form:
\begin{display}
\meta{long} (\meta{short}) \meta{description}
\end{display}

Let's suppose it's possible that I may have a mixed glossary. I can
check this in the second argument of \ics{newacronymstyle} using:
\begin{verbatim}
\ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
\end{verbatim}
This will use \ics{glsgenentryfmt} if the entry isn't an acronym,
otherwise it will use \ics{glsgenacfmt}. The third argument
(\meta{definitions}) of
\ics{newacronymstyle} needs to redefine \ics{genacrfullformat} etc 
so that the \firstuse\ displays the short form in the text with the 
long form in a footnote followed by the description. This is done as
follows (remember to use \verb|##| instead of \verb|#|):
\begin{verbatim}
 % No case change, singular first use:
  \renewcommand*{\genacrfullformat}[2]{%
   \firstacronymfont{\glsentryshort{##1}}##2%
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
 % First letter upper case, singular first use: 
  \renewcommand*{\Genacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshort{##1}}##2%
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
 % No case change, plural first use:
  \renewcommand*{\genplacrfullformat}[2]{%
   \firstacronymfont{\glsentryshortpl{##1}}##2%
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
 % First letter upper case, plural first use:
  \renewcommand*{\Genplacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshortpl{##1}}##2%
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
\end{verbatim}
If you think it inappropriate for the short form to be capitalised
at the start of a sentence you can change the above to:
\begin{verbatim}
 % No case change, singular first use:
  \renewcommand*{\genacrfullformat}[2]{%
   \firstacronymfont{\glsentryshort{##1}}##2%
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
 % No case change, plural first use:
  \renewcommand*{\genplacrfullformat}[2]{%
   \firstacronymfont{\glsentryshortpl{##1}}##2%
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
 \let\Genacrfullformat\genacrfullformat
 \let\Genplacrfullformat\genplacrfullformat
\end{verbatim}
Another variation is to use \ics{Glsentrylong} and
\ics{Glsentrylongpl} in the footnote instead of \ics{glsentrylong} and
\ics{glsentrylongpl}.

Now let's suppose that commands such as \ics{glsentryfull} and
\ics{acrfull} shouldn't
use a~footnote, but instead use the format: \meta{long}
(\meta{short}).
This means that the style needs to redefine \cs{glsentryfull},
\ics{acrfullfmt} and their plural and upper case variants.

First, the non-linking commands: 
\begin{verbatim}
  \renewcommand*{\glsentryfull}[1]{%
    \glsentrylong{##1}\space
      (\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Glsentryfull}[1]{%
    \Glsentrylong{##1}\space
      (\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\glsentryfullpl}[1]{%
    \glsentrylongpl{##1}\space
      (\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Glsentryfullpl}[1]{%
    \Glsentrylongpl{##1}\space
      (\acronymfont{\glsentryshortpl{##1}})%
  }%
\end{verbatim}
Now for the linking commands:
\begin{verbatim}
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})%
    }%
  }%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \Glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})%
    }%
  }%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \MakeTextUppercase{%
       \glsentrylong{##2}##3\space
         (\acronymfont{\glsentryshort{##2}})%
     }%
    }%
  }%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \glsentrylongpl{##2}##3\space
       (\acronymfont{\glsentryshortpl{##2}})%
    }%
  }%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \Glsentrylongpl{##2}##3\space
       (\acronymfont{\glsentryshortpl{##2}})%
    }%
  }%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \MakeTextUppercase{%
       \glsentrylongpl{##2}##3\space
         (\acronymfont{\glsentryshortpl{##2}})%
     }%
    }%
  }%
\end{verbatim}
(This may cause problems with long hyperlinks, in which case adjust
the definitions so that, for example, only the short form is inside
the argument of \ics{glslink}.)

The style also needs to redefine \ics{acronymsort} so that the
acronyms are sorted according to the long form:
\begin{verbatim}
  \renewcommand*{\acronymsort}[2]{##2}%
\end{verbatim}
If you prefer them to be sorted according to the short form you can
change the above to:
\begin{verbatim}
  \renewcommand*{\acronymsort}[2]{##1}%
\end{verbatim}
The acronym font needs to be set to \ics{textsc} and the plural
suffix adjusted so that the \qt{s} suffix in the plural short form
doesn't get converted to \gls{smallcaps}:
\begin{verbatim}
  \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
\end{verbatim}
There are a number of ways of dealing with the format in the list of
acronyms. The simplest way is to redefine \ics{acronymentry} to the
long form followed by the upper case short form in parentheses:
\begin{verbatim}
 \renewcommand*{\acronymentry}[1]{%
   \Glsentrylong{##1}\space
     (\MakeTextUppercase{\glsentryshort{##1}})}%
\end{verbatim}
(I've used \ics{Glsentrylong} instead of \ics{glsentrylong} to
capitalise the name in the glossary.)

An alternative approach is to set \ics{acronymentry} to just the
long form and redefine \ics{GenericAcronymFields} to set the
\gloskey{symbol} key to the short form and use a glossary style that
displays the symbol in parentheses after the \gloskey{name} (such as
the \glostyle{tree} style) like this:
\begin{verbatim}
 \renewcommand*{\acronymentry}[1]{\Glsentrylong{##1}}%
 \renewcommand*{\GenericAcronymFields}{%
    symbol={\protect\MakeTextUppercase{\the\glsshorttok}}}%
\end{verbatim}
I'm going to use the first approach and set
\ics{GenericAcronymFields} to do nothing:
\begin{verbatim}
 \renewcommand*{\GenericAcronymFields}{}%
\end{verbatim}

Finally, this style needs to switch off hyperlinks on first use to
avoid nested links:
\begin{verbatim}
 \glshyperfirstfalse
\end{verbatim}
Putting this all together:
\begin{verbatim}
\newacronymstyle{custom-fn}% new style name
{%
  \ifglshaslong{\glslabel}{\glsgenacfmt}{\glsgenentryfmt}%
}%
{%
 \renewcommand*{\GenericAcronymFields}{}%
 \glshyperfirstfalse
  \renewcommand*{\genacrfullformat}[2]{%
   \firstacronymfont{\glsentryshort{##1}}##2%
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshort{##1}}##2%
   \footnote{\glsentrylong{##1}: \glsentrydesc{##1}}%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \firstacronymfont{\glsentryshortpl{##1}}##2%
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \firstacronymfont{\Glsentryshortpl{##1}}##2%
   \footnote{\glsentrylongpl{##1}: \glsentrydesc{##1}}%
  }%
  \renewcommand*{\glsentryfull}[1]{%
    \glsentrylong{##1}\space
      (\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\Glsentryfull}[1]{%
    \Glsentrylong{##1}\space
      (\acronymfont{\glsentryshort{##1}})%
  }%
  \renewcommand*{\glsentryfullpl}[1]{%
    \glsentrylongpl{##1}\space
      (\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Glsentryfullpl}[1]{%
    \Glsentrylongpl{##1}\space
      (\acronymfont{\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})%
    }%
  }%
  \renewcommand*{\Acrfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \Glsentrylong{##2}##3\space
      (\acronymfont{\glsentryshort{##2}})%
    }%
  }%
  \renewcommand*{\ACRfullfmt}[3]{%
    \glslink[##1]{##2}{%
     \MakeTextUppercase{%
       \glsentrylong{##2}##3\space
         (\acronymfont{\glsentryshort{##2}})%
     }%
    }%
  }%
  \renewcommand*{\acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \glsentrylongpl{##2}##3\space
       (\acronymfont{\glsentryshortpl{##2}})%
    }%
  }%
  \renewcommand*{\Acrfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \Glsentrylongpl{##2}##3\space
       (\acronymfont{\glsentryshortpl{##2}})%
    }%
  }%
  \renewcommand*{\ACRfullplfmt}[3]{%
    \glslink[##1]{##2}{%
     \MakeTextUppercase{%
       \glsentrylongpl{##2}##3\space
         (\acronymfont{\glsentryshortpl{##2}})%
     }%
    }%
  }%
  \renewcommand*{\acronymfont}[1]{\textsc{##1}}%
  \renewcommand*{\acrpluralsuffix}{\glstextup{\glspluralsuffix}}%
  \renewcommand*{\acronymsort}[2]{##2}%
  \renewcommand*{\acronymentry}[1]{%
   \Glsentrylong{##1}\space
     (\MakeTextUppercase{\glsentryshort{##1}})}%
}
\end{verbatim}

Now I need to specify that I want to use this new style:
\begin{verbatim}
\setacronymstyle{custom-fn}
\end{verbatim}
I also need to use a glossary style that suits this acronym style,
for example \glostyle{altlist}:
\begin{verbatim}
\setglossarystyle{altlist}
\end{verbatim}

Once the acronym style has been set, I can define my acronyms:
\begin{verbatim}
\newacronym[description={set of tags for use in 
developing hypertext documents}]{html}{html}{Hyper 
Text Markup Language}

\newacronym[description={language used to describe the 
layout of a document written in a markup language}]{css}
{css}{Cascading Style Sheet}
\end{verbatim}

The sample file \samplefile{-custom-acronym} illustrates this
example.
\end{example}

\begin{example}{Italic and Upright Abbreviations}{ex:font-abbr}
Suppose I~want to have some abbreviations in italic and some that
just use the surrounding font. Hard-coding this into the
\meta{short} argument of \cs{newacronym} can cause complications.

This example uses \ics{glsaddstoragekey} to add an extra field that
can be used to store the formatting declaration (such as \cs{em}).
\begin{verbatim}
\glsaddstoragekey{font}{}{\entryfont}
\end{verbatim}
This defines a~new field/key called \texttt{font}, which defaults to
nothing if it's not explicitly set. This also defines a command
called \cs{entryfont} that's analogous to \cs{glsentrytext}. A~new
style is then created to format abbreviations that access this field.

There are two ways to do this. The first is to create a style that
doesn't use \ics{glsgenacfmt} but instead provides a~modified
version that doesn't use \cs{acronymfont}\marg{short}
but instead uses
\verb|{|\cs{entryfont}\verb|{\glslabel}|\meta{short}\verb|}|.
The full format given by commands such as \cs{genacrfullformat}
need to be similarly adjusted. For example:
\begin{verbatim}
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\space
   ({\entryfont{##1}\glsentryshort{##1}})%
  }%
\end{verbatim}
This will deal with commands like \ics{gls} but not commands like
\ics{acrshort} which still use \ics{acronymfont}. Another approach
is to redefine \cs{acronymfont} to look up the required font
declaration. Since \cs{acronymfont} doesn't take the entry label as
an argument, the following will only work if \cs{acronymfont} is
used in a~context where the label is provided by \ics{glslabel}.
This is true in \cs{gls}, \cs{acrshort} and \cs{acrfull}. The
redefinition is now:
\begin{verbatim}
\renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}#1}}%
\end{verbatim}
So the new style can be defined as:
\begin{verbatim}
\newacronymstyle{long-font-short}
{%
  \GlsUseAcrEntryDispStyle{long-short}%
}
{%
  \GlsUseAcrStyleDefs{long-short}%
  \renewcommand*{\genacrfullformat}[2]{%
   \glsentrylong{##1}##2\space
   ({\entryfont{##1}\glsentryshort{##1}})%
  }%
  \renewcommand*{\Genacrfullformat}[2]{%
   \Glsentrylong{##1}##2\space
   ({\entryfont{##1}\glsentryshort{##1}})%
  }%
  \renewcommand*{\genplacrfullformat}[2]{%
   \glsentrylongpl{##1}##2\space
   ({\entryfont{##1}\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\Genplacrfullformat}[2]{%
   \Glsentrylongpl{##1}##2\space
   ({\entryfont{##1}\glsentryshortpl{##1}})%
  }%
  \renewcommand*{\acronymfont}[1]{{\entryfont{\glslabel}##1}}%
  \renewcommand*{\acronymentry}[1]{{\entryfont{##1}\glsentryshort{##1}}}%
}
\end{verbatim}
Remember the style needs to be set before defining the entries:
\begin{verbatim}
\setacronymstyle{long-font-short}
\end{verbatim}

The complete document is contained in the sample file
\samplefile{-font-abbr}.
\end{example}

Some writers and publishing houses have started to drop full stops
(periods) from upper case initials but may still retain them for
lower case abbreviations, while others may still use them for both
upper and lower case. This can cause complications. Chapter~12 of
\emph{The \TeX{}book} discusses the spacing between words but,
briefly, the default behaviour of \TeX\ is to assume that an upper
case character followed by a~full stop and space is an abbreviation,
so the space is the default inter-word space whereas a~lower case
character followed by a~full stop and space is a word occurring at
the end of a~sentence. In the event that this isn't true, you need
to make a~manual adjustment using \verb*| | (back slash space) in
place of just a~space character for an inter-word mid-sentence space
and use \verb|\@| before the full stop to indicate the end of the
sentence.

For example:
\begin{verbatim}
I was awarded a B.Sc. and a Ph.D. (From the same place.)
\end{verbatim}
is typeset as
\begin{display}
I was awarded a B.Sc. and a Ph.D. (From the same place.)
\end{display}
The spacing is more noticeable with the typewriter font:
\begin{verbatim}
\ttfamily
I was awarded a B.Sc. and a Ph.D. (From the same place.)
\end{verbatim}
is typeset as
\begin{display}\ttfamily
I was awarded a B.Sc. and a Ph.D. (From the same place.)
\end{display}
The lower case letter at the end of ``B.Sc.''\ is confusing \TeX\
into thinking that the full stop after it marks the end of the
sentence. Whereas the upper case letter at the end of ``Ph.D.'' has
confused \TeX\ into thinking that the following full stop is just
part of the abbreviation. These can be corrected:
\begin{verbatim}
I was awarded a B.Sc.\ and a Ph.D\@. (From the same place.)
\end{verbatim}

This situation is a bit problematic for \styfmt{glossaries}. The
full stops can form part of the \meta{short} argument of
\cs{newacronym} and the \verb*|B.Sc.\ | part can be dealt with by
remembering to add \verb*|\ | (for example, \verb*|\gls{bsc}\ |)
but the end of sentence case is more troublesome as you need to omit
the sentence terminating full stop (to avoid two dots) which can
make the source code look a little strange but you also need to
adjust the space factor, which is usually done by inserting \cs{@}
before the full stop.

The next example shows one way of achieving this.
(Note that the supplemental \gls{glossaries-extra} package provides a much
simpler way of doing this, which you may prefer to use. See the
\gallery{sample-initialisms.shtml}{initialisms example}.)

\begin{example}{Abbreviations with Full Stops (Periods)}{ex:dotabbr}
As from version 4.16, there's now a hook (\ics{glspostlinkhook})
that's called at the very end of the \glslike\ and \glstextlike\
commands. This can be redefined to check if the following character
is a full stop. The \sty{amsgen} package (which is automatically
loaded by \styfmt{glossaries}) provides an internal command
called \cs{new@ifnextchar} that can be used to determine if the
given character appears next. (For more information see the
\sty{amsgen} documentation.)

It's possible that I~may also want acronyms or contractions in my
document, so I~need some way to differentiate between them.
Here I'm going to use the same method as in
example~\ref{ex:addstoragekey} where a~new field is defined
to indicate the type of abbreviation:
\begin{verbatim}
\glsaddstoragekey{abbrtype}{word}{\abbrtype}

\newcommand*{\newabbr}[1][]{\newacronym[abbrtype=initials,#1]}
\end{verbatim}
Now I just use \ics{newacronym} for the acronyms, for example,
\begin{verbatim}
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\end{verbatim}
and my new command \cs{newabbr} for initials, for example,
\begin{verbatim}
\newabbr{eg}{e.g.}{exempli gratia}
\newabbr{ie}{i.e.}{id est}
\newabbr{bsc}{B.Sc.}{Bachelor of Science}
\newabbr{ba}{B.A.}{Bachelor of Arts}
\newabbr{agm}{A.G.M.}{annual general meeting}
\end{verbatim}
Within \cs{glspostlinkhook} the entry's label can be accessed using
\ics{glslabel} and \ics{ifglsfieldeq} can be used to determine if
the current entry has the new \texttt{abbrtype} field set to
\qt{initials}. If it doesn't, then nothing needs to happen, but if
it does, a~check is performed to see if the next character is a~full
stop. If it is, this signals the end of a~sentence otherwise it's
mid-sentence.

Remember that internal commands within the document file (rather
than in a~class or package) need to be placed between
\ics{makeatletter} and \ics{makeatother}:
\begin{verbatim}
\makeatletter
\renewcommand{\glspostlinkhook}{%
 \ifglsfieldeq{\glslabel}{abbrtype}{initials}%
 {\new@ifnextchar.\doendsentence\doendword}
 {}%
}
\makeatother
\end{verbatim}
In the event that a full stop is found \cs{doendsentence} is
performed but it will be followed by the full stop, which needs to
be discarded. Otherwise \cs{doendword} will be done but it won't be
followed by a full stop so there's nothing to discard. The
definitions for these commands are:
\begin{verbatim}
\newcommand{\doendsentence}[1]{\spacefactor=10000{}}
\newcommand{\doendword}{\spacefactor=1000{}}
\end{verbatim}
Now, I can just do \verb|\gls{bsc}| mid-sentence and
\verb|\gls{phd}.| at the end of the sentence. The terminating full
stop will be discarded in the latter case, but it won't be discarded
in, say, \verb|\gls{laser}.| as that doesn't have the
\texttt{abbrtype} field set to \qt{initials}.

This also works on first use when the style is set to one of the
\meta{long} (\meta{short}) styles but it will fail with the
\meta{short} (\meta{long}) styles as in this case the terminating
full stop shouldn't be discarded. Since \ics{glspostlinkhook} is
used after the \firstuseflag\ has been unset for the entry, this
can't be fixed by simply checking with \ics{ifglsused}. One possible
solution to this is to redefine \ics{glslinkpostsetkeys} to check
for the \firstuseflag\ and define a macro that can then be used in
\ics{glspostlinkhook}.

The other thing to consider is what to do with plurals. One
possibility is to check for plural use within \cs{doendsentence}
(using \ics{glsifplural}) and put the full stop back if the plural
has been used.

The complete document is contained in the sample file
\samplefile{-dot-abbr}.
\end{example}

\section{Displaying the List of Acronyms}
\label{sec:disploa}

The list of acronyms is just like any other type of glossary and can
be displayed on its own using:
\begin{description}
\itempar{\opt1:}
\begin{alltt}
\ics{printnoidxglossary}[type=\ics{acronymtype}]
\end{alltt}

\itempar{\optsand23:}
\begin{alltt}
\ics{printglossary}[type=\ics{acronymtype}]
\end{alltt}

(If you use the
\pkgopt{acronym} package option you can also use 
\begin{alltt}
\ics{printacronyms}\oarg{options}
\end{alltt}
as a synonym for
\begin{alltt}
\ics{printglossary}[type=\ics{acronymtype},\meta{options}]
\end{alltt}
See \sectionref{sec:pkgopts-acronym}.)

\end{description}
Alternatively the list of acronyms can be displayed with all the other 
glossaries using:
\begin{description}
\item[\opt1:] \ics{printnoidxglossaries}

\item[\optsand23:] \ics{printglossaries}
\end{description}

However, care must be taken to choose a glossary style that's
appropriate to your acronym style.
Alternatively, you can define your own custom style (see 
\sectionref{sec:newglossarystyle} for further details).

\section{Upgrading From the glossary Package}
\label{sec:oldacronym}

Users of the obsolete \sty{glossary} package may recall that
the syntax used to define new acronyms has changed with the
replacement \styfmt{glossaries} package. In addition, the old
\sty{glossary} package created the command 
\cs{}\meta{acr-name} when defining the acronym \meta{acr-name}.

In order to facilitate migrating from the old package to the new
one, the \styfmt{glossaries} package\footnote{as from version 1.18} 
provides the command:
\begin{definition}[\DescribeMacro{\oldacronym}]
\cs{oldacronym}\oarg{label}\marg{abbrv}\marg{long}\marg{key-val list}
\end{definition}
This uses the same syntax as the \sty{glossary} package's
method of defining acronyms. It is equivalent to:
\begin{display}
\ics{newacronym}\oarg{key-val list}\marg{label}\marg{abbrv}\marg{long}
\end{display}
In addition, \ics{oldacronym} also defines the commands
\cs{}\meta{label}, which is equivalent to \ics{gls}\marg{label},
and \cs{}\meta{label}\texttt{*}, which is equivalent to
\ics{Gls}\marg{label}. If \meta{label} is omitted, \meta{abbrv}
is used. Since commands names must consist only of alphabetical
characters, \meta{label} must also only consist of alphabetical
characters. Note that \cs{}\meta{label} doesn't allow you to use
the first optional argument of \ics{gls} or \ics{Gls} --- you will
need to explicitly use \ics{gls} or \ics{Gls} to change the
settings.

\begin{important}
Recall that, in general, \LaTeX\ ignores spaces following command 
names consisting of alphabetical characters. This is also true for 
\cs{}\meta{label} unless you additionally load the
\sty{xspace} package, but be aware that there are some issues with
using \sty{xspace}.\footnotemark
\end{important}
\footnotetext{See David Carlisle's explanation in
\href{http://tex.stackexchange.com/questions/86565/drawbacks-of-xspace}{Drawbacks
of xspace}}

The \styfmt{glossaries} package doesn't load the \sty{xspace} package
since there are both advantages and disadvantages to using
\ics{xspace} in \cs{}\meta{label}. If you don't use the 
\sty{xspace} package you need to explicitly force a space using
\verb*|\ | (backslash space) however you can follow \cs{}\meta{label}
with additional text in square brackets (the final optional
argument to \ics{gls}). If you use the \sty{xspace} package
you don't need to escape the spaces but you can't use
the optional argument to insert text (you will have to explicitly
use \ics{gls}).

To illustrate this, suppose I define the acronym \qt{abc} as
follows:
\begin{verbatim}
\oldacronym{abc}{example acronym}{}
\end{verbatim}
This will create the command \cs{abc} and its starred version
\cs{abc*}. \Tableref{tab:xspace} illustrates the effect of
\cs{abc} (on subsequent use) according to whether or not the
\sty{xspace} package has been loaded. As can be seen from the
final row in the table, the \sty{xspace} package prevents the
optional argument from being recognised.

\begin{table}[htbp]
\caption[The effect of using xspace]{The effect of using 
\styfmt{xspace} with \cs{oldacronym}}
\label{tab:xspace}
\vskip\baselineskip
\centering
\begin{tabular}{lll}
\bfseries Code & \bfseries With \styfmt{xspace} &
\bfseries Without \styfmt{xspace}\\
\verb|\abc.| & abc. & abc.\\
\verb|\abc xyz| & abc xyz & abcxyz\\
\verb|\abc\ xyz| & abc xyz & abc xyz\\
\verb|\abc* xyz| & Abc xyz & Abc xyz\\
\verb|\abc['s] xyz| & abc ['s] xyz & abc's xyz
\end{tabular}
\par
\end{table}

\chapter{Unsetting and Resetting Entry Flags}
\label{sec:glsunset}

When using the \glslike\ commands it is
possible that you may want to use the value given by the
\gloskey{first} key, even though you have already \glslink{firstuse}{used} the glossary
entry. Conversely, you may want to use the value given by the
\gloskey{text} key, even though you haven't used the glossary entry.
The former can be achieved by one of the following commands:
\begin{definition}[\DescribeMacro{\glsreset}]
\cs{glsreset}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glslocalreset}]
\cs{glslocalreset}\marg{label}
\end{definition}
while the latter can be achieved by one of the following commands:
\begin{definition}[\DescribeMacro{\glsunset}]
\cs{glsunset}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro{\glslocalunset}]
\cs{glslocalunset}\marg{label}
\end{definition}
You can also reset or unset all entries for a given glossary or list of
glossaries using:
\begin{definition}[\DescribeMacro{\glsresetall}]
\cs{glsresetall}\oarg{glossary list}
\end{definition}
\begin{definition}[\DescribeMacro{\glslocalresetall}]
\cs{glslocalresetall}\oarg{glossary list}
\end{definition}
\begin{definition}[\DescribeMacro{\glsunsetall}]
\cs{glsunsetall}\oarg{glossary list}
\end{definition}
\begin{definition}[\DescribeMacro{\glslocalunsetall}]
\cs{glslocalunsetall}\oarg{glossary list}
\end{definition}
where \meta{glossary list} is a comma-separated list of 
glossary labels. If omitted, all defined glossaries are assumed
(except for the ignored ones).
For example, to reset all entries in the main glossary and the
list of acronyms:
\begin{verbatim}
\glsresetall[main,acronym]
\end{verbatim}

You can determine whether an entry's \gls{firstuseflag} is set using:
\begin{definition}[\DescribeMacro{\ifglsused}]
\cs{ifglsused}\marg{label}\marg{true part}\marg{false part}
\end{definition}
where \meta{label} is the label of the required entry. If the
entry has been used, \meta{true part} will be done, otherwise
\meta{false part} will be done.

\begin{important}
Be careful when using \glslike\ commands within an
environment or command argument that gets processed multiple times
as it can cause unwanted side-effects when the first use displayed
text is different from subsequent use.
\end{important}

For example, the \env{frame} environment in \cls{beamer} processes
its argument for each overlay. This means that the \firstuseflag\
will be unset on the first overlay and subsequent overlays will use
the non-first use form.

Consider the following example:
\begin{verbatim}
\documentclass{beamer}

\usepackage{glossaries}

\newacronym{svm}{SVM}{support vector machine}

\begin{document}

\begin{frame}
 \frametitle{Frame 1}

 \begin{itemize}
  \item<+-> \gls{svm}
  \item<+-> Stuff.
 \end{itemize}
\end{frame}

\end{document}
\end{verbatim}

On the first overlay, \verb|\gls{svm}| produces \qt{support vector
machine (SVM)} and then unsets the \firstuseflag. When the second
overlay is processed, \verb|\gls{svm}| now produces \qt{SVM}, which
is unlikely to be the desired effect. I~don't know anyway around
this and I can only offer two suggestions.

Firstly, unset all acronyms at the start of the document and
explicitly use \ics{acrfull} when you want the full version to be
displayed:
\begin{verbatim}
\documentclass{beamer}

\usepackage{glossaries}

\newacronym{svm}{SVM}{support vector machine}

\glsunsetall

\begin{document}
\begin{frame}
 \frametitle{Frame 1}

 \begin{itemize}
  \item<+-> \acrfull{svm}
  \item<+-> Stuff.
 \end{itemize}
\end{frame}
\end{document}
\end{verbatim}

Secondly, explicitly reset each acronym on first use:
\begin{verbatim}
\begin{frame}
 \frametitle{Frame 1}

 \begin{itemize}
  \item<+-> \glsreset{svm}\gls{svm}
  \item<+-> Stuff.
 \end{itemize}
\end{frame}
\end{verbatim}
These are non-optimal, but the \cls{beamer} class is too complex for
me to provide a programmatic solution. Other potentially problematic
environments are some \env{tabular}-like environments (but not
\env{tabular} itself) that process the contents in order to work out
the column widths and then reprocess the contents to do the actual
typesetting.

The \sty{amsmath} environments, such as \env{align}, also process
their contents multiple times, but the \styfmt{glossaries} package now
checks for this. For \sty{tabularx}, you need to explicitly patch it
by placing \cs{glspatchtabularx} in the preamble (or anywhere
before the problematic use of \envfmt{tabularx}).

\begin{xtr}
If you need to use commands like \cs{gls} in any problematic context
that interferes with the \gls{firstuseflag}, then you can try using
the buffering system provided with \gls{glossaries-extra}. See the
\qt{First Use Flag} section of the \gls{glossaries-extra} manual.
\end{xtr}

\section{Counting the Number of Times an Entry has been Used (First Use
Flag Unset)}
\label{sec:enableentrycount}

As from version 4.14, it's now possible to keep track of how many
times an entry is used. That is, how many times the \firstuseflag\
is unset. Note that the supplemental \gls{glossaries-extra} package improves
this function and also provides per-unit counting, which isn't
available with the \styfmt{glossaries} package.

\begin{important}
This function is disabled by default as it adds extra
overhead to the document build time and also switches
\ics{newglossaryentry} (and therefore \ics{newacronym}) into
a~preamble-only command.
\end{important}

To enable this function, use
\begin{definition}[\DescribeMacro\glsenableentrycount]
\cs{glsenableentrycount}
\end{definition}
before defining your entries. This adds two extra (internal) fields
to entries: \texttt{currcount} and \texttt{prevcount}.

The \texttt{currcount} field keeps track of how many times
\cs{glsunset} is used within the document. A~local unset (using
\cs{glslocalunset}) performs a~local rather than global increment to
\texttt{currcount}. Remember that not all commands use
\cs{glsunset}. Only the \glslike\ commands do this. The reset
commands \cs{glsreset} and \cs{glslocalreset} reset this field back
to zero (where \cs{glslocalreset} performs a~local change).

The \texttt{prevcount} field stores the final value of the
\texttt{currcount} field \emph{from the previous run}. This value is
read from the \filetype{aux} file at the beginning of the
\env{document} environment.

You can access these fields using
\begin{definition}[\DescribeMacro\glsentrycurrcount]
\cs{glsentrycurrcount}\marg{label}
\end{definition}
for the \texttt{currcount} field, and
\begin{definition}[\DescribeMacro\glsentryprevcount]
\cs{glsentryprevcount}\marg{label}
\end{definition}
for the \texttt{prevcount} field. 

\begin{important}
These commands are only defined if you have used \cs{glsenableentrycount}.
\end{important}

For example:
\begin{verbatim}
\documentclass{article}
\usepackage{glossaries}
\makeglossaries

\glsenableentrycount

\newglossaryentry{apple}{name=apple,description={a fruit}}

\begin{document}
Total usage on previous run: \glsentryprevcount{apple}.

\gls{apple}. \gls{apple}. \glsadd{apple}\glsentrytext{apple}.
\glslink{apple}{apple}. \glsdisp{apple}{apple}. \Gls{apple}.

Number of times apple has been used: \glsentrycurrcount{apple}.
\end{document}
\end{verbatim}
On the first \LaTeX\ run, \verb|\glsentryprevcount{apple}|
produces~0. At the end of the document,
\verb|\glsentrycurrcount{apple}| produces~4. This is because
the only commands that have incremented the entry count are those
that use \cs{glsunset}. That is: \cs{gls}, \cs{glsdisp} and
\cs{Gls}. The other commands used in the above example, \cs{glsadd},
\cs{glsentrytext} and \cs{glslink}, don't use \cs{glsunset} so they
don't increment the entry count. On the \emph{next} \LaTeX\ run,
\verb|\glsentryprevcount{apple}| now produces~4 as that was the
value of the \texttt{currcount} field for the \texttt{apple} entry
at the end of the document on the previous run.

When you enable the entry count using \cs{glsenableentrycount}, you
also enable the following commands:
\begin{definition}[\DescribeMacro\cgls]
\cs{cgls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
(no case-change, singular)
\begin{definition}[\DescribeMacro\cglspl]
\cs{cglspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
(no case-change, plural)
\begin{definition}[\DescribeMacro\cGls]
\cs{cGls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
(first letter uppercase, singular), and
\begin{definition}[\DescribeMacro\cGlspl]
\cs{cGlspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
(first letter uppercase, plural).
These all have plus and starred variants like the analogous
\cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl} commands.

If you don't use \cs{glsenableentrycount}, these commands behave
like \cs{gls}, \cs{glspl}, \cs{Gls} and \cs{Glspl},
respectively, only there will be a warning that you haven't enabled
entry counting. If you have enabled entry counting with
\cs{glsenableentrycount} then these commands test if
\cs{glsentryprevcount}\marg{label} equals~1. If it doesn't then the
analogous \cs{gls} etc will be used. If it does, then the first optional
argument will be ignored and 
\begin{alltt}
\meta{cs format}\marg{label}\marg{insert}\cs{glsunset}\marg{label}
\end{alltt}
will be performed, where \meta{cs format} is a command that takes
two arguments. The command used depends whether you have used
\cs{cgls}, \cs{cglspl}, \cs{cGls} or \cs{cGlspl}.

\begin{definition}[\DescribeMacro\cglsformat]
\cs{cglsformat}\marg{label}\marg{insert}
\end{definition}
This command is used by \cs{cgls} and defaults to
\begin{alltt}
\cs{glsentrylong}\marg{label}\meta{insert}
\end{alltt}
if the entry given by
\meta{label} has a~long form or
\begin{alltt}
\cs{glsentryfirst}\marg{label}\meta{insert}
\end{alltt}
otherwise.

\begin{definition}[\DescribeMacro\cglsplformat]
\cs{cglsplformat}\marg{label}\marg{insert}
\end{definition}
This command is used by \cs{cglspl} and defaults to
\begin{alltt}
\cs{glsentrylongpl}\marg{label}\meta{insert} 
\end{alltt}
if the entry given by
\meta{label} has a~long form or
\begin{alltt}
\cs{glsentryfirstplural}\marg{label}\meta{insert}
\end{alltt}
otherwise.

\begin{definition}[\DescribeMacro\cGlsformat]
\cs{cGlsformat}\marg{label}\marg{insert}
\end{definition}
This command is used by \cs{cGls} and defaults to
\begin{alltt}
\cs{Glsentrylong}\marg{label}\meta{insert}
\end{alltt}
if the entry given by \meta{label} has a~long form or
\begin{alltt}
\cs{Glsentryfirst}\marg{label}\meta{insert}
\end{alltt}
otherwise.

\begin{definition}[\DescribeMacro\cGlsplformat]
\cs{cGlsplformat}\marg{label}\marg{insert}
\end{definition}
This command is used by \cs{cGlspl} and defaults to
\begin{alltt}
\cs{Glsentrylongpl}\marg{label}\meta{insert}
\end{alltt}
if the entry given by \meta{label} has a~long form or
\begin{alltt}
\cs{Glsentryfirstplural}\marg{label}\meta{insert}
\end{alltt}
otherwise.

This means that if the previous count for the given entry was~1, the
entry won't be hyperlinked with the \cs{cgls}-like commands and they
won't add a~line to the external glossary file. If you haven't used
any of the other commands that add information to glossary file
(such as \cs{glsadd} or the \glstextlike\ commands) then the entry
won't appear in the glossary.

Remember that since these commands use \cs{glsentryprevcount} you
need to run \LaTeX\ twice to ensure they work correctly.  The
document build order is now (at least): \texttt{(pdf)latex},
\texttt{(pdf)latex}, \texttt{makeglossaries}, \texttt{(pdf)latex}.

\begin{example}{Don't index entries that are only used once}{sec:entrycount}
In this example, the abbreviations that have only been used once (on the previous run)
only have their long form shown with \cs{cgls}.
\begin{verbatim}
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[acronym]{glossaries}
\makeglossaries

\glsenableentrycount

\setacronymstyle{long-short}

\newacronym{html}{HTML}{hypertext markup language}
\newacronym{css}{CSS}{cascading style sheets}
\newacronym{xml}{XML}{extensible markup language}
\newacronym{sql}{SQL}{structured query language}
\newacronym{rdbms}{RDBMS}{relational database management system}
\newacronym{rdsms}{RDSMS}{relational data stream management system}

\begin{document}
These entries are only used once: \cgls{sql}, \cgls{rdbms},
\cgls{xml}. These entries are used multiple times:
\cgls{html}, \cgls{html}, \cgls{css}, \cgls{css}, \cgls{css},
\cgls{rdsms}, \cgls{rdsms}.

\printglossaries
\end{document}
\end{verbatim}
After a complete document build (\texttt{latex}, \texttt{latex},
\texttt{makeglossaries}, \texttt{latex}) the list of abbrevaitions only
includes the entries HTML, CSS and RDSMS. The entries SQL, RDBMS and
XML
only have their long forms displayed and don't have a~hyperlink.
\end{example}

Remember that if you don't like typing \cs{cgls} you can create a
synonym. For example
\begin{verbatim}
\let\ac\cgls
\end{verbatim}

\begin{bib2gls}
With \gls{bib2gls} there's an analogous record counting set of
commands. See \gls{glossaries-extra} and \gls{bib2gls} manuals for further details. 
\end{bib2gls}

\chapter{Glossary Styles}
\label{sec:styles}

Glossaries vary from lists that simply contain a symbol with a terse
description to lists of terms or phrases with lengthy descriptions.
Some glossaries may have terms with associated symbols. Some may
have hierarchical entries.  There is therefore no single style that
fits every type of glossary. The \styfmt{glossaries} package comes
with a number of pre-defined glossary styles, described in
\sectionref{sec:predefinedstyles}. You can choose one of these that
best suits your type of glossary or, if none of them suit your
document, you can defined your own style (see
\sectionref{sec:newglossarystyle}). There are some examples
of glossary styles available at \gallerytopic{glossaries}.

The glossary style can be set using the \gloskey[printglossary]{style} key in the optional
argument to \ics{printnoidxglossary} (\opt1) or \ics{printglossary}
(\optsand23) or using the command:
\begin{definition}[\DescribeMacro{\setglossarystyle}]
\cs{setglossarystyle}\marg{style-name}
\end{definition}
(before the glossary is displayed).

Some of the predefined glossary styles may also be set using the \pkgopt{style} 
package option, it depends if the package in which they are defined
is automatically loaded by the \styfmt{glossaries} package.

You can use the lorum ipsum dummy entries provided in the
accompanying
\texttt{example\dhyphen glossaries\dhyphen *.tex} files (described in
\sectionref{sec:lipsum}) to test the different styles.

\begin{xtr}
The \sty{glossaries-extra-stylemods} package provided with
\gls{glossaries-extra} patches the predefined styles. There also
more styles available with \gls{glossaries-extra}.
\end{xtr}

\section{Predefined Styles}
\label{sec:predefinedstyles}

The predefined styles can
accommodate numbered level~0 (main) and level~1 entries. See the
package options \pkgopt{entrycounter}, \pkgopt{counterwithin} and
\pkgopt{subentrycounter} described in
\sectionref{sec:pkgopts-printglos}. There is a summary
of available styles in \tableref{tab:styles}. 
You can view samples of all the predefined styles at
\galleryurl{glossaries-styles/}.
Note that \gls{glossaries-extra} provides additional styles
in the supplementary packages \sty{glossary-bookindex} and
\sty{glossary-longnoloc}. See the \gls{glossaries-extra} manual for
further details.

\begin{important}
Note that the group styles (such as \glostyle{listgroup}) will
have unexpected results if used with the \pkgopt[def]{sort}
or \pkgopt[use]{sort} options. If you don't sort your entries
alphabetically, it's best to set the \pkgopt{nogroupskip}
package option to prevent odd vertical gaps appearing.
\end{important}

The group title is obtained using \cs{glsgetgrouptitle}\marg{label},
which is described in \sectionref{sec:newglossarystyle}.

\begin{table}[htbp]
\caption[Glossary Styles]{Glossary Styles. An asterisk in the style 
name indicates anything that matches that doesn't match any
previously listed style (e.g.\ \texttt{long3col*}
matches \glostyle{long3col}, \glostyle{long3colheader}, 
\glostyle{long3colborder} and \glostyle{long3colheaderborder}).
A maximum level of 0 indicates a flat glossary (sub-entries
are displayed in the same way as main entries). Where the maximum
level is given as --- there is no limit, but note that 
\gls{makeindex} (\opt2) imposes a limit of 2 sub-levels. If the
homograph column is checked, then the name is not displayed for
sub-entries. If the symbol column is checked, then the symbol will
be displayed.}
\label{tab:styles}
\vskip\baselineskip
\centering
\begin{tabular}{lccc}
\bfseries Style & \bfseries Maximum Level &
\bfseries Homograph & \bfseries Symbol\\
\ttfamily listdotted & 0 & & \\
\ttfamily sublistdotted & 1 & & \\
\ttfamily list* & 1 & \tick & \\
\ttfamily altlist* & 1 & \tick & \\
\ttfamily long*3col* & 1 & \tick & \\
\ttfamily long4col* & 1 & \tick & \tick \\
\ttfamily altlong*4col* & 1 & \tick & \tick \\
\ttfamily long* & 1 & \tick & \\
\ttfamily super*3col* & 1 & \tick & \\
\ttfamily super4col* & 1 & \tick & \tick \\
\ttfamily altsuper*4col* & 1 & \tick & \tick \\
\ttfamily super* & 1 & \tick & \\
\ttfamily *index* & 2 & & \tick\\
\ttfamily treenoname* & --- & \tick & \tick\\
\ttfamily *alttree* & --- & & \tick\\
\ttfamily *tree* & --- & & \tick\\
\ttfamily inline & 1 & \tick &  
\end{tabular}
\par
\end{table}

The tabular-like styles that allow multi-line descriptions and page
lists use the length 
\begin{definition}[\DescribeMacro{\glsdescwidth}]
\cs{glsdescwidth}
\end{definition}
to set the width of the description column and the length
\begin{definition}[\DescribeMacro{\glspagelistwidth}]
\cs{glspagelistwidth} 
\end{definition}
to set the width of the page list column.\footnote{These lengths will not be
available if you use both the \pkgopt{nolong} and \pkgopt{nosuper}
package options or if you use the \pkgopt{nostyles} package option
unless you explicitly load the relevant package.}
These will need to be changed using \cs{setlength} if the glossary
is too wide. Note that the \glostyle{long4col} and
\glostyle{super4col} styles (and their header and border variations)
don't use these lengths as they are designed for single line
entries. Instead you should use the analogous \glostyle{altlong4col}
and \glostyle{altsuper4col} styles.  If you want to
explicitly create a line-break within a multi-line description in
a tabular-like style it's better to use \ics{newline} instead of
\verb|\\|.

\begin{important}
Remember that a cell within a tabular-like environment can't
be broken across a page, so even if a tabular-like style, such as
\glostyle{long}, allows multilined descriptions, you'll probably encounter
page-breaking problems if you have entries with long descriptions.
You may want to consider using the \glostyle{alttree} style instead.
\end{important}

Note that if you use the \gloskey[printglossary]{style} key in the
optional argument to \ics{printnoidxglossary} (\opt1) or
\ics{printglossary} (\optsand23), it will override any 
previous style settings for the given glossary, so if, for example,
you do
\begin{verbatim}
\renewcommand*{\glsgroupskip}{}
\printglossary[style=long]
\end{verbatim}
then the new definition of \ics{glsgroupskip} will not have an affect
for this glossary, as \cs{glsgroupskip} is redefined by 
\verb|style=long|. Likewise, \ics{setglossarystyle} will also
override any previous style definitions, so, again
\begin{verbatim}
\renewcommand*{\glsgroupskip}{}
\setglossarystyle{long}
\end{verbatim}
will reset \cs{glsgroupskip} back to its default definition for the
named glossary style (\glostyle{long} in this case). If you want to 
modify the styles, either use \ics{newglossarystyle} (described
in the next section) or make the modifications after 
\ics{setglossarystyle}, e.g.:
\begin{verbatim}
\setglossarystyle{long}
\renewcommand*{\glsgroupskip}{}
\end{verbatim}
As from version 3.03, you can now use the package option
\pkgopt{nogroupskip} to suppress the gap between groups for the
default styles instead of redefining \cs{glsgroupskip}.

All the styles except for the three- and four-column styles and the
\glostyle{listdotted} style use the command
\begin{definition}[\DescribeMacro{\glspostdescription}]
\cs{glspostdescription}
\end{definition}
after the description. This simply displays a full stop by default.
To eliminate this full stop (or replace it with something else, say,
a comma) you will need to redefine \cs{glspostdescription} before
the glossary is displayed. Alternatively, you can suppress it for a
given entry by placing \ics{nopostdesc} in the entry's description.
Note that \ics{longnewglossaryentry} puts \cs{nopostdesc} at the end
of the description. The \gls{glossaries-extra} package provides a
starred version that doesn't.

As from version 3.03 you can now use the package option
\pkgopt{nopostdot} to suppress this full stop. This is the better
option if you want to use the \gls{glossaries-extra} package.
The \sty{glossaries-extra-stylemods} package provides some
adjustments some of to the predefined styles listed here, allowing
for greater flexibility. See the \gls{glossaries-extra}
documentation for further details.

\subsection{List Styles}
\label{sec:liststyles}

The styles described in this section are all defined in the package
\sty{glossary-list}. Since they all use the \env{description}
environment, they are governed by the same parameters as that
environment. These styles all ignore the entry's symbol.  Note that
these styles will automatically be available unless you use the
\pkgopt{nolist} or \pkgopt{nostyles} package options.

\begin{important}
Note that, except for the \glostyle{listdotted} style, these 
list styles are incompatible with \sty{classicthesis}. They
may also be incompatible with other classes or packages that
modify the \env{description} environment.
\end{important}

\begin{description}
\item[list] The \glostyle{list} style uses the \env{description}
environment. The entry name is placed in the optional argument of
the \ics{item} command (so it will usually appear in bold by default). The
description follows, and then the associated \gls{numberlist} for 
that entry. The symbol is ignored.  If the entry has child entries,
the description and number list follows (but not the name) for each
child entry.  Groups are separated using \ics{indexspace}.

The closest matching non-list style is the \glostyle{index} style.

\item[listgroup] The \glostyle{listgroup} style is like 
\glostyle{list} but the glossary groups have headings
obtained using \cs{glsgetgrouptitle}\marg{label},
which is described in \sectionref{sec:newglossarystyle}.

\item[listhypergroup] The \glostyle{listhypergroup} style is like
\glostyle{listgroup} but has a navigation line at the start of the
glossary with links to each group that is present in the glossary.
This requires an additional run through \LaTeX\ to ensure the group
information is up to date. In the navigation line, each group is
separated by
\begin{definition}[\DescribeMacro{\glshypernavsep}]
\cs{glshypernavsep}
\end{definition}
which defaults to a vertical bar with a space on either side. For
example, to simply have a space separating each group, do:
\begin{verbatim}
\renewcommand*{\glshypernavsep}{\space}
\end{verbatim}

Note that the hyper-navigation line is now (as from version 1.14) 
set inside the optional argument to \ics{item} instead of after it
to prevent a spurious space at the start. This can cause a problem
if the navigation line is too long.
As from v4.22, if you need to adjust this, you can redefine
\begin{definition}[\DescribeMacro\glslistnavigationitem]
\cs{glslistnavigationitem}\marg{navigation line}
\end{definition}
The default definition is \cs{item}\oarg{navigation line} but may
be redefined independently of setting the style. For example:
\begin{verbatim}
\renewcommand*{\glslistnavigationitem}[1]{\item \textbf{#1}}
\end{verbatim}

You may prefer to use the tree-like styles, such as
\glostyle{treehypergroup} instead.

\item[altlist] The \glostyle{altlist} style is like \glostyle{list}
but the description starts on the line following the name. (As
with the \glostyle{list} style, the symbol is ignored.) Each child
entry starts a new line, but as with the \glostyle{list} style,
the name associated with each child entry is ignored.

The closest matching non-list style is the \glostyle{index}
style with the following adjustment:
\begin{verbatim}
\renewcommand{\glstreepredesc}{%
 \glstreeitem\parindent\hangindent}
\end{verbatim}


\item[altlistgroup] The \glostyle{altlistgroup} style is like 
\glostyle{altlist} but the glossary groups have headings.

\item[altlisthypergroup] The \glostyle{altlisthypergroup} style is like 
\glostyle{altlistgroup} but has a set of links to the glossary 
groups. The navigation line is the same as that for 
\glostyle{listhypergroup}, described above.

\item[listdotted] This style uses the \env{description}
environment.\footnote{This style was supplied by Axel~Menzel.} Each
entry starts with \verb|\item[]|, followed by the name followed by a
dotted line, followed by the description. Note that this style
ignores both the \gls{numberlist} and the symbol. The length
\begin{definition}[\DescribeMacro{\glslistdottedwidth}]
\cs{glslistdottedwidth}
\end{definition}
governs where the description should start. This is a flat style, so
child entries are formatted in the same way as the parent entries.

A non-list alternative is to use the \glostyle{index} style
with
\begin{verbatim}
\renewcommand{\glstreepredesc}{\dotfill}
\renewcommand{\glstreechildpredesc}{\dotfill}
\end{verbatim}
Note that this doesn't use \cs{glslistdottedwidth} and causes
the description to be flush-right and will display the
symbol, if provided. (It also doesn't suppress
the \gls*{numberlist}, but that can be achieved with the
\pkgopt{nonumberlist} option.)

\item[sublistdotted] This is a variation on the \glostyle{listdotted}
style designed for hierarchical glossaries. The main entries
have just the name displayed. The sub entries are displayed in
the same manner as \glostyle{listdotted}. Unlike the
\glostyle{listdotted} style, this style is incompatible with
\sty{classicthesis}.
\end{description}


\subsection{Longtable Styles}
\label{sec:longstyles}

The styles described in this section are all defined in the package
\sty{glossary-long}. Since they all use the \env{longtable}
environment, they are governed by the same parameters as that
environment.  Note that these styles will automatically be available
unless you use the \pkgopt{nolong} or \pkgopt{nostyles} package
options.  These styles fully justify the description and page list
columns.  If you want ragged right formatting instead, use the
analogous styles described in \sectionref{sec:longraggedstyles}.
If you want to incorporate rules from the \sty{booktabs} package,
try the styles described in \sectionref{sec:longbooktabsstyles}.

\begin{description}
\item[long] The \glostyle{long} style uses the \env{longtable}
environment (defined by the \sty{longtable} package). It has two
columns: the first column contains the entry's name and the second
column contains the description followed by the \gls{numberlist}.
The entry's symbol is ignored.
Sub groups are separated with a blank row. The width of the
first column is governed by the widest entry in that column. The
width of the second column is governed by the length
\ics{glsdescwidth}. Child entries have a similar format to the
parent entries except that their name is suppressed.

\item[longborder] The \glostyle{longborder} style is like
\glostyle{long} but has horizontal and vertical lines around it.

\item[longheader] The \glostyle{longheader} style is like
\glostyle{long} but has a header row.

\item[longheaderborder] The \glostyle{longheaderborder} style is
like \glostyle{longheader} but has horizontal and vertical lines
around it.

\item[long3col] The \glostyle{long3col} style is like
\glostyle{long} but has three columns. The first column contains
the entry's name, the second column contains the description
and the third column contains the \gls{numberlist}.
The entry's symbol is ignored. The width of the
first column is governed by the widest entry in that column, the
width of the second column is governed by the length
\ics{glsdescwidth}, and the width of the third column is governed by the
length \ics{glspagelistwidth}.

\item[long3colborder] The \glostyle{long3colborder} style is like
the \glostyle{long3col} style but has horizontal and vertical
lines around it.

\item[long3colheader] The \glostyle{long3colheader} style is like
\glostyle{long3col} but has a header row.

\item[long3colheaderborder] The \glostyle{long3colheaderborder} style is
like \glostyle{long3colheader} but has horizontal and vertical lines
around it.

\item[long4col] The \glostyle{long4col} style is like 
\glostyle{long3col} but has an additional column in which the
entry's associated symbol appears. This style is used for brief
single line descriptions. The column widths are governed by the
widest entry in the given column. Use \glostyle{altlong4col} for 
multi-line descriptions.

\item[long4colborder] The \glostyle{long4colborder} style is like
the \glostyle{long4col} style but has horizontal and vertical
lines around it.

\item[long4colheader] The \glostyle{long4colheader} style is like
\glostyle{long4col} but has a header row.

\item[long4colheaderborder] The \glostyle{long4colheaderborder} style is
like \glostyle{long4colheader} but has horizontal and vertical lines
around it.

\item[altlong4col] The \glostyle{altlong4col} style is like
\glostyle{long4col} but allows multi-line descriptions and page
lists.  The width of the description column is governed by the
length \ics{glsdescwidth} and the width of the page list column is
governed by the length \ics{glspagelistwidth}. The widths of the
name and symbol columns are governed by the widest entry in the
given column.

\item[altlong4colborder] The \glostyle{altlong4colborder} style is like
the \glostyle{long4colborder} but allows multi-line descriptions and
page lists.

\item[altlong4colheader] The \glostyle{altlong4colheader} style is like
\glostyle{long4colheader} but allows multi-line descriptions and
page lists.

\item[altlong4colheaderborder] The \glostyle{altlong4colheaderborder} 
style is like \glostyle{long4colheaderborder} but allows multi-line
descriptions and page lists.
\end{description}


\subsection{Longtable Styles (Ragged Right)}
\label{sec:longraggedstyles}

The styles described in this section are all defined in the package
\sty{glossary-longragged}. These styles are analogous to those
defined in \sty{glossary-long} but the multiline columns are left
justified instead of fully justified. Since these styles all use the
\env{longtable} environment, they are governed by the same
parameters as that environment. The \sty{glossary-longragged}
package additionally requires the \sty{array} package.  Note that
these styles will only be available if you explicitly load
\sty{glossary-longragged}:
\begin{verbatim}
\usepackage{glossaries}
\usepackage{glossary-longragged}
\end{verbatim}
Note that you can't set these styles using the \pkgopt{style}
package option since the styles aren't defined until after
the \styfmt{glossaries} package has been loaded.
If you want to incorporate rules from the \sty{booktabs} package,
try the styles described in \sectionref{sec:longbooktabsstyles}.

\begin{description}
\item[longragged] The \glostyle{longragged} style has two
columns: the first column contains the entry's name and the second
column contains the (left-justified) description followed by the 
\gls{numberlist}.  The entry's symbol is ignored.
Sub groups are separated with a blank row. The width of the
first column is governed by the widest entry in that column. The
width of the second column is governed by the length
\ics{glsdescwidth}. Child entries have a similar format to the
parent entries except that their name is suppressed.

\item[longraggedborder] The \glostyle{longraggedborder} style is like
\glostyle{longragged} but has horizontal and vertical lines around it.

\item[longraggedheader] The \glostyle{longraggedheader} style is like
\glostyle{longragged} but has a header row.

\item[longraggedheaderborder] The \glostyle{longraggedheaderborder} 
style is like \glostyle{longraggedheader} but has horizontal and 
vertical lines around it.

\item[longragged3col] The \glostyle{longragged3col} style is like
\glostyle{longragged} but has three columns. The first column
contains the entry's name, the second column contains the (left
justified) description and the third column contains the (left
justified) \gls{numberlist}.  The entry's symbol is ignored. The
width of the first column is governed by the widest entry in that
column, the width of the second column is governed by the length
\ics{glsdescwidth}, and the width of the third column is governed by
the length \ics{glspagelistwidth}.

\item[longragged3colborder] The \glostyle{longragged3colborder}
style is like the \glostyle{longragged3col} style but has horizontal
and vertical lines around it.

\item[longragged3colheader] The \glostyle{longragged3colheader} style is like
\glostyle{longragged3col} but has a header row.

\item[longragged3colheaderborder] The \glostyle{longragged3colheaderborder} style is
like \glostyle{longragged3colheader} but has horizontal and vertical lines
around it.

\item[altlongragged4col] The \glostyle{altlongragged4col} style is
like \glostyle{longragged3col} but has an additional column in which
the entry's associated symbol appears. The width of the description
column is governed by the length \ics{glsdescwidth} and the width of
the page list column is governed by the length
\ics{glspagelistwidth}. The widths of the name and symbol columns
are governed by the widest entry in the given column.

\item[altlongragged4colborder] The
\glostyle{altlongragged4colborder} style is like the
\glostyle{altlongragged4col} but has horizontal and vertical lines
around it.

\item[altlongragged4colheader] The
\glostyle{altlongragged4colheader} style is like
\glostyle{altlongragged4col} but has a header row.

\item[altlongragged4colheaderborder] The
\glostyle{altlongragged4colheaderborder} style is like
\glostyle{altlongragged4colheader} but has horizontal and vertical
lines around it.

\end{description}

\subsection{Longtable Styles (\styfmt{booktabs})}
\label{sec:longbooktabsstyles}

The styles described in this section are all defined in the package
\sty{glossary-longbooktabs}.

Since these styles all use the
\env{longtable} environment, they are governed by the same
parameters as that environment. The \sty{glossary-longbooktabs}
package automatically loads the \sty{glossary-long}
(\sectionref{sec:longstyles})
and \sty{glossary-longragged} (\sectionref{sec:longraggedstyles}) packages.  Note that
these styles will only be available if you explicitly load
\sty{glossary-longbooktabs}:
\begin{verbatim}
\usepackage{glossaries}
\usepackage{glossary-longbooktabs}
\end{verbatim}
Note that you can't set these styles using the \pkgopt{style}
package option since the styles aren't defined until after
the \styfmt{glossaries} package has been loaded.

These styles are similar to the
\qt{header} styles in the \sty{glossary-long} and
\sty{glossary-ragged} packages, but they add the rules
provided by the \sty{booktabs} package, \ics{toprule}, \ics{midrule} and
\ics{bottomrule}. Additionally these styles patch the
\env{longtable} environment to check for instances of the group
skip occurring at a page break. If you don't want this patch to
affect any other use of \env{longtable} in your document, you can
scope the effect by only setting the style through the
\gloskey[printglossary]{style} key in the optional argument of
\cs{printglossary}. (The \pkgopt{nogroupskip} package option 
is checked by these styles.)

Alternatively, you can restore the original \env{longtable}
behaviour with:
\begin{definition}[\DescribeMacro\glsrestoreLToutput]
\cs{glsrestoreLToutput}
\end{definition}
For more information about the patch, see the documented code
(\texttt{glossaries-code.pdf}).

\begin{description}
\item[\glostyle{long-booktabs}] This style is similar to
the \glostyle{longheader} style but adds rules above and below the
header (\cs{toprule} and \cs{midrule}) and inserts a rule at the
bottom of the table (\cs{bottomrule}).

\item[\glostyle{long3col-booktabs}] This style is similar to
the \glostyle{long3colheader} style but adds rules as per
\glostyle{long-booktabs}.

\item[\glostyle{long4col-booktabs}] This style is similar to
the \glostyle{long4colheader} style but adds rules as above.

\item[\glostyle{altlong4col-booktabs}] This style is similar to
the \glostyle{altlong4colheader} style but adds rules as above.

\item[\glostyle{longragged-booktabs}] This style is similar to
the \glostyle{longraggedheader} style but adds rules as above.

\item[\glostyle{longragged3col-booktabs}] This style is similar to
the \glostyle{longragged3colheader} style but adds rules as above.

\item[\glostyle{altlongragged4col-booktabs}] This style is similar to
the \glostyle{altlongragged4colheader} style but adds rules as above.

\end{description}

\subsection{Supertabular Styles}
\label{sec:superstyles}

The styles described in this section are all defined in the package
\sty{glossary-super}. Since they all use the \env{supertabular}
environment, they are governed by the same parameters as that
environment.  Note that these styles will automatically be available
unless you use the \pkgopt{nosuper} or \pkgopt{nostyles} package
options.  In general, the \env{longtable} environment is better,
but there are some circumstances where it is better to use
\env{supertabular}.\footnote{e.g.\ with the \sty{flowfram}
package.} These styles fully justify the description and page list
columns.  If you want ragged right formatting instead, use the
analogous styles described in \sectionref{sec:superraggedstyles}.

\begin{description}
\item[super] The \glostyle{super} style uses the \env{supertabular}
environment (defined by the \sty{supertabular} package). It has two
columns: the first column contains the entry's name and the second
column contains the description followed by the \gls{numberlist}.
The entry's symbol is ignored.
Sub groups are separated with a blank row. The width of the
first column is governed by the widest entry in that column. The
width of the second column is governed by the length
\ics{glsdescwidth}. Child entries have a similar format to the
parent entries except that their name is suppressed.

\item[superborder] The \glostyle{superborder} style is like
\glostyle{super} but has horizontal and vertical lines around it.

\item[superheader] The \glostyle{superheader} style is like
\glostyle{super} but has a header row.

\item[superheaderborder] The \glostyle{superheaderborder} style is
like \glostyle{superheader} but has horizontal and vertical lines
around it.

\item[super3col] The \glostyle{super3col} style is like
\glostyle{super} but has three columns. The first column contains
the entry's name, the second column contains the description
and the third column contains the \gls{numberlist}. The
entry's symbol is ignored. The width of the
first column is governed by the widest entry in that column. The
width of the second column is governed by the length
\ics{glsdescwidth}. The width of the third column is governed by the
length \ics{glspagelistwidth}.

\item[super3colborder] The \glostyle{super3colborder} style is like
the \glostyle{super3col} style but has horizontal and vertical
lines around it.

\item[super3colheader] The \glostyle{super3colheader} style is like
\glostyle{super3col} but has a header row.

\item[super3colheaderborder] The \glostyle{super3colheaderborder} style
is like the \glostyle{super3colheader} style but has horizontal and vertical
lines around it.

\item[super4col] The \glostyle{super4col} style is like 
\glostyle{super3col} but has an additional column in which the
entry's associated symbol appears. This style is designed for
entries with brief single line descriptions. The column widths are governed by the
widest entry in the given column. Use \glostyle{altsuper4col}
for multi-line descriptions.

\item[super4colborder] The \glostyle{super4colborder} style is like
the \glostyle{super4col} style but has horizontal and vertical
lines around it.

\item[super4colheader] The \glostyle{super4colheader} style is like
\glostyle{super4col} but has a header row.

\item[super4colheaderborder] The \glostyle{super4colheaderborder} style
is like the \glostyle{super4colheader} style but has horizontal and vertical
lines around it.

\item[altsuper4col] The \glostyle{altsuper4col} style is like 
\glostyle{super4col} but allows multi-line descriptions and page
lists.
The width of the description column is governed by the length
\ics{glsdescwidth} and the width of the page list column is
governed by the length \ics{glspagelistwidth}. The width of the name 
and symbol columns is governed by the widest entry in the 
given column.

\item[altsuper4colborder] The \glostyle{altsuper4colborder} style is like
the \glostyle{super4colborder} style but allows multi-line descriptions
and page lists.

\item[altsuper4colheader] The \glostyle{altsuper4colheader} style is like
\glostyle{super4colheader} but allows multi-line descriptions and
page lists.

\item[altsuper4colheaderborder] The \glostyle{altsuper4colheaderborder}
style is like \glostyle{super4colheaderborder} but allows multi-line
descriptions and page lists.
\end{description}


\subsection{Supertabular Styles (Ragged Right)}
\label{sec:superraggedstyles}

The styles described in this section are all defined in the package
\sty{glossary-superragged}. These styles are analogous to those
defined in \sty{glossary-super} but the multiline columns are left
justified instead of fully justified. Since these styles all use the
\env{supertabular} environment, they are governed by the same
parameters as that environment. The \sty{glossary-superragged}
package additionally requires the \sty{array} package.  Note that
these styles will only be available if you explicitly load
\sty{glossary-superragged}:
\begin{verbatim}
\usepackage{glossaries}
\usepackage{glossary-superragged}
\end{verbatim}
Note that you can't set these styles using the \pkgopt{style}
package option since the styles aren't defined until after
the \styfmt{glossaries} package has been loaded.

\begin{description}
\item[superragged] The \glostyle{superragged} style uses the
\env{supertabular} environment (defined by the
\sty{supertabular} package). It has two columns: the first column
contains the entry's name and the second column contains the (left
justified) description followed by the \gls{numberlist}.  The
entry's symbol is ignored.  Sub groups are separated with a blank
row. The width of the first column is governed by the widest entry
in that column. The width of the second column is governed by the
length \ics{glsdescwidth}. Child entries have a similar format to
the parent entries except that their name is suppressed.

\item[superraggedborder] The \glostyle{superraggedborder} style is
like \glostyle{superragged} but has horizontal and vertical lines
around it.

\item[superraggedheader] The \glostyle{superraggedheader} style is
like \glostyle{superragged} but has a header row.

\item[superraggedheaderborder] The
\glostyle{superraggedheaderborder} style is like
\glostyle{superraggedheader} but has horizontal and vertical lines
around it.

\item[superragged3col] The \glostyle{superragged3col} style is like
\glostyle{superragged} but has three columns. The first column
contains the entry's name, the second column contains the (left
justified) description and the third column contains the (left
justified) \gls{numberlist}. The entry's symbol is ignored. The
width of the first column is governed by the widest entry in that
column. The width of the second column is governed by the length
\ics{glsdescwidth}. The width of the third column is governed by the
length \ics{glspagelistwidth}.

\item[superragged3colborder] The \glostyle{superragged3colborder}
style is like the \glostyle{superragged3col} style but has
horizontal and vertical lines around it.

\item[superragged3colheader] The \glostyle{superragged3colheader}
style is like \glostyle{superragged3col} but has a header row.

\item[superragged3colheaderborder] The
\glostyle{superragged3colheaderborder} style is like
the above but has horizontal and vertical
lines around it.

\item[altsuperragged4col] The \glostyle{altsuperragged4col} style is
like \glostyle{superragged3col} but has an additional column in
which the entry's associated symbol appears. The column widths for
the name and symbol column are governed by the widest entry in the
given column.

\item[altsuperragged4colborder] The
\glostyle{altsuperragged4colborder} style is like the
\glostyle{altsuperragged4col} style but has horizontal and vertical
lines around it.

\item[altsuperragged4colheader] The
\glostyle{altsuperragged4colheader} style is like
\glostyle{altsuperragged4col} but has a header row.

\item[altsuperragged4colheaderborder] The
\glostyle{altsuperragged4colheaderborder} style is like
the above but has horizontal and vertical
lines around it.

\end{description}

\subsection{Tree-Like Styles}
\label{sec:treestyles}

The styles described in this section are all defined in the package
\sty{glossary-tree}. These styles are designed for hierarchical
glossaries but can also be used with glossaries that don't have
sub-entries. These styles will display the entry's symbol if it
exists. Note that these styles will automatically be available
unless you use the \pkgopt{notree} or \pkgopt{nostyles} package
options. 

These styles all format the entry name using:
\begin{definition}[\DescribeMacro\glstreenamefmt]
\cs{glstreenamefmt}\marg{name}
\end{definition}
This defaults to \cs{textbf}\marg{name}, but note that \meta{name}
includes \ics{glsnamefont} so the bold setting in \cs{glstreenamefont}
may be counteracted by another font change in \cs{glsnamefont} (or
in \cs{acronymfont}). The tree-like styles that also display the
header use
\begin{definition}[\DescribeMacro\glstreegroupheaderfmt]
\cs{glstreegroupheaderfmt}\marg{text}
\end{definition}
to format the heading. This defaults to
\cs{glstreenamefmt}\marg{text}. The tree-like styles that display
navigation links to the groups (such as \glostyle{indexhypergroup}), format
the navigation line using
\begin{definition}[\DescribeMacro\glstreenavigationfmt]
\cs{glstreenavigationfmt}\marg{text}
\end{definition}
which defaults to \cs{glstreenamefmt}\marg{text}. 

Note that this is
different from \cs{glslistnavigationitem}, provided with the styles
such as \glostyle{listhypergroup}, as that also includes \cs{item}.

With the exception of the \glostyle{alttree} style (and those
derived from it), the space before the description for top-level
entries is produced with
\begin{definition}[\DescribeMacro\glstreepredesc]
\cs{glstreepredesc}
\end{definition}
This defaults to \cs{space}.

With the exception of the \glostyle{treenoname} and
\glostyle{alttree} styles (and those derived from them), the 
space before the description for child
entries is produced with
\begin{definition}[\DescribeMacro\glstreechildpredesc]
\cs{glstreechildpredesc}
\end{definition}
This defaults to \cs{space}.

\begin{important}
Most of these styles are not designed for multi-paragraph 
descriptions. (The \glostyle{tree} style isn't too bad for
multi-paragraph top-level entry descriptions, or you can use the
\glostyle{index} style with the adjustment shown below.)
\end{important}

\begin{description}
\item[index] The \glostyle{index} style is similar to the way
indices are usually formatted in that it has a hierarchical
structure up to three levels (the main level plus two sub-levels).
The name is typeset in bold, and if the symbol is present it is set
in parentheses after the name and before the description.
Sub-entries are indented and also include the name, the symbol
in brackets (if present) and the description.  Groups are separated
using \ics{indexspace}.

Each main level item is started with
\begin{definition}[\DescribeMacro\glstreeitem]
\cs{glstreeitem}
\end{definition}
The level~1 entries are started with
\begin{definition}[\DescribeMacro\glstreesubitem]
\cs{glstreesubitem}
\end{definition}

The level~2 entries are started with
\begin{definition}[\DescribeMacro\glstreesubsubitem]
\cs{glstreesubsubitem}
\end{definition}

Note that the \glostyle{index} style automatically sets
\begin{verbatim}
\let\item\glstreeitem
\let\subitem\glstreesubitem
\let\subsubitem\glstreesubsubitem
\end{verbatim}
at the start of the glossary for backward compatibility.

The \glostyle{index} style isn't suitable for multi-paragraph
descriptions, but this limitation can be overcome by redefining
the above commands. For example:
\begin{verbatim}
\renewcommand{\glstreeitem}{%
 \parindent0pt\par\hangindent40pt
 \everypar{\parindent50pt\hangindent40pt}}
\end{verbatim}

\item[indexgroup] The \glostyle{indexgroup} style is similar to
the \glostyle{index} style except that each group has a heading
obtained using \cs{glsgetgrouptitle}\marg{label},
which is described in \sectionref{sec:newglossarystyle}.

\item[indexhypergroup] The \glostyle{indexhypergroup} style is like 
\glostyle{indexgroup} but has a set of links to the glossary 
groups. The navigation line is the same as that for 
\glostyle{listhypergroup}, described above, but is formatted using
\cs{glstreenavigationfmt}.

\item[tree] The \glostyle{tree} style is similar to the
\glostyle{index} style except that it can have arbitrary levels.
(Note that \gls{makeindex} is limited to three levels, so
you will need to use \gls{xindy} if you want more than 
three levels.) Each sub-level is indented by 
\DescribeMacro{\glstreeindent}\cs{glstreeindent}. Note that the
name, symbol (if present) and description are placed in the
same paragraph block. If you want the name to be apart from the
description, use the \glostyle{alttree} style instead. (See below.)

\item[treegroup] The \glostyle{treegroup} style is similar to
the \glostyle{tree} style except that each group has a heading.

\item[treehypergroup] The \glostyle{treehypergroup} style is like 
\glostyle{treegroup} but has a set of links to the glossary 
groups. The navigation line is the same as that for 
\glostyle{listhypergroup}, described above, but is formatted using
\cs{glstreenavigationfmt}.

\item[treenoname] The \glostyle{treenoname} style is like
the \glostyle{tree} style except that the name for each sub-entry
is ignored.

\item[treenonamegroup] The \glostyle{treenonamegroup} style is 
similar to the \glostyle{treenoname} style except that each group 
has a heading.

\item[treenonamehypergroup] The \glostyle{treenonamehypergroup} 
style is like \glostyle{treenonamegroup} but has a set of links to 
the glossary groups. The navigation line is the same as that for 
\glostyle{listhypergroup}, described above, but is formatted using
\cs{glstreenavigationfmt}.

\item[alttree] The \glostyle{alttree} style is similar to the
\glostyle{tree} style except that the indentation for each level
is determined by the width of the text specified by
\begin{definition}[\DescribeMacro{\glssetwidest}]
\cs{glssetwidest}\oarg{level}\marg{text}
\end{definition}
The optional argument \meta{level} indicates the level, where
0 indicates the top-most level, 1 indicates the first level 
sub-entries, etc. If \cs{glssetwidest} hasn't been used for a 
given sub-level, the level~0 widest text is used instead. If
\meta{level} is omitted, 0 is assumed.

As from v4.22, the \sty{glossary-tree} package also provides
\begin{definition}[\DescribeMacro\glsfindwidesttoplevelname]
\cs{glsfindwidesttoplevelname}\oarg{glossary list}
\end{definition}
This iterates over all parentless entries in the given glossary
lists and determines the widest entry. If the optional argument is
omitted, all glossaries are assumed (as per \cs{forallglossaries}).

For example, to have the same name width for all glossaries:
\begin{verbatim}
\glsfindwidesttoplevelname
\setglossarystyle{alttree}
\printglossaries
\end{verbatim}
Alternatively, to compute the widest entry for each glossary
before it's displayed:
\begin{verbatim}
\renewcommand{\glossarypreamble}{%
  \glsfindwidesttoplevelname[\currentglossary]}
\setglossarystyle{alttree}
\printglossaries
\end{verbatim}

\begin{important}
These commands only affects the \glostyle{alttree} styles, including those 
listed below and the ones in the \sty{glossary-mcols} package.
If you forget to set the widest entry name, the description will
overwrite the name.
\end{important}

For each level, the name is placed to the left of the paragraph
block containing the symbol (optional) and the description. If the
symbol is present, it is placed in parentheses before the
description.

The name is placed inside a left-aligned \cs{makebox}. As from
v4.19, this can now be adjusted by redefining
\begin{definition}[\DescribeMacro\glstreenamebox]
\cs{glstreenamebox}\marg{width}\marg{text}
\end{definition}
where \meta{width} is the width of the box and \meta{text} is the
contents of the box. For example, to make the name right-aligned:
\begin{verbatim}
\renewcommand*{\glstreenamebox}[2]{%
  \makebox[#1][r]{#2}%
}
\end{verbatim}

\item[alttreegroup] The \glostyle{alttreegroup} is like the
\glostyle{alttree} style except that each group has a heading.

\item[alttreehypergroup] The \glostyle{alttreehypergroup} style is 
like \glostyle{alttreegroup} but has a set of links to the glossary 
groups. The navigation line is the same as that for 
\glostyle{listhypergroup}, described above.

\end{description}

\subsection{Multicols Style}
\label{sec:mcolstyles}

The \sty{glossary-mcols} package provides tree-like styles that are
in the \env{multicols} environment (defined by the \sty{multicol}
package). The style names are as their analogous tree styles (as
defined in \sectionref{sec:treestyles}) but are prefixed with
\qt{mcol}.
For example, the \glostyle{mcolindex} style is essentially the
\glostyle{index} style but put in a \env{multicols} environment.
For the complete list, see \tableref{tab:mcols}. The
\sty{glossary-tree} package is automatically loaded by
\sty{glossary-mcols} (even if the \pkgopt{notree} package option is
used when loading \styfmt{glossaries}). The formatting commands
\cs{glstreenamefmt}, \cs{glstreegroupheaderfmt} and
\cs{glstreenavigationfmt} are all used by the corresponding
\sty{glossary-mcols} styles.

\begin{important}
Note that \sty{glossary-mcols} is not loaded by \styfmt{glossaries}. If
you want to use any of the multicol styles in that package you need
to load it explicitly with \cs{usepackage} and set the required glossary
style using \ics{setglossarystyle}.
\end{important}

The default number of columns is 2, but can be changed by redefining
\begin{definition}[\DescribeMacro{\glsmcols}]
\cs{glsmcols}
\end{definition}
to the required number. For example, for a three column glossary:
\begin{verbatim}
\usepackage{glossary-mcols}
\renewcommand*{\glsmcols}{3}
\setglossarystyle{mcolindex}
\end{verbatim}

\begin{table}[htbp]
\caption{Multicolumn Styles}
\label{tab:mcols}
\centering
\begin{tabular}{ll}
\bfseries
\sty{glossary-mcols} Style &
\bfseries
Analogous Tree Style\\
\glostyle{mcolindex} & \glostyle{index}\\
\glostyle{mcolindexgroup} & \glostyle{indexgroup}\\
\glostyle{mcolindexhypergroup} or \glostyle{mcolindexspannav} & \glostyle{indexhypergroup}\\
\glostyle{mcoltree} & \glostyle{tree}\\
\glostyle{mcoltreegroup} & \glostyle{treegroup}\\
\glostyle{mcoltreehypergroup} or \glostyle{mcoltreespannav} & \glostyle{treehypergroup}\\
\glostyle{mcoltreenoname} & \glostyle{treenoname}\\
\glostyle{mcoltreenonamegroup} & \glostyle{treenonamegroup}\\
\glostyle{mcoltreenonamehypergroup} or
\glostyle{mcoltreenonamespannav} & \glostyle{treenonamehypergroup}\\
\glostyle{mcolalttree} & \glostyle{alttree}\\
\glostyle{mcolalttreegroup} & \glostyle{alttreegroup}\\
\glostyle{mcolalttreehypergroup} or \glostyle{mcolalttreespannav} & \glostyle{alttreehypergroup}
\end{tabular}
\end{table}

The styles with a navigation line, such as
\glostyle{mcoltreehypergroup}, now have a variant (as from v4.22)
with \qt{hypergroup} replaced with \qt{spannav} in the style name.
The original \qt{hypergroup} styles place the navigation line at the
start of the first column. The newer \qt{spannav} styles put the
navigation line in the optional argument of the \env{multicols}
environment so that it spans across all the columns.

\subsection{In-Line Style}
\label{sec:inline}

This section covers the \sty{glossary-inline} package that supplies
the \glostyle{inline} style. This is a style that is designed for
in-line use (as opposed to block styles, such as lists or tables).
This style doesn't display the \gls{numberlist}.

You will most likely need to redefine \ics{glossarysection} with
this style. For example, suppose you are required to have your
glossaries and list of acronyms in a footnote, you can do:
\begin{verbatim}
 \usepackage{glossary-inline}

 \renewcommand*{\glossarysection}[2][]{\textbf{#1}: }
 \setglossarystyle{inline}
\end{verbatim}

\begin{important}
Note that you need to include \sty{glossary-inline} with
\cs{usepackage} as it's not automatically included by the
\styfmt{glossaries} package and then set the style using 
\ics{setglossarystyle}.
\end{important}

Where you need to include your glossaries as a footnote you can do:
\begin{verbatim}
\footnote{\printglossaries}
\end{verbatim}

The \glostyle{inline} style is governed by the following:
\begin{definition}[\DescribeMacro{\glsinlineseparator}]
\ics{glsinlineseparator}
\end{definition}
This defaults to \qt{\texttt{\glsinlineseparator}} and is used between
main (i.e.\ level~0) entries.
\begin{definition}[\DescribeMacro{\glsinlinesubseparator}]
\ics{glsinlinesubseparator}
\end{definition}
This defaults to \qt{\texttt{\glsinlinesubseparator}} and is used between
sub-entries.
\begin{definition}[\DescribeMacro{\glsinlineparentchildseparator}]
\ics{glsinlineparentchildseparator}
\end{definition}
This defaults to \qt{\texttt{\glsinlineparentchildseparator}} and is used between
a parent main entry and its first sub-entry.
\begin{definition}[\DescribeMacro{\glspostinline}]
\ics{glspostinline}
\end{definition}
This defaults to \qt{\texttt{\glsinlineseparator}} and is used at the end
of the glossary.
\begin{definition}[\DescribeMacro\glsinlinenameformat]
\cs{glsinlinenameformat}\marg{label}\marg{name}
\end{definition}
This is used to format the entry name and defaults to 
\cs{glstarget}\marg{label}\marg{name}, where \meta{name} is provided
in the form \cs{glossentryname}\marg{label} and \meta{label} is the
entry's label. For example, if you want the name to appear in
\gls{smallcaps}:
\begin{verbatim}
\renewcommand*{\glsinlinenameformat}[2]{\glstarget{#1}{\textsc{#2}}}
\end{verbatim}
Sub-entry names are formatted according to
\begin{definition}[\DescribeMacro\glsinlinesubnameformat]
\cs{glsinlinesubnameformat}\marg{label}\marg{name}
\end{definition}
This defaults to \cs{glstarget}\marg{label}\verb|{}| so the
sub-entry name is ignored.

If the description has been suppressed (according to
\cs{ifglsdescsuppressed}) then 
\begin{definition}[\DescribeMacro\glsinlineemptydescformat]
\cs{glsinlineemptydescformat}\marg{symbol}\marg{number list}
\end{definition}
(which defaults to nothing) is used,
otherwise the description is formatted according to
\begin{definition}[\DescribeMacro\glsinlinedescformat]
\cs{glsinlinedescformat}\marg{description}\marg{symbol}\marg{number
list}
\end{definition}
This defaults to just \cs{space}\meta{description} so the symbol and
location list are ignored. If the description is missing (according
to \cs{ifglshasdesc}), then \cs{glsinlineemptydescformat} is used
instead.

For example, if you want a colon between the name and the
description:
\begin{verbatim}
\renewcommand*{\glsinlinedescformat}[3]{: #1}
\end{verbatim}

The sub-entry description is formatted according to:
\begin{definition}[\DescribeMacro\glsinlinesubdescformat]
\cs{glsinlinesubdescformat}\marg{description}\marg{symbol}\marg{number
list}
\end{definition}
This defaults to just \meta{description}.

\section{Defining your own glossary style}
\label{sec:newglossarystyle}

If the predefined styles don't fit your requirements, you can
define your own style using:
\begin{definition}[\DescribeMacro{\newglossarystyle}]
\cs{newglossarystyle}\marg{name}\marg{definitions}
\end{definition}
where \meta{name} is the name of the new glossary style (to be
used in \cs{setglossarystyle}). The second argument \meta{definitions}
needs to redefine all of the following:

\begin{definition}[\DescribeEnv{theglossary}]
\env{theglossary}
\end{definition}
This environment defines how the main body of the glossary should
be typeset. 

Note that this does not include the section heading,
the glossary preamble (defined by \ics{glossarypreamble}) or the
glossary postamble (defined by \ics{glossarypostamble}). For example,
the \glostyle{list} style uses the \env{description} environment,
so the \env{theglossary} environment is simply redefined to begin
and end the \env{description} environment.

\begin{definition}[\DescribeMacro{\glossaryheader}]
\cs{glossaryheader}
\end{definition}
This macro indicates what to do at the start of the main body
of the glossary. Note that this is not the same as 
\ics{glossarypreamble}, which should not be affected by changes in
the glossary style. The \glostyle{list} glossary style redefines
\ics{glossaryheader} to do nothing, whereas the \glostyle{longheader}
glossary style redefines \cs{glossaryheader} to do a header row.

\begin{definition}[\DescribeMacro{\glsgroupheading}]
\cs{glsgroupheading}\marg{label}
\end{definition}
This macro indicates
what to do at the start of each logical block within the main body
of the glossary. If you use \gls{makeindex} the glossary is
sub-divided into a maximum of twenty-eight logical blocks that are
determined by the first character of the \gloskey{sort} key (or
\gloskey{name} key if the \gloskey{sort} key is omitted). The
sub-divisions are in the following order: symbols, numbers, A,
\ldots, Z\@. If you use \gls{xindy}, the sub-divisions depend on
the language settings.

Note that the argument to \cs{glsgroupheading}
is a label \emph{not} the group title. The group title can be obtained
via
\begin{definition}[\DescribeMacro{\glsgetgrouptitle}]
\cs{glsgetgrouptitle}\marg{label}
\end{definition}
This obtains the title as follows: if \meta{label} consists of a
single non-active character or \meta{label} is equal to
\texttt{glssymbols} or \texttt{glsnumbers} and
\cs{}\meta{label}\texttt{groupname} exists, this is taken to be the 
title, otherwise the title is just \meta{label}. (The \qt{symbols}
group has the label \texttt{glssymbols}, so the command 
\ics{glssymbolsgroupname} is used, and the \qt{numbers} group has the
label \texttt{glsnumbers}, so the command \ics{glsnumbersgrouptitle}
is used.) If you are using \gls{xindy}, \meta{label} may be an
active character (for example \o), in which case the title will be
set to just \meta{label}. You can redefine \cs{glsgetgrouptitle} if
this is unsuitable for your document.

A navigation hypertarget can be created using
\begin{definition}[\DescribeMacro{\glsnavhypertarget}]
\cs{glsnavhypertarget}\marg{label}\marg{text}
\end{definition}
This typically requires \cs{glossaryheader} to be redefined to use
\begin{definition}[\DescribeMacro\glsnavigation]
\cs{glsnavigation}
\end{definition}
which displays the navigation line.

For further details about \cs{glsnavhypertarget}, see
\ifpdf section~\ref*{sec:code:hypernav} in \fi the documented code 
(\texttt{glossaries-code.pdf}).

Most of the predefined glossary styles redefine \cs{glsgroupheading}
to simply ignore its argument.  The \glostyle{listhypergroup} style
redefines \cs{glsgroupheading} as follows:
\begin{verbatim}
\renewcommand*{\glsgroupheading}[1]{%
\item[\glsnavhypertarget{##1}{\glsgetgrouptitle{##1}}]}
\end{verbatim}
See also \cs{glsgroupskip} below. 

Note that command definitions within 
\ics{newglossarystyle} must use \verb|##1| instead of \verb|#1| etc.

\begin{definition}[\DescribeMacro{\glsgroupskip}]
\cs{glsgroupskip}
\end{definition}
This macro determines what to do after one logical group but before
the header for the next logical group. The \glostyle{list} glossary
style simply redefines \cs{glsgroupskip} to be \ics{indexspace},
whereas the tabular-like styles redefine \cs{glsgroupskip} to
produce a blank row.

As from version 3.03, the package option \pkgopt{nogroupskip} can be
used to suppress this default gap for the predefined styles.

\begin{definition}[\DescribeMacro{\glossentry}]
\cs{glossentry}\marg{label}\marg{number list}
\end{definition}
This macro indicates what to do for each top-level (level~0) glossary entry.
The entry label is given by \meta{label} and the associated
\gls{numberlist} is given by \meta{number list}. You can redefine
\ics{glossentry} to use commands like \ics{glossentryname}\marg{label},
\ics{glossentrydesc}\marg{label} and \ics{glossentrysymbol}\marg{label} 
to display the name, description and symbol fields, or to access
other fields, use commands like \ics{glsentryuseri}\marg{label}.
(See \sectionref{sec:glsnolink} for further details.) You can also
use the following commands:

\begin{definition}[\DescribeMacro{\glsentryitem}]
\cs{glsentryitem}\marg{label}
\end{definition}
This macro will increment and display the associated counter for the
main (level~0) entries if the \pkgopt{entrycounter} or
\pkgopt{counterwithin} package options have been used. This macro
is typically called by \cs{glossentry} before \cs{glstarget}. 
The format of the counter is controlled by the macro
\begin{definition}[\DescribeMacro{\glsentrycounterlabel}]
\cs{glsentrycounterlabel}
\end{definition}

Each time you use a glossary entry it creates a hyperlink (if
hyperlinks are enabled) to the relevant line in the glossary.
Your new glossary style must therefore redefine
\cs{glossentry} to set the appropriate target. This
is done using
\begin{definition}[\DescribeMacro{\glstarget}]
\cs{glstarget}\marg{label}\marg{text}
\end{definition}
where \meta{label} is the entry's label. Note that you
don't need to worry about whether the \sty{hyperref} package has
been loaded, as \cs{glstarget} won't create a target if
\cs{hypertarget} hasn't been defined.

For example, the \glostyle{list} style defines \cs{glossentry} as follows:
\begin{verbatim}
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \glstarget{##1}{\glossentryname{##1}}]
       \glossentrydesc{##1}\glspostdescription\space ##2}
\end{verbatim}

Note also that \meta{number list} will always be of the form
\begin{definition}
\ics{glossaryentrynumbers}\{\cs{relax}\\
\ics{setentrycounter}\oarg{Hprefix}\marg{counter name}\meta{format cmd}\marg{number(s)}\}
\end{definition}
where \meta{number(s)}
may contain \ics{delimN} (to delimit individual numbers) and/or
\ics{delimR} (to indicate a range of numbers). There may be 
multiple occurrences of 
\ics{setentrycounter}\oarg{Hprefix}\marg{counter name}\meta{format cmd}\marg{number(s)}, but note
that the entire number list is enclosed within the argument
of \ics{glossaryentrynumbers}. The user can redefine this to change
the way the entire number list is formatted, regardless of 
the glossary style. However the most common use of
\ics{glossaryentrynumbers} is to provide a means of suppressing the
number list altogether. (In fact, the \pkgopt{nonumberlist} option 
redefines \ics{glossaryentrynumbers} to ignore its argument.)
Therefore, when you define a new glossary style, you don't need
to worry about whether the user has specified the 
\pkgopt{nonumberlist} package option.

\begin{definition}[\DescribeMacro{\subglossentry}]
\cs{subglossentry}\marg{level}\marg{label}\marg{number list}
\end{definition}
This is used to display sub-entries.
The first argument, \meta{level}, indicates the sub-entry level.
This must be an integer from 1 (first sub-level) onwards. The
remaining arguments are analogous to those for
\ics{glossentry} described above.

\begin{definition}[\DescribeMacro{\glssubentryitem}]
\cs{glssubentryitem}\marg{label}
\end{definition}
This macro will increment and display the associated counter for the
level~1 entries if the \pkgopt{subentrycounter} package option has
been used. This macro is typically called by \cs{subglossentry}
before \ics{glstarget}. The format of the counter is controlled by
the macro
\begin{definition}[\DescribeMacro{\glssubentrycounterlabel}]
\cs{glssubentrycounterlabel}
\end{definition}

Note that \ics{printglossary} (which \ics{printglossaries} calls)
sets
\begin{definition}[\DescribeMacro{\currentglossary}]
\cs{currentglossary}
\end{definition}
to the current glossary label, so it's possible to create a glossary
style that varies according to the glossary type.

For further details of these commands, see \ifpdf
section~\ref*{sec:code:printglos} \fi \qt{Displaying the glossary}
in the documented code (\texttt{glossaries-code.pdf}).

\begin{example}{Creating a completely new style}{sec:exnewstyle}

If you want a completely new style, you will need to redefine all
of the commands and the environment listed above. 

For example, suppose you want each entry to start with a bullet point.
This means that the glossary should be placed in the \env{itemize}
environment, so \env{theglossary} should start and end that
environment. Let's also suppose that you don't want anything between
the glossary groups (so \ics{glsgroupheading} and \ics{glsgroupskip}
should do nothing) and suppose you don't want anything to appear
immediately after \verb|\begin{theglossary}| (so \ics{glossaryheader}
should do nothing). In addition, let's suppose the symbol should
appear in brackets after the name, followed by the description and
last of all the \gls{numberlist} should appear within square brackets
at the end. Then you can create this new glossary style, called, say,
\texttt{mylist}, as follows:
\begin{verbatim}
 \newglossarystyle{mylist}{%
 % put the glossary in the itemize environment:
 \renewenvironment{theglossary}%
   {\begin{itemize}}{\end{itemize}}%
 % have nothing after \begin{theglossary}:
 \renewcommand*{\glossaryheader}{}%
 % have nothing between glossary groups:
 \renewcommand*{\glsgroupheading}[1]{}%
 \renewcommand*{\glsgroupskip}{}%
 % set how each entry should appear:
 \renewcommand*{\glossentry}[2]{%
 \item % bullet point
 \glstarget{##1}{\glossentryname{##1}}% the entry name
 \space (\glossentrysymbol{##1})% the symbol in brackets
 \space \glossentrydesc{##1}% the description
 \space [##2]% the number list in square brackets
 }%
 % set how sub-entries appear:
 \renewcommand*{\subglossentry}[3]{%
   \glossentry{##2}{##3}}%
 }
\end{verbatim}
Note that this style creates a flat glossary, where sub-entries
are displayed in exactly the same way as the top level entries.
It also hasn't used \ics{glsentryitem} or \ics{glssubentryitem} so
it won't be affected by the \pkgopt{entrycounter},
\pkgopt{counterwithin} or \pkgopt{subentrycounter} package options.

Variations:
\begin{itemize}
\item You might want the entry name to be capitalised, in
which case use \ics{Glossentryname} instead of \ics{glossentryname}.

\item You might want to check if the symbol hasn't been set and omit
the parentheses if the symbol is absent. In this case you can use
\ics{ifglshassymbol} (see \sectionref{sec:utilities}):
\begin{verbatim}
 \renewcommand*{\glossentry}[2]{%
 \item % bullet point
 \glstarget{##1}{\glossentryname{##1}}% the entry name
 \ifglshassymbol{##1}% check if symbol exists
 {%
   \space (\glossentrysymbol{##1})% the symbol in brackets
 }%
 {}% no symbol so do nothing
 \space \glossentrydesc{##1}% the description
 \space [##2]% the number list in square brackets
 }%
\end{verbatim}
\end{itemize}
\end{example}

\begin{example}{Creating a new glossary style based on an
existing style}{sec:exadaptstyle}

If you want to define a new style that is a slightly modified
version of an existing style, you can use \ics{setglossarystyle}
within the second argument of \ics{newglossarystyle} followed by
whatever alterations you require. For example, suppose you want 
a style like the \glostyle{list} style but you don't want the extra
vertical space created by \ics{indexspace} between groups, then you
can create a new glossary style called, say, \texttt{mylist} as
follows:
\begin{verbatim}
\newglossarystyle{mylist}{%
\setglossarystyle{list}% base this style on the list style
\renewcommand{\glsgroupskip}{}% make nothing happen 
                              % between groups
}
\end{verbatim} 
(In this case, you can actually achieve the same effect using the
\glostyle{list} style in combination with the package option
\pkgopt{nogroupskip}.)
\end{example}

\begin{example}{Example: creating a glossary style that uses the
\texorpdfstring{\gloskey{user1}}{user1}, \ldots, 
\texorpdfstring{\gloskey{user6}}{user6} keys}{sec:exuserstyle}

Suppose each entry not only has an associated symbol,
but also units (stored in \gloskey{user1}) and dimension
(stored in \gloskey{user2}). Then you can define a glossary style
that displays each entry in a \env{longtable} as follows:
\begin{verbatim}
\newglossarystyle{long6col}{%
 % put the glossary in a longtable environment:
 \renewenvironment{theglossary}%
  {\begin{longtable}{lp{\glsdescwidth}cccp{\glspagelistwidth}}}%
  {\end{longtable}}%
 % Set the table's header:
 \renewcommand*{\glossaryheader}{%
  \bfseries Term & \bfseries Description & \bfseries Symbol &
  \bfseries Units & \bfseries Dimensions & \bfseries Page List
  \\\endhead}%
 % No heading between groups:
  \renewcommand*{\glsgroupheading}[1]{}%
 % Main (level 0) entries displayed in a row optionally numbered:
  \renewcommand*{\glossentry}[2]{%
    \glsentryitem{##1}% Entry number if required
    \glstarget{##1}{\glossentryname{##1}}% Name
    & \glossentrydesc{##1}% Description
    & \glossentrysymbol{##1}% Symbol
    & \glsentryuseri{##1}% Units
    & \glsentryuserii{##1}% Dimensions
    & ##2% Page list
    \tabularnewline % end of row
  }%
 % Similarly for sub-entries (no sub-entry numbers):
 \renewcommand*{\subglossentry}[3]{%
    % ignoring first argument (sub-level)
    \glstarget{##2}{\glossentryname{##2}}% Name
    & \glossentrydesc{##2}% Description
    & \glossentrysymbol{##2}% Symbol
    & \glsentryuseri{##2}% Units
    & \glsentryuserii{##2}% Dimensions
    & ##3% Page list
    \tabularnewline % end of row
  }%
 % Nothing between groups:
 \renewcommand*{\glsgroupskip}{}%
}
\end{verbatim}
\end{example}

\chapter{Utilities}
\label{sec:utilities}

This section describes some utility commands. Additional commands
can be found in the documented code (glossaries-code.pdf).

\begin{xtr}
The \gls{glossaries-extra} package provides extra utility commands.
See the \qt{Utilities} section of the \gls{glossaries-extra} manual.
\end{xtr}

\section{Loops}
\label{sec:loops}

\begin{important}
Some of the commands described here take a comma-separated list as
an argument. As with \LaTeX's \cs{@for} command, make sure your list
doesn't have any unwanted spaces in it as they don't get stripped.
(Discussed in more detail in
\href{http://www.dickimaw-books.com/latex/admin/html/docsvlist.shtml#spacesinlists}{\S2.7.2 of \qt{\LaTeX\ for Administrative
Work}}.)
\end{important}

\begin{definition}[\DescribeMacro{\forallglossaries}]
\cs{forallglossaries}\oarg{glossary list}\marg{cs}\marg{body}
\end{definition}
This iterates through \meta{glossary list}, a comma-separated list
of glossary labels (as supplied when the glossary was defined).
At each iteration \meta{cs} (which must be a control sequence) is
set to the glossary label for the current iteration and \meta{body}
is performed. If \meta{glossary list} is omitted, the default is to
iterate over all glossaries (except the ignored ones).

\begin{definition}[\DescribeMacro{\forallacronyms}]
\cs{forallacronyms}\marg{cs}\marg{body}
\end{definition}
This is like \cs{forallglossaries} but only iterates over the
lists of acronyms (that have previously been declared using
\ics{DeclareAcronymList} or the \pkgopt{acronymlists} package
option). This command doesn't have an optional argument. If you want
to explicitly say which lists to iterate over, just use the optional
argument of \cs{forallglossaries}.

\begin{definition}[\DescribeMacro{\forglsentries}]
\cs{forglsentries}\oarg{glossary label}\marg{cs}\marg{body}
\end{definition}
This iterates through all entries in the glossary given by
\meta{glossary label}. At each iteration \meta{cs} (which must be a
control sequence) is set to the entry label for the current
iteration and \meta{body} is performed. If \meta{glossary label} is
omitted, \ics{glsdefaulttype} (usually the main glossary) is used.

\begin{definition}[\DescribeMacro{\forallglsentries}]
\cs{forallglsentries}\oarg{glossary list}\marg{cs}\marg{body}
\end{definition}
This is like \cs{forglsentries} but for each glossary in
\meta{glossary list} (a comma-separated list of glossary labels). If
\meta{glossary list} is omitted, the default is the list of all
defined glossaries (except the ignored ones). At each iteration 
\meta{cs} is set to the entry label and \meta{body} is performed. 
(The current glossary label can be obtained using 
\cs{glsentrytype}\marg{cs} within \meta{body}.)

\section{Conditionals}
\label{sec:conditionals}

\begin{definition}[\DescribeMacro{\ifglossaryexists}]
\cs{ifglossaryexists}{\meta{label}}{\meta{true part}}{\meta{false
part}}
\end{definition}
This checks if the glossary given by \meta{label} exists. If it
does \meta{true part} is performed, otherwise \meta{false part}.
The unstarred form will do \meta{false part} for ignored glossaries. 
As from v4.46, there is now a starred form of this command which
will also consider ignored glossaries as existing. For example,
given:
\begin{alltt}
\ics{newignoredglossary}\mgroup{common}
\end{alltt}
then
\begin{verbatim}
\ifglossaryexists{common}{true}{false}
\ifglossaryexists*{common}{true}{false}
\end{verbatim}
will produce \qt{false true}.

\begin{definition}[\DescribeMacro{\ifglsentryexists}]
\cs{ifglsentryexists}{\meta{label}}{\meta{true part}}{\meta{false
part}}
\end{definition}
This checks if the glossary entry given by \meta{label} exists. If it
does \meta{true part} is performed, otherwise \meta{false part}.
(Note that \cs{ifglsentryexists} will always be true after the
containing glossary has been displayed via \ics{printglossary}
or \ics{printglossaries} even if the entry is explicitly defined
later in the document. This is because the entry has to be defined
before it can be displayed in the glossary, see \sectionref{sec:techissues} for
further details.)

\begin{definition}[\DescribeMacro{\glsdoifexists}]
\cs{glsdoifexists}\marg{label}\marg{code}
\end{definition}
Does \meta{code} if the entry given by \meta{label} exists. If it
doesn't exist, an error is generated. (This command uses
\cs{ifglsentryexists}.)

\begin{definition}[\DescribeMacro{\glsdoifnoexists}]
\cs{glsdoifnoexists}\marg{label}\marg{code}
\end{definition}
Does the reverse of \cs{glsdoifexists}. (This command uses
\cs{ifglsentryexists}.)

\begin{definition}[\DescribeMacro{\glsdoifexistsorwarn}]
\cs{glsdoifexistsorwarn}\marg{label}\marg{code}
\end{definition}
As \cs{glsdoifexists} but issues a warning rather than an error if
the entry doesn't exist.

\begin{definition}[\DescribeMacro{\glsdoifexistsordo}]
\cs{glsdoifexistsordo}\marg{label}\marg{code}\marg{else code}
\end{definition}
Does \meta{code} if the entry given by \meta{label} exists otherwise
generate an error and do \meta{else code}.

\begin{definition}[\DescribeMacro{\glsdoifnoexistsordo}]
\cs{glsdoifnoexistsordo}\marg{label}\marg{code}\marg{else code}
\end{definition}
Does \meta{code} if the entry given by \meta{label} doesn't exist otherwise
generate an error and do \meta{else code}.

\begin{definition}[\DescribeMacro{\ifglsused}]
\cs{ifglsused}{\meta{label}}{\meta{true part}}{\meta{false
part}}
\end{definition}
See \sectionref{sec:glsunset}.

\begin{definition}[\DescribeMacro{\ifglshaschildren}]
\cs{ifglshaschildren}{\meta{label}}{\meta{true part}}{\meta{false
part}}
\end{definition}
This checks if the glossary entry given by \meta{label} has any
sub-entries. If it does, \meta{true part} is performed, otherwise
\meta{false part}.

\begin{definition}[\DescribeMacro{\ifglshasparent}]
\cs{ifglshasparent}{\meta{label}}{\meta{true part}}{\meta{false
part}}
\end{definition}
This checks if the glossary entry given by \meta{label} has a parent
entry. If it does, \meta{true part} is performed, otherwise
\meta{false part}.

\begin{definition}[\DescribeMacro{\ifglshassymbol}]
\cs{ifglshassymbol}\marg{label}\marg{true part}\marg{false part}
\end{definition}
This checks if the glossary entry given by \meta{label} has had the
\gloskey{symbol} field set. If it has, \meta{true part} is performed,
otherwise \meta{false part}.

\begin{definition}[\DescribeMacro{\ifglshaslong}]
\cs{ifglshaslong}\marg{label}\marg{true part}\marg{false part}
\end{definition}
This checks if the glossary entry given by \meta{label} has had the
\gloskey{long} field set. If it has, \meta{true part} is performed,
otherwise \meta{false part}. This should be true for any entry that
has been defined via \ics{newacronym}.
There is no check for the existence of \meta{label}.

\begin{definition}[\DescribeMacro{\ifglshasshort}]
\cs{ifglshasshort}\marg{label}\marg{true part}\marg{false part}
\end{definition}
This checks if the glossary entry given by \meta{label} has had the
\gloskey{short} field set. If it has, \meta{true part} is performed,
otherwise \meta{false part}. This should be true for any entry that
has been defined via \ics{newacronym}.
There is no check for the existence of \meta{label}.

\begin{definition}[\DescribeMacro{\ifglshasdesc}]
\cs{ifglshasdesc}\marg{label}\marg{true part}\marg{false part}
\end{definition}
This checks if the \gloskey{description} field is non-empty for 
the entry given by \meta{label}. If it has, \meta{true part} is 
performed, otherwise \meta{false part}. Compare with:
\begin{definition}[\DescribeMacro{\ifglsdescsuppressed}]
\cs{ifglsdescsuppressed}\marg{label}\marg{true part}\marg{false part}
\end{definition}
This checks if the \gloskey{description} field has been set to just
\ics{nopostdesc} for the entry given by \meta{label}. If it has, 
\meta{true part} is performed, otherwise \meta{false part}.
There is no check for the existence of \meta{label}.

For all other fields you can use:
\begin{definition}[\DescribeMacro\ifglshasfield]
\cs{ifglshasfield}\marg{field}\marg{label}\marg{true part}\marg{false
part}
\end{definition}
This tests the value of the field given by \meta{field} for the entry
identified by \meta{label}. If the value is empty \emph{or the default
value}, then \meta{false part} is performed, otherwise \meta{true
part} is performed. If the field supplied is unrecognised \meta{false part}
is performed and a warning is issued. Unlike the above commands,
such as \cs{ifglshasshort}, an error occurs if the entry is
undefined.

As from version 4.23, within \meta{true part} you can use
\begin{definition}[\DescribeMacro\glscurrentfieldvalue]
\cs{glscurrentfieldvalue}
\end{definition}
to access the field value. This command is
initially defined to nothing but has
no relevance outside \meta{true part}. This saves re-accessing the
field if the test is true. For example:
\begin{verbatim}
\ifglshasfield{useri}{sample}{, \glscurrentfieldvalue}{}
\end{verbatim}
will insert a comma, space and the field value if the
\gloskey{user1} key has been set for
the entry whose label is \texttt{sample}.

You can test if the value of the field is equal to a given string
using:
\begin{definition}[\DescribeMacro\ifglsfieldeq]
\cs{ifglsfieldeq}\marg{label}\marg{field}\marg{string}\marg{true}\marg{false}
\end{definition}
In this case the \meta{field} must be the field name not the key
(see \tableref{tab:fieldmap}). If the field isn't recognised, an
error will occur. This command internally uses
\sty{etoolbox}'s \cs{ifcsstring} to perform the comparison. \emph{The
string is not expanded during the test.}

The result may vary depending on whether or not expansion is on for
the given field (when the entry was defined). For example:
\begin{verbatim}
\documentclass{article}

\usepackage{glossaries}

\newcommand*{\foo}{FOO}

\newglossaryentry{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry{sample2}{name={sample2},description={an example},
user1={\foo}}

\begin{document}
\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}.

\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}.
\end{document}
\end{verbatim}
This will produce \qt{TRUE} in both cases since expansion is on, so
\cs{foo} was expanded to \qt{FOO} when \texttt{sample2} was defined.
If the tests are changed to:
\begin{verbatim}
\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}.

\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}.
\end{verbatim}
then this will produce \qt{FALSE} in both cases. Now suppose
expansion is switched off for the \gloskey{user1} key:
\begin{verbatim}
\documentclass{article}

\usepackage{glossaries}

\newcommand*{\foo}{FOO}

\glssetnoexpandfield{useri}

\newglossaryentry{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry{sample2}{name={sample2},description={an example},
user1={\foo}}

\begin{document}
\ifglsfieldeq{sample1}{useri}{FOO}{TRUE}{FALSE}.

\ifglsfieldeq{sample2}{useri}{FOO}{TRUE}{FALSE}.
\end{document}
\end{verbatim}
This now produces \qt{TRUE} for the first case (comparing \qt{FOO}
with \qt{FOO}) and \qt{FALSE} for the second case (comparing
\qt{\cs{foo}} with \qt{FOO}).

The reverse happens in the following:
\begin{verbatim}
\documentclass{article}

\usepackage{glossaries}

\newcommand*{\foo}{FOO}

\glssetnoexpandfield{useri}

\newglossaryentry{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry{sample2}{name={sample2},description={an example},
user1={\foo}}

\begin{document}
\ifglsfieldeq{sample1}{useri}{\foo}{TRUE}{FALSE}.

\ifglsfieldeq{sample2}{useri}{\foo}{TRUE}{FALSE}.
\end{document}
\end{verbatim}
This now produces \qt{FALSE} for the first case (comparing \qt{FOO}
with \qt{\cs{foo}}) and \qt{TRUE} for the second case (comparing
\qt{\cs{foo}} with \qt{\cs{foo}}).

You can test if the value of a field is equal to the replacement
text of a command using:
\begin{definition}[\DescribeMacro\ifglsfielddefeq]
\cs{ifglsfielddefeq}\marg{label}\marg{field}\marg{command}\marg{true}\marg{false}
\end{definition}
This internally uses \sty{etoolbox}'s \cs{ifdefstrequal} command to
perform the comparison. The argument \meta{command} must be a macro.

For example:
\begin{verbatim}
\documentclass{article}

\usepackage{glossaries}

\newcommand*{\foo}{FOO}

\glssetnoexpandfield{useri}

\newglossaryentry{sample1}{name={sample1},description={an example},
user1={FOO}}
\newglossaryentry{sample2}{name={sample2},description={an example},
user1={\foo}}

\begin{document}
\ifglsfielddefeq{sample1}{useri}{\foo}{TRUE}{FALSE}.

\ifglsfielddefeq{sample2}{useri}{\foo}{TRUE}{FALSE}.
\end{document}
\end{verbatim}
Here, the first case produces \qt{TRUE} since the value of the
\texttt{useri} field (\qt{FOO}) is the same as the replacement text
(definition) of \cs{foo} (\qt{FOO}). We have the result
\qt{\texttt{FOO}} is equal to \qt{\texttt{FOO}}.

The second case produces \qt{FALSE} since the value of the
\texttt{useri} field (\qt{\cs{foo}}) is not the same as the replacement
text (definition) of \cs{foo} (\qt{FOO}). No expansion has been
performed on the value of the \texttt{useri} field. We have the
result \qt{\cs{foo}} is not equal to \qt{\texttt{FOO}}.

If we add:
\begin{verbatim}
\newcommand{\FOO}{\foo}
\ifglsfielddefeq{sample2}{useri}{\FOO}{TRUE}{FALSE}.
\end{verbatim}
we now get \qt{TRUE} since the value of the
\texttt{useri} field (\qt{\cs{foo}}) is the same as the replacement
text (definition) of \cs{FOO} (\qt{\cs{foo}}). We have the result \qt{\cs{foo}}
is equal to \qt{\cs{foo}}.

There is a similar command that requires the control sequence name
(without the leading backslash) instead of the actual control sequence:
\begin{definition}[\DescribeMacro\ifglsfieldcseq]
\cs{ifglsfieldcseq}\marg{label}\marg{field}\marg{csname}\marg{true}\marg{false}
\end{definition}
This internally uses \sty{etoolbox}'s \cs{ifcsstrequal} command
instead of \cs{ifdefstrequal}.

\section{Fetching and Updating the Value of a Field}
\label{sec:fetchset}

In addition to the commands described in \sectionref{sec:glsnolink},
the following may also be used to fetch field information.
\begin{definition}[\DescribeMacro\glsentrytype]
\cs{glsentrytype}\marg{label}
\end{definition}
Expands to the entry's glossary type. No existence check is
performed.

\begin{definition}[\DescribeMacro\glsentryparent]
\cs{glsentryparent}\marg{label}
\end{definition}
Expands to the label of the entry's parent. No existence check is
performed.

\begin{definition}[\DescribeMacro\glsentrysort]
\cs{glsentrysort}\marg{label}
\end{definition}
Expands to the entry's sort value. No existence check is performed.

You can fetch the value of a given field and store it in a control
sequence using:
\begin{definition}[\DescribeMacro\glsfieldfetch]
\cs{glsfieldfetch}\marg{label}\marg{field}\marg{cs}
\end{definition}
where \meta{label} is the label identifying the glossary entry,
\meta{field} is the field label (see \tableref{tab:fieldmap})
and \meta{cs} is the control sequence in which to store the value.
Remember that \meta{field} is the internal label and is not
necessarily the same as the key used to set that field in the
argument of \cs{newglossaryentry} (or the optional argument of
\cs{newacronym}).

You can change the value of a given field using one of the following
commands. Note that these commands only change the value of the
given field. They have no affect on any related field. For example,
if you change the value of the \gloskey{text} field, it won't modify the
value given by the \gloskey{name}, \gloskey{plural}, \gloskey{first} or any other related key.

In all the four related commands below, \meta{label} and
\meta{field} are as above and \meta{definition} is the new value 
of the field.

\begin{definition}[\DescribeMacro\glsfielddef]
\cs{glsfielddef}\marg{label}\marg{field}\marg{definition}
\end{definition}
This uses \cs{def} to change the value of the field (so it will be
localised by any grouping).

\begin{definition}[\DescribeMacro\glsfieldedef]
\cs{glsfieldedef}\marg{label}\marg{field}\marg{definition}
\end{definition}
This uses \cs{edef} to change the value of the field (so it will be
localised by any grouping). Any fragile commands contained in the
\meta{definition} must be protected.

\begin{definition}[\DescribeMacro\glsfieldgdef]
\cs{glsfieldgdef}\marg{label}\marg{field}\marg{definition}
\end{definition}
This uses \cs{gdef} to change the value of the field.

\begin{definition}[\DescribeMacro\glsfieldxdef]
\cs{glsfieldxdef}\marg{label}\marg{field}\marg{definition}
\end{definition}
This uses \cs{xdef} to change the value of the field. Any fragile
commands contained in the \meta{definition} must be protected.


\chapter{Prefixes or Determiners}\label{sec:prefix}

The \sty{glossaries-prefix} package that comes with the
\styfmt{glossaries} package provides 
additional keys that can be used as prefixes. For example, if you
want to specify determiners (such
as \qt{a}, \qt{an} or \qt{the}). The \styfmt{glossaries-prefix}
package automatically loads the \styfmt{glossaries} package and has
the same package options.

The extra keys for \ics{newglossaryentry} are as follows:
\begin{description}
\item[\gloskey{prefix}] The prefix associated with the
\gloskey{text} key. This defaults to nothing.

\item[\gloskey{prefixplural}] The prefix associated with the
\gloskey{plural} key. This defaults to nothing.

\item[\gloskey{prefixfirst}] The prefix associated with the
\gloskey{first} key. If omitted, this defaults to the value of the
\gloskey{prefix} key.

\item[\gloskey{prefixfirstplural}] The prefix associated with the
\gloskey{firstplural} key. If omitted, this defaults to the value of
the \gloskey{prefixplural} key.
\end{description}

\begin{example}{Defining Determiners}{ex:determiners}
Here's the start of my example document:
\begin{verbatim}
\documentclass{article}

\usepackage[colorlinks]{hyperref}
\usepackage[toc,acronym]{glossaries-prefix}
\end{verbatim}
Note that I've simply replaced \styfmt{glossaries} from previous
sample documents with \styfmt{glossaries-prefix}. Now for a sample
definition\footnote{Single letter words, such as \qt{a} and \qt{I}
should typically not appear at the end of a line, hence the
non-breakable space after \qt{a} in the \gloskey{prefix} field.}:
\begin{verbatim}
\newglossaryentry{sample}{name={sample},%
  description={an example},%
  prefix={a~},%
  prefixplural={the\space}%
}
\end{verbatim}
Note that I've had to explicitly insert a~space after the prefix
since there's no designated separator between the prefix and the
term being referenced. This not only means that you can vary between
a breaking space and non-breaking space, but also
allows for the possibility of prefixes that shouldn't have a~space, 
such as:
\begin{verbatim}
\newglossaryentry{oeil}{name={oeil},
  plural={yeux},
  description={eye},
  prefix={l'},
  prefixplural={les\space}}
\end{verbatim}
Where a space is required at the end of the prefix, you must use 
a~spacing command, such as \cs{space}, \verb*|\ | (backslash space) or
\verb|~| due to the automatic spacing trimming performed in
\meta{key}=\meta{value} options.

In the event that you always require a space between the prefix and
the term, then you can instead redefine
\begin{definition}[\DescribeMacro\glsprefixsep]
\cs{glsprefixsep}
\end{definition}
to do a space. (This command does nothing by default.) For example:
\begin{verbatim}
\renewcommand{\glsprefixsep}{\space}
\end{verbatim}

The prefixes can also be used with acronyms. For example:
\begin{verbatim}
\newacronym
 [%
   prefix={an\space},prefixfirst={a~}%
 ]{svm}{SVM}{support vector machine}
\end{verbatim}
\end{example}

The \sty{glossaries-prefix} package provides convenient commands to
use these prefixes with commands such as \ics{gls}. Note that the
prefix is not considered part of the \gls{linktext}, so it's not
included in the hyperlink (where hyperlinks are enabled). The
options and any star or plus modifier are passed on to the \glslike\
command. (See \sectionref{sec:glslink} for further details.)

\begin{definition}[\DescribeMacro\pgls]
\cs{pgls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This is inserts the value of the \gloskey{prefix} key (or
\gloskey{prefixfirst} key, on \gls{firstuse}) in front of
\cs{gls}\oarg{options}\marg{label}\oarg{insert}.

\begin{definition}[\DescribeMacro\Pgls]
\cs{Pgls}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
If the \gloskey{prefix} key (or \gloskey{prefixfirst}, on
\gls*{firstuse}) has been set, this displays the value of that key
with the first letter converted to upper case followed by
\cs{gls}\oarg{options}\marg{label}\oarg{insert}. If that key hasn't
been set, this is equivalent to
\ics{Gls}\oarg{options}\marg{label}\oarg{insert}.

\begin{definition}[\DescribeMacro\PGLS]
\cs{PGLS}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
As \cs{pgls} but converts the prefix to upper case and uses
\ics{GLS} instead of \cs{gls}.

\begin{definition}[\DescribeMacro\pglspl]
\cs{pglspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
This is inserts the value of the \gloskey{prefixplural} key (or
\gloskey{prefixfirstplural} key, on \gls{firstuse}) in front of
\cs{glspl}\oarg{options}\marg{label}\oarg{insert}.

\begin{definition}[\DescribeMacro\Pglspl]
\cs{Pglspl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
If the \gloskey{prefixplural} key (or \gloskey{prefixfirstplural}, on
\gls*{firstuse}) has been set, this displays the value of that key
with the first letter converted to upper case followed by
\cs{glspl}\oarg{options}\marg{label}\oarg{insert}. If that key hasn't
been set, this is equivalent to
\ics{Glspl}\oarg{options}\marg{label}\oarg{insert}.

\begin{definition}[\DescribeMacro\PGLSpl]
\cs{PGLSpl}\oarg{options}\marg{label}\oarg{insert}
\end{definition}
As \cs{pglspl} but converts the prefix to upper case and uses
\ics{GLSpl} instead of \cs{glspl}.

\begin{example}{Using Prefixes}{ex:prefixes}
Continuing from Example~\ref{ex:determiners}, now that I've defined
my entries, I~can use them in the text via the above commands:
\begin{verbatim}
First use: \pgls{svm}. Next use: \pgls{svm}.
Singular: \pgls{sample}, \pgls{oeil}.
Plural: \pglspl{sample}, \pglspl{oeil}.
\end{verbatim}
which produces:
\begin{quote}
First use: a~support vector machine (SVM). Next
use: an SVM.
Singular: a~sample, l'oeil. Plural: the samples, les yeux.
\end{quote}
For a complete document, see \samplefile{-prefix}.
\end{example}

This package also provides the commands described below, none of
which perform any check to determine the entry's existence.

\begin{definition}[\DescribeMacro\ifglshasprefix]
\cs{ifglshasprefix}\marg{label}\marg{true part}\marg{false part}
\end{definition}
Does \meta{true part} if the entry identified by \meta{label} has a
non-empty value for the \gloskey{prefix} key.

This package also provides the following commands:
\begin{definition}[\DescribeMacro\ifglshasprefixplural]
\cs{ifglshasprefixplural}\marg{label}\marg{true part}\marg{false part}
\end{definition}
Does \meta{true part} if the entry identified by \meta{label} has a
non-empty value for the \gloskey{prefixplural} key.

\begin{definition}[\DescribeMacro\ifglshasprefixfirst]
\cs{ifglshasprefixfirst}\marg{label}\marg{true part}\marg{false part}
\end{definition}
Does \meta{true part} if the entry identified by \meta{label} has a
non-empty value for the \gloskey{prefixfirst} key.

\begin{definition}[\DescribeMacro\ifglshasprefixfirstplural]
\cs{ifglshasprefixfirstplural}\marg{label}\marg{true part}\marg{false part}
\end{definition}
Does \meta{true part} if the entry identified by \meta{label} has a
non-empty value for the \csoptfmt{prefix\-first\-plural} key.

\begin{definition}[\DescribeMacro\glsentryprefix]
\cs{glsentryprefix}\marg{label}
\end{definition}
Displays the value of the \gloskey{prefix} key for the entry given
by \meta{label}.

\begin{definition}[\DescribeMacro\glsentryprefixfirst]
\cs{glsentryprefixfirst}\marg{label}
\end{definition}
Displays the value of the \gloskey{prefixfirst} key for the entry given
by \meta{label}.

\begin{definition}[\DescribeMacro\glsentryprefixplural]
\cs{glsentryprefixplural}\marg{label}
\end{definition}
Displays the value of the \gloskey{prefixplural} key for the entry given
by \meta{label}. (No check is performed to determine if the entry
exists.)

\begin{definition}[\DescribeMacro\glsentryprefixfirstplural]
\cs{glsentryprefixfirstplural}\marg{label}
\end{definition}
Displays the value of the \gloskey{prefixfirstplural} key for the entry given
by \meta{label}. (No check is performed to determine if the entry
exists.)

There are also variants that convert the first letter to upper
case\footnote{The earlier caveats about initial non-Latin characters
apply.}:
\begin{definition}[\DescribeMacro\Glsentryprefix]
\cs{Glsentryprefix}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro\Glsentryprefixfirst]
\cs{Glsentryprefixfirst}\marg{label}
\end{definition}
\begin{definition}[\DescribeMacro\Glsentryprefixplural]
\cs{Glsentryprefixplural}\marg{label}
\end{definition}

\begin{definition}[\DescribeMacro\Glsentryprefixfirstplural]
\cs{Glsentryprefixfirstplural}\marg{label}
\end{definition}

\begin{important}
As with analogous commands such as \ics{Glsentrytext}, these
commands aren't expandable so can't be used in PDF bookmarks.
\end{important}

\begin{example}{Adding Determiner to Glossary Style}{ex:plist}
You can use the above commands to define a new glossary style that
uses the determiner. For example, the following style is a slight
modification of the \glostyle{list} style that inserts the prefix
before the name:
\begin{verbatim}
\newglossarystyle{plist}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \glsentryprefix{##1}%
          \glstarget{##1}{\glossentryname{##1}}]
       \glossentrydesc{##1}\glspostdescription\space ##2}%
}
\end{verbatim}
If you want to change the prefix separator (\cs{glsprefixsep}) then
the following is better:
\begin{verbatim}
\newglossarystyle{plist}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \ifglshasprefix{##1}{\glsentryprefix{##1}\glsprefixsep}{}%
          \glstarget{##1}{\glossentryname{##1}}]
       \glossentrydesc{##1}\glspostdescription\space ##2}%
}
\end{verbatim}
The conditional is also useful if you want the style to use an
uppercase letter at the start of the entry item:
\begin{verbatim}
\newglossarystyle{plist}{%
  \setglossarystyle{list}%
  \renewcommand*{\glossentry}[2]{%
    \item[\glsentryitem{##1}%
          \glstarget{##1}%
          {%
            \ifglshasprefix{##1}%
            {\Glsentryprefix{##1}\glsprefixsep\glossentryname{##1}}%
            {\Glossentryname{##1}}%
          }]
       \glossentrydesc{##1}\glspostdescription\space ##2}%
}
\end{verbatim}
\end{example}

\chapter{Accessibility Support}\label{sec:accsupp}

Limited accessibility support is provided by the accompanying
\sty{glossaries-accsupp} package, but note that this package is
experimental and it requires the \sty{accsupp} package 
which is also listed as experimental. This package automatically
loads the \sty{glossaries} package. Any options are passed to
\sty{glossaries} (if it hasn't already been loaded). For example:
\begin{verbatim}
\usepackage[acronym]{glossaries-accsupp}
\end{verbatim}
This will load \sty{glossaries} with the \pkgopt{acronym} package
option as well as loading \sty{glossaries-accsupp}.

If you are using the \gls{glossaries-extra} extension package, you
need to load \gls{glossaries-extra} with the \pkgopt*{accsupp}
package option. For example:
\begin{verbatim}
\usepackage[abbreviations,accsupp]{glossaries-extra}
\end{verbatim}
This will load \gls{glossaries-extra} (with the
\pkgopt*{abbreviations} option), \sty{glossaries} and
\sty{glossaries-accsupp} and make appropriate patches to integrate
the accessibility support with the extension commands.

The \sty{glossaries-accsupp} package defines
additional keys that may be used when defining glossary entries.
The keys are as follows:
\begin{description}\raggedright
\item[{\gloskey{access}}] The replacement text corresponding to
the \gloskey{name} key.

\item[{\gloskey{textaccess}}] The replacement text corresponding
to the \gloskey{text} key.

\item[{\gloskey{firstaccess}}] The replacement text corresponding
to the \gloskey{first} key.

\item[{\gloskey{pluralaccess}}] The replacement text corresponding
to the \gloskey{plural} key.

\item[{\gloskey{firstpluralaccess}}] The replacement text corresponding
to the \gloskey{firstplural} key.

\item[{\gloskey{symbolaccess}}] The replacement text corresponding
to the \gloskey{symbol} key.

\item[{\gloskey{symbolpluralaccess}}] The replacement text corresponding
to the \gloskey{symbolplural} key.

\item[{\gloskey{descriptionaccess}}] The replacement text corresponding
to the \gloskey{description} key.

\item[{\gloskey{descriptionpluralaccess}}] The replacement text corresponding
to the \gloskey{descriptionplural} key.

\item[{\gloskey{longaccess}}] The replacement text corresponding to
the \gloskey{long} key (used by \ics{newacronym}).

\item[{\gloskey{shortaccess}}] The replacement text corresponding to
the \gloskey{short} key (used by \ics{newacronym}).

\item[{\gloskey{longpluralaccess}}] The replacement text corresponding to
the \gloskey{longplural} key (used by \ics{newacronym}).

\item[{\gloskey{shortpluralaccess}}] The replacement text corresponding to
the \gloskey{shortplural} key (used by \ics{newacronym}).

\item[{\gloskey{user1access}}] The replacement text corresponding to
the \gloskey{user1} key.

\item[{\gloskey{user2access}}] The replacement text corresponding to
the \gloskey{user2} key.

\item[{\gloskey{user3access}}] The replacement text corresponding to
the \gloskey{user3} key.

\item[{\gloskey{user4access}}] The replacement text corresponding to
the \gloskey{user4} key.

\item[{\gloskey{user5access}}] The replacement text corresponding to
the \gloskey{user5} key.

\item[{\gloskey{user6access}}] The replacement text corresponding to
the \gloskey{user6} key.
\end{description}
For example:
\begin{verbatim}
\newglossaryentry{tex}{name={\TeX},description={Document 
preparation language},access={TeX}}
\end{verbatim}
Now the \gls{linktext} produced by \verb|\gls{tex}| will be:
\begin{verbatim}
\BeginAccSupp{ActualText={TeX}}\TeX\EndAccSupp{}
\end{verbatim}
The sample file \samplefile{accsupp} illustrates the
\sty{glossaries-accsupp} package.

If you prefer to use \sty{accessibility} or \sty{tagpdf} instead of
\sty{accsupp} then you'll need to define \cs{gls@accsupp@engine} and
\cs{gls@accessibility} before loading \sty{glossaries-accsupp}. See
\ifpdf section~\ref*{sec:code:accsupp} \else the section
\qt{Accessibility Support}\fi in the documented code for further
details.

The PDF specification identifies three different types of
replacement text:
\begin{description}
\item[Alt] Description of some content that's non-textual (for
example, an image). A word break is assumed after the content.
\item[ActualText] A character or sequence of characters that
replaces textual content (for example, a dropped capital, a
ligature or a symbol). No word break is assumed after the content.
\item[E] Expansion of an abbreviation to avoid ambiguity (for
example, \qt{St} could be short for \qt{saint} or \qt{street}).
\end{description}

\begin{important}
Many PDF viewers don't actually support any type of replacement text. Some may
support \qt{ActualText} but not \qt{Alt} or \qt{E}. 
\href{https://pdfbox.apache.org/}{PDFBox}'s \qt{PDFDebugger} tool
can be used to inspect the PDF content to make sure that the
replacement text has been correctly set.
\end{important}

If you define abbreviations with \ics{newacronym}, the
\gloskey{shortaccess} field will automatically be set to:
\begin{definition}[\DescribeMacro\glsdefaultshortaccess]
\cs{glsdefaultshortaccess}\marg{long}\marg{short}
\end{definition}
With the base \styfmt{glossaries} package this just expands to
\meta{long}. With \gls{glossaries-extra} this expands to \meta{long}
(\meta{short}). This command must be fully expandable. It expands
when the abbreviation is defined.

As from \sty{glossaries-accsupp} v4.45, the helper command used to
identify the replacement text depends on the field name. Previous
versions just used:
\begin{definition}[\DescribeMacro\glsaccsupp]
\cs{glsaccsupp}\marg{replacement}\marg{content}
\end{definition}
for all fields. This is defined to use \texttt{ActualText}, which is
appropriate for symbols but not for abbreviations.

As from v4.45, there's a new helper command:
\begin{definition}[\DescribeMacro\glsfieldaccsupp]
\cs{glsfieldaccsupp}\marg{replacement}\marg{content}\marg{field}\marg{label}
\end{definition}
This will use \csmeta{gls}{field}{accsupp} if it's defined otherwise
it will just use \cs{glsaccsupp}. There are just two of these field
commands for \gloskey{short} and \gloskey{shortplural}:
\begin{definition}[\DescribeMacro\glsshortaccsupp]
\cs{glsshortaccsupp}\marg{replacement}\marg{content}
\end{definition}
which is like \cs{glsaccsupp} but uses \texttt{E} instead of
\texttt{ActualText} and
\begin{definition}[\DescribeMacro\glsshortplaccsupp]
\cs{glsshortplaccsupp}\marg{replacement}\marg{content}
\end{definition}
which just does \cs{glsshortaccsupp}\marg{replacement}\marg{content}.
Note that \meta{field} indicates the \emph{internal} field name
(such as \texttt{shortpl}) not the key name (such as
\texttt{shortplural}). See \tableref{tab:fieldmap}.

Rather than explicitly using \ics{BeginAccSupp}, these helper
commands can use:
\begin{definition}[\DescribeMacro\glsaccessibility]
\cs{glsaccessibility}\oarg{options}\marg{tag}\marg{value}\marg{content}
\end{definition}
where \meta{tag} is one of \texttt{E}, \texttt{Alt} or
\texttt{ActualText}. The replacement text for \meta{content} should be provided in
\meta{value}.
This does:
\begin{alltt}
\ics{BeginAccSupp}\mgroup{\meta{tag}=\marg{value},\meta{options}}\meta{content}\ics{EndAccSupp}\mgroup{}
\end{alltt}
but it also provides debugging information if \pkgopt[showaccsupp]{debug} is used.
If you explicitly use \cs{BeginAccSupp} instead of this command then
the debugging support won't be available.

You can define your own custom helper commands for specific fields
that require them. For example:
\begin{verbatim}
\newcommand{\glssymbolaccsupp}[2]{%
 \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
}
\end{verbatim}
This definition requires the replacement text to be specified with
the hexadecimal character code. For example:
\begin{verbatim}
\newglossaryentry{int}{name={int},description={integral},
  symbol={\ensuremath{\int}},symbolaccess={222B}
}
\end{verbatim}

If you are using \gls{glossaries-extra}, then \cs{glsfieldaccsupp}
will first test for the existence of
\csmetameta*{glsxtr}{category}{}{field}{accsupp}
and \csmeta*{glsxtr}{category}{accsupp} and then for
\csmeta{gls}{field}{accsupp}. For example:
\begin{verbatim}
\usepackage{siunitx}
\usepackage[accsupp]{glossaries-extra}

\glsnoexpandfields

\newcommand{\glsxtrsymbolaccsupp}[2]{%
 \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
}

\newcommand{\glsxtrunitaccsupp}[2]{\glsaccessibility{E}{#1}{#2}}

\newglossaryentry{cm}{name={\si{\centi\metre}},
 access={centimetre},
 description={centimetre},
 category=unit
}

\newglossaryentry{int}{name={\ensuremath{\int}},access={222B},
  description={integral},category={symbol}
}
\end{verbatim}
The above uses the \csmeta*{glsxtr}{category}{accsupp} form that
doesn't include the field name. Remember that if you want to supply
a command specifically for the \gloskey{name} field then it won't be
picked up by the \gloskey{text}, \gloskey{plural}, \gloskey{firstplural} and
\gloskey{first} fields. You'd need to supply them all. For example:
\begin{verbatim}
\newcommand{\glsnameaccsupp}[2]{%
 \glsaccessibility[method=hex,unicode]{ActualText}{#1}{#2}%
}
\newcommand{\glstextaccsupp}{\glsnameaccsupp}
\newcommand{\glspluralaccsupp}{\glsnameaccsupp}
\newcommand{\glsfirstaccsupp}{\glsnameaccsupp}
\newcommand{\glsfirstplaccsupp}{\glsnameaccsupp}
\end{verbatim}

See \ifpdf section~\ref*{sec:code:accsupp} in \fi the documented code
(\texttt{glossaries-code.pdf}) for further details. I~recommend
that you also read the \sty{accsupp} documentation.  See also the
\sty{accessibility} and \sty{tagpdf} packages.

\chapter{Sample Documents}
\label{sec:samples}

The \styfmt{glossaries} package is provided with some sample
documents that illustrate the various functions. These should
be located in the \texttt{samples} subdirectory (folder) of the
\styfmt{glossaries} documentation directory. This location varies
according to your operating system and \TeX\ distribution. You
can use \texttt{texdoc} to locate the main glossaries documentation.
For example, in a
\href{http://www.dickimaw-books.com/latex/novices/html/terminal.html}{terminal or command prompt}, type:
\begin{prompt}
texdoc -l glossaries
\end{prompt}
This should display a list of all the files in the \styfmt{glossaries}
documentation directory with their full pathnames. (The GUI version
of \texttt{texdoc} may also provide you with the information.)

If you can't find the sample files on your computer, they are also available
from your nearest CTAN mirror at
\url{http://mirror.ctan.org/macros/latex/contrib/glossaries/samples/}. 
Each sample file listed below has a hyperlink to the file's location on
the CTAN mirror.

The \gls{glossaries-extra} package and \gls{bib2gls}
provide some additional sample files. There are also examples in the
\gallery{}{Dickimaw Books Gallery}.

If you prefer to use UTF-8 aware engines (\texttt{xelatex} or
\texttt{lualatex}) remember that you'll need to switch from
\styfmt{fontenc} \& \styfmt{inputenc} to \styfmt{fontspec} where
appropriate.

\commandpromptnote
If you get any errors or unexpected results, check that you have up-to-date versions of
all the required packages. (Search the log file for lines starting
with \qt{\texttt{Package:\ }}.) Where \sty{hyperref} is loaded you will 
get warnings about non-existent references that look something like:
\begin{verbatim}
pdfTeX warning (dest): name{glo:aca} has been 
referenced but does not exist, replaced by a fixed one
\end{verbatim}
These warnings may be ignored on the first \LaTeX\ run. (The
destinations won't be defined until the glossary has been created.)

\section{Basic}
\label{sec:samplesbasic}

\exitem[minimal]{gls} This document is a
minimal working example. You can test your installation using this
file. To create the complete document you will need to do the
following steps:
  \begin{enumerate}
  \item Run \texttt{minimalgls.tex} through \LaTeX\ either by 
  typing
\begin{prompt}
pdflatex minimalgls
\end{prompt}
  in a terminal or by using the relevant button or menu item in
  your text editor or front-end. This will create the required 
  associated files but you will not see the glossary in the document.

  \item If you have Perl installed, run \gls{makeglossaries} on the document (\sectionref{sec:makeglossaries}). This can
  be done on a terminal by typing:
\begin{prompt}
makeglossaries minimalgls
\end{prompt}
  otherwise do:
\begin{prompt}
makeglossaries-lite minimalgls
\end{prompt}
  If for some reason you want to call \gls{makeindex} explicitly, you can do this
  in a terminal by typing (all on one line):
\begin{prompt}
makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
\end{prompt}
  See \sectionref{sec:makeindexapp} for further details on using 
   \gls*{makeindex} explicitly.

  Note that if the file name contains spaces, you will need to use
  the double-quote character to delimit the name.

  \item Run \texttt{minimalgls.tex} through \LaTeX\ again (as step~1)
  \end{enumerate}
You should now have a complete document. The number following
each entry in the glossary is the location number. By default, this 
is the page number where the entry was referenced.

The \pkgopt{acronym} package option creates a second glossary with
the label \texttt{acronym} (which can be referenced with
\cs{acronymtype}). If you decide to enable this option then there
will be a second set of glossary files that need to be processed by
\gls{makeindex}. If you use \gls{makeglossaries} or
\gls{makeglossaries-lite.lua} you don't need to worry about it, as
those scripts automatically detect which files need to be processed
and will run \gls{makeindex} (or \gls{xindy}) the appropriate number
of times.

If for some reason you don't want to use \gls{makeglossaries} or
\gls{makeglossaries-lite.lua} and you want the \pkgopt{acronym}
package option then the complete build process is:
\begin{prompt}
pdflatex minimalgls
makeindex -s minimalgls.ist -t minimalgls.glg -o minimalgls.gls minimalgls.glo
makeindex -s minimalgls.ist -t minimalgls.alg -o minimalgls.acr minimalgls.acn
pdflatex minimalgls
\end{prompt}

There are three other files that can be used as 
\href{http://www.dickimaw-books.com/latex/minexample/}{minimal working
examples}: \mirrorsamplefile{mwe-gls.tex}, \mirrorsamplefile{mwe-acr.tex} and
\mirrorsamplefile{mwe-acr-desc.tex}.

\glsxtrnote
If you want to try out the \gls{glossaries-extra} extension package,
you need to replace the package loading line:
\begin{alltt}
\cs{usepackage}[acronym]\mgroup{\strong{glossaries}}
\end{alltt}
with:
\begin{alltt}
\cs{usepackage}[acronym\strong{,\xtrfont{postdot},\xtrfont{stylemods}}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Note the different default package options. (You may omit the
\pkgopt{acronym} package option in both cases if you only want a
single glossary.) The \gls{glossaries-extra} package internally
loads the base \styfmt{glossaries} package so you don't need to
explicitly load both (in fact, it's better to let
\gls{glossaries-extra} load \styfmt{glossaries}).

Next, replace:
\begin{alltt}
\cs{setacronymstyle}\mgroup{long-short}
\end{alltt}
with:
\begin{alltt}
\ics*{setabbreviationstyle}[\strong{acronym}]\mgroup{long-short}
\end{alltt}
The optional argument \cat{acronym} identifies the category that
this style should be applied to. The \cs{newacronym} command
provided by the base \styfmt{glossaries} package is redefined by
\gls{glossaries-extra} to use \ics*{newabbreviation} with the category
set to \cat{acronym}.

If you prefer to replace \cs{newacronym} with \ics*{newabbreviation}
then the default category is \cat{abbreviation} so the style should
instead be:
\begin{alltt}
\ics*{setabbreviationstyle}[\strong{abbreviation}]\mgroup{long-short}
\end{alltt}
This is actually the default category if the optional argument is
omitted, so you can simply do:
\begin{alltt}
\ics*{setabbreviationstyle}\mgroup{long-short}
\end{alltt}
The \abbrstyle{long-short} style is the default for the
\cat{abbreviation} category so you can omit this line completely if
you replace \cs{newacronym}. (The default style for the
\cat{acronym} category is \abbrstyle{short-nolong}, which only shows
the short form on \gls{firstuse}.)

As mentioned earlier, the \pkgopt{acronym} package option creates a
new glossary with the label \texttt{acronym}. This is independent of
the \cat{acronym} category.  You can use the \pkgopt{acronym}
package option with either \cs{newacronym} or \ics*{newabbreviation}.

You may instead prefer to use the \pkgopt*{abbreviations} package
option, which creates a new glossary with the label \texttt{abbreviations}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{abbreviations}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
This can again be used with either \cs{newacronym} or
\ics*{newabbreviation}, but the file extensions are different. This
isn't a problem if you are using \gls{makeglossaries} or
\gls{makeglossaries-lite.lua}. If you are explicitly calling
\gls{makeindex} (or \gls{xindy}) then you need to modify the file
extensions.
See the \gls{glossaries-extra} user manual for further details.

If you use both the \pkgopt{acronym} and \pkgopt*{abbreviations}
package options then \cs{newacronym} will default to the
\texttt{acronym} glossary and \ics*{newabbreviation} will default to
the \texttt{abbreviations} glossary.

\bibglsnote
If you want to try \gls{bib2gls}, you first need to convert the
document to use \gls{glossaries-extra} as described above. Then add
the \pkgopt*{record} package option. For example:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next you need to convert the entry definitions into the
\filetype{bib} format required by \gls{bib2gls}. This can easily be
done with \gls{convertgls2bib}. For example:
\begin{prompt}
convertgls2bib -{}-preamble-only minimalgls.tex entries.bib
\end{prompt}
This will create a file called \strong{\nolinkurl{entries.bib}}. Next, replace:
\begin{alltt}
\cs{makeglossaries}
\end{alltt}
with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\strong{entries}]
\end{alltt}
Now remove all the entry definitions in the preamble
(\cs{longnewglossaryentry}, \cs{newglossaryentry} and \cs{newacronym}
or \cs{newabbreviation}). 

The abbreviation style command
must go before \ics*{GlsXtrLoadResources}. For example (if you are
using \cs{newacronym}):
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
Finally, replace:
\begin{verbatim}
\printglossaries
\end{verbatim}
with:
\begin{alltt}
\ics*{printunsrtglossaries}
\end{alltt}
The document build is now:
\begin{prompt}
pdflatex minimalgls
bib2gls minimalgls
pdflatex minimalgls
\end{prompt}

\exitem{DB} This document illustrates how
to load external files containing the glossary definitions. It also
illustrates how to define a new glossary type. This document has the
\gls{numberlist} suppressed and uses \hyperref[sec:glsadd]{\ics{glsaddall}} to add all
the entries to the glossaries without referencing each one
explicitly. (Note that it's more efficient to use
\gls{glossaries-extra} and \gls{bib2gls} if you have a large number
of entries.) To create the document do:
\begin{prompt}
pdflatex sampleDB
makeglossaries sampleDB
pdflatex sampleDB
\end{prompt}
or
\begin{prompt}
pdflatex sampleDB
makeglossaries-lite sampleDB
pdflatex sampleDB
\end{prompt}
The glossary definitions are stored in the accompanying files
\mirrorsamplefile{database1.tex} and \mirrorsamplefile{database2.tex}. If for some
reason you want to call \gls{makeindex} explicitly you must
have a separate call for each glossary:
\begin{enumerate}
\item Create the main glossary (all on one line):
\begin{prompt}
makeindex -s sampleDB.ist -t sampleDB.glg -o sampleDB.gls sampleDB.glo
\end{prompt}
\item Create the secondary glossary (all on one line):
\begin{prompt}
makeindex -s sampleDB.ist -t sampleDB.nlg -o sampleDB.not sampleDB.ntn
\end{prompt}
Note that both \gls{makeglossaries} and \gls{makeglossaries-lite.lua} do
this all in one call, so they not only make it easier because you
don't need to supply all the switches and remember all the
extensions but they also call \gls{makeindex} the appropriate number of times.
\end{enumerate}

\bibglsnote
If you want to switch to using \gls{bib2gls} with \gls{glossaries-extra}, you can convert
\mirrorsamplefile{database1.tex} and \mirrorsamplefile{database2.tex} to \filetype{bib}
files using \gls{convertgls2bib}:
\begin{prompt}
convertgls2bib database1.tex database1.bib
convertgls2bib database2.tex database2.bib
\end{prompt}
The document code then needs to be:
\begin{alltt}
\cs{documentclass}\mgroup{article}

\cs{usepackage}[colorlinks,plainpages=false]\mgroup{hyperref}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}

\strong{\ics{newglossary*}}\mgroup{punc}\mgroup{Punctuation Characters}

\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{database1},
 \strong{\xtrfont{selection}=all},\resourceopt{sort}=en]
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{database2},\strong{\xtrfont{type}=punc,}
 \strong{\xtrfont{selection}=all},\resourceopt{sort}=letter-case]

\cs{begin}\mgroup{document}
\xtrfont{\cs{print\strong{unsrt}glossaries}}
\cs{end}\mgroup{document}
\end{alltt}
Note that the \pkgopt{nonumberlist} package option has been omitted.
It's not needed because there are no locations in this amended
document (whereas in the original \samplefile{DB} locations are
created with \cs{glsaddall}). The starred \ics{newglossary*} is used
since the \gls{makeindex}/\gls{xindy} extensions are now irrelevant.

Instead of using \gls{makeglossaries} you need to use \gls{bib2gls} 
when you build the document:
\begin{prompt}
pdflatex sampleDB
bib2gls sampleDB
pdflatex sampleDB
\end{prompt}
Note that one \gls{bib2gls} call processes all the indexing (rather
than one call per glossary). Unlike \gls{makeindex} and \gls{xindy},
\gls{bib2gls} processes each resource set in turn, but the resource
sets aren't linked to a specific glossary. Multiple glossaries may
be processed in a single resource set or sub-blocks of a single
glossary may be processed by multiple resource sets. In this
example, there happens to be one resource set per glossary because
each glossary requires a different sort method. (A locale-sensitive
alphabetical sort for the first and a character code sort for the
second.)

If you want letter groups, you need to use the \bibglslongopt{group}
switch:
\begin{prompt}
bib2gls -{}-group sampleDB
\end{prompt}
and use an appropriate glossary style.

See also \bibglsgallery{sorting}, \bibglsbegin\ and the \gls{bib2gls} user manual.

\section{Acronyms and First Use}
\label{sec:sampleacronyms}

\exitem{Acr} This document has some
sample abbreviations. It also adds the glossary to the table of contents,
so an extra run through \LaTeX\ is required to ensure the document
is up to date:
\begin{prompt}
pdflatex sampleAcr
makeglossaries sampleAcr
pdflatex sampleAcr
pdflatex sampleAcr
\end{prompt}
(or use \gls{makeglossaries-lite.lua}).

Note that if the glossary is at the start of the document
and spans across multiple pages, then this can cause the locations
to be shifted. In that case, an extra \gls{makeglossaries} and
\LaTeX\ call are required. In this particular example, the glossary
is at the end of the document so it's not a problem. It's also not a
problem for a glossary at the start of the document if the page
numbering is reset at the end of the glossary. For example, if the
glossary is at the end of the front matter in a book-style document.

This document uses \ics{ifglsused} to determine whether to use
\qt{a} or \qt{an} in:
\begin{alltt}
\ldots\ is \ics{ifglsused}\mgroup{svm}\mgroup{an}\mgroup{a} \cs{gls}\mgroup{svm} \ldots
\end{alltt}
This clumsy bit of code can be tidied up with the
\sty{glossaries-prefix} package. Since that package automatically
loads \styfmt{glossaries} and passes all its options to the base
package it's possible to do a simple replacement of:
\begin{verbatim}
\usepackage[style=long,toc]{glossaries}
\end{verbatim}
with:
\begin{alltt}
\cs{usepackage}[style=long,toc]\mgroup{\strong{glossaries-prefix}}
\end{alltt}
The definition of \texttt{svm} now needs an adjustment:
\begin{alltt}
\ics{newacronym}[description=\mgroup{statistical pattern recognition 
technique\string~\cs{protect}\cs{cite}\mgroup{svm}},
\strong{prefixfirst=\mgroup{a\string~},prefix=\mgroup{an\ics{space}}}
]\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
\end{alltt}
The clumsy text can now simply be changed to:
\begin{alltt}
\ldots\ is \ics{pgls}\mgroup{svm} \ldots
\end{alltt}

\glsxtrnote
If you want to convert this sample document to use \gls{glossaries-extra},
you may want the patched version of the styles provided in \sty{glossary-long}, 
in which case you can also add \pkgopt*{stylemods}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{stylemods},}style=long]\mgroup{\strong{glossaries-extra}}
\end{alltt}
If you want to suppress all the other glossary style packages with
\pkgopt{nostyles}, then you need to specify exactly which package
(or packages) that you do want:
\begin{alltt}
\cs{usepackage}[\strong{nostyles,}\xtrfont{stylemods\strong{=long}},style=long]\mgroup{glossaries-extra}
\end{alltt}
(Now that \gls{glossaries-extra} is being used, there are more
available \qt{long} styles in the \sty*{glossary-longextra} package,
which you may prefer.)

If you want to use \sty{glossaries-prefix}, you can either load it
after \gls{glossaries-extra} or (with at least
\gls{glossaries-extra} v1.42) you can simply use the
\pkgopt*{prefix} package option.

Note that the \pkgopt{toc} package option has been dropped. This is
the default with \gls{glossaries-extra}, so it doesn't need to be
specified now. The document build is now shorter:
\begin{prompt}
pdflatex sampleAcr
makeglossaries sampleAcr
pdflatex sampleAcr
\end{prompt}
The third \LaTeX\ call is no longer required to make the table of
contents up-to-date. This is because \gls{glossaries-extra} provides
boilerplate text on the first \LaTeX\ call when the glossary files
are missing. This means that the glossary header is added to the
\filetype{toc} file on the first \LaTeX\ call, whereas with just the
base \styfmt{glossaries} package, the header isn't present until the
second \LaTeX\ call. (As with just the base \styfmt{glossaries}
package, if the glossary occurs at the start of the document without
a page reset after it then part of the build process needs repeating
to ensure all referenced page numbers are up-to-date. This problem isn't
specific to the \sty{glossaries} package.)

The other different default setting is the post-description
punctuation. The base package has \pkgopt[false]{nopostdot} as the
default. This means that a full stop (period) is automatically
inserted after the description in the glossary. The extension
package has \pkgopt[true]{nopostdot} as the default. If you want the
original behaviour then you can use \pkgopt[false]{nopostdot} or the
shorter synonym \pkgopt*{postdot}. 

The \gls{glossaries-extra} package has different
abbreviation handling that's far more flexible than that provided by
the base \styfmt{glossaries} package. The style now needs to be set with
\ics*{setabbreviationstyle} instead of \ics{setacronymstyle}:
\begin{alltt}
\strong{\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc}}
\ics{newacronym}\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
\end{alltt}
(Note the different style name \abbrstyle{long-short-sc} instead of
\acrstyle{long-sc-short} and the optional argument \cat{acronym}.) If you
prefer to replace \ics{newacronym} with \ics*{newabbreviation} then
omit the optional argument:
\begin{alltt}
\ics*{setabbreviationstyle}\mgroup{long-short-sc}
\ics*{newabbreviation}\mgroup{svm}\mgroup{svm}\mgroup{support vector machine}
\end{alltt}
(The optional argument of \ics*{setabbreviationstyle} is the
category to which the style should be applied. If it's omitted, 
\cat{abbreviation} is assumed. You can therefore have different
styles for different categories.)

Finally, you need to replace \ics{acrshort}, \ics{acrlong} and
\ics{acrfull} and their variants with \ics*{glsxtrshort}, \ics*{glsxtrlong} and
\ics*{glsxtrfull} etc.

\exitem{AcrDesc} This is similar to
the previous example, except that the abbreviations have an associated
description. As with the previous example, the glossary is added to
the table of contents, so an extra run through \LaTeX\ is required:
\begin{prompt}
pdflatex sampleAcrDesc
makeglossaries sampleAcrDesc
pdflatex sampleAcrDesc
pdflatex sampleAcrDesc
\end{prompt}
This document uses the \pkgopt{acronym} package option, which
creates a new glossary used by \cs{newacronym}. This leaves the
default \texttt{main} glossary available for general terms. However,
in this case there are no general terms so the \texttt{main}
glossary is redundant. The \pkgopt{nomain} package option will
prevent its creation. Obviously, if you decide to add some terms
with \cs{newglossaryentry} you will need to remove the
\pkgopt{nomain} option as the \texttt{main} glossary will now be
required.

\glsxtrnote
As with the previous example, if you want to convert this document
to use \gls{glossaries-extra} you need to make a few modifications.
The most obvious one is to replace \texttt{glossaries} with
\texttt{glossaries-extra} in the \cs{usepackage} argument. Again you
can omit \pkgopt{toc} as this is the default for
\gls{glossaries-extra}. As in the previous example, you may want to
use the patched styles. This document uses \glostyle{altlist} which
is provided by \sty{glossary-list}, so the style can be patched with
\pkgopt*{stylemods}.
\begin{alltt}
\cs{usepackage}[acronym,nomain,style=altlist\strong{,\xtrfont{stylemods}}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
You may prefer to replace the \pkgopt{acronym} option with
\pkgopt*{abbreviations}, but this will change the file extensions.
If you use \gls{makeglossaries} or \gls{makeglossaries-lite.lua} you
don't need to worry about it.

Again the style command needs to be changed:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc-desc}
\end{alltt}
(Note the change in style name \abbrstyle{long-short-sc-desc}
instead of \acrstyle{long-sc-short-desc} and the optional argument \cat{acronym}.) 

As with the previous example, if
you prefer to use \ics*{newabbreviation} instead of \ics{newacronym}
then you need to omit the optional argument:
\begin{alltt}
\ics*{setabbreviationstyle}\mgroup{long-short-sc-desc}
\end{alltt}
The original document uses:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\%
 \ics{acronymfont}\mgroup{\ics{glsentrytext}\mgroup{\#1}}}
\end{alltt}
to ensure that the cross-references (from the \gloskey{see} key) use
the acronym font. The new abbreviation styles don't
use \ics{acronymfont} so this isn't appropriate with
\gls{glossaries-extra}. If you're using at least version 1.42 of
\gls{glossaries-extra}, you don't need to do anything as it
automatically redefines \ics{glsseeitemformat} to take the style
formatting into account. If you have an earlier version you can
redefine this command as follows:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\%
 \ics{ifglshasshort}\mgroup{\#1}\mgroup{\ics*{glsfmttext}\mgroup{\#1}}\mgroup{\ics*{glsfmtname}\mgroup{\#1}}\%
}
\end{alltt}
This will just show the short form in the cross-reference. If you
prefer the name instead (which includes the short and long form) you can use:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\ics*{glsfmtname}\mgroup{\#1}}
\end{alltt}

The \gls{glossaries-extra} package provides two additional
cross-referencing keys \xtrgloskey{seealso} and \xtrgloskey{alias}, 
so \texttt{\gloskey{see}=\mgroup{[see also]\mgroup{svm}}}
can be replaced with a more appropriate key:
\begin{alltt}
\ics{newacronym}[description=\mgroup{Statistical pattern recognition 
technique using the ``kernel trick''},
\strong{\xtrgloskey{seealso}=\mgroup{svm}},
]\mgroup{ksvm}\mgroup{ksvm}\mgroup{kernel support vector machine}
\end{alltt}

Finally, as with the previous example, you need to replace
\ics{acrshort}, \ics{acrlong} and \ics{acrfull} etc with
\ics*{glsxtrshort}, \ics*{glsxtrlong} and \ics*{glsxtrfull} etc.

\bibglsnote
If you want to convert this document so that it uses \gls{bib2gls},
you first need to convert it to use \gls{glossaries-extra}, as above, 
but remember that you now need the \pkgopt*{record} option:
\begin{alltt}
\cs{usepackage}[acronym,nomain,style=altlist,\strong{\xtrfont{record},\xtrfont{postdot},\xtrfont{stylemods}}]
\mgroup{\strong{glossaries-extra}}
\end{alltt}
Now you need to convert the abbreviation definitions to the \filetype{bib}
format required by \gls{bib2gls}. This can be done with:
\begin{prompt}
convertgls2bib -{}-preamble-only sampleAcrDesc.tex entries.bib
\end{prompt}
If you retained \ics{newacronym} from the original example file,
then the new \nolinkurl{entries.bib} file will contain entries
defined with \atentry{acronym}. For example:
\begin{alltt}
\atentry{acronym}\mgroup{ksvm,
  description = \mgroup{Statistical pattern recognition technique
  using the ``kernel trick''},
  \xtrfont{seealso} = \mgroup{svm},
  short = \mgroup{ksvm},
  long = \mgroup{kernel support vector machine}
}
\end{alltt}
If you switched to \ics*{newabbreviation} then the entries will
instead be defined with \atentry{abbreviation}.

Next replace \cs{makeglossaries} with the resource command, but note
that the abbreviation style must be set first:
\begin{alltt}
\strong{\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-sc-desc}}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% terms defined in entries.bib
 \strong{\xtrfont{abbreviation-sort-fallback}=long}]
\end{alltt}
Another possibility is to make \atentry{acronym} behave as though it
was actually \atentry{abbreviation}:
\begin{alltt}
\strong{\ics*{setabbreviationstyle}\mgroup{long-short-sc-desc}}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{abbreviation-sort-fallback}=long\strong{,
 entry-type-aliases=\mgroup{acronym=abbreviation}}]
\end{alltt}
Note that the category is now \cat{abbreviation} not \cat{acronym} so the optional
argument of \ics*{setabbreviationstyle} needs adjusting.

If the \gloskey{sort} field is missing (which should usually be the
case), then both \atentry{acronym} and \atentry{abbreviation} will
fallback on the \gloskey{short} field (not the \gloskey{name} field,
which is usually set by the style and therefore not visible to
\gls{bib2gls}). For some styles, as in this example, it's more
appropriate to sort by the long form so the fallback is changed.
(Remember that you will break this fallback mechanism if you
explicitly set the sort value.) See the \gls{bib2gls} manual for
further details and other examples.

Remember to delete any \cs{newacronym} or \cs{newabbreviation} in
the \filetype{tex} file. 
Finally replace \cs{printglossary} with \ics*{printunsrtglossary}.
The document build is now:
\begin{prompt}
pdflatex sampleAcrDesc
bib2gls sampleAcrDesc
pdflatex sampleAcrDesc
\end{prompt}

Note that it's now much easier to revert back to the descriptionless
style used in \samplefile{Acr}:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{\strong{long-short-sc}}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries\strong{,\resourceopt{ignore-fields}=description}]
\end{alltt}
With the other options it would be necessary to delete all the
\gloskey{description} fields from the abbreviation definitions in
order to omit them, but with \gls{bib2gls} you can simply instruct
\gls{bib2gls} to ignore the description. This makes it much easier
to have a large database of abbreviations for use across multiple
documents that may or may not require the description.

\exitem{Desc} This is similar to the
previous example, except that it defines the abbreviations using
\ics{newglossaryentry} instead of \ics{newacronym}. As with the
previous example, the glossary is added to the table of contents, so
an extra run through \LaTeX\ is required:
\begin{prompt}
pdflatex sampleDesc
makeglossaries sampleDesc
pdflatex sampleDesc
pdflatex sampleDesc
\end{prompt}
This sample file demonstrates the use of the \gloskey{first} and
\gloskey{text} keys but in general it's better to use
\ics{newacronym} instead as it's more flexible. For even greater
flexibility use \ics*{newabbreviation} provided by \gls{glossaries-extra}.
For other variations, such as showing the symbol on \gls{firstuse},
you may prefer to make use of the post-link category hook. For
examples, see the section \qt{Changing the Formatting} in \bibglsbegin.

\exitem{FnAcrDesc} This document has some sample abbreviations that
use the \acrstyle{footnote-sc-desc} acronym style. As with the previous example, 
the glossary is added to the table of contents, so an extra run through 
\LaTeX\ is required:
\begin{prompt}
pdflatex sampleFnAcrDesc
makeglossaries sampleFnAcrDesc
pdflatex sampleFnAcrDesc
pdflatex sampleFnAcrDesc
\end{prompt}
\glsxtrnote
If you want to convert this sample document to use
\gls{glossaries-extra}, then you just need to follow the same steps
as for \samplefile{Acr} with a slight modification. This time the 
\abbrstyle{short-sc-footnote-desc} abbreviation style is needed:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{short-sc-footnote-desc}
\end{alltt}
The command redefinitions (performed with \cs{renewcommand}) should
now all be deleted as they are no longer applicable.

You may prefer to use the \abbrstyle{short-sc-postfootnote-desc}
style instead. There are subtle differences between the \abbrstyle{postfootnote} and
\abbrstyle{footnote} set of styles. Try changing the abbreviation style to
\abbrstyle{short-sc-footnote} and compare the location of the footnote marker
with the two styles.

This modified sample file now has a shorter build:
\begin{prompt}
pdflatex sampleFnAcrDesc
makeglossaries sampleFnAcrDesc
pdflatex sampleFnAcrDesc
\end{prompt}
This is because the \gls{glossaries-extra} package produces
boilerplate text when the glossary file is missing (on the first
\LaTeX\ run) which adds the glossary title to the table of contents
(\filetype{toc}) file.

\exitem{CustomAcr} This document has some sample abbreviations with a
custom acronym style. It also adds the glossary to the table of
contents, so an extra run through \LaTeX\ is required:
\begin{prompt}
pdflatex sampleCustomAcr
makeglossaries sampleCustomAcr
pdflatex sampleCustomAcr
pdflatex sampleCustomAcr
\end{prompt}
This is a slight variation on the previous example where the name is
in the form \meta{long} (\meta{short}) instead of \meta{short}
(\meta{long}), and the \gloskey{sort} key is set to the long form
instead of the short form.  On \gls{firstuse}, the footnote text is
in the form \meta{long}: \meta{description} (instead of just the
long form). This requires defining a new acronym
style that inherits from the \acrstyle{footnote-sc-desc} style.

\glsxtrnote
The conversion to \gls{glossaries-extra} starts in much the same way
as the previous examples:
\begin{alltt}
\cs{usepackage}[acronym,nomain,\strong{\xtrfont{postdot},\xtrfont{stylemods},}style=altlist]
\mgroup{\strong{glossaries-extra}}
\end{alltt}
The abbreviation styles have associated helper commands that may be
redefined to make minor modifications. These redefinitions should be
done before the abbreviations are defined.

The \abbrstyle{short-sc-footnote-desc} abbreviation style is the closest match
to the requirement, so replace the \cs{setacronymstyle} command
with:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{short-sc-footnote-desc}
\end{alltt}
Again, you may prefer \abbrstyle{short-sc-postfootnote-desc}. Both
styles use the same helper commands.

Next some adjustments need to be made to fit the new requirements.
The name needs to be \meta{long} (\meta{short}):
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescname}}\mgroup{\%
  \cs{protect}\strong{\ics*{glslongfont}\mgroup{\cs{the}\ics{glslongtok}}}\%
  \cs{protect}\ics*{glsxtrfullsep}\mgroup{\cs{the}\ics{glslabeltok}}\%
  \cs{protect}\ics*{glsxtrparen}\mgroup{\cs{protect}\strong{\ics*{glsabbrvfont}\mgroup{\cs{the}\ics{glsshorttok}}}}\%
}
\end{alltt}
This command expands when the abbreviations are defined so take care
to \cs{protect} commands that shouldn't be expanded at that point,
and make sure that the token registers that store the label, long
and short values are able to expand. Similarly the sort value needs
adjusting:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescsort}}\mgroup{\strong{\cs{the}\ics{glslongtok}}}
\end{alltt}
The footnote for all the footnote abbreviation styles is produced
with:
\begin{alltt}
\ics*{glsxtrabbrvfootnote}\marg{label}\marg{text}
\end{alltt}
where \meta{text} is the singular or plural long form, depending on
what command was used to reference the abbreviation (\cs{gls},
\cs{glspl} etc). This can simply be redefined as:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\%
  \#2: \ics{glsentrydesc}\mgroup{\#1}}}
\end{alltt}
This will mimic the result from the original sample document.

You may prefer to replace \verb|#2| with a reference to a
specific field (or fields). For example:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\%
 \ics*{Glsfmtlong}\mgroup{\#1} (\ics*{glsfmtshort}\mgroup{\#1}): \ics{glsentrydesc}\mgroup{\#1}.}}
\end{alltt}
As with the earlier \samplefile{AcrDesc}, you need to remove or change the redefinition of
\ics{glsseeitemformat} since \cs{acronymfont} is no longer appropriate.

In the original \texttt{sampleCustomAcr.tex} source code, I started
the description with a capital:
\begin{verbatim}
\newacronym[description={Statistical pattern recognition 
technique using the ``kernel trick''},
see={[see also]{svm}},
]{ksvm}{ksvm}{kernel support vector machine}
\end{verbatim}
This leads to a capital letter after the colon in the footnote,
which is undesirable, but I would like to have the description start
with a capital in the glossary. The solution to this problem is
easy with \gls{glossaries-extra}. I start the description with a
lowercase letter and set the \attr{glossdesc} attribute to
\optfmt{firstuc}:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{glossdesc}\mgroup{firstuc}
\end{alltt}
The abbreviation definitions are modified slightly:
\begin{alltt}
\ics{newacronym}[description=\mgroup{\strong{s}tatistical pattern recognition 
technique using the ``kernel trick''},
\strong{\xtrgloskey{seealso}=\mgroup{svm}},
]\mgroup{ksvm}\mgroup{ksvm}\mgroup{kernel support vector machine}
\end{alltt}
Note the use of the \xtrgloskey{seealso} key, which is only
available with \gls{glossaries-extra}.

If you prefer to use \ics*{newabbreviation} instead of
\ics{newacronym}, then the category needs to be
\cat{abbreviation} rather than \cat{acronym}:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{\strong{abbreviation}}\mgroup{glossdesc}\mgroup{firstuc}
\end{alltt}
and the style command needs to be adjusted so that it omits the
optional argument. For example:
\begin{alltt}
\ics*{setabbreviationstyle}\mgroup{short-sc-postfootnote-desc}
\end{alltt}

\exitem{-FnDesc} This example
defines a custom display format that puts the description in a
footnote on \gls{firstuse}.
\begin{prompt}
pdflatex sample-FnDesc
makeglossaries sample-FnDesc
pdflatex sample-FnDesc
\end{prompt}
In order to prevent nested hyperlinks, this document uses the
\pkgopt[false]{hyperfirst} package option (otherwise the footnote
marker hyperlink would be inside the hyperlink around the
\gls{linktext} which would result in a nested hyperlink).

\glsxtrnote
The \gls{glossaries-extra} package has category post-link hooks that
make it easier to adjust the formatting. The post-link hook is
placed after the hyperlink around the \gls{linktext}, so a hyperlink
created by \ics{footnote} in the post-link hook won't cause a nested
link. This means that the \pkgopt[false]{hyperfirst} option isn't
required:
\begin{alltt}
\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
\end{alltt}

\begin{important}
Never use commands like \cs{gls} or \cs{glsdesc} in the post-link
hook as you can end up with infinite recursion. Use commands that
don't themselves have a post-link hook, such as \cs{glsentrydesc} or
\cs{glossentrydesc}, instead.
\end{important}

In the original \texttt{sample-FnDesc.tex} file, the format was
adjusted with:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glsentryfmt}}\mgroup{\%
  \ics{glsgenentryfmt}
  \ics{ifglsused}\mgroup{\ics{glslabel}}\mgroup{}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}%
}
\end{alltt}
This can be changed to:
\begin{alltt}
\ics*{glsdefpostlink}
\mgroup{general}\% category label
\mgroup{\ics*{glsxtrifwasfirstuse}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}\mgroup{}}
\end{alltt}
This sets the post-link hook for the \cat{general} category
(which is the default category for entries defined with \ics{newglossaryentry}). If I
added some abbreviations (which have a different category) then this
change wouldn't apply to them.

The first paragraph in the document is:
\begin{verbatim}
First use: \gls{sample}.
\end{verbatim}
So the PDF will have the word \qt{sample} (the \gls{linktext}
created by \verb|\gls{sample}|) as a hyperlink to the entry in the
glossary followed by the footnote marker, which is a hyperlink to
the footnote. This is then followed by the sentence terminator. 
\qt{First use: sample\textsuperscript{1}.}

It would look tidier if the footnote marker could be shifted after
the full stop. \qt{First use: sample.\textsuperscript{1}} 
This can easily be achieved with a minor modification:
\begin{alltt}
\ics*{glsdefpostlink}
\mgroup{general}\% category label
\mgroup{\ics*{glsxtrifwasfirstuse}
 \mgroup{\ics*{glsxtrdopostpunc}\mgroup{\ics{footnote}\mgroup{\ics{glsentrydesc}\mgroup{\ics{glslabel}}}}}\%
 \mgroup{}\%
}
\end{alltt}
You may prefer to use \ics{glossentrydesc} instead of
\ics{glsentrydesc}. This will obey the \attr{glossdesc} attribute.
If you append \ics{glspostdescription}, you can also pick up the
\pkgopt*{postdot} package option. For example:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossdesc}\mgroup{firstuc}

\ics*{glsdefpostlink}
\mgroup{general}\% category label
\mgroup{\ics*{glsxtrifwasfirstuse}
 \mgroup{\ics*{glsxtrdopostpunc}\mgroup{\ics{footnote}\mgroup{\%
    \strong{\ics{glossentrydesc}}\mgroup{\ics{glslabel}}\strong{\ics{glspostdescription}}}}}\%
 \mgroup{}\%
}
\end{alltt}
Alternatively, you could just use \ics{Glsentrydesc} and explicitly
append the full stop.

\exitem{-custom-acronym}
This document illustrates how to define your own acronym style if
the predefined styles don't suit your requirements.
\begin{prompt}
pdflatex sample-custom-acronym
makeglossaries sample-custom-acronym
pdflatex sample-custom-acronym
\end{prompt}
In this case, a style is defined to show the short form in the text
with the long form and description in a footnote on \gls{firstuse}.
The long form is used for the \gloskey{sort} value.
The short form is displayed in \gls{smallcaps} in the main part of the
document but in uppercase in the list of acronyms. (So it's a slight
variation of some of the examples above.) The \gloskey{name} is set
to the long form (starting with an initial capital) followed by the
all caps short form in parentheses. The final requirement is that
the inline form should show the long form followed by the short form
in parentheses.

\glsxtrnote
As with \samplefile{FnAcrDesc}, the \abbrstyle{short-sc-footnote-desc}
and \abbrstyle{short-sc-postfootnote-desc} abbreviation styles produce 
almost the required effect so one of those can be used as a starting point. 
However the final requirement doesn't fit. It's now necessary to actually define a custom
abbreviation style, but it can mostly inherit from the
\abbrstyle{short-sc-footnote-desc} or \abbrstyle{short-sc-postfootnote-desc} style:
\begin{alltt}
\ics*{newabbreviationstyle}\mgroup{custom-fn}\%
\mgroup{\%
  \ics*{GlsXtrUseAbbrStyleSetup}\mgroup{short-sc-footnote-desc}\%
}\%
\mgroup{\%
  \ics*{GlsXtrUseAbbrStyleFmts}\mgroup{short-sc-footnote-desc}\%
  \cs{renewcommand}*\mgroup{\ics*{glsxtrinlinefullformat}}[2]\mgroup{\%
    \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{glsaccesslong}\mgroup{\#\#1}}\%
       \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
     \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
    \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshort}\mgroup{\#\#1}}}}\%
  }\%
  \cs{renewcommand}*\mgroup{\ics*{glsxtrinlinefullplformat}}[2]\mgroup{\%
    \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{glsaccesslongpl}\mgroup{\#\#1}}\%
       \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}%
    \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
    \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshortpl}\mgroup{\#\#1}}}}\%
  }%
  \cs{renewcommand}*\mgroup{\ics*{Glsxtrinlinefullformat}}[2]\mgroup{\%
    \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{Glsaccesslong}\mgroup{\#\#1}}\%
       \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
     \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
    \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshort}\mgroup{\#\#1}}}}\%
  }\%
  \cs{renewcommand}*\mgroup{\ics*{Glsxtrinlinefullplformat}}[2]\mgroup{\%
    \strong{\ics*{glsfirstlongfootnotefont}}\mgroup{\strong{\ics*{Glsaccesslongpl}\mgroup{\#\#1}}\%
       \ics*{ifglsxtrinsertinside}\#\#2\cs{fi}}\%
    \ics*{ifglsxtrinsertinside}\cs{else}\#\#2\cs{fi}\ics*{glsxtrfullsep}\mgroup{\#\#1}\%
    \ics*{glsxtrparen}\mgroup{\strong{\ics*{glsfirstabbrvscfont}\mgroup{\ics*{glsaccessshortpl}\mgroup{\#\#1}}}}\%
  }\%
}
\end{alltt}
(See the \gls{glossaries-extra} user manual for further details.)

This new custom style now needs to be set:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{custom-fn}
\end{alltt}
Remember that if you decide to use \ics*{newabbreviation} instead 
of \ics{newacronym} then the category will be \cat{abbreviation} not \cat{acronym}:
\begin{alltt}
\ics*{setabbreviationstyle}\mgroup{custom-fn}
\end{alltt}
This custom style simply adjusts the inline full form. There are other
adjustments to be made that apply to the inherited style. (The alternative is to
design a new style from scratch.) The footnote contains the long form followed by the
description. This is the same as the modification to an earlier
example:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}\mgroup{\#2:
\ics{glsentrydesc}\mgroup{\#1}.}}
\end{alltt}
As with \samplefile{CustomAcr}, if you specifically
want the singular long form then you can ignore the second argument.
For example:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrabbrvfootnote}}[2]\mgroup{\ics{footnote}
 \mgroup{\ics*{Glsfmtlong}\mgroup{\#1}: \ics{glsentrydesc}\mgroup{\#1}.}}
\end{alltt}

The \gloskey{name} now needs to be the long form followed by the
short form in parentheses, but note the new requirement that the
short form should now be in all capitals not \gls{smallcaps} and the
long form should start with a capital letter.
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescname}}\mgroup{\%
  \cs{protect}\ics*{glsfirstlongfootnotefont}
    \mgroup{\ics{makefirstuc}\mgroup{\cs{the}\ics{glslongtok}}}
  (\cs{protect}\ics{MakeTextUppercase}\mgroup{\cs{the}\ics{glsshorttok}})\%
}
\end{alltt}
The inherited abbreviation style uses the short form as the 
\gloskey{sort} value by default. This needs to be changed to the long form:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics*{glsxtrfootnotedescsort}}\mgroup{\cs{the}\strong{\ics{glslongtok}}}
\end{alltt}

\begin{bib2gls}
If you want to switch to using \gls{bib2gls}, remember to set the
abbreviation style before the resource command and change the
default sort fallback field to \gloskey{long}, as with
\samplefile{AcrDesc}.
\end{bib2gls}

\exitem{-dot-abbr} This document illustrates how to use the base
post link hook to adjust the space factor after abbreviations.
\begin{prompt}
pdflatex sample-dot-abbr
makeglossaries sampledot-abbrf
pdflatex sample-dot-abbr
\end{prompt}
This example creates a custom storage key that provides a similar
function to \gls{glossaries-extra}['s] \xtrgloskey{category} key.

\glsxtrnote
This example is much simpler with \gls{glossaries-extra}. The custom
storage key, which is defined using:
\begin{alltt}
\ics{glsaddstoragekey}\mgroup{abbrtype}\mgroup{word}\mgroup{\cs{abbrtype}}
\end{alltt}
can now be removed.

The \xtrgloskey{category} key is set to \texttt{initials} for
the initialisms (which are defined with the custom \cs{newacr}
command). The abbreviation styles can be set with:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\ics*{setabbreviationstyle}[initials]\mgroup{long-short}
\end{alltt}
The \attr{discardperiod} attribute will discard any full stop
(period) following commands like \cs{gls}:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{discardperiod}\mgroup{true}
\end{alltt}
(If you want to use the \attr{noshortplural} attribute then you will
also need to set the \attr{pluraldiscardperiod} attribute.)

The \gls{firstuse} is governed by the \attr{retainfirstuseperiod}
attribute. If set, the period won't be discarded if it follows the
\gls{firstuse} of commands like \cs{gls}. This is useful for styles
where the \gls{firstuse} doesn't end with the short form. In this
case, the \gls{firstuse} of the \abbrstyle{long-short} style ends
with a closing parenthesis, so the end of sentence might be clearer
if the period is retained:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{retainfirstuseperiod}\mgroup{true}
\end{alltt}

The \attr{insertdots} attribute can automatically insert dots into
the short form with a final space factor adjustment:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{initials}\mgroup{insertdots}\mgroup{true}
\end{alltt}

The custom helper command defined in the example needs to be
slightly modified:
\begin{alltt}
\cs{newcommand}*\mgroup{\cs{newabbr}}[1][]\mgroup{\%
 \strong{\ics*{newabbreviation}}[\strong{\xtrfont{category}}=initials,\#1]}
\end{alltt}
The definitions need to be slightly modified to work with the
\attr{insertdots} attribute:
\begin{alltt}
\cs{newabbr}\mgroup{eg}\mgroup{\strong{eg}}\mgroup{eg}
\cs{newabbr}\mgroup{ie}\mgroup{\strong{ie}}\mgroup{ie}
\cs{newabbr}\mgroup{bsc}\mgroup{\strong{B\mgroup{Sc}}}\mgroup{Bachelor of Science}
\cs{newabbr}\mgroup{ba}\mgroup{\strong{BA}}\mgroup{BA}
\cs{newabbr}\mgroup{agm}\mgroup{\strong{AGM}}\mgroup{AGM}
\end{alltt}
(This makes it much easier to change your mind if you decide at a
later date to omit the dots, especially if you are storing all your
definitions in a file that's shared across multiple documents, but
note the need to group \qt{Sc}.)

The \qt{laser} definition remains unchanged:
\begin{verbatim}
\newacronym{laser}{laser}{light amplification by stimulated
emission of radiation}
\end{verbatim}
The remaining code in the preamble must now be removed. (It will
interfere with \gls{glossaries-extra}['s] category post-link hooks.)
No change is required in the document body.

See the \gls{glossaries-extra} user manual for further details about
category attributes and post-link hooks.

\exitem{-font-abbr} This document illustrates how to have different fonts
for abbreviations within the style. The document build is:
\begin{prompt}
pdflatex sample-font-abbr
makeglossaries sample-font-abbr
pdflatex sample-font-abbr
\end{prompt}
The acronym mechanism provided by the base \styfmt{glossaries}
package isn't well suited to having a mixture of styles. This
example provides a workaround that involves defining a new storage
key with \ics{glsaddstoragekey} that's used to hold the font
declaration (such as \cs{em}).
\begin{verbatim}
\glsaddstoragekey{font}{}{\entryfont}
\end{verbatim}
A new custom acronym style is defined that fetches the font
information from this new key so that it can be applied to the
abbreviation. Some helper commands are also provided to define the
different types of abbreviation:
\begin{verbatim}
\newcommand*{\newitabbr}[1][]{\newacronym[font=\em,#1]}
\newcommand*{\newupabbr}{\newacronym}

\newitabbr{eg}{e.g.}{exempli gratia}
\newupabbr{bsc}{BSc}{Bachelor of Science}
\end{verbatim}
This makes the \gls{firstuse} of \verb|\gls{eg}| appear as \qt{exempli
gratia (\emph{e.g.})} whereas the \gls{firstuse} of \verb|\gls{bsc}|
is \qt{Bachelor of Science (BSc)}.

\glsxtrnote
This example document is much simpler with \gls{glossaries-extra}.
First the \cs{usepackage} command needs adjusting:
\begin{alltt}
\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The custom storage key can now be removed and also the custom
acronym style. Now replace the \ics{setacronymstyle} line with:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short-em}
\end{alltt}
and change the definition of the helper commands:
\begin{alltt}
\cs{newcommand}*\mgroup{\cs{newitabbr}}\mgroup{\ics{newacronym}}
\cs{newcommand}*\mgroup{\cs{newupabbr}}\mgroup{\strong{\ics*{newabbreviation}}}
\end{alltt}
Note that the \verb|font=\em,| part has been removed from the
definition of the first command and the second command uses
\ics*{newabbreviation} instead of \ics{newacronym}. This means that
\cs{newitabbr} will default to
\xtrgloskey{category}\csoptfmt{=acronym} and \cs{newupabbr} will
default to \xtrgloskey{category}\csoptfmt{=abbreviation}. The
default style for the \cat{abbreviation} category is
\abbrstyle{long-short}, which is the required style for this
example. This just means that only the \cat{acronym} category needs
to have the style set (with the above \ics*{setabbreviationstyle}
command).

Finally, the \ics{acrshort}, \ics{acrlong} and \cs{acrfull} commands
need to be replaced with \ics*{glsxtrshort}, \ics*{glsxtrlong} and
\ics*{glsxtrfull}.

You may notice that the spacing after \qt{e.g\@.} and \qt{i.e\@.}
isn't correct. This is similar to the \samplefile{-dot-abbr} example
where the space factor needs adjusting. In this case I've inserted
the dots manually (rather than relying on the \attr{insertdots}
attribute). You can either remove the dots and use \attr{insertdots}
with \attr{discardperiod}:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{insertdots}\mgroup{true}
\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{discardperiod}\mgroup{true}

\cs{newitabbr}\mgroup{eg}\mgroup{\strong{eg}}\mgroup{exempli gratia}
\cs{newitabbr}\mgroup{ie}\mgroup{\strong{ie}}\mgroup{id est}
\end{alltt}
Or you can manually insert the space factor adjustment and only use
the \attr{discardperiod} attribute:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{acronym}\mgroup{discardperiod}\mgroup{true}

\cs{newitabbr}\mgroup{eg}\mgroup{e.g.\strong{\ics{@}}}\mgroup{exempli gratia}
\cs{newitabbr}\mgroup{ie}\mgroup{i.e.\strong{\ics{@}}}\mgroup{id est}
\end{alltt}

You don't have to use the \cat{acronym} category. You may prefer a
different label that fits better semantically. For example:
\begin{alltt}
\ics*{setabbreviationstyle}[\strong{latinabbr}]\mgroup{long-short-em}
\cs{newcommand}*\mgroup{\cs{new\strong{latin}abbr}}[1][]\mgroup{\ics*{newabbreviation}[\xtrfont{category}=\strong{latinabbr},\#1]}
\ics*{glssetcategoryattribute}\mgroup{\strong{latinabbr}}\mgroup{insertdots}\mgroup{true}
\ics*{glssetcategoryattribute}\mgroup{\strong{latinabbr}}\mgroup{discardperiod}\mgroup{true}

\cs{new\strong{latin}abbr}\mgroup{eg}\mgroup{e.g.\strong{\ics{@}}}\mgroup{exempli gratia}
\cs{new\strong{latin}abbr}\mgroup{ie}\mgroup{i.e.\strong{\ics{@}}}\mgroup{id est}
\end{alltt}

\section{Non-Page Locations}
\label{sec:samplecounter}

\exitem{Eq} This document illustrates how
to change the location to something other than the page number. In
this case, the \ctrfmt{equation} counter is used since all glossary
entries appear inside an \env{equation} environment. To create
the document do:
\begin{prompt}
pdflatex sampleEq
makeglossaries sampleEq
pdflatex sampleEq
\end{prompt}
The \styfmt{glossaries} package provides some location formats, such
as \ics{hyperrm} and \ics{hyperbf}, that allow the locations in the \gls{numberlist}
to hyperlink to the appropriate place in the document (if
\sty{hyperref} has been used). Since it's not possible to include
the hyperlink name in the indexing information with \gls{makeindex}
and \gls{xindy}, the \styfmt{glossaries} package has to reform the
name from a prefix and the location value.

Unfortunately it's not always possible to split the link name into a
prefix and location.  That happens with the \ctrfmt{equation}
counter in certain classes, such as the \clsfmt{report} class (which
is used in this example). This means that it's necessary to redefine
\ics{theHequation} so that it has a format that fits the requirement:
\begin{verbatim}
\renewcommand*\theHequation{\theHchapter.\arabic{equation}}
\end{verbatim}
If you don't do this, the equation locations in the glossary won't
form valid hyperlinks.

Each glossary entry represents a mathematical symbol. This means
that with \optsto13 it's necessary to use the \gloskey{sort} key.
For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
description=Gamma function,\strong{sort=Gamma}}
\end{alltt}

\bibglsnote
If you want to switch to using \gls{bib2gls}, the first change you
need to make is to switch from explicitly loading
\styfmt{glossaries} to loading \gls{glossaries-extra} with the
\pkgopt*{record} package option. If \pkgopt+{only}{record} (or
\pkgopt*{record} without a value) is used, then the above
redefinition of \cs{theHequation} is still required. If
\pkgopt+{nameref}{record} is used instead then the redefinition of
\cs{theHequation} isn't required. You may also want to use the
\pkgopt*{stylemods} and \pkgopt*{postdot} options:
\begin{alltt}
\cs{usepackage}[\strong{\strong{\xtrfont{record=nameref}},\xtrfont{stylemods},\xtrfont{postdot}},
 ucmark,style=long3colheader,counter=equation]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The entries now need to be converted into the \filetype{bib} format required 
by \gls{bib2gls}, which can be done with \gls{convertgls2bib}:
\begin{prompt}
convertgls2bib -{}-preamble-only sampleEq.tex entries.bib
\end{prompt}
This will create a file called \nolinkurl{entries.bib} that starts:
\begin{alltt}
\% Encoding: UTF-8
\atentry{entry}\mgroup{Gamma,
  name = \mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}(z)}},
  description = \mgroup{Gamma function}
}
\end{alltt}
You may prefer to change \atentry{entry} to \atentry{symbol}. (This
should be easy to do with your text editor's search and replace
function.)

Note that the \gloskey{sort} key has been omitted. This is because
it typically shouldn't be used. The difference between using
\atentry{entry} and \atentry{symbol} is that with \atentry{entry}
the sort value will be obtained from the \gloskey{name} but with
\atentry{symbol} the sort value will be obtained from the label.
If you explicitly use the \gloskey{sort} key then you will break
this behaviour. (If you try this example out, notice the difference
in the ordering if you switch between \atentry{entry} and
\atentry{symbol}. See also \bibglsgallery{sorting}.)

Next replace \cs{makeglossaries} with:
\begin{alltt}
\strong{\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]}
\end{alltt}
If you have used \pkgopt+{nameref}{record} then you can remove the
redefinition of \cs{theHequation}. Next remove all the lines
defining the glossary entries (since they're now defined in the
\filetype{bib} file). 

Finally, replace \ics{printglossary} with \ics*{printunsrtglossary}:
\begin{alltt}
\strong{\ics*{printunsrtglossary}}[title=\mgroup{Index of Special Functions and 
Notations}]
\end{alltt}
The rest of the document remains unchanged (unless you want to use
\ics*{glsxtrfmt} as described in the following example).

\exitem{EqPg} This is similar to the previous example, but the \glspl{numberlist} are a
mixture of page numbers and equation numbers. This example adds the
glossary to the table of contents, so an extra \LaTeX\ run is
required:
\begin{prompt}
pdflatex sampleEqPg
makeglossaries sampleEqPg
pdflatex sampleEqPg
pdflatex sampleEqPg
\end{prompt}
As with the previous example, entries are defined like this:
\begin{verbatim}
\newglossaryentry{Gamma}{name=\ensuremath{\Gamma(z)},
description=Gamma function,sort=Gamma}
\end{verbatim}
The \pkgopt[equation]{counter} package option is used to set the
default indexing counter to \ctrfmt{equation}. This means that it
has to be changed for indexing outside of any numbered equation. For
example:
\begin{verbatim}
\glslink[format=hyperbf,counter=page]{Gamma}{gamma function}
\end{verbatim}
I've set the \gloskey[glslink]{format} to \locfmt{hyperbf} to indicate that
this is a primary reference. (Note that I'm using \ics{hyperbf} not
\ics{textbf} in order to include a hyperlink in the location.)

The \gls{linktext} here is almost identical to the
description. The only difference is that the description starts with
a capital. If it started with a lowercase character instead, I could
simply use \ics{glsdesc} instead of \ics{glslink}. If I change the
entry descriptions so that they all start with a lowercase letter
then I would need to create a custom glossary style that used
\ics{Glossentrydesc} instead of \ics{glossentrydesc}.

\glsxtrnote
If I switch to using \gls{glossaries-extra} I wouldn't need a new
glossary style. Instead I could just use the \attr{glossdesc}
attribute to perform the case change. Remember that the first change
to make is to replace \styfmt{glossaries} with
\gls{glossaries-extra}:
\begin{alltt}
\cs{usepackage}[style=long3colheader,\strong{\xtrfont{postdot},\xtrfont{stylemods}},
            counter=equation]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The entries are now all defined so that the description starts with
a lowercase letter (except for the descriptions that start with a
proper noun). For example:
\begin{alltt}
\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
description=\strong{g}amma function,sort=Gamma}
\end{alltt}
The \attr{glossdesc} attribute needs setting:
\begin{alltt}
\ics*{glssetcategoryattribute}\mgroup{general}\mgroup{glossdesc}\mgroup{firstuc}
\end{alltt}
This means that I can now use \ics{glsdesc} instead of \ics{glslink}.

It's a bit cumbersome typing \texttt{[format=hyperbf,counter=page]}
for each primary reference, but \gls{glossaries-extra} provides a
convenient way of having a third modifier for commands like \cs{gls}
and \cs{glstext}. This needs to be a single punctuation character
(but not \texttt{*} or \texttt{+} which are already in use). For
example:
\begin{alltt}
\ics*{GlsXtrSetAltModifier}\mgroup{\strong{!}}\mgroup{format=hyperbf,counter=page}
\end{alltt}
Now \texttt{\ics{glsdesc}\strong{!}\mgroup{Gamma}} is equivalent to:
\begin{alltt}
\ics{glsdesc}[format=hyperbf,counter=page]\mgroup{Gamma}
\end{alltt}
So the text at the start of the \qt{Gamma Functions} chapter is now
just:
\begin{alltt}
The \ics{glsdesc}!\mgroup{Gamma} is defined as
\end{alltt}
which is much more compact. Similar changes can be made for the
other instance of \ics{glslink} where the \gls{linktext} is just
the description:
\begin{alltt}
The \ics{glsdesc}!\mgroup{erf} is defined as
\end{alltt}

There are three other instances of \ics{glslink}, such as:
\begin{alltt}
\ics{glslink}\mgroup{Gamma}\mgroup{\cs{Gamma}(x+1)}
\end{alltt}
If I just use \verb|\gls{Gamma}| then I would get $\Gamma(z)$ as the
\gls{linktext}. For entries like this that represent functions with
variable parameters it would be more convenient (and help with
consistency) if a command was available to easily replace the
parameters.

With the base \styfmt{glossaries} package, one simple solution that
works for this example is to save just the function symbol in the 
\gloskey{symbol} field, for example:
\begin{alltt}
\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
\strong{symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}}},}
description=gamma function,sort=Gamma}
\end{alltt}
and then use:
\begin{alltt}
\strong{\ics{glssymbol}}\mgroup{Gamma}\strong[(\cs{Gamma}(x+1))\strong]
\end{alltt}
(which includes the function parameter inside the \gls{linktext}) or just:
\begin{alltt}
\ics{glssymbol}\mgroup{Gamma}(\cs{Gamma}(x+1))
\end{alltt}
(which has the function parameter after the \gls{linktext}).
This is a convenient approach where the extra material can simply
follow the symbol, and it can also be used with \gls{glossaries-extra}.

The \gls{glossaries-extra} package provides another possibility. It
requires a command that takes a single argument, for example:
\begin{verbatim}
\newcommand{\Gammafunction}[1]{\Gamma(#1)}
\end{verbatim}
The control sequence name (the command name without the leading
backslash) is stored in the field identified by the command \ics*{GlsXtrFmtField}
(this should be the internal field name not the key name, see \tableref{tab:fieldmap}). The
default is \field{useri} which corresponds to the \gloskey{user1}
key. This means that the \texttt{Gamma} entry would need to be
defined with \texttt{user1=Gammafunction}. With this approach, each
function entry would need a separate associated command.

Another approach is to store the parameterless function in the
\gloskey{symbol} key (as earlier) and have a more generic command that uses this
symbol. This requires the entry label, which can be obtained with
\cs{glslabel} within the \gls{linktext}:
\begin{alltt}
\cs{newcommand}\mgroup{\cs{entryfunc}}[1]\mgroup{\ics{glsentrysymbol}\mgroup{\ics{glslabel}}(\#1)}
\end{alltt}
(Obviously, this command can't be used outside of the \gls{linktext}
or post-link hooks since it uses \ics{glslabel}.)

So the entry now needs the parameterless function in 
\gloskey{symbol} and the control sequence name of this generic
command in \gloskey{user1}. For example:
\begin{alltt}
\ics{newglossaryentry}\mgroup{Gamma}\mgroup{name=\cs{ensuremath}\mgroup{\cs{Gamma}(z)},
\strong{symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{Gamma}}},user1=entryfunc,}
description=gamma function,sort=Gamma}
\end{alltt}
(This doesn't need to be done for the \texttt{C} and \texttt{G}
entries since they're constants not functions.)

You may want to consider providing helper commands to make the
functions easier to define. For example:
\begin{verbatim}
\newcommand{\func}[2]{#1(#2)}
\newcommand{\entryfunc}[1]{\func{\glsentrysymbol{\glslabel}}{#1}}
\newcommand{\newfunc}[5][]{%
 \newglossaryentry{#2}{name={\ensuremath{\func{#3}{#4}}},
   symbol={#3},
   user1={entryfunc},
   description={#5},
   sort={#2},#1
 }%
}
\end{verbatim}
The entries can now be defined using this custom \cs{newfunc}
command. For example:
\begin{verbatim}
\newfunc{Gamma}{\Gamma}{z}{gamma function}
\newfunc[sort=gamma1]{gamma}{\gamma}{\alpha,x}{lower 
  incomplete gamma function}
\newfunc[sort=Gamma2]{iGamma}{\Gamma}{\alpha,x}{upper 
  incomplete gamma function}
\end{verbatim}

Note that in \cs{newfunc} the \gloskey{symbol} key doesn't have its value
encapsulated with \ics{ensuremath} so \cs{glssymbol} will need to explicitly be
placed in math mode. If you switch to a glossary style that displays
the symbol, you will either need to adjust the definition of
\cs{newfunc} to use \ics{ensuremath} in the \gloskey{symbol} field
or you can add the encapsulation with the \attr{glosssymbolfont}
attribute.

Now \verb|\glslink{Znu}{Z_\nu}| can simply be replaced with
\texttt{\ics{glssymbol}\mgroup{Znu}} (no parameter is required in
this case). For the other cases, where the parameter is different
from that given in the \gloskey{text} field (which is obtained from
the \gloskey{name}), you can use \ics*{glsxtrfmt}. For example, 
\texttt{\cs{glslink}\mgroup{Gamma}\mgroup{\cs{Gamma}(x+1)}} can now be replaced with:
\begin{alltt}
\ics*{glsxtrfmt}\mgroup{Gamma}\mgroup{x+1}
\end{alltt}
This effectively works like \cs{glslink} but omits the post-link hook.
(See the \gls{glossaries-extra} user manual for further details.)

\begin{important}
Don't use \ics*{glsxtrfmt} within the argument of another \ics*{glsxtrfmt} command
(or inside any other \gls{linktext}).
\end{important}

Similarly \verb|\glslink{Gamma}{\Gamma(\alpha)}|
can now be replaced with:
\begin{alltt}
\ics*{glsxtrfmt}\mgroup{Gamma}\mgroup{\cs{alpha}}
\end{alltt}
Note that it's still possible to use:
\begin{alltt}
\ics{glssymbol}\mgroup{Gamma}[(\cs{alpha})]
\end{alltt}
You may prefer to define a helper command that makes it easier to
switch between your preferred method. For example:
\begin{verbatim}
\newcommand*{\Fn}[3][]{\glssymbol[#1]{#2}[(#3)]}
\end{verbatim}
or:
\begin{alltt}
\cs{newcommand}*\mgroup{\cs{Fn}}[3][]\mgroup{\ics*{glsxtrfmt}[\#1]\mgroup{\#2}\mgroup{\#3}}
\end{alltt}

\bibglsnote
If you want to convert this example so that it works with \gls{bib2gls}, first
convert it to use \gls{glossaries-extra} (as described above), and
then follow the instructions from \samplefile{Eq}. The
\gls{convertgls2bib} application recognises \cs{newcommand} so it
will be able to parse the custom \cs{newfunc} commands.

Note that \gls{bib2gls} allows you to separate the locations in the \gls{numberlist}
into different groups according to the counter used for the
location. This can be done with the \resourceopt{loc-counters}
resource option. It's also possible to identify primary formats
(such as \locfmt{hyperbf} used in this example) using the
\resourceopt{primary-location-formats} option. The primary locations
can then be given a more prominent position in the
\gls{numberlist}.  See the \gls{bib2gls} user manual for further
details.

\exitem{Sec} This document also
illustrates how to change the location to something other than the
page number. In this case, the \texttt{section} counter is used.
This example adds the glossary to the table of contents, so an extra
\LaTeX\ run is required:
\begin{prompt}
pdflatex sampleSec
makeglossaries sampleSec
pdflatex sampleSec
pdflatex sampleSec
\end{prompt}
Note that there are conflicting location formats, which trigger a
warning from \gls{makeindex}:
\begin{verbatim}
## Warning (input = sampleSec.glo, line = 6; output = 
sampleSec.gls, line = 9):
   -- Conflicting entries: multiple encaps for the same page 
under same key.

## Warning (input = sampleSec.glo, line = 2; output = 
sampleSec.gls, line = 10):
   -- Conflicting entries: multiple encaps for the same page 
under same key.
\end{verbatim}
This is the result of indexing an entry multiple times for the same
location\footnote{\gls{makeindex} assumes that the location is a
page number} with different values of the \gloskey[glslink]{format} key. In this case, 
it's caused by three references to the \texttt{ident} entry in section~2.1:
\begin{verbatim}
\gls[format=hyperit]{ident}
\glspl{ident} % default format=glsnumberformat
\gls*[format=hyperbf]{ident}
\end{verbatim}

If you use the \gls{makeglossaries} Perl script it will detect the warnings in the
\gls{makeindex} transcript file and attempt to fix the conflict by
removing entries from the \filetype{glo} file:
\begin{verbatim}
Multiple encaps detected. Attempting to remedy.
Reading sampleSec.glo...
Writing sampleSec.glo...
Retrying
\end{verbatim}
(Range formats have highest precedence. The default \locfmt{glsnumberformat}
has the lowest precedence.)

If you use \gls{makeglossaries-lite.lua} or call
\gls{makeindex} directly then the problem won't be fixed and the
glossary will end up with the rather odd \gls{numberlist} for the
identity matrix entry consisting of three references to section 2.1:
the first in the default font, followed by bold (\locfmt{hyperbf})
and then italic (\locfmt{hyperit}), which results in 2.1,
\textbf{2.1}, \textit{2.1}.  If you use \gls{makeglossaries} then
only the bold entry (\textbf{2.1}) will be present. 

If you switch to \gls{xindy}:
\begin{alltt}
\cs{usepackage}[\strong{xindy},style=altlist,toc,counter=section]\mgroup{glossaries}
\end{alltt}
then the conflict will be resolved using the number format attribute
list order of priority. In this case, \locfmt{glsnumberformat} has
the highest priority. This means that only the upright medium weight entry
(2.1) will be present. The simplest way of altering this is to
provide your own custom format. For example:
\begin{alltt}
\cs{newcommand}*\mgroup{\strong{\cs{primary}}}[1]\mgroup{\ics{hyperit}\mgroup{\#1}}
\ics{GlsAddXdyAttribute}\mgroup{\strong{primary}}
\end{alltt}
and change \verb|\gls[format=hyperit]| to \texttt{\cs{gls}[format=\strong{primary}]} etc.
This will give \csoptfmt{\gloskey[glslink]{format}=\locfmt{primary}} the highest priority.
(It's also better practice to provide this kind of semantic command.)

With \gls{bib2gls}, you can supply rules to deal with location format
conflicts, as illustrated below.

\bibglsnote
In order to switch to \gls{bib2gls}, first replace
\styfmt{glossaries} with \gls{glossaries-extra}, and add the \pkgopt*{record} 
package option. Remember that \gls{glossaries-extra} has a different
set of defaults and you may also want to patch the predefined base styles.
For example:
\begin{alltt}
\cs{usepackage}[style=altlist,\strong{\xtrfont{postdot},\xtrfont{stylemods}},counter=section]
\mgroup{\strong{glossaries-extra}}
\end{alltt}

The entry definitions now need to be converted into \gls{bib2gls}
format and saved in a \filetype{bib} file (say, \texttt{entries.bib}). You can use 
\gls{convertgls2bib}:
\begin{prompt}
convertgls2bib -{}-preamble-only sampleSec.tex entries.bib
\end{prompt} 

Next replace \ics{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[src=entries]
\end{alltt}
and remove all the \cs{newglossaryentry} commands.

Finally, replace \ics{printglossaries} with \ics*{printunsrtglossaries}.
The document build is now:
\begin{prompt}
pdflatex sampleSec
bib2gls sampleSec
pdflatex sampleSec
\end{prompt}
As with the original example, there's still a location format
conflict, which \gls{bib2gls} warns about:
\begin{verbatim}
Warning: Entry location conflict for formats: hyperbf and hyperit
Discarding: {ident}{}{section}{hyperbf}{2.1}
Conflicts with: {ident}{}{section}{hyperit}{2.1}
\end{verbatim}
This means that it has discarded the bold location and kept the
italic one. (As with \gls{makeglossaries}, range formats have the
highest priority and \locfmt{glsnumberformat} has the lowest.)

It would be better if the conflict could be merged into
a single location that was both bold and italic. To achieve this,
it's first necessary to define a command that produces this effect:
\begin{alltt}
\cs{newcommand}*\mgroup{\ics{hyperbfit}}[1]\mgroup{\cs{textbf}\mgroup{\cs{hyperit}\mgroup{\#1}}}
\end{alltt}
Now \gls{bib2gls} needs to be invoked with the appropriate mapping
with the \bibglslongopt{map-format} or \bibglsopt{m} switch:
\begin{prompt}
bib2gls -m \glsquote{hyperbf:hyperbfit,hyperit:hyperbfit} sampleSec
\end{prompt}
If you are using \app{arara} the directive should be:
\begin{alltt}
\% arara: bib2gls: \mgroup{ mapformats: [ [hyperbf, hyperbfit],
\% arara: -{}-> [hyperit, hyperbfit] ] }
\end{alltt}

If you try out this example, notice the difference between
\pkgopt+{only}{record} and \pkgopt+{nameref}{record}. If you use the
latter, the locations will now be the section titles rather than the
section numbers. If you use the \optfmt{nameref} setting you can customize the
location by defining the command:
\begin{alltt}
\csmeta*{glsxtr}{counter}{locfmt}\marg{location}\marg{title}
\end{alltt}

In this case the counter is \ctrfmt{section}, so the command should be 
\ics*{glsxtrsectionlocfmt}. It takes two arguments: the first is the
location and the second is the title. For example:
\begin{alltt}
\cs{newcommand}*\mgroup{\ics*{glsxtrsectionlocfmt}}[2]\mgroup{\ics{S}\#1 \#2}
\end{alltt}
(The only command of this type that is defined by default is the one
for the \ctrfmt{equation} counter, \ics*{glsxtrequationlocfmt}.) Make sure 
that you have at least version 1.42 of \gls{glossaries-extra}.

\section{Multiple Glossaries}
\label{sec:samplestype}

See also \samplefile{Sort} in \sectionref{sec:samplessort}, which
has three glossaries.

\exitem{Ntn} This document illustrates
how to create an additional glossary type. This example adds the
glossary to the table of contents, so an extra \LaTeX\ run is
required:
\begin{prompt}
pdflatex sampleNtn
makeglossaries sampleNtn
pdflatex sampleNtn
pdflatex sampleNtn
\end{prompt}
Note that if you want to call \gls{makeindex} explicitly instead of
using the \gls{makeglossaries} or \gls{makeglossaries-lite.lua}
scripts then you need to call \gls{makeindex} twice:
\begin{enumerate}
\item Create the main glossary (all on one line):
\begin{prompt}
makeindex -s sampleNtn.ist -t sampleNtn.glg -o sampleNtn.gls sampleNtn.glo
\end{prompt}
\item Create the secondary glossary (all on one line):
\begin{prompt}
makeindex -s sampleNtn.ist -t sampleNtn.nlg -o sampleNtn.not sampleNtn.ntn
\end{prompt}
\end{enumerate}
This document creates a new glossary using:
\begin{alltt}
\ics{newglossary}[nlg]\mgroup{notation}\mgroup{not}\mgroup{ntn}\mgroup{Notation}
\end{alltt}
This defines a glossary that can be identified with the label
\texttt{notation} with the default title \qt{Notation}. The other
arguments are the file extensions required with \optsand23. For those
two options, the \styfmt{glossaries} package needs to know the input
and output files required by \gls{makeindex} or \gls{xindy}. 

(The optional argument is the file extension of the indexing transcript
file, which \styfmt{glossaries} doesn't need to know about, but it
writes the information to the \filetype{aux} file for the benefit of
\gls{makeglossaries} and \gls{makeglossaries-lite.lua}.)

If you switch to a different indexing option then these file extensions
aren't required, in which case it's simpler to use the starred form:
\begin{alltt}
\ics{newglossary*}\mgroup{notation}\mgroup{Notation}
\end{alltt}

This example uses a label prefixing system\footnote{If you use
\sty{babel} with a language that makes the colon character
\texttt{:} active you will need to change the prefix.}\ to differentiate
between the different types of entries. For example, the term
\qt{set} is defined as:
\begin{verbatim}
\newglossaryentry{gls:set}{name=set,
description={A collection of distinct objects}}
\end{verbatim}
and the set notation is defined as:
\begin{verbatim}
\newglossaryentry{not:set}{type=notation,
name={\ensuremath{\mathcal{S}}},
description={A \gls{gls:set}},sort={S}}
\end{verbatim}
Notice that the latter description contains \cs{gls}. This means
you shouldn't use \ics{glsdesc} with this entry otherwise you will
end up with nested links.

\glsxtrnote
The \gls{glossaries-extra} package provides a command for use in
within field values to prevent nested \gls{linktext}:
\begin{alltt}
\ics*{glsxtrp}\marg{field}\marg{label}
\end{alltt}
There are convenient shortcuts for common fields:
\texttt{\ics*{glsps}\marg{label}} (for the \gloskey{short} field) and 
\texttt{\ics*{glspt}\marg{label}} (for the \gloskey{text}
field). So the set notation definition can be modified:
\begin{alltt}
\cs{newglossaryentry}\mgroup{not:set}\mgroup{type=notation,
name=\mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
description=\mgroup{A \strong{\ics*{glspt}\mgroup{gls:set}}},sort={S}}
\end{alltt}
This will stop the inner reference from causing interference if you use \ics{glsdesc}.
It will also suppress indexing within the glossary but will have a
hyperlink (if \styfmt{hyperref} is used).

The \gls{glossaries-extra} package provides a way of defining
commands like \cs{gls} that automatically insert a prefix. For
example:
\begin{alltt}
\ics*{glsxtrnewgls}\mgroup{not:}\mgroup{\cs{sym}}
\ics*{glsxtrnewglslike}\mgroup{gls:}\mgroup{\cs{term}}\mgroup{\cs{termpl}}\mgroup{\cs{Term}}\mgroup{\cs{Termpl}}
\end{alltt}
(there's no point providing commands for plural or case-changing with
symbols).  Now \verb|\gls{not:set}| can be replaced with \verb|\sym{set}| and
\verb|\gls{gls:set}| can be replaced with \verb|\term{set}|.

\bibglsnote
These two commands are primarily provided for the benefit of \gls{bib2gls} as
the information is written to the \filetype{aux} file. This allows
\gls{bib2gls} to recognise the custom commands if they have been
used in the \filetype{bib} files. When combined with
\resourceopt{label-prefix} and \resourceopt{ext-prefixes} (see
below) this makes it much simpler to change the prefixes if
necessary.

If you want to convert this document to use \gls{bib2gls}, remember
that you need the \pkgopt*{record} or \pkgopt+{nameref}{record}
option. For example:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record},}\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
\end{alltt}
As with earlier examples, \gls{convertgls2bib} can be used to
convert the entry definitions into the required \filetype{bib} format.
You may prefer to split the entries into separate files according to
type.\footnote{Requires at least \gls{bib2gls} v2.0.} This is useful 
if you want to reuse a large database of
entries across multiple documents as it doesn't lock you into using
a specific glossary.  For example:
\begin{prompt}
convertgls2bib -{}-split-on-type -{}-preamble-only sampleNtn.tex entries.bib
\end{prompt}
This will create a file called \nolinkurl{entries.bib} that contains
the entries that didn't have a \gloskey{type} assigned in the original
file, such as:
\begin{alltt}
\atentry{entry}\mgroup{gls:set,
  name = \mgroup{set},
  description = \mgroup{A collection of distinct objects}
}
\end{alltt}
It will also create a file called \nolinkurl{notation.bib} that
contains the entries that had the \gloskey{type} set to
\texttt{notation} in the original file, such as:
\begin{alltt}
\atentry{entry}\mgroup{not:set,
  name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
  description = \mgroup{A \ics*{glspt}\mgroup{gls:set}}
}
\end{alltt}
Note that the \gloskey{type} field has been removed. The above entry
in the \nolinkurl{notation.bib} file references a term in the
\nolinkurl{entries.bib} file. It's possible to strip all the
prefixes from the \filetype{bib} files and get \gls{bib2gls} to
automatically insert them. In which case, this cross-reference needs
adjusting to indicate that it's referring to an entry in another
file. This can be done with one of the special
\xtrfont{\texttt{ext\meta{n}.}}\ prefixes:
\begin{alltt}
\atentry{entry}\mgroup{\strong{set},
  name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
  description = \mgroup{A \ics*{glspt}\mgroup{\strong{\xtrfont{ext1.}}set}}
}
\end{alltt}
The corresponding term in the \nolinkurl{entries.bib} file is now:
\begin{alltt}
\atentry{entry}\mgroup{\strong{set},
  name = \mgroup{set},
  description = \mgroup{A collection of distinct objects}
}
\end{alltt}

Now you can replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\strong{\xtrfont{label-prefix}=\mgroup{gls:}}]
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{notation},\resourceopt{type}=notation,
 \strong{\xtrfont{label-prefix}=\mgroup{not:},\xtrfont{ext-prefixes}=\mgroup{gls:}}]
\end{alltt}
Remove all the \cs{newglossaryentry} definitions and replace \cs{printglossaries} with
\ics*{printunsrtglossaries}.

Regardless of how many resource sets the document contains, only one
\gls{bib2gls} call is required:
\begin{prompt}
pdflatex sampleNtn
bib2gls sampleNtn
pdflatex sampleNtn
\end{prompt}

You may notice that the ordering in the notations list has changed
from the original. This is because the \gloskey{sort} field was
automatically removed by \gls{convertgls2bib}, so the entries are
now sorted according to the \gloskey{name} field (since they are
defined with \atentry{entry}). You can use your text editor's search
and replace function to replace all instances of \atentry{entry}
with \atentry{symbol} in the \nolinkurl{notations.bib} file so that,
for example, the \texttt{set} definition becomes:
\begin{alltt}
\strong{\atentry{symbol}}\mgroup{set,
  name = \mgroup{\cs{ensuremath}\mgroup{\cs{mathcal}\mgroup{S}}},
  description = \mgroup{A \ics*{glspt}\mgroup{\xtrfont{ext1.}set}}
}
\end{alltt}
Now these \atentry{symbol} entries will be sorted according to their
label. (The original label in the \filetype{bib} file, not the
prefixed label.) This will put them in the same order as the original
document. (See the \qt{Examples} chapter of
the \gls{bib2gls} user manual for examples of varying the sorting
and also \bibglsgallery{sorting}.)

\exitem{-dual} This document
illustrates how to define an entry that both appears in the list of
acronyms and in the main glossary. To create the document do:
\begin{prompt}
pdflatex sample-dual
makeglossaries sample-dual
pdflatex sample-dual
\end{prompt}
This defines a custom command \ics{newdualentry} that defines two entries at once (a
normal entry and an abbreviation). It uses \ics{glsadd} to ensure
that if one is used then the other is automatically indexed:
\begin{verbatim}
\newcommand*{\newdualentry}[5][]{%
  % main entry:
  \newglossaryentry{main-#2}{name={#4},%
  text={#3\glsadd{#2}},%
  description={#5},%
  #1% additional options for main entry
  }%
  % abbreviation:
  \newacronym{#2}{#3\glsadd{main-#2}}{#4}%
}
\end{verbatim}
A sample dual entry is defined with this command:
\begin{verbatim}
\newdualentry{svm}% label
  {SVM}% abbreviation
  {support vector machine}% long form
  {Statistical pattern recognition technique}% description
\end{verbatim}
This defines an acronym with the label \texttt{svm} that can be
referenced with \verb|\gls{svm}| but it also defines an entry with
the label \texttt{main-svm}. This isn't used in the document with
\cs{gls} but it's automatically added from the
\texttt{\cs{glsadd}\mgroup{main-svm}} in the short form of
\texttt{svm}.

For this trivial document, this kind of dual entry is redundant and
unnecessarily leads the reader down a trail, first to the list of
acronyms and from there the reader then has to go to the main
glossary to look up the description. It's better to simply include
the description in the list of acronyms.

\bibglsnote
If you want to switch over to \gls{bib2gls}, first change to
\gls{glossaries-extra}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next, the definition needs to be converted to the \filetype{bib}
format required by \gls{bib2gls}. If you do:
\begin{prompt}
convertgls2bib -{}-preamble-only sample-dual.tex entries.bib
\end{prompt}
then \gls{convertgls2bib} will report the following:
\begin{verbatim}
Overriding default definition of \newdualentry with custom 
definition. (Change \newcommand to \providecommand if you want 
\newdualentry[options]{label}{short}{long}{description}
converted to @dualabbreviationentry.)
\end{verbatim}
This is because \gls{convertgls2bib} has its own internal definition
of \cs{newdualentry}, but if it encounters a new definition that
will override its default. If you want to retain
\gls{convertgls2bib}['s] definition (recommended) then just replace
\cs{newcommand} with \cs{providecommand} in the document source and
rerun \gls{convertgls2bib}.

With \cs{providecommand}, the new \nolinkurl{entries.bib} file
created by \gls{convertgls2bib} contains:
\begin{alltt}
\atentry{dualabbreviationentry}\mgroup{svm,
  short = \mgroup{SVM},
  description = \mgroup{Statistical pattern recognition technique},
  long = \mgroup{support vector machine}
}
\end{alltt}
If \cs{newcommand} is retained, it will instead contain:
\begin{alltt}
\atentry{entry}\mgroup{main-svm,
  name = \mgroup{support vector machine},
  description = \mgroup{Statistical pattern recognition technique},
  text = \mgroup{SVM\cs{glsadd}\mgroup{svm}}
}

\atentry{acronym}\mgroup{svm,
  short = \mgroup{SVM\cs{glsadd}\mgroup{main-svm}},
  long = \mgroup{support vector machine}
}
\end{alltt}
In the first case, \gls{bib2gls} creates two linked entries using
its primary-dual mechanism. In the second case, \gls{bib2gls}
creates two entries that simply reference each other.

Assuming that your \nolinkurl{entries.bib} file just contains
\atentry{dualabbreviationentry}, 
now replace \cs{makeglossaries} with:
\begin{alltt}
\cs{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
  \resourceopt{type}=acronym,\resourceopt{dual-type}=main,\resourceopt{dual-prefix}=\mgroup{main-}]
\end{alltt}

Then remove the definition of \cs{newdualentry} and the entry
definition. Finally, replace \cs{printglossaries} with
\ics*{printunsrtglossaries}.
The document build is:
\begin{prompt}
pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
\end{prompt}

If, instead, your \nolinkurl{entries.bib} file contains separate
\atentry{entry} and \atentry{acronym}, then you need:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
If you need \glspl{numberlist}, the document build is now
\begin{prompt}
pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
bib2gls sample-dual
pdflatex sample-dual
\end{prompt}
and this time \gls{bib2gls} complains about the use of \ics{glsadd}
within the \gloskey{short} and \gloskey{text} fields as this can be
problematic. (The extra \gls{bib2gls} and \LaTeX\ calls are
to ensure the \gls{numberlist} is up to date for the
\texttt{main-svm} entry, which can only be indexed with \cs{glsadd}
after \texttt{svm} has been defined.)

Dual entries make much more sense when one entry is for a glossary
with the description displayed but no \gls{numberlist}, and the
other is for the index without the description but with a
\gls{numberlist}. This can be created with by replacing
\atentry{dualabbreviationentry} with \atentry{dualindexabbreviation}:
\begin{alltt}
\atentry{dualindexabbreviation}\mgroup{svm,
  description = \mgroup{Statistical pattern recognition technique},
  short = \mgroup{SVM},
  long = \mgroup{support vector machine}
}
\end{alltt}
This can be mixed with \atentry{index} terms for example:
\begin{alltt}
\atentry{index}\mgroup{machlearn,
   name=\mgroup{machine learning}
}
\end{alltt}
The document needs modifying:
\begin{alltt}
\cs{documentclass}\mgroup{article}

\ics{usepackage}[\xtrfont{record},\xtrfont{postdot},
 nostyles,\xtrfont{stylemods}=\mgroup{\xtrfont{bookindex},list},\% only want bookindex and list styles
 acronym]\mgroup{glossaries-extra}

\ics*{setabbreviationstyle}\mgroup{long-short-desc}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
 \resourceopt{dual-type}=acronym,
 \xtrfont{label-prefix}=\mgroup{\strong{idx.}},\resourceopt{dual-prefix}=\mgroup{},
 \resourceopt{combine-dual-locations}=\mgroup{primary}]

\ics*{glsxtrnewglslike}\mgroup{\strong{idx.}}\mgroup{\strong{\cs{idx}}}\mgroup{\cs{idxpl}}\mgroup{\cs{Idx}}\mgroup{\cs{Idxpl}}

\cs{begin}\mgroup{document}
\cs{gls}\mgroup{svm} and \strong{\cs{idx}}\mgroup{machlearn}.

\ics*{printunsrtglossary}[type=\acronymtype,style=altlist]
\ics*{printunsrtglossary}[style=bookindex,title=\mgroup{Index}]
\cs{end}\mgroup{document}
\end{alltt}
See the \gls{bib2gls} manual for further details.

\exitem{-langdict} This document
illustrates how to use the glossaries package to create English
to French and French to English dictionaries. To create the document
do:
\begin{prompt}
pdflatex sample-langdict
makeglossaries sample-langdict
pdflatex sample-langdict
\end{prompt}
This example uses the \pkgopt{nomain} package option to prevent the
creation of the \texttt{main} glossary. This means that the document
must provide its own glossaries:
\begin{verbatim}
\newglossary[glg]{english}{gls}{glo}{English to French}
\newglossary[flg]{french}{flx}{flo}{French to English}
\end{verbatim}
This means that if you want to call \gls{makeindex} explicitly
you need to take these new extensions into account:
\begin{prompt}
makeindex -s sample-langdict.ist -t sample-langdict.glg -o sample-langdict.gls sample-langdict.glo
makeindex -s sample-langdict.ist -t sample-langdict.flg -o sample-langdict.flx sample-langdict.flo
\end{prompt}
As with the previous example, this document provides a custom
command that defines two related entries:
\begin{verbatim}
\newcommand*{\newword}[4]{%
  \newglossaryentry{en-#1}{type=english,name={#2},description={#3 #4}}%
  \newglossaryentry{fr-#1}{type=french,name={#3 #4},text={#4},sort={#4},
    description={#2}}%
}
\end{verbatim}
This has the syntax:
\begin{alltt}
\cs{newword}\marg{label}\marg{english}\marg{determiner}\marg{french}
\end{alltt}
(Note that this trivial example doesn't take plurals into account.)
This custom command will define two terms with labels \texttt{en-\meta{label}} (for
the English term) and \texttt{fr-\meta{label}} (for the French term).
So
\begin{verbatim}
\newword{cat}{cat}{le}{chat}
\end{verbatim}
is equivalent to:
\begin{verbatim}
\newglossaryentry{en-cat}{type=english,name={cat},description={le chat}}
\newglossaryentry{fr-cat}{type=french,name={le chat},sort={chat},
  description={cat}}
\end{verbatim}

Unlike the previous example (\samplefile{-dual}), there's no link
between these two entries. If the document only uses
\verb|\gls{en-cat}|, then the \texttt{en-cat} entry will appear in the
\texttt{english} glossary but the \texttt{fr-cat} entry won't
appear in the \texttt{french} one.

\bibglsnote
If you want to switch to \gls{bib2gls} then you first need to
convert the document so that it uses \gls{glossaries-extra}, but
include the \pkgopt*{prefix} option to ensure that
\sty{glossaries-prefix} is also loaded:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record},\xtrfont{prefix}},\xtrfont{postdot},\xtrfont{stylemods},nomain]\mgroup{\strong{glossaries-extra}}
\end{alltt}
You don't need to worry about file extensions now, so it's simpler
to use the starred form of \cs{newglossary}:
\begin{alltt}
\cs{newglossary}\strong{*}\mgroup{english}\mgroup{English to French}
\cs{newglossary}\strong{*}\mgroup{french}\mgroup{French to English}
\end{alltt}
Next the entries need to be converted to the \filetype{bib} format
required by \gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-only-preamble sample-langdict.tex entries.bib
\end{prompt}
This creates the file \nolinkurl{entries.bib} that contains entries
defined like:
\begin{alltt}
\atentry{entry}\mgroup{en-cat,
  name = \mgroup{cat},
  description = \mgroup{le chat},
  type = \mgroup{english}
}

\atentry{entry}\mgroup{fr-cat,
  name = \mgroup{le chat},
  description = \mgroup{cat},
  text = \mgroup{chat},
  type = \mgroup{french}
}
\end{alltt}
(Note that the \gloskey{sort} field has been omitted.)

This would be more flexible, and much briefer, if these entries were
defined using \gls{bib2gls}['s] dual entry system combined with the
\sty{glossaries-prefix} package:
\begin{alltt}
\atentry{dualentry}\mgroup{cat,
  name = \mgroup{chat},
  description = \mgroup{cat},
  \gloskey{prefix} = \mgroup{le},
  \gloskey{prefixplural} = \mgroup{les}
}
\end{alltt}
Similarly for the \qt{chair} entry:
\begin{alltt}
\atentry{dualentry}\mgroup{chair,
  name = \mgroup{chaise},
  description = \mgroup{chair},
  \gloskey{prefix} = \mgroup{la},
  \gloskey{prefixplural} = \mgroup{les}
}
\end{alltt}

With \atentry{dualentry}, the English and French terms are now
automatically linked from \gls{bib2gls}['s] point of view. If only one
is referenced in the document, the other will also be added by default.

Now that the determiner has been moved out of the description, it
won't show in the glossary. However, it's possible to include it by
providing a command to encapsulate the description (which can also
apply the language change as well).

\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\% entries.bib
 \xtrfont{append-prefix-field}=\mgroup{space},
 \resourceopt{category}=\mgroup{same as type},\resourceopt{dual-category}=\mgroup{same as type},
 \xtrfont{label-prefix}=\mgroup{en-},\resourceopt{dual-prefix}=\mgroup{fr-},
 \resourceopt{type}=english,\resourceopt{dual-type}=french,
 \resourceopt{sort}=en,\resourceopt{dual-sort}=fr]

\cs{newcommand}\mgroup{\cs{FrEncap}}[1]\mgroup{\%
 \ics{foreignlanguage}\mgroup{french}\mgroup{\ics{glsentryprefix}\mgroup{\ics{glscurrententrylabel}}\#1}}
\cs{newcommand}\mgroup{\cs{EnEncap}}[1]\mgroup{\ics{foreignlanguage}\mgroup{english}\mgroup{\#1}}

\ics*{glssetcategoryattribute}\mgroup{english}\mgroup{glossnamefont}\mgroup{EnEncap}
\ics*{glssetcategoryattribute}\mgroup{english}\mgroup{glossdescfont}\mgroup{FrEncap}
\ics*{glssetcategoryattribute}\mgroup{french}\mgroup{glossnamefont}\mgroup{FrEncap}
\ics*{glssetcategoryattribute}\mgroup{french}\mgroup{glossdescfont}\mgroup{EnEncap}
\end{alltt}

Remember to remove \cs{makeglossaries}, the definition of \cs{newword} and
the entry definitions from the document preamble, and 
replace \cs{printglossary} with:
\begin{alltt}
\ics*{printunsrtglossary}
\end{alltt}

Other refinements that you might like to make include using
\ics*{glsxtrnewglslike} so you don't have to worry about the label
prefix (\qt{en-} and \qt{fr-}).

\exitem{-index} This document uses
the \styfmt{glossaries} package to create both a glossary and an
index. This requires two \gls{makeglossaries} (or
\gls{makeglossaries-lite.lua}) calls to ensure the
document is up to date:
\begin{prompt}
pdflatex sample-index
makeglossaries sample-index
pdflatex sample-index
makeglossaries sample-index
pdflatex sample-index
\end{prompt}

\section{Sorting}
\label{sec:samplessort}

\exitem{People} This document illustrates how you can hook into the
standard sort mechanism to adjust the way the sort key is set. This
requires an additional run to ensure the table of contents is
up-to-date:
\begin{prompt}
pdflatex samplePeople
makeglossaries samplePeople
pdflatex samplePeople
pdflatex samplePeople
\end{prompt}
This provides two commands for typesetting a name:
\begin{verbatim}
\newcommand{\sortname}[2]{#2, #1}
\newcommand{\textname}[2]{#1 #2}
\end{verbatim}
where the first argument contains the forenames and the second is the
surname. The first command is the one required for sorting the name
and the second is the one required for displaying the name in the
document. A synonym is then defined:
\begin{verbatim}
\let\name\textname
\end{verbatim}
This command defaults to the display name command (\cs{textname})
but is temporarily redefined to the sort name command (\cs{sortname})
within the \gloskey{sort} field assignment hook:
\begin{alltt}
\cs{renewcommand}\mgroup{\ics{glsprestandardsort}}[3]\mgroup{\%
 \strong{\cs{let}\cs{name}\cs{sortname}}
 \cs{edef}\#1\mgroup{\cs{expandafter}\cs{expandonce}\cs{expandafter}\mgroup{#1}}\%
 \strong{\cs{let}\cs{name}\cs{textname}}
 \ics{glsdosanitizesort}
}
\end{alltt}
The people are defined using the custom \cs{name} command:
\begin{alltt}
\cs{newglossaryentry}\mgroup{joebloggs}\mgroup{name=\mgroup{\strong{\cs{name}}\mgroup{Joe}\mgroup{Bloggs}},
 description=\mgroup{\cs{nopostdesc}}}
\end{alltt}
Since \cs{name} is temporarily changed while the \gloskey{sort} key
is being assigned, the sort value for this entry ends up as
\qt{Bloggs, Joe}, but the name appears in the document as \qt{Joe Bloggs}.

\bibglsnote
If you want to use \gls{bib2gls}, you first need to convert the
document to use \gls{glossaries-extra} but make sure you include the
\pkgopt*{record} option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{stylemods},style=listgroup]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next it's necessary to convert the entry definitions to the
\filetype{bib} format required by \gls{bib2gls}. You can simply do:
\begin{prompt}
convertgls2bib -{}-preamble-only samplePeople people.bib
\end{prompt}
which will create a file called \nolinkurl{people.bib} that contains
definitions like:
\begin{alltt}
\atentry{entry}\mgroup{joebloggs,
  name = \mgroup{\cs{name}\mgroup{Joe}\mgroup{Bloggs}},
  description = \mgroup{\ics{nopostdesc}}
}
\end{alltt}
However, you may prefer to use the \texttt{-{}-index-conversion}
(\texttt{-i}) switch:
\begin{prompt}
convertgls2bib -i -{}-preamble-only samplePeople people.bib
\end{prompt}
This will discard the \gloskey{description} field and use
\atentry{index} instead of \atentry{entry} if the
\gloskey{description} is either empty or simply set to \ics{nopostdesc} or
\ics*{glsxtrnopostpunc}. The \nolinkurl{people.bib} file now
contains definitions like:
\begin{alltt}
\atentry{index}\mgroup{joebloggs,
  name = \mgroup{\cs{name}\mgroup{Joe}\mgroup{Bloggs}}
}
\end{alltt}
Regardless of which approach you used to create the \filetype{bib}
file, you now need to edit it to provide a definition of the custom
\cs{name} command for \gls{bib2gls}['s] use:
\begin{alltt}
\atentry{preamble}\mgroup{"\strong{\ics{providecommand}}\mgroup{\cs{name}}[2]\mgroup{\#2, \#1}"}
\end{alltt}
Note the use of \cs{providecommand} instead of \cs{newcommand}.

In the document (\nolinkurl{samplePeople.tex}) you now need to
delete \cs{makeglossaries}, the definitions of \cs{sortname},
\cs{textname}, \cs{name}, \cs{glsprestandardsort}, and all the entry
definitions. Then add the following to the document preamble:
\begin{alltt}
\cs{newcommand}\mgroup{\cs{name}}[2]\mgroup{\#1 \#2}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=people]
\end{alltt}
Next, use your text editor's search and replace function to
subsitute all instances of \cs{glsentrytext} in the chapter
headings with \ics*{glsfmttext}. For example:
\begin{alltt}
\ics{chapter}\mgroup{\strong{\ics*{glsfmttext}}\mgroup{joebloggs}}
\end{alltt}
Finally, replace \cs{printunsrtglossaries} with:
\begin{alltt}
\ics*{printunsrtglossaries}
\end{alltt}
The document build is now:
\begin{prompt}
pdflatex samplePeople
bib2gls samplePeople
pdflatex samplePeople
pdflatex samplePeople
\end{prompt}
The third \LaTeX\ call is required to ensure that the PDF bookmarks
are up to date, as the entries aren't defined until after the
\gls{bib2gls} run (which is why you have to use \ics*{glsfmttext}
instead of \cs{glsentrytext}).

This again leads to a list sorted by surname. The reason this works
is because \gls{bib2gls} only sees the definition of \cs{name}
provided in \atentry{preamble}, but the document uses the definition
of \cs{name} provided before \cs{GlsXtrLoadResources}. The use of
\ics{providecommand} in \atentry{preamble} prevents \cs{name} from 
being redefined within the document.

See also the \qt{Examples} chapter of the \gls{bib2gls} user manual,
which provides another \qt{people} example.

\exitem{Sort} This is another document that illustrates how to hook
into the standard sort mechanism. An additional run is required to
ensure the table of contents is up-to-date:
\begin{prompt}
pdflatex sampleSort
makeglossaries sampleSort
pdflatex sampleSort
pdflatex sampleSort
\end{prompt}
This document has three glossaries (\texttt{main}, \texttt{acronym}
and a custom \texttt{notation}), so if you want to use
\gls{makeindex} explicitly you will need to have three
\gls{makeindex} calls with the appropriate file extensions:
\begin{prompt}
pdflatex sampleSort
makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
makeindex -s sampleSort.ist -t sampleSort.nlg -o sampleSort.not sampleSort.ntn
pdflatex sampleSort
pdflatex sampleSort
\end{prompt}
It's much simpler to just use \gls{makeglossaries} or \gls{makeglossaries-lite.lua}.

In this example, the sort hook is adjusted to ensure the list of
notation is sorted according to the order of definition. A new
counter is defined to keep track of the entry number:
\begin{verbatim}
\newcounter{sortcount}
\end{verbatim}
The sort hook is then redefined to increment this counter and assign
the sort key to that numerical value, but only for the
\texttt{notation} glossary. The other two glossaries have their sort
keys assigned as normal:
\begin{verbatim}
\renewcommand{\glsprestandardsort}[3]{%
  \ifdefstring{#2}{notation}%
  {%
     \stepcounter{sortcount}%
     \edef#1{\glssortnumberfmt{\arabic{sortcount}}}%
  }%
  {%
     \glsdosanitizesort
  }%
}
\end{verbatim}
This means that \gls{makeindex} will sort the notation in numerical order.

\glsxtrnote
If you want to convert this document to use \gls{glossaries-extra},
a much simpler approach is available with its hybrid method. First
change the package loading line to:
\begin{alltt}
\cs{usepackage}[\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Either remove \cs{setacronymstyle} and replace all instances of
\cs{newacronym} with \ics*{newabbreviation} or replace:
\begin{verbatim}
\setacronymstyle{long-short}
\end{verbatim}
with:
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\end{alltt}

The custom counter and redefinition of \cs{glsprestandardsort} can now
be removed. The file extensions for the custom \texttt{notation}
glossary are no longer relevant so the glossary definition can be
changed to:
\begin{alltt}
\cs{newglossary\strong{*}}\mgroup{notation}\mgroup{Notation}
\end{alltt}
The \ics{makeglossaries} command now needs to be adjusted to
indicate which glossaries need to be processed by \gls{makeindex}:
\begin{alltt}
\cs{makeglossaries}\strong{[main,acronym]}
\end{alltt}
Finally, \ics{printglossaries} needs to be replaced with:
\begin{alltt}
\cs{printglossary}
\cs{printacronyms}
\cs{print\strong{noidx}glossary}[type=notation\strong{,sort=def}]
\end{alltt}
Note that the \texttt{notation} glossary, which hasn't been listed in the optional
argument of \cs{makeglossaries}, must be displayed with \ics{printnoidxglossary}.

This means that \gls{makeindex} only needs to process the
\texttt{main} and \texttt{acronym} glossaries. No actual sorting is
performed for the \texttt{notation} glossary because, when used with
\printnoidxglosskey[def]{sort}, \cs{printnoidxglossary} simply
iterates over the list of entries that have been indexed.

The document build doesn't need the third \LaTeX\ call now (since
none of the glossaries extend beyond a page break):
\begin{prompt}
pdflatex sampleSort
makeglossaries sampleSort
pdflatex sampleSort
\end{prompt}
This time \gls{makeglossaries} will include the message:
\begin{verbatim}
only processing subset 'main,acronym'
\end{verbatim}
This means that although \gls{makeglossaries} has noticed the \texttt{notation} glossary, 
it will be skipped.

If you are explicitly calling \gls{makeindex} then you need to drop the call
for the \texttt{notation} glossary:
\begin{prompt}
pdflatex sampleSort
makeindex -s sampleSort.ist -t sampleSort.alg -o sampleSort.acr sampleSort.acn
makeindex -s sampleSort.ist -t sampleSort.glg -o sampleSort.gls sampleSort.glo
pdflatex sampleSort
\end{prompt}

\bibglsnote
If you prefer to use \gls{bib2gls}, the package loading line needs
to be changed to:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},acronym]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next the entry definitions need to be convert to the \filetype{bib}
format required by \gls{bib2gls}.

For this example, it's simpler to split the entries into different files according
to the glossary type. This can be done with the
\texttt{-{}-split-on-type} or \texttt{-t} switch:
\begin{prompt}
convertgls2bib -t -{}-preamble-only sampleSort.tex entries.bib
\end{prompt}
This will create three files:
\begin{description}
\item[\nolinkurl{entries.bib}] which contains the entries that were
defined with \ics{newglossaryentry}. For example:
\begin{alltt}
\atentry{entry}\mgroup{gls:set,
  name = {set},
  description = {A collection of distinct objects}
}
\end{alltt}

\item[\nolinkurl{abbreviations.bib}] which contains the entries that
were defined with \ics{newacronym}. For example:
\begin{alltt}
\atentry{acronym}\mgroup{zfc,
  short = \mgroup{ZFC},
  long = \mgroup{Zermelo-Fraenkel set theory}
}
\end{alltt}
If you changed \ics{newacronym} to \ics*{newabbreviation} then
\atentry{abbreviation} will be used instead:
\begin{alltt}
\atentry{abbreviation}\mgroup{zfc,
  short = \mgroup{ZFC},
  long = \mgroup{Zermelo-Fraenkel set theory}
}
\end{alltt}

\item[\nolinkurl{notation.bib}] which contains the entries that were
defined with \texttt{\gloskey{type}=notation}. For example:
\begin{alltt}
\atentry{entry}\mgroup{not:set,
  name = \mgroup{\$\cs{mathcal}\mgroup{S}\$},
  description = \mgroup{A set},
  text = \mgroup{\cs{mathcal}\mgroup{S}}
}
\end{alltt}
You may prefer to replace \atentry{entry} with \atentry{symbol}
in this file.
\end{description}
\emph{After} the definition of the \texttt{notation} glossary
(\cs{newglossary}), add:
\begin{alltt}
\% abbreviation style must be set first:
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries,abbreviations}]
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{notation},\% notation.bib
 \strong{\xtrfont{type}=notation},\resourceopt{sort}=\strong{unsrt}]
\end{alltt}
Delete the remainder of the preamble (\cs{makeglossaries} and entry
definitions).

Finally, replace the lines that display the glossaries with:
\begin{alltt}
\ics*{printunsrtglossaries}
\end{alltt}
The build process is now:
\begin{prompt}
pdflatex sampleSort
bib2gls sampleSort
pdflatex sampleSort
\end{prompt}

In this case, I have one resource command that processes two
glossaries (\texttt{main} and \texttt{acronym}) at the same time.
The entries in these glossaries are ordered alphabetically.
The second resource command processes the \texttt{notation} glossary but
the entries in this glossary aren't sorted (and so will appear in
the order of definition within the \filetype{bib} file).

See also \samplefile{Ntn}, \bibglsgallery{sorting} and the \gls{bib2gls} user manual
for more examples.

\section{Child Entries}
\label{sec:samplesparent}

\exitem{} This document illustrates some of
the basics, including how to create child entries that use the same
name as the parent entry. This example adds the glossary to the
table of contents and it also uses \ics{glsrefentry}, so an extra \LaTeX\ 
run is required:
\begin{prompt}
pdflatex sample
makeglossaries sample
pdflatex sample
pdflatex sample
\end{prompt}
You can see the difference between word and letter ordering if you
add the package option \pkgopt[letter]{order}. (Note
that this will only have an effect if you use
\gls{makeglossaries} or \gls{makeglossaries-lite.lua}.
If you use \gls{makeindex} explicitly, you will need to use the
\mkidxopt{l} switch to indicate letter ordering.)

One of the entries has its name encapsulated with a semantic command:
\begin{alltt}
\cs{newcommand}\mgroup{\strong{\cs{scriptlang}}}[1]\mgroup{\cs{textsf}\mgroup{\#1}}

\cs{newglossaryentry}\mgroup{Perl}\mgroup{name=\strong{\cs{scriptlang}}\mgroup{Perl},\strong{sort=Perl,}
description=\mgroup{A scripting language}}
\end{alltt}
This means that this entry needs to have the \gloskey{sort} key set
otherwise \gls{makeindex} will assign it to the \qt{symbol} letter
group, since it starts with a backslash (which \gls{makeindex}
simply treats as punctuation).

The homograph entries \qt{glossary} and \qt{bravo} are defined as
sub-entries that inherit the name from the parent entry. The parent
entry doesn't have a description, but with the default
\pkgopt[false]{nopostdot} setting this will lead to a spurious dot.
This can be removed by adding \ics{nopostdesc} to the description,
which suppresses the post-description hook for that entry.

Since the child entries have the same name as the parent, this means
that the child entries will have duplicate sort values unless the
default is changed with the \gloskey{sort} key:
\begin{alltt}
\cs{newglossaryentry}\mgroup{glossary}\mgroup{name=glossary,
 description=\mgroup{\strong{\ics{nopostdesc}}},plural=\mgroup{glossaries}}

\ics{newglossaryentry}\mgroup{glossarycol}\mgroup{
 description=\mgroup{collection of glosses},
 \strong{sort=\mgroup{2},}
 parent=\mgroup{glossary}\% parent \emph{label}
}

\cs{newglossaryentry}\mgroup{glossarylist}\mgroup{
 description=\mgroup{list of technical words},
 \strong{sort=\mgroup{1},}
 parent=\mgroup{glossary}\% parent \emph{label}
}
\end{alltt} 
(Remember that the entries are sorted hierarchically.) This will
place \texttt{glossarylist} before \texttt{glossarycol}, but both
will come immediately after their parent \texttt{glossary} entry.

\glsxtrnote
If you switch to using \gls{glossaries-extra}, remember that the
default package options are different:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{postdot},\xtrfont{stylemods}},style=treenonamegroup,order=word,
  subentrycounter]\mgroup{\strong{glossaries-extra}}
\end{alltt}

You may now want to consider replacing \ics{nopostdesc} in the
descriptions with \ics*{glsxtrnopostpunc} (using your
text editor's search and replace function). This suppresses the
post-description punctuation but not the category post-description
hook.

You may have noticed that some of the descriptions include the
plural form, but it's not done very consistently. For example:
\begin{verbatim}
\newglossaryentry{cow}{name=cow,
  plural=cows,% not required as this is the default
  user1=kine,
  description={(\emph{pl.}\ cows, \emph{archaic} kine) an adult
female of any bovine animal} 
}
\end{verbatim}
which has the parenthetical material at the start of the
description with emphasis,
\begin{verbatim}
\newglossaryentry{bravocry}{
  description={cry of approval (pl.\ bravos)},
  sort={1},
  parent={bravo}
}
\end{verbatim}
which has the parenthetical material at the end of the
description without emphasis even though it's a regular plural,
\begin{verbatim}
\newglossaryentry{bravoruffian}{
  description={hired ruffian or killer (pl.\ bravoes)},
  sort={2},
  plural={bravoes},
  parent=bravo}
\end{verbatim}
which has the parenthetical material at the end of the
description without emphasis, and
\begin{verbatim}
\newglossaryentry{glossary}{name=glossary,
  description={\nopostdesc},
  plural={glossaries}}
\end{verbatim}
which doesn't show the plural in the description.

With \gls{glossaries-extra}, you can remove this parenthetical
material and implement it using the category post-description hook instead. 
For example, the above definitions become:
\begin{verbatim}
\newglossaryentry{cow}{name=cow,
  user1=kine,
  description={an adult female of any bovine animal} 
}

\newglossaryentry{bravocry}{
  description={cry of approval},
  sort={1},
  parent={bravo}
}

\newglossaryentry{bravoruffian}{
  description={hired ruffian or killer},
  sort={2},
  plural={bravoes},
  parent=bravo}
\end{verbatim}
\begin{alltt}
\cs{newglossaryentry}\mgroup{glossary}\mgroup{name=glossary,
  description=\mgroup{\strong{\ics*{glsxtrnopostpunc}}},
  plural=\mgroup{glossaries}}
\end{alltt}
The post-description hook for the \cat{general} category can now be
set:
\begin{alltt}
\ics*{glsdefpostdesc}\mgroup{general}\mgroup{\%
\codecomment{\% Has the user1 key been set?}
  \ics*{glsxtrifhasfield}\mgroup{useri}\mgroup{\ics{glscurrententrylabel}}\%
  \mgroup{\cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\ics{glsentryplural}\mgroup{\ics{glscurrententrylabel}},
    \cs{emph}\mgroup{archaic} \ics{glscurrentfieldvalue})\%
  }\%
  \mgroup{\%
\codecomment{\% The user1 key hasn't been set. Is the plural the same as the
\% singular form with the plural suffix appended?}
    \ics*{GlsXtrIfXpFieldEqXpStr}\mgroup{plural}\mgroup{\ics{glscurrententrylabel}}\%
    \mgroup{\ics{glsentrytext}\mgroup{\ics{glscurrententrylabel}}\ics{glspluralsuffix}}\%
    \mgroup{\%
\codecomment{\% Sibling check with \gls{bib2gls} (see below)}
    }\%
    \mgroup{\%
\codecomment{\% The plural isn't the default. Does this entry have a parent?}
      \cs{ifglshasparent}\mgroup{\cs{glscurrententrylabel}}%
      \mgroup{\%
\codecomment{\% This entry has a parent.
\% Are the plurals for the child and parent the same?}
        \ics*{GlsXtrIfXpFieldEqXpStr}\mgroup{plural}\mgroup{\cs{glscurrententrylabel}}\%
        \mgroup{\cs{glsentryplural}\mgroup{\cs{glsentryparent}\mgroup{\cs{glscurrententrylabel}}}}\%
        \mgroup{}\% \codecomment{child and parent plurals the same}
        \mgroup{\%
          \cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\cs{glsentryplural}\mgroup{\cs{glscurrententrylabel}})\%
        }\%
      }%
      \mgroup{\cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\ics{glsentryplural}\mgroup{\ics{glscurrententrylabel}})}\%
    }\%
  }\%
}
\end{alltt}
(If you try this example out, notice the difference for the
\texttt{glossary} entry if you use \cs{nopostdesc} and then
replace it with \ics*{glsxtrnopostpunc}.)
See the \gls{glossaries-extra} user manual for further details and
also \bibglsbegin.

The \qt{bravo} homographs are an oddity where the singular form is
identical but the plural is different (\qt{bravos} and
\qt{bravoes}). In the original, both descriptions included the
plural term. The above modifications drop the display of the regular
\qt{bravos} plural (for the \texttt{bravocry} term) and only show 
the \qt{bravoes} plural (for the \texttt{bravoruffian} term). In this
particular case it might be useful to show the regular plural in
order to highlight the difference.

While it's straightforward to access an entry's parent label (with
\ics{glsentryparent}) it's much harder to access entry's children or
siblings. The \ics{ifglshaschildren} command has to iterate over all
entries to determine if any have a parent that matches the given
label. This is obviously very time-consuming if you have a large
database of entries. It also doesn't provide a way of determining
whether or not the child entries have been indexed.

With \gls{bib2gls}, it's possible to save this information with the
\resourceopt{save-child-count} and \resourceopt{save-sibling-count},
which not only save the total but also save the child or sibling
labels in an \sty{etoolbox} internal list. This makes the
information much faster to access and also only includes the labels of
those entries that have actually been indexed.

In the above, the comment line:
\begin{alltt}
\codecomment{\% Sibling check with \gls{bib2gls} (see below)}
\end{alltt}
indicates where to put the extra code. If you switch to
\gls{bib2gls} and make sure to use \resourceopt{save-sibling-count}
then you can insert the following code in the block above where that
comment is:
\begin{alltt}
\ics*{GlsXtrIfFieldNonZero}\mgroup{siblingcount}\mgroup{\cs{glscurrententrylabel}}\%
\mgroup{\% \codecomment{\xtrfield{siblingcount} field value non-zero}
 \ics*{glsxtrfieldforlistloop} \% \codecomment{iterate over internal list}
 \mgroup{\cs{glscurrententrylabel}}\% \codecomment{entry label}
 \mgroup{siblinglist}\% \codecomment{label of field containing list}
 \mgroup{\cs{siblinghandler}}\% \codecomment{loop handler}
}\%
\mgroup{}\% \codecomment{\xtrfield{siblingcount} field value 0 or empty or missing}
\end{alltt}
This uses a custom handler that's defined as follows:
\begin{alltt}
\cs{newcommand}\mgroup{\cs{siblinghandler}}[1]\mgroup{\%
  \ics*{GlsXtrIfXpFieldEqXpStr}*\mgroup{plural}\mgroup{\cs{glscurrententrylabel}}\%
  \mgroup{\cs{glsentryplural}\mgroup{\#1}}\%
  \mgroup{}\% \codecomment{current entry's plural same as sibling's plural}
  \mgroup{\%
    \cs{space}(\cs{emph}\mgroup{pl.}\cs{ }\cs{glsentryplural}\mgroup{\cs{glscurrententrylabel}})\%
    \ics{listbreak}
  }%
}
\end{alltt}
The \cs{listbreak} command is provided by \sty{etoolbox} and is used
for prematurely exiting a loop. The handler tests if the sibling's
\gloskey{plural} field is identical to the current entry's \gloskey{plural}
field. If they are the same, it does nothing. If they are different,
it displays the current entry's plural and breaks the loop.

Note that this assumes that the parent entry hasn't had the plural
form explicitly set to \qt{bravoes} instead of the default
\qt{bravos}. In that case, the parent entry would show the plural
but the \texttt{bravoruffian} child entry wouldn't show the plural (since
this case would led to the empty code block identified with the
comment \qt{child and parent plurals the same}). The \qt{bravoes}
plural form would instead be shown for the parent, which wouldn't
look right.

If you don't use \gls{bib2gls} or if you use it without the
\resourceopt{save-sibling-count} resource option then the sibling
information won't be available.

\bibglsnote
In order to switch to using \gls{bib2gls}, it's first necessary to
switch to using \gls{glossaries-extra} (as above). Remember that the
\pkgopt*{record} option is required:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record},}\xtrfont{postdot},\xtrfont{stylemods},style=treenonamegroup,
subentrycounter]\mgroup{glossaries-extra}
\end{alltt}
Next the entry definitions need to be converted to the
\filetype{bib} format required by \gls{bib2gls}. This can be done
with \gls{convertgls2bib}:
\begin{alltt}
convertgls2bib -{}-preamble-only sample.tex entries.
\end{alltt}
The semantic command may be moved to the \filetype{bib} file to
ensure it's defined:
\begin{alltt}
\atentry{preamble}\mgroup{"\cs{providecommand}\mgroup{\cs{scriptlang}}[1]\mgroup{\cs{textsf}\mgroup{\#1}}"}
\end{alltt}

The \gloskey{sort} field typically shouldn't be set when using
\gls{bib2gls}, so \gls{convertgls2bib} strips it. 
If the \gloskey{sort} field is missing, \gls{bib2gls} will obtain it
from the sort fallback for that entry type. In this case,
\atentry{entry} has the \gloskey{name} field as the sort fallback.
If this is also missing then its value is obtained from the parent's
\gloskey{name} field (see \bibglsgallery{sorting} for other examples).

Therefore the \qt{Perl} entry is simply defined as:
\begin{alltt}
\atentry{entry}\mgroup{Perl,
  name = \mgroup{\cs{scriptlang}\mgroup{Perl}},
  description = \mgroup{A scripting language}
}
\end{alltt}
This isn't a problem for \gls{bib2gls}. In this case, the command
has been provided in the \atentry{preamble}, but \gls{bib2gls}
strips font information so the sort value becomes \texttt{Perl}. 
If the definition isn't placed in \atentry{preamble} then
\gls{bib2gls} will simply ignore the command (as \gls{xindy} does)
so the sort value will still end up as \texttt{Perl}.

The homograph entries have also had their \gloskey{sort} fields omitted:
\begin{alltt}
\atentry{entry}\mgroup{glossarycol,
  parent = \mgroup{glossary},
  description = \mgroup{collection of glosses}
}

\atentry{entry}\mgroup{glossarylist,
  parent = \mgroup{glossary},
  description = \mgroup{list of technical words}
}
\end{alltt}

This means that the sort value for both these child entries is
\qt{glossary}. When \gls{bib2gls} encounters identical sort values
it acts according to its \resourceopt{identical-sort-action} setting.
The default action is to sort by the label using a simple string
comparison. In this case, it would put \texttt{glossarycol} before
\texttt{glossarylist}. In the original document, the \gloskey{sort}
value was manually chosen to ensure that the entries are ordered
according to \gls{firstuse}.  This ordering can easily be obtained
by changing \gls{bib2gls}['s] identical sort action (requires at
least \gls{bib2gls} v2.0):
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\strong{\xtrfont{identical-sort-action}=use}]
\end{alltt}
This command should replace \cs{makeglossaries}. If you want the
sibling information (see earlier), then you need to remember to add
\resourceopt{save-sibling-count} to the list of options.

Note that this is a better solution than in the original example. If
I edit the document so that \texttt{glossarycol} is used first, then
the ordering will be updated accordingly, but with the original
example, the \gloskey{sort} keys would need to be manually changed.

The remainder of the preamble (that is, the definition of
\cs{scriptlang} and all the entry definitions) should now be
removed.

Finally, replace \cs{printglossaries} with \ics*{printunsrtglossaries}.
The document build is now:
\begin{prompt}
pdflatex sample
bib2gls -{}-group sample
pdflatex sample
pdflatex sample
\end{prompt}
Note use of the \bibglslongopt{group} (or \bibglsopt{g}) switch, which is needed
to support the \glostyle{treenonamegroup} style. The third \LaTeX\
call is needed because the document contains \ics{glsrefentry}.

Note that you can't use the \pkgopt[letter]{order} package option
with \gls{bib2gls}. Instead use the \resourceopt[none]{break-at}
resource option:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=\mgroup{entries},\xtrfont{identical-sort-action}=use,
  \strong{\xtrfont{break-at}=none}
]
\end{alltt}

\exitem{-inline} This document is
like \texttt{sample.tex}, above, but uses the \glostyle{inline}
glossary style to put the glossary in a footnote. The document build
is:
\begin{prompt}
pdflatex sample-inline
makeglossaries sample-inline
pdflatex sample-inline
pdflatex sample-inline
\end{prompt}
If you want to convert this document to \gls{glossaries-extra},
follow the same procedure as above. If you want to use \gls{bib2gls}
then you don't need the \bibglslongopt{group} switch since no letter
groups are required.

\exitem{tree} This document illustrates
a hierarchical glossary structure where child entries have different
names to their corresponding parent entry. To create the document
do:
\begin{prompt}
pdflatex sampletree
makeglossaries sampletree
pdflatex sampletree
\end{prompt}
The document uses the \glostyle{alttreehypergroup} glossary style,
which needs to know the widest name for each hierarchical level.
This has been assigned manually in the preamble with
\ics{glssetwidest}:
\begin{verbatim}
\glssetwidest{Roman letters} % level 0 widest name
\glssetwidest[1]{Sigma}      % level 1 widest name
\end{verbatim}
(Level~0 is the top-most level. That is, entries that don't have a
parent.) It's possible to get \styfmt{glossaries} to compute the
widest top-level entry with \ics{glsfindwidesttoplevelname} but this
will iterate over all top-level entries, regardless of whether or
not they appear in the glossary. If you have a large database of
entries, this will firstly take time and secondly the width may be
too large due to an unindexed entry with a big name.

This sample document doesn't require any of the tabular styles so I've
prevented those packages from being loaded with \pkgopt{nolong} and
\pkgopt{nosuper}. The reduces the overall package loading.
\begin{alltt}
\cs{usepackage}[style=alttreehypergroup,\strong{nolong,nosuper}]
\mgroup{glossaries}
\end{alltt}
(This example glossary is actually better suited for one of the
topic styles provided with \sty*{glossary-topic}, see below.)

This is obviously a contrived example since it's strange to have the
symbol names (such as \qt{Sigma}) in the glossary. The purpose is to
demonstrate the \glostyle{alttreehypergroup} with an entry that's
noticeably wider than the others in the same hierarchical level. A
more sensible document would have the symbol in the \gloskey{name}
key.

\glsxtrnote
If you want to switch to \gls{glossaries-extra}, then you can
instead use a combination of \pkgopt{nostyles} and
\pkgopt*{stylemods}:
\begin{alltt}
\cs{usepackage}[style=alttreehypergroup,\xtrfont{postdot},\strong{nostyles,
\xtrfont{stylemods=tree}}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The \pkgopt*{stylemods} package not only patches the original styles
provided by the base \styfmt{glossaries} package (such as
\sty{glossary-tree} used in this example) but also provides extra
helper commands. In this case, it provides additional commands to
calculate the widest name. For example, instead of manually setting
the widest entry with \ics{glssetwidest}, you could add the
following before the glossary:
\begin{alltt}
\ics*{glsFindWidestUsedTopLevelName}
\ics*{glsFindWidestUsedLevelTwo}
\end{alltt}
This will only take into account the entries that have actually been
used in the document, but it can still be time-consuming if you have
a large number of entries.

\begin{important}
Note that the glossary must be at the end of the document (after all
required entries have been used) with this method. The alternative
is to perform the calculation at the end of the document and save
the results in the \filetype{aux} file for the next run.
\end{important}

This example document is using top-level entries for topics without
descriptions. This means that the descriptions simply contain
\ics{nopostdesc} to prevent the post-description punctuation from
being automatically inserted. For example:
\begin{verbatim}
\newglossaryentry{greekletter}{name={Greek letters},
text={Greek letter},
description={\nopostdesc}}
\end{verbatim}
With \gls{glossaries-extra}, you can convert this to
\ics*{glsxtrnopostpunc} which will prevent the post-description
punctuation without interfering with the category post-description
hook.

In order to distinguish between the child entries, which are
symbols, and the parent entries, which are topics, it's useful to
give these two different types of entries different categories. The
topics can use the default \cat{general} category, but the symbol
entries can be assigned to a different category. The value of the
\xtrgloskey{category} key must be a label. For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{C}\mgroup{name=\mgroup{C},
description=\mgroup{Euler's constant},
\strong{\xtrfont{category}=symbol,}
parent=romanletter}
\end{alltt}

There is some redundancy caused by a parenthetical note after the \gls{firstuse} in some
of the symbol entries. For example:
\begin{verbatim}
\newglossaryentry{pi}{name={pi},
text={\ensuremath{\pi}},
first={\ensuremath{\pi} (lowercase pi)},
description={Transcendental number},
parent=greekletter}
\end{verbatim}
With \gls{glossaries-extra} this can be dealt with through the category post-link hook:
\begin{alltt}
\ics*{glsdefpostlink}\mgroup{symbol}\mgroup{\%
  \ics*{glsxtrifwasfirstuse}
  \mgroup{\% first use
    \ics*{glsxtrifhasfield}\mgroup{useri}\mgroup{\ics{glslabel}}\%
    \mgroup{ (\ics{glscurrentfieldvalue})}\mgroup{}\%
  }\% 
  \mgroup{}\% not first use
}
\end{alltt}
The parenthetical material is now stored in the \gloskey{user1} key.
For example:
\begin{alltt}
\cs{newglossaryentry}\mgroup{sigma}\mgroup{name={Sigma},
text=\mgroup{\cs{ensuremath}{\cs{Sigma}}},
\strong{user1=\mgroup{uppercase sigma},}
description=\mgroup{Used to indicate summation},
parent=greekletter}
\end{alltt}
The category post-description link is also set to ensure that the symbol is
displayed after the description in the glossary:
\begin{alltt}
\ics*{glsdefpostdesc}\mgroup{symbol}\mgroup{\cs{space}
  (\$\ics{glsentrytext}\mgroup{\ics{glscurrententrylabel}}\$)}
\end{alltt}
These modifications only affect entries with the
\xtrgloskey{category} set to \cat{symbol}.

With \gls{glossaries-extra}, it's now possible to use the topic
styles provided with the \sty*{glossary-topic} package:
\begin{alltt}
\cs{usepackage}[style=\strong{\xtrfont{topic}},\xtrfont{postdot},\strong{nostyles,\xtrfont{stylemods=\mgroup{tree\strong{,topic}}}}]
\mgroup{\strong{glossaries-extra}}
\end{alltt}
The \xtrglostyle{topic} style is designed for this kind of hierarchy
where all the top-level entries don't have descriptions. This means
that the \ics{nopostdot} and \ics*{glsxtrnopostpunc} commands aren't
required. The top-level entries can simply be defined as:
\begin{alltt}
\cs{newglossaryentry}\mgroup{greekletter}\mgroup{name=\mgroup{Greek letters},
text=\mgroup{Greek letter}, description=\mgroup{}}

\cs{newglossaryentry}\mgroup{romanletter}\mgroup{name=\mgroup{Roman letters},
text=\mgroup{Roman letter}, description=\mgroup{}}
\end{alltt}
I've now loaded both the \sty{glossary-tree} and
\sty{glossary-topic} packages
(via \pkgopt*{stylemods}\optfmt{\dequals\mgroup{tree\dcomma topic}}). The
\sty{glossary-topic} package can be used without
\sty{glossary-tree}, in which case it will behave more like the
normal \glostyle{tree} rather than \glostyle{alttree} styles (but
with different indentation and no description in the top-level).
However, if you use \ics{glssetwidest} (provided by
\sty{glossary-tree}) then the \xtrglostyle{topic} style will behave
more like \glostyle{alttree}.

Since there's no description for the top-level entries, the
\xtrglostyle{topic} style ignores the widest name setting for the
top-level, so I can just have the level~1 setting:
\begin{verbatim}
\glssetwidest[1]{Sigma}
\end{verbatim}

\bibglsnote
If you want to convert this document so that it uses \gls{bib2gls},
you first need to convert it to using \gls{glossaries-extra}, as
described above, but remember that you now need the \pkgopt*{record}
option.
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record},}style=topic,\xtrfont{postdot},nostyles,\xtrfont{stylemods=\mgroup{tree,topic}}]
\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next convert the entries to the \filetype{bib} format required by
\gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-preamble-only sampletree.tex entries.bib
\end{prompt}
Now replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\strong{\xtrfont{set-widest}}]
\end{alltt}
I've used the \resourceopt{set-widest} option here to get
\gls{bib2gls} to compute the widest name. (Obviously, it can only do
this if it can correctly interpret any commands contained in the
\gloskey{name} field.)

This means that the \ics{glssetwidest} commands can now be removed
completely. All the \cs{newglossaryentry} commands also need to be removed from
the preamble. Finally, \cs{printunsrtglossaries} needs to be
replaced with \ics*{printunsrtglossaries}. The document build is now:
\begin{prompt}
pdflatex sampletree
bib2gls sampletree
pdflatex sampletree
\end{prompt}

This produces the same result as with just \gls{glossaries-extra}
and \gls{makeglossaries}. However, there are some modifications that
can be made to the \filetype{bib} file to make it neater. 

The top-level entries are defined as:
\begin{alltt}
\atentry{entry}\mgroup{greekletter,
  name = \mgroup{Greek letters},
  description = \mgroup{},
  text = \mgroup{Greek letter}
}

\atentry{entry}\mgroup{romanletter,
  name = \mgroup{Roman letters},
  description = \mgroup{},
  text = \mgroup{Roman letter}
}
\end{alltt}
This is a direct translation from the \cs{newglossaryentry} commands
(after switching to the \xtrglostyle{topic} style). There's a more
appropriate entry type:
\begin{alltt}
\atentry{indexplural}\mgroup{greekletter,
  text = \mgroup{Greek letter}
}

\atentry{indexplural}\mgroup{romanletter,
  text = \mgroup{Roman letter}
}
\end{alltt}
The \atentry{indexplural} entry type doesn't require the
\gloskey{description} and will set the \gloskey{name} field to the
same as the \gloskey{plural} field. Since the \gloskey{plural} field
hasn't been set it's obtained by appending \qt{s} to the
\gloskey{text} field.

Now let's assume that the symbol entries are defined in a more
rational manner, with the actual symbol in the \gloskey{name} field.
For example:
\begin{alltt}
\atentry{entry}\mgroup{sigma,
  user1 = \mgroup{uppercase sigma},
  parent = \mgroup{greekletter},
  description = \mgroup{Used to indicate summation},
  \strong{name = \mgroup{\cs{ensuremath}\mgroup{\cs{Sigma}}}},
  category = \mgroup{symbol}
}

\atentry{entry}\mgroup{C,
  parent = \mgroup{romanletter},
  name = \mgroup{\cs{ensuremath}\mgroup{C}},
  description = \mgroup{Euler's constant},
  category = \mgroup{symbol}
}
\end{alltt}
The category post-description hook (provided with
\ics*{glsdefpostdesc}) should now be removed from the document.

If you make these changes and rebuild the document, you'll find that
the order has changed. Now the \texttt{sigma} entry is before the
\texttt{pi} entry. This is because \gls{bib2gls} is obtaining the
sort values from the \gloskey{name} field, which is the sort
fallback for \atentry{entry}. This means that the sort values end up
as $\Sigma$ and $\pi$ (\gls{bib2gls} recognises the commands
\ics{Sigma} and \ics{pi} and converts them to the Unicode characters
0x1D6F4 and 0x1D70B).

If you change \atentry{entry} to \atentry{symbol} then you will once
again get the order from the original example (\texttt{pi} before
\texttt{Sigma}). This is because the sort fallback for
\atentry{symbol} is the label not the \gloskey{name}. (Remember that
the sort fallback is only used if the \gloskey{sort} field isn't
set. If you explicitly set the \gloskey{sort} field then no fallback
is required. See \bibglsgallery{sorting}.)

You can further tidy the \filetype{bib} file by removing the
\xtrgloskey{category} fields. For example:
\begin{alltt}
\atentry{symbol}\mgroup{sigma,
  user1 = \mgroup{uppercase sigma},
  parent = \mgroup{greekletter},
  description = \mgroup{Used to indicate summation},
  name = \mgroup{\cs{ensuremath}\mgroup{\cs{Sigma}}}
}
\end{alltt}
You can then assign the \xtrgloskey{category} in the resource set:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\xtrfont{set-widest},\strong{\xtrfont{category}=\mgroup{same as entry}}]
\end{alltt}
This means that all the entries defined with \atentry{symbol} will
have the \xtrgloskey{category} set to \texttt{symbol} and all the
entries defined with \atentry{indexplural} will have the
\xtrgloskey{category} set to \texttt{indexplural}. (Only the
\cat{symbol} category is significant in this example.)

You can make the \filetype{bib} files even more flexible by
introducing field and entry aliases with \resourceopt{field-aliases}
and \resourceopt{entry-type-aliases}. See the \gls{bib2gls} manual
for further details.

\section{Cross-Referencing}
\label{sec:samplescrossref}

\exitem{-crossref}
This document illustrates how to cross-reference entries in the
glossary.
\begin{prompt}
pdflatex sample-crossref
makeglossaries sample-crossref
pdflatex sample-crossref
\end{prompt}
The document provides a command \ics{alsoname} to produce some fixed text, which can be
changed as appropriate (usually within a language hook):
\begin{verbatim}
\providecommand{\alsoname}{see also}
\end{verbatim}
I've used \cs{providecommand} as some packages define this command.
This is used to create a \qt{see also} cross-reference with the
\gloskey{see} key:
\begin{verbatim}
\newglossaryentry{apple}{name=apple,description={firm, round fruit},
see=[\alsoname]{pear}}

\newglossaryentry{marrow}{name={marrow},
 description={long vegetable with thin green skin and white flesh},
 see={[\alsoname]courgette}}
\end{verbatim}

Note that \qt{marrow} is included in the glossary even though it
hasn't been referenced in the text. This is because the
\gloskey{see} key automatically triggers \ics{glssee} which indexes
the term. This behaviour is intended for documents where only the
terms that are actually required in the document are defined. It's
not suitable for a large database of terms shared across multiple
documents that may or may not be used in a particular document. In
that case, you may want to consider using \gls{glossaries-extra}
(see below).

\glsxtrnote
This example is quite simple to convert to \gls{glossaries-extra}.
If you want the dot after the description, you need the
\pkgopt[false]{nopostdot} or \pkgopt*{postdot} package option. You
may also want to consider using the \pkgopt*{stylemods} option.

In order to prevent the \qt{marrow} entry from being automatically
being added to the glossary as a result of the cross-reference, you
can use \pkgopt+{false}{autoseeindex} to prevent the automatic
indexing triggered by the \gloskey{see} key (or the
\xtrgloskey{seealso} key provided by \gls{glossaries-extra}).

\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{autoseeindex}=false},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
\end{alltt}
The document build is the same, but now the \qt{marrow} and
\qt{zucchini} entries aren't present in the document.

Note that the \qt{fruit} entry is still included even though it
hasn't been used in the document. This is because it was explicitly
indexed with \ics{glssee} not via the \gloskey{see} key.

The entries that contains \texttt{see=[\cs{alsoname}]}
can be converted to use the \xtrgloskey{seealso} key:
\begin{alltt}
\cs{newglossaryentry}\mgroup{apple}\mgroup{name=apple,description=\mgroup{firm, round fruit},
\strong{\xtrfont{seealso}=\mgroup{pear}}}

\cs{newglossaryentry}\mgroup{marrow}\mgroup{name=\mgroup{marrow},
 description=\mgroup{long vegetable with thin green skin and white flesh},
 \strong{\xtrfont{seealso}=\mgroup{courgette}}}
\end{alltt}
(The provided \cs{alsoname} definition may be removed.)

The original example redefines the cross-referencing format to use
\gls{smallcaps}:
\begin{alltt}
\cs{renewcommand}\mgroup{\ics{glsseeitemformat}}[1]\mgroup{\cs{textsc}\mgroup{\ics{glsentryname}\mgroup{\#1}}}
\end{alltt}
This will still produce the desired effect with \gls{glossaries-extra} for 
this simple example but, as with \samplefile{AcrDesc},
this redefinition isn't necessary if you have at least
\gls{glossaries-extra} v1.42.

\bibglsnote
If you want to switch to \gls{bib2gls} then you first need to switch
to \gls{glossaries-extra}, as described above, but you now need the
\pkgopt*{record} option but no longer need the
\pkgopt+{false}{autoseeindex} option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods}]\mgroup{glossaries-extra}
\end{alltt}
Next the entry definitions need to be converted to the
\filetype{bib} format required by \gls{bib2gls}.
\begin{prompt}
convertgls2bib sample-crossref.tex entries.bib
\end{prompt}
If you have at least v2.0 then \gls{convertgls2bib} will absorb the
cross-referencing information supplied by:
\begin{verbatim}
\glssee{fruit}{pear,apple,banana}
\end{verbatim}
into the \texttt{fruit} definition:
\begin{alltt}
\atentry{entry}\mgroup{fruit,
  see = \mgroup{pear,apple,banana},
  name = \mgroup{fruit},
  description = \mgroup{sweet, fleshy product of plant containing seed}
}
\end{alltt}
Now remove \cs{makeglossaries} and all the entry definition commands
(including \cs{glssee} from the preamble) and add:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib]
\end{alltt}
Finally, replace \cs{printglossaries} with
\ics*{printunsrtglossaries}. The document build is now:
\begin{prompt}
pdflatex sample-crossref
bib2gls sample-crossref
pdflatex sample-crossref
\end{prompt}
The glossary now contains: apple, banana, courgette and pear. Note
that it doesn't contain fruit, zucchini or marrow.

Now change the selection criteria:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib,
 \strong{\xtrfont{selection}=\mgroup{recorded and deps and see}}]
\end{alltt}
The glossary now includes fruit, zucchini and marrow.

The fruit and zucchini use the \gloskey{see} key which is a simple
redirection for the reader. There's no \gls{numberlist} for either
of these entries. Whereas marrow uses the \xtrgloskey{seealso} key,
which is typically intended as a supplement to a \gls{numberlist}
but in this case there are no locations as marrow hasn't been used
in the text.

With at least v2.0, there's an alternative:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib,
 \resourceopt{selection}=\mgroup{recorded and deps and see\strong{ not also}}]
\end{alltt}
In this case, the glossary includes fruit and zucchini but not marrow.


\section{Custom Keys}
\label{sec:samplescustomkeys}

\exitem{-newkeys} This document illustrates how add custom keys
(using \ics{glsaddkey}). There are two custom keys \texttt{ed}, where
the default value is the \gloskey{text} field with \qt{ed} appended,
and \texttt{ing}, where the default value is the \gloskey{text}
field with \qt{ing} appended. Since the default value in both cases
references the \gloskey{text} field, the starred version
\cs{glsaddkey*} is required to ensure that the default value is expanded on
definition if no alternative has been provided.

The entries are then defined as follows:
\begin{verbatim}
\newglossaryentry{jump}{name={jump},description={}}

\newglossaryentry{run}{name={run},%
 ed={ran},%
 ing={running},
 description={}}

\newglossaryentry{waddle}{name={waddle},%
 ed={waddled},%
 ing={waddling},%
 description={}}
\end{verbatim}

Each custom key is provided a set of commands analogous to
\cs{glsentrytext}, that allows the key value to be accessed, and
\cs{glstext} that allows the key value to be access with indexing
and hyperlinking (where applicable).

If you find yourself wanting to create a lot of custom keys that
produce minor variations of existing keys (such as different tenses)
you may find it simpler to just use \cs{glsdisp}. When editing the
document source, it's usually simpler to read:
\begin{verbatim}
The dog \glsdisp{jump}{jumped} over the duck.
\end{verbatim}
than
\begin{verbatim}
The dog \glsed{jump} over the duck.
\end{verbatim}

\bibglsnote
If you want to convert this document to use \gls{bib2gls}, you first
need to switch to \gls{glossaries-extra}, but remember that you need
the \pkgopt*{record} option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}}]{\strong{glossaries-extra}}
\end{alltt}
Next convert the entry definitions to the \filetype{bib} format
required by \gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-index-conversion -{}-preamble-only sample-newkeys.tex entries.bib
\end{prompt}
The \texttt{-{}-index-conversion} switch requires at least v2.0 and
will convert entries without a description (or where the description
is simply \ics{nopostdesc} or \ics*{glsxtrnopostpunc}) to
\atentry{index} instead of \atentry{entry}. This means that the
new \nolinkurl{entries.bib} file will contain:
\begin{alltt}
\atentry{index}\mgroup{jump,
  name = \mgroup{jump}
}

\atentry{index}\mgroup{run,
  ing = \mgroup{running},
  name = \mgroup{run},
  ed = \mgroup{ran}
}

\atentry{index}\mgroup{waddle,
  ing = \mgroup{waddling},
  name = \mgroup{waddle},
  ed = \mgroup{waddled}
}
\end{alltt}
Now replace \cs{makeglossaries} with
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
and delete the \cs{newglossaryentry} commands. Finally replace
\cs{printglossaries} with \ics*{printunsrtglossaries}.

The document build is now:
\begin{prompt}
pdflatex sample-newkeys
bib2gls sample-newkeys
pdflatex sample-newkeys
\end{prompt}
Note that there's no need for the \pkgopt{nonumberlist} package
option when you don't use \gls{bib2gls}['s] \texttt{-{}-group}
switch.
 
\exitem{-storage-abbr} This document illustrates how add custom
storage keys (using \cs{glsaddstoragekey}). The document build is:
\begin{prompt}
pdflatex sample-storage-abbr
makeglossaries sample-storage-abbr
pdflatex sample-storage-abbr
\end{prompt}

The custom storage key is called \texttt{abbrtype} which defaults
to \texttt{word} if not explicitly set. Its value can be accessed
with the provided custom command \cs{abbrtype}.
\begin{alltt}
\ics{glsaddstoragekey}\mgroup{abbrtype}\mgroup{word}\mgroup{\cs{abbrtype}}
\end{alltt}
A custom abbreviation style is then defined that checks the value of
this key and makes certain adjustments depending on whether or not
its value is the default \texttt{word}.

This essentially forms a very similar function to the
\gls{glossaries-extra} package's \xtrgloskey{category} key, which is
also defined as a storage key:
\begin{alltt}
\cs{glsaddstoragekey}\mgroup{category}\mgroup{general}\mgroup{\ics*{glscategory}}
\end{alltt}

\glsxtrnote
This document is much simpler with the \gls{glossaries-extra}
package:
\begin{alltt}
\cs{documentclass}\mgroup{article}
\cs{usepackage}[\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
\cs{makeglossaries}
\ics*{setabbreviationstyle}[\strong{acronym}]\mgroup{short-long}
\ics{newacronym}\mgroup{radar}\mgroup{radar}\mgroup{radio detecting and ranging}
\ics{newacronym}\mgroup{laser}\mgroup{laser}\mgroup{light amplification by stimulated
emission of radiation}
\ics{newacronym}\mgroup{scuba}\mgroup{scuba}\mgroup{self-contained underwater breathing
apparatus}

\ics*{newabbreviation}\mgroup{dsp}\mgroup{DSP}\mgroup{digital signal processing}
\ics*{newabbreviation}\mgroup{atm}\mgroup{ATM}\mgroup{automated teller machine}

\cs{begin}\mgroup{document}

First use: \cs{gls}\mgroup{radar}, \cs{gls}\mgroup{laser}, \cs{gls}\mgroup{scuba}, \cs{gls}\mgroup{dsp},
\cs{gls}\mgroup{atm}.

Next use: \cs{gls}\mgroup{radar}, \cs{gls}\mgroup{laser}, \cs{gls}\mgroup{scuba}, \cs{gls}\mgroup{dsp},
\cs{gls}\mgroup{atm}.

\cs{printglossaries}
\cs{end}\mgroup{document}
\end{alltt}

\exitem{-storage-abbr-desc} An extension of the previous example
where the user needs to provide a~description.

\exitem{-chap-hyperfirst} This document illustrates how to add
a~custom key using \cs{glsaddstoragekey} and hook into the \glslike\
and \glstextlike\ mechanism used to determine whether or not to
hyperlink an entry.
The document build is:
\begin{prompt}
pdflatex sample-chap-hyperfirst
makeglossaries sample-chap-hyperfirst
pdflatex sample-chap-hyperfirst
\end{prompt}
This example creates a storage key called \texttt{chapter} used to store the chapter 
number.
\begin{alltt}
\ics{glsaddstoragekey}\mgroup{\strong{chapter}}\mgroup{0}\mgroup{\strong{\cs{glschapnum}}}
\end{alltt}
It's initialised to 0 and the \ics{glslinkpostsetkeys} hook is used
to check this value against the current chapter number. If the
values are the same then the hyperlink is switched off, otherwise
the key value is updated unless the hyperlink has been switched off
(through the optional argument of commands like \cs{gls} and \cs{glstext}).
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glslinkpostsetkeys}}\mgroup{\%
 \cs{edef}\cs{currentchap}\mgroup{\cs{arabic}\mgroup{chapter}}\%
 \cs{ifnum}\cs{currentchap}=\strong{\cs{glschapnum}}\mgroup{\cs{glslabel}}\cs{relax}
  \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\%
 \cs{else}
  \ics{glsifhyperon}\mgroup{\ics{glsfieldxdef}\mgroup{\cs{glslabel}}\mgroup{\strong{chapter}}\mgroup{\cs{currentchap}}}\mgroup{}\%
 \cs{fi}
}
\end{alltt}
Since this key isn't intended for use when the entry is being
defined, it would be more appropriate to simply use an internal
field that doesn't have an associated key or helper command, but
\ics{glsfieldxdef} requires the existence of the field. The
\gls{glossaries-extra} package provides utility commands designed to
work on internal fields that don't have an associated key and may
not have had a value assigned.

\glsxtrnote
If you want to switch to \gls{glossaries-extra} you need to change
the package loading line:
\begin{alltt}
\cs{usepackage}[\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The custom storage key (provided with \cs{glsaddstoragekey}) can be
removed, and the \ics{glslinkpostsetkeys} hook can be changed to:
\begin{alltt}
\cs{renewcommand}*\mgroup{\ics{glslinkpostsetkeys}}\mgroup{\%
 \cs{edef}\cs{currentchap}\mgroup{\cs{arabic}\mgroup{chapter}}\%
 \strong{\ics*{GlsXtrIfFieldEqNum}*}\mgroup{\strong{chapter}}\mgroup{\cs{glslabel}}\mgroup{\cs{currentchap}}
 \mgroup{\%
   \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\%
 }\%
 \mgroup{%
   \ics{glsifhyperon}\mgroup{\strong{\ics*{xGlsXtrSetField}}\mgroup{\cs{glslabel}}\mgroup{\strong{chapter}}\mgroup{\cs{currentchap}}}\mgroup{}\%
 }%
}
\end{alltt}
The field name is still called \texttt{chapter} but there's no
longer an associated key or command.

\section{Xindy (Option 3)}
\label{sec:samplesxindy}

Most of the earlier \gls{makeindex} sample files can be adapted to
use \gls{xindy} instead by adding the \pkgopt{xindy} package option.
Situations that you need to be careful about are when the sort value
(obtained from the \gloskey{name} if the \gloskey{sort} key is
omitted) contains commands (such as \verb|name={\pi}|) or is identical 
to another value (or is identical after \gls{xindy} has stripped all
commands and braces). This section describes sample documents that
use features which are unavailable with \gls{makeindex}.

\exitem{xdy} The document uses UTF8 encoding (with the
\sty{inputenc} package). This is information that needs to be passed
to \gls{xindy}, so the encoding is picked up by \gls{makeglossaries}
from the \filetype{aux} file.

By default, this document will create a \gls{xindy} style file called 
\nolinkurl{samplexdy.xdy}, but if you uncomment the lines
\begin{verbatim}
\setStyleFile{samplexdy-mc}
\noist
\GlsSetXdyLanguage{}
\end{verbatim}
it will set the style file to \texttt{samplexdy-mc.xdy} instead.
This provides an additional letter group for entries starting with
\qt{Mc} or \qt{Mac}. If you use \gls{makeglossaries} or
\gls{makeglossaries-lite.lua}, you don't
need to supply any additional information. If you don't use
\gls*{makeglossaries}, you will need to specify the required
information. Note that if you set the style file to
\nolinkurl{samplexdy-mc.xdy} you must also specify \ics{noist},
otherwise the \styfmt{glossaries} package will overwrite
\nolinkurl{samplexdy-mc.xdy} and you will lose the \qt{Mc} letter
group.

To create the document do:
\begin{prompt}
pdflatex samplexdy
makeglossaries samplexdy
pdflatex samplexdy
\end{prompt}
If you don't have Perl installed then you can't use 
\gls{makeglossaries}, but you also can't use \gls{xindy}!
However, if for some reason you want to call 
\gls{xindy} explicitly instead of using \gls{makeglossaries} (or
\gls{makeglossaries-lite.lua}):
\begin{itemize}
\item if you are using the default style file \nolinkurl{samplexdy.xdy}, then
do (no line breaks):
\begin{prompt}
xindy -L english -C utf8 -I xindy -M samplexdy -t samplexdy.glg -o samplexdy.gls samplexdy.glo
\end{prompt}
\item if you are using \nolinkurl{samplexdy-mc.xdy}, then do
(no line breaks):
\begin{prompt}
xindy -I xindy -M samplexdy-mc -t samplexdy.glg -o samplexdy.gls samplexdy.glo
\end{prompt}
\end{itemize}

This document creates a new command to use with the
\gloskey[glslink]{format} key in the optional argument of commands
like \cs{gls} to format the location in the \gls{numberlist}.
The usual type of definition when a hyperlinked location is required
should use one of the \csmeta{hyper}{xx}{} commands listed in
\tableref{tab:hyperxx}:
\begin{verbatim}
\newcommand*{\hyperbfit}[1]{\textit{\hyperbf{#1}}}
\end{verbatim}
Unfortunately, this definition doesn't work for this particular
document and some adjustments are needed (see below). As a result of
the adjustments, this command doesn't actually get used by \TeX,
even though \texttt{hyperbfit} is used in the
\gloskey[glslink]{format} key. It does, however, need to be
identified as an attribute so that \gls{xindy} can recognise it:
\begin{verbatim}
\GlsAddXdyAttribute{hyperbfit}
\end{verbatim}
This will add information to the \filetype{xdy} file when it's
created by \cs{makeglossaries}. If you prevent the creation of this
file with \ics{noist} then you will need to add the attribute to
your custom \filetype{xdy} file (see the provided
\nolinkurl{samplexdy-mc.xdy} file).

In order to illustrate unusual location formats, this sample
document provides a command called \cs{tallynum}\marg{n} that represents its
numerical argument with a die or dice where the dots add up to \meta{n}:
\begin{verbatim}
\newrobustcmd*{\tallynum}[1]{%
 \ifnum\number#1<7
  $\csname dice\romannumeral#1\endcsname$%
 \else
  $\dicevi$%
  \expandafter\tallynum\expandafter{\numexpr#1-6}%
 \fi
}
\end{verbatim}
This command needs to be robust to prevent it from being expanded
when it's written to any of the auxiliary files. The \ics{dicei},
\ldots, \cs{dicevi} commands are provided by the \sty{stix}
package, so that needs to be loaded.

An associated command \cs{tally}\marg{counter} is defined that
formats the value of the named \meta{counter} according to
\cs{tallynum}:
\begin{verbatim}
\newcommand*{\tally}[1]{\tallynum{\arabic{#1}}}
\end{verbatim}
(This shouldn't be robust as it needs the counter value to expand.)
The page numbers are altered to use this format (by redefining \ics{thepage}).

This custom location format also needs to be identified in the
\filetype{xdy} file so that \gls{xindy} can recognise it and
determine how to form ranges if required.
\begin{verbatim}
\GlsAddXdyLocation{tally}{% tally location format
 :sep "\string\tallynum\space\glsopenbrace"
 "arabic-numbers" 
 :sep "\glsclosebrace"
}
\end{verbatim}
Again this information is written to the \filetype{xdy} file by
\cs{makeglossaries} so if you use \cs{noist} then you need to
manually add it to your custom \filetype{xdy} file.

When \gls{xindy} creates the associated glossary files, the
locations will be written using: 
\begin{alltt}
\csmetameta{glsX}{counter}{X}{format}{}\marg{hyper-prefix}\marg{location}
\end{alltt}
In this case:
\begin{alltt}
\cs{glsXpageXglsnumberformat}\mgroup{}\mgroup{\cs{tallynum}\marg{number}}
\end{alltt}
or
\begin{alltt}
\cs{glsXpageXhyperbfit}\mgroup{}\mgroup{\cs{tallynum}\marg{number}}
\end{alltt}
This means that although \cs{hyperbf} is designed to create
hyperlinked locations, the presence of \cs{tallynum} interferes with
it.
In order to make the hyperlinks work correctly, the definitions of
\cs{glsXpageXhyperbfit} need to be redefined in order to grab the
number part in order to work out the location's numeric value. If
the value of \cs{tally} is changed so that it expands differently
then these modifications won't work.

Remember that in both cases, the second argument \verb|#2| is in the
form \cs{tally}\marg{n}:
\begin{verbatim}
\renewcommand{\glsXpageXglsnumberformat}[2]{%
 \linkpagenumber#2%
}
\renewcommand{\glsXpageXhyperbfit}[2]{%
 \textbf{\em\linkpagenumber#2}%
}
\end{verbatim}
These need a command that can grab the actual number and correctly encapsulate
it:
\begin{verbatim}
\newcommand{\linkpagenumber}[2]{\hyperlink{page.#2}{#1{#2}}}
\end{verbatim}

If you want to try out the \nolinkurl{samplexdy-mc.xdy} file, the
entries starting with \qt{Mac} or \qt{Mc} will be placed in their
own \qt{Mc} letter group. Ideally it should be possible to do this
simply with \ics{GlsAddLetterGroup} (and not require a custom
\filetype{xdy} file) but unfortunately the \qt{M} letter
group will have already been defined and take precedence over
\qt{Mc}, which is why a custom file is required and the normal
language module must be suppressed:
\begin{verbatim}
\setStyleFile{samplexdy-mc}
\noist
\GlsSetXdyLanguage{}
\end{verbatim}

This \qt{Mc} group is suitable for names like
\qt{Maclaurin} but not for \qt{Mach}. To prevent this, the
\gloskey{sort} key for that value is set to lower case:
\begin{verbatim}
\newglossaryentry{mach}{name={Mach, Ernst},
first={Ernst Mach},text={Mach},
sort={mach, Ernst},
description={Czech/Austrian physicist and philosopher}}
\end{verbatim}

\bibglsnote
If you want to convert this document so that it uses \gls{bib2gls},
you first need to switch to \gls{glossaries-extra} and use the
\pkgopt*{record} package option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
The \gls{xindy}-only commands can now all be removed
(attribute \cs{GlsAddXdyAttribute}, location \cs{GlsAddXdyLocation},
language \cs{GlsSetXdyLanguage}, location encapsulators 
\csmetameta{glsX}{counter}{X}{format}{}
and the custom helper \cs{linkpagenumber}).
Also \cs{noist} and \cs{setStyleFile} aren't relevant with
\gls{bib2gls} and so should be removed.

The definitions of \cs{hyperbfit} should be retained (as well as
\cs{tallynum}, \cs{tally} and the redefinition of \cs{thepage}).

The entries all need to be converted to the \filetype{bib} format
required by \gls{bib2gls}.
\begin{prompt}
convertgls2bib -{}-preamble-only samplexdy.tex entries.bib
\end{prompt}
Next replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
and remove all the entry definitions from the preamble. Use the
search and replace function on your text editor to replace all
instances of \ics{glsentryfirst} with \ics*{glsfmtfirst}, and all
instances of \ics{glsentryname} with \ics*{glsfmtname}.

Finally, replace \ics{printglossaries} with \ics*{printunsrtglossaries}.
The document build is now:
\begin{prompt}
pdflatex samplexdy
bib2gls -{}-group samplexdy
pdflatex samplexdy
\end{prompt}

This results in a slightly different ordering from the original
document (without the \qt{Mc} letter group). In the original
example, \qt{Mach number} was listed before \qt{Mach, Ernest}. The
modified document now has \qt{Mach, Ernest} before \qt{Mach number}.
This difference is due to \gls{bib2gls}['s] default
\resourceopt[word]{break-at} setting, which marks word boundaries
with the pipe (\texttt{|}) character, so the sort values for
\gls{bib2gls} are \texttt{Mach|Earnest|} and \texttt{Mach|number|}.
See the \gls{bib2gls} manual for further details of this option, and
also see the examples chapter of that manual for alternative
approaches when creating entries that contain people's names.

If you want the \qt{Mc} letter group, it can be obtained by
providing a custom sort rule:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,
   \resourceopt{sort}=\strong{custom},
   \strong{\xtrfont{sort-rule}}=\mgroup{\ics*{glsxtrcontrolrules}
   ;\ics*{glsxtrspacerules};\ics*{glsxtrnonprintablerules}
   ;\ics*{glsxtrcombiningdiacriticrules},\ics*{glsxtrhyphenrules}
   <\ics*{glsxtrgeneralpuncrules}<\ics*{glsxtrdigitrules}
   <a,A<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K<l,L\strong{<Mc=Mac}<m,M<o,O
   <p,P<q,Q<r,R<s,S<t,T<u,U<v,V<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z
   }
]
\end{alltt}
Unfortunately, as with \gls{xindy}, this puts \qt{Mach} into the
\qt{Mc} letter group.

One way to get around this problem is to define a custom command to
help identify genuine \qt{Mc}/\qt{Mac} prefixes with names that
happen to start with \qt{Mac}. For example:
\begin{alltt}
\atentry{entry}\mgroup{mcadam,
  name = \mgroup{\strong{\cs{Mac}\mgroup{Mc}}Adam, John Loudon},
  description = \mgroup{Scottish engineer},
  text = \mgroup{McAdam},
  first = \mgroup{John Loudon McAdam}
}

\atentry{entry}\mgroup{maclaurin,
  name = \mgroup{\strong{\cs{Mac}\mgroup{Mac}}laurin, Colin},
  description =\mgroup{Scottish mathematician best known for the
\cs{gls}\mgroup{maclaurinseries}},
  text = \mgroup{Maclaurin},
  first = \mgroup{Colin Maclaurin}
}
\end{alltt}
but not for \qt{Mach}:
\begin{alltt}
\atentry{entry}\mgroup{mach,
  name = \mgroup{Mach, Ernst},
  description = \mgroup{Czech/Austrian physicist and philosopher},
  text = \mgroup{Mach},
  first = \mgroup{Ernst Mach}
}
\end{alltt}
With \LaTeX, this command should simply do its argument:
\begin{verbatim}
\newcommand{\Mac}[1]{#1}
\end{verbatim}
However, when \gls{bib2gls} works out the \gloskey{sort} value, it
needs to be defined with something unique that won't happen to occur
at the start of another term. For example:
\begin{verbatim}
\providecommand{\Mac}[1]{MC}
\end{verbatim}
(Remember that \resourceopt[word]{break-at} will strip spaces
and punctuation so don't include them unless you switch to
\resourceopt[none]{break-at}.)

So add the first definition of \cs{Mac} to the \filetype{tex} file and modify
\nolinkurl{entries.bib} so that it includes the second definition:
\begin{alltt}
\atentry{preamble}\mgroup{"\cs{providecommand}\mgroup{\cs{Mac}}[1]\mgroup{MC}"}
\end{alltt}
Then modify the \qt{Mc}/\qt{Mac} entries as appropriate (see the
above \qt{McAdam} and \qt{Maclaurin} examples).

The custom sort rule needs to be modified:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,
   \strong{\xtrfont{write-preamble}=false,}
   \resourceopt{sort}=custom,
   \resourceopt{sort-rule}=\mgroup{\ics*{glsxtrcontrolrules}
   ;\ics*{glsxtrspacerules};\ics*{glsxtrnonprintablerules}
   ;\ics*{glsxtrcombiningdiacriticrules},\ics*{glsxtrhyphenrules}
   <\ics*{glsxtrgeneralpuncrules}<\ics*{glsxtrdigitrules}
   <a,A<b,B<c,C<d,D<e,E<f,F<g,G<h,H<i,I<j,J<k,K<l,L\strong{<MC}<m,M<o,O
   <p,P<q,Q<r,R<s,S<t,T<u,U<v,V<r,R<s,S<t,T<u,U<v,V<w,W<x,X<y,Y<z,Z
   }
]
\end{alltt}
This will create a \qt{Mc} letter group that only includes the names
that start with the custom \cs{Mac} command.

Other alternatives include moving \atentry{preamble} into a separate
\filetype{bib} file, so that you can choose whether or not to
include it. See the \qt{Examples} chapter of the \gls{bib2gls} user
manual for further examples.

\exitem{xdy2} This document illustrates
how to use the \styfmt{glossaries} package where the location
numbers don't follow a standard format. This example will only work
with \gls{xindy}. To create the document do:
\begin{prompt}
pdflatex samplexdy2
makeglossaries samplexdy2
pdflatex samplexdy2
\end{prompt}
The explicit \gls{xindy} call is:
\begin{prompt}
xindy -L english -C utf8 -I xindy -M samplexdy2 -t samplexdy2.glg -o samplexdy2.gls samplexdy2.glo
\end{prompt}
This example uses the \texttt{section} counter with \gls{xindy}:
\begin{verbatim}
\usepackage[xindy,counter=section]{glossaries}
\end{verbatim}
The document employs an eccentric section numbering system for
illustrative purposes. The section numbers are prefixed by the
chapter number in square brackets:
\begin{verbatim}
\renewcommand*{\thesection}{[\thechapter]\arabic{section}}
\end{verbatim}
Parts use Roman numerals:
\begin{verbatim}
\renewcommand*{\thepart}{\Roman{part}}
\end{verbatim}
The section hyperlink name includes the part:
\begin{verbatim}
\renewcommand*{\theHsection}{\thepart.\thesection}
\end{verbatim}
This custom numbering scheme needs to be identified in the
\filetype{xdy} file:
\begin{verbatim}
\GlsAddXdyLocation["roman-numbers-uppercase"]{section}{:sep "["
  "arabic-numbers" :sep "]" "arabic-numbers"
}
\end{verbatim}
If the part is 0 then \cs{thepart} will be empty (there isn't a zero
Roman numeral). An extra case is needed to catch this:
\begin{verbatim}
\GlsAddXdyLocation{zero.section}{:sep "["
  "arabic-numbers" :sep "]" "arabic-numbers"
}
\end{verbatim}
Note that this will stop xindy giving a warning, but the location
hyperlinks will be invalid if no \cs{part} is used.

\bibglsnote
If you want to switch to \gls{bib2gls}, you first need to switch to
\gls{glossaries-extra} but remember to use \pkgopt*{record} instead
of \pkgopt{xindy}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},counter=section]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Next remove the \cs{GlsAddXdyLocation} commands and convert the
entry definitions to the \filetype{bib} format required by
\gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-preamble-only samplexdy2.tex entries.bib
\end{prompt}
Now replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
and remove the \cs{newglossaryentry} commands.
Finally, replace \cs{printglossaries} with \ics*{printunsrtglossaries}.

The document build is:
\begin{prompt}
pdflatex samplexdy2
bib2gls samplexdy2
pdflatex samplexdy2
\end{prompt}

With unusual numbering systems, it's sometimes better to use \pkgopt+{nameref}{record}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}=nameref},counter=section]\mgroup{\strong{glossaries-extra}}
\end{alltt}
In this case, the locations will be the actual section headings,
rather than the section number. In order to make the number appear
instead you need to define:
\begin{alltt}
\cs{newcommand}*\mgroup{\ics*{glsxtrsectionlocfmt}}[2]\mgroup{\#1}
\end{alltt}
(Make sure you have at least v1.42 of \gls{glossaries-extra}.) See
also the earlier \samplefile{Sec}. 

\exitem{xdy3} This document is very similar to 
\samplefile{xdy} but uses the command \cs{Numberstring} from the
\sty{fmtcount} package to format the page numbers instead of the
\cs{tally} command from the earlier example.

\exitem{utf8} This is another example
that uses \gls{xindy}. Unlike \gls{makeindex},
\gls{xindy} can cope with \glspl{nonlatinchar}. This
document uses UTF-8 encoding. To create the document do:
\begin{prompt}
pdflatex sampleutf8
makeglossaries sampleutf8
pdflatex sampleutf8
\end{prompt}
The explicit \gls{xindy} call is
(no line breaks):
\begin{prompt}\raggedright
xindy -L english -C utf8 -I xindy -M sampleutf8 -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
\end{prompt}

If you remove the \pkgopt{xindy} option from \texttt{sampleutf8.tex} 
and do:
\begin{prompt}
pdflatex sampleutf8
makeglossaries sampleutf8
pdflatex sampleutf8
\end{prompt}
or
\begin{prompt}
pdflatex sampleutf8
makeglossaries-lite sampleutf8
pdflatex sampleutf8
\end{prompt}
you will see that the entries that start with an \gls{exlatinchar}
now appear in the symbols group, and the word \qt{man\oe uvre} is now 
after \qt{manor} instead of before it. If you want to explicitly
call \gls{makeindex} (no line breaks):
\begin{prompt}
makeindex -s sampleutf8.ist -t sampleutf8.glg -o sampleutf8.gls sampleutf8.glo
\end{prompt}

\bibglsnote
If you want to switch to \gls{bib2gls}, you first need to switch to
\gls{glossaries-extra} but replace \pkgopt{xindy} with
\pkgopt*{record}:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{postdot},\xtrfont{stylemods},style=listgroup]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Note that you don't need the \pkgopt{nonumberlist} option with
\gls{bib2gls}. You can instruct \gls{bib2gls} to simply not save the
\glspl{numberlist}, but in this case there won't be any locations as
there's no actual indexing.

The entries need to be converted to the \filetype{bib} format
required by \gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-preamble-only -{}-texenc UTF-8 -{}-bibenc UTF-8 sampleutf8.tex entries.bib
\end{prompt}
Note the first line of the \nolinkurl{entries.bib} file:
\begin{alltt}
\% Encoding: UTF-8
\end{alltt}
This is the encoding of the \filetype{bib} file. It doesn't have to
match the encoding of the \filetype{tex} file, but it's generally
better to be consistent. When \gls{bib2gls} parses this file, it
will look for this encoding line.
(If the \texttt{-{}-texenc} and \texttt{-{}-bibenc} switches aren't
used, \gls{convertgls2bib} will assume your system's default
encoding. See the \gls{bib2gls} manual for further details.)

Next replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all}]
\end{alltt}
and remove all the \cs{newglossaryentry} commands.

Iterative commands like \ics{glsaddall} don't work with
\gls{bib2gls}.  Instead, you can select all entries using the
\resourceopt[all]{selection} option.
This is actually better than \cs{glsaddall}, which enforces
the selection of all entries by indexing each entry. As a result,
with \gls{makeindex} and \gls{xindy} (and \opt1), every entry will
have the same location (which is the location of the \cs{glsaddall}
command, in this case page~1). With \resourceopt[all]{selection},
\gls{bib2gls} will automatically selection all entries even if they
don't have any records (indexing information) so in this case there
are no \glspl{numberlist}.

Finally, replace \cs{printglossaries} with
\ics*{printunsrtglossaries}. The build process is now:
\begin{prompt}
pdflatex sampleutf8
bib2gls -{}-group sampleutf8
pdflatex sampleutf8
\end{prompt}
\gls{bib2gls} picks up the encoding of the \filetype{tex} file from
the \filetype{aux} file:
\begin{alltt}
\ics*{glsxtr@texencoding}\mgroup{utf8}
\end{alltt}
If you experience any encoding issues, check the \filetype{aux} file for
this command and check the \filetype{bib} file for the encoding
comment line. Also check \gls{bib2gls}['s] \filetype{glg} transcript file
for encoding messages, which should look like:
\begin{verbatim}
TeX character encoding: UTF-8
\end{verbatim}

The document language, if it has been set, is also added to the \filetype{aux} file when
the \pkgopt{record} option is used. In this case, no language
package has been used, so \gls{bib2gls} will fallback on the system's default
locale. If no sort method is set, the entries will be sorted
according to the document language, if set, or the default locale.
You can specify a specific locale using the \resourceopt{sort} key
with a locale tag identifier. For example:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all},\strong{\xtrfont{sort}=de-CH-1996}]
\end{alltt}
(Swiss German new orthography) or:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\resourceopt{selection}=\strong{all},\strong{\xtrfont{sort}=is}]
\end{alltt}
(Icelandic).

\section{No Indexing Application (Option 1)}
\label{sec:samplesnoidx}

\exitem{-noidxapp} This document illustrates how to use the
\styfmt{glossaries} package without an external \gls{indexingapp} (\opt1).
To create the complete document, you need to do:
\begin{prompt}
pdflatex sample-noidxapp
pdflatex sample-noidxapp
\end{prompt}
Note the need to group the accent command that occurs at the start
of the \gloskey{name}:
\begin{alltt}
\cs{newglossaryentry}\mgroup{elite}\mgroup{\%
  name=\mgroup{\strong{\mgroup{\ics{'}e}}lite},
  description=\mgroup{select group of people}
}
\end{alltt}
This is necessary to allow the term to work with \ics{Gls}.
Notice also how the \glspl{numberlist} can't be compacted into
ranges. For example, the list \qt{1, 2, 3} would be converted to
\qt{1--3} with a proper indexing application (\optsor23 or, with
\gls{glossaries-extra}, \opt4).

The larger the list of entries, the longer the document build time.
This method is very inefficient for large glossaries. See
\gallery{glossaries-performance.shtml}{Gallery: glossaries performance} for a comparison.

\exitem{-noidxapp-utf8} As the previous example, except that it uses
the \sty{inputenc} package.
To create the complete document, you need to do:
\begin{prompt}
pdflatex sample-noidxapp-utf8
pdflatex sample-noidxapp-utf8
\end{prompt}
This method is unsuitable for sorting languages with
\glspl{exlatinalph} or \glspl{nonlatinalph}. Use \optsor34 instead.

\section{Other}
\label{sec:samplesother}

\exitem{4col} This document illustrates
a four column glossary where the entries have a symbol in addition
to the name and description. To create the complete document, you
need to do:
\begin{prompt}
pdflatex sample4col
makeglossaries sample4col
pdflatex sample4col
\end{prompt}
or
\begin{prompt}
pdflatex sample4col
makeglossaries-lite sample4col
pdflatex sample4col
\end{prompt}
The vertical gap between entries is the
gap created at the start of each group. This can be suppressed
using the \pkgopt{nogroupskip} package option. (If you switch to
\gls{bib2gls}, simply omit the \texttt{-{}-group} command line option.)

This example uses the \glostyle{long4colheaderborder}. This style
doesn't allow multi-line descriptions. You may prefer to use
\glostyle{altlong4colheaderborder} with long descriptions. However,
in either case a style that uses \sty{booktabs} is preferable. For
example, \glostyle{long4col-booktabs} or
\glostyle{altlongragged4col-booktabs}. Note that this requires
\sty{glossary-longbooktabs}, which needs to be explicitly loaded.
The style can only be set once this package has been loaded:
\begin{alltt}
\cs{usepackage}\mgroup{glossaries}
\cs{usepackage}\mgroup{glossary-longbooktabs}
\cs{setglossarystyle}\mgroup{altlongragged4col-booktabs}
\end{alltt}

\glsxtrnote
The \gls{glossaries-extra} package provides a more compact way of
doing this with the \pkgopt*{stylemods} option:
\begin{alltt}
\cs{usepackage}[style=altlongragged4col-booktabs,\xtrfont{stylemods}=\strong{longbooktabs}]
\mgroup{\strong{glossaries-extra}}
\end{alltt}
The \gls{glossaries-extra} package provides additional styles,
including more \qt{long} styles with the \sty*{glossary-longextra}
package. For example, the \xtrglostyle{long-name-desc-sym-loc}
style:
\begin{alltt}
\cs{usepackage}[style=\strong{\xtrfont{long-name-desc-sym-loc}},\xtrfont{stylemods}=\strong{longextra}]
\mgroup{glossaries-extra}
\end{alltt}
If you use the \pkgopt*{stylemods} option with an argument, you may
prefer to use it with \pkgopt{nostyles} to prevent unwanted styles
from being automatically loaded. For example:
\begin{alltt}
\cs{usepackage}[style=\xtrfont{long-name-desc-sym-loc},\strong{\xtrfont{nostyles},}\xtrfont{stylemods}=longextra]
\mgroup{glossaries-extra}
\end{alltt}
See also the
\gallery{glossaries-styles/}{gallery of predefined styles}.

\exitem{-numberlist} This document illustrates how to reference the
\gls{numberlist} in the document text. This requires an additional
\LaTeX\ run:
\begin{prompt}
pdflatex sample-numberlist
makeglossaries sample-numberlist
pdflatex sample-numberlist
pdflatex sample-numberlist
\end{prompt}
This uses the \pkgopt{savenumberlist} package option, which enables 
\ics{glsentrynumberlist} and \ics{glsdisplaynumberlist}
(with limitations).  The location counter is set to
\texttt{chapter}, so the \gls{numberlist} refers to the chapter
numbers.
\begin{verbatim}
\usepackage[savenumberlist,counter=chapter]{glossaries}
\end{verbatim}
The \gls{numberlist} can't be obtained until \gls{makeindex} (or
\gls{xindy}) has created the glossary file. The \gls{numberlist} is
picked up when this file is input by \cs{printglossary} and is then
saved in the \filetype{aux} file so that it's available on the next
\LaTeX\ run.

This document contains both commands:
\begin{alltt}
This is a \cs{gls}\mgroup{sample} document. \cs{Glspl}\mgroup{sample}
are discussed in chapters~\strong{\ics{glsdisplaynumberlist}}\mgroup{sample}
(or \strong{\ics{glsentrynumberlist}}\mgroup{sample}).
\end{alltt}
Without \sty{hyperref}, the first list shows as \qt{1--3, 5 \& 6}
and the second list shows as \qt{1--3, 5, 6}.

Note that you can't use \ics{glsdisplaynumberlist} with
\sty{hyperref} and \optsor23. If you do, you will get the warning:
\begin{verbatim}
Package glossaries Warning: \glsdisplaynumberlist doesn't work with 
hyperref.
Using \glsentrynumberlist instead
\end{verbatim}
Now both lists show as \qt{1--3, 5, 6}.

If you switch to \opt1 (replace \cs{makeglossaries} with
\cs{makenoidxglossaries} and replace \cs{printglossaries} with
\cs{printnoidxglossaries}), then the document build is simply:
\begin{prompt}
pdflatex sample-numberlist
pdflatex sample-numberlist
\end{prompt}
Now \ics{glsdisplaynumberlist} works with \sty{hyperref},
however there are no ranges, so the first list shows as \qt{1,
2, 3, 5, \& 6} and the second list shows as \qt{1, 2, 3, 4, 5, 6}.

\bibglsnote
If you want to switch to \gls{bib2gls}, you first need to switch to
\gls{glossaries-extra} (at least v1.42) but remember to include the \pkgopt{record}
option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},counter=chapter]\mgroup{\strong{glossaries-extra}}
\end{alltt}
Note that the \pkgopt{savenumberlist} option is no longer required.
Next convert the entry to the \filetype{bib} format required by
\gls{bib2gls}:
\begin{prompt}
convertgls2bib sample-numberlist.tex entries.bib
\end{prompt}
Replace \cs{makeglossaries} with:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries.bib]
\end{alltt}
and remove the \cs{newglossaryentry} command from the document
preamble. Finally, replace \cs{printglossaries} with
\ics*{printunsrtglossaries}. The build process is now:
\begin{prompt}
pdflatex sample-numberlist
bib2gls sample-numberlist
pdflatex sample-numberlist
\end{prompt}
Now both ranges and hyperlinks work. The first list shows \qt{1--3,
5, \& 6} and the second list shows \qt{1--3, 5, 6}. You can also
use:
\begin{alltt}
\ics*{glsxtrfieldformatlist}\mgroup{sample}\mgroup{loclist}
\end{alltt}
which will show the complete list without ranges \qt{1, 2, 3, 5 \&
6}.

This method works much better than using the \pkgopt{savenumberlist}
option because \gls{bib2gls} saves the formatted \gls{numberlist} in the
\xtrfield{location} field (which is an internal field provided by
\gls{glossaries-extra} for the benefit of \gls{bib2gls}) and the
unformatted \gls{numberlist} in the \field{loclist} internal field (which is
also used by \opt1).

With \optsand23, both \gls{makeindex} and \gls{xindy} simply create a
file containing the commands to typeset the glossary, which is input
by \cs{printglossary}. This means that it's quite hard to gather
information obtained by the \gls{indexingapp}.

\gls{bib2gls}, on the other hand, doesn't write a file containing
the glossary. It writes a file containing the entry definitions and
uses internal fields to save the indexing information. The glossary is
then displayed with \ics*{printunsrtglossary}, which simply iterates
over all defined entries and fetches the required information from
those internal fields.

The \ics{glsdisplaynumberlist} and \ics{glsentrynumberlist} commands
are redefined by \sty{glossaries-extra-bib2gls} to simply access the
\xtrfield{location} field.
However, if you want a complete list without ranges you can use:
\begin{alltt}
\ics*{glsxtrfieldformatlist}\mgroup{sample}\mgroup{loclist}
\end{alltt}
In this example, this produces \qt{1, 2, 3, 5 \& 6}. 

Note the difference if you use the \pkgopt+{nameref}{record} package
option instead of just \pkgopt*{record}.

\exitem{-nomathhyper} This document illustrates how to selectively
enable and disable entry hyperlinks in \ics{glsentryfmt}. The
document build is:
\begin{prompt}
pdflatex sample-nomathhyper
makeglossaries sample-nomathhyper
pdflatex sample-nomathhyper
\end{prompt}
This disables the hyperlinks for the main glossary with:
\begin{alltt}
\ics{GlsDeclareNoHyperList}\mgroup{main}
\end{alltt}
and then redefines \cs{glsentryfmt} so that it adds a hyperlink if
not in maths mode and the hyperlinks haven't been forced off (with
the \texttt{\gloskey[glslink]{hyper}\dequals false} key).

\glsxtrnote
If you want to switch to \gls{glossaries-extra}, then you can
instead use the hook that comes before the keys are set. The
preamble is much simpler:
\begin{alltt}
\cs{usepackage}\mgroup{\strong{glossaries-extra}}

\cs{makeglossaries}

\cs{renewcommand}\mgroup{\strong{\ics*{glslinkpresetkeys}}}\mgroup{\%
 \cs{ifmmode} \cs{setkeys}\mgroup{glslink}\mgroup{hyper=false}\cs{fi}
}

\% entry definition
\end{alltt}

\exitem{-entryfmt} This document illustrates how to change the
way an entry is displayed in the text. (This is just a test
document. For a real document, I recommend you use the \sty{siunitx}
package to typeset units.) The document build is:
\begin{prompt}
pdflatex sample-entryfmt
makeglossaries sample-entryfmt
pdflatex sample-entryfmt
\end{prompt}
This redefines \ics{glsentryfmt} to add the symbol on
\gls{firstuse}:
\begin{alltt}
\cs{renewcommand}*\mgroup{\cs{glsentryfmt}}\mgroup{\%
  \ics{glsgenentryfmt}
  \ics{ifglsused}\mgroup{\cs{glslabel}}\mgroup{}\mgroup{\cs{space} (\strong{\ics{glsentrysymbol}}\mgroup{\cs{glslabel}})}\%
}
\end{alltt}
Note the use of \cs{glsentrysymbol} \emph{not} \cs{glssymbol} (which
would result in nested \gls{linktext}).

\glsxtrnote
If you want to switch to the \gls{glossaries-extra} package, you can
make use of the category post-link hook instead:
\begin{alltt}
\cs{usepackage}[\xtrfont{stylemods},style=tree]\mgroup{\strong{glossaries-extra}}

\cs{makeglossaries}

\ics*{glsdefpostlink}\mgroup{\strong{unit}}\mgroup{\ics*{glsxtrpostlinkAddSymbolOnFirstUse}}

\cs{newglossaryentry}\mgroup{distance}\mgroup{
\xtrfont{category}=\mgroup{\strong{unit}},
name=distance,
description=\mgroup{The length between two points},
symbol=\mgroup{km}}
\end{alltt}
Note that in this case the symbol is now outside of the hyperlink.

\exitem{-prefix} This document illustrates the use of the
\sty{glossaries-prefix} package. An additional run is required to
ensure the table of contents is up-to-date:
\begin{prompt}
pdflatex sample-prefix
makeglossaries sample-prefix
pdflatex sample-prefix
pdflatex sample-prefix
\end{prompt}
Remember that the default separator between the prefix and \cs{gls}
(or one of its variants) is empty, so if a space is required it must
be inserted at the end of the prefix. However, the \sty{xkeyval}
package (which is used to parse the \meta{key}\dequals\meta{value}
lists) trims leading and trailing space from the values, so an
ordinary space character will be lost.
\begin{alltt}
\cs{newglossaryentry}\mgroup{sample}\mgroup{name=\mgroup{sample},
  description=\mgroup{an example},
  prefix=\mgroup{a\strong{~}},
  prefixplural=\mgroup{the\strong{\cs{space}}}%
}

\cs{newglossaryentry}\mgroup{oeil}\mgroup{name=\mgroup{oeil},
  plural=\mgroup{yeux},
  description=\mgroup{eye},
  prefix=\mgroup{l'},
  prefixplural=\mgroup{les\strong{\cs{space}}}}
\end{alltt}

\glsxtrnote
If you want to convert this example to use \gls{glossaries-extra},
then (as from v1.42) you can use the \pkgopt*{prefix} option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{prefix}},\xtrfont{postdot},acronym]\mgroup{\strong{glossaries-extra}}
\end{alltt}
(Alternatively load \sty{glossaries-prefix} after
\gls{glossaries-extra}.) The rest of the document is the same as for
the base \styfmt{glossaries} package, unless you want to switch to
using \gls{bib2gls}.

\bibglsnote
If you want to switch to \gls{bib2gls}, first switch to
\gls{glossaries-extra} (as above) but make sure you include the
\pkgopt*{record} package option:
\begin{alltt}
\cs{usepackage}[\strong{\xtrfont{record}},\xtrfont{prefix},\xtrfont{postdot},acronym]\mgroup{glossaries-extra}
\end{alltt}
Next convert the entries into the \filetype{bib} format required by
\gls{bib2gls}:
\begin{prompt}
convertgls2bib -{}-preamble-only sample-prefix.tex entries.bib
\end{prompt}
Replace \cs{makeglossaries} with
\begin{alltt}
\ics*{setabbreviationstyle}[acronym]\mgroup{long-short}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries]
\end{alltt}
remove the entry definitions from the preamble, and replace
\begin{alltt}
\cs{printglossary}[style=plist]
\cs{printacronyms}
\end{alltt}
with
\begin{alltt}
\ics*{printunsrtglossary}[style=plist]
\ics*{printunsrtacronyms}
\end{alltt}
The document build is now:
\begin{prompt}
pdflatex sample-prefix
bib2gls sample-prefix
pdflatex sample-prefix
\end{prompt}

With \gls{bib2gls} v2.0+, you don't need to manually insert the spaces at
the end of the prefixes. Instead you can instruct \gls{bib2gls} to
insert them. To try this out, remove the trailing \verb|~| and
\cs{space} from the \nolinkurl{entries.bib} file:
\begin{alltt}
\atentry{entry}\mgroup{sample,
  prefix = \mgroup{a},
  name = \mgroup{sample},
  description = \mgroup{an example},
  prefixplural = \mgroup{the}
}

\atentry{entry}\mgroup{oeil,
  plural = \mgroup{yeux},
  prefix = \mgroup{l'},
  name = \mgroup{oeil},
  description = \mgroup{eye},
  prefixplural = \mgroup{les}
}

\atentry{acronym}\mgroup{svm,
  prefixfirst = \mgroup{a},
  prefix = \mgroup{an},
  short = \mgroup{SVM},
  long = \mgroup{support vector machine}
}
\end{alltt}
Now add the \resourceopt[\mgroup{space or nbsp}]{append-prefix-field}
resource option:
\begin{alltt}
\ics*{GlsXtrLoadResources}[\resourceopt{src}=entries,\strong{\xtrfont{append-prefix-field}=\mgroup{space or nbsp}}]
\end{alltt}
See the \gls{bib2gls} manual for further details.

\exitem{accsupp} This document uses the \sty{glossaries-accsupp} package 
(see \sectionref{sec:accsupp}). That package automatically loads
\styfmt{glossaries} and passes all options to the base package. So
you can load both packages at once with just:
\begin{verbatim}
\usepackage[acronym]{glossaries-accsupp}
\end{verbatim}
This provides additional keys that aren't available with just the
base package, which may be used to provide replacement text. The
replacement text is inserted using \sty{accsupp}'s
\ics{BeginAccSupp} and \ics{EndAccSupp} commands. See the
\sty{accsupp} package for further details of those commands.

Note that this example document is provided to demonstrate
\sty{glossaries-accsupp} as succinctly as possible. The resulting
document isn't fully accessible as it's not tagged. See the
\sty{accessibility} and \sty{tagpdf} packages for further
information about tagging documents.

It's not essential to use \sty{glossaries-accsupp}. You can simply insert the replacement
text directly into the field values. For example:
\begin{verbatim}
\newglossaryentry{Drive}{
 name={\BeginAccSupp{Actual=Drive}Dr.\EndAccSupp{}},
 description={Drive}
}
\newglossaryentry{image}{name={sample image},
 description={an example image},
 user1={\protect\BeginAccSupp{Alt={a boilerplate image used in
  examples}}\protect\includegraphics
  [height=20pt]{example-image}\protect\EndAccSupp{}}
}
\end{verbatim}
However, this can cause interference (especially with
case-changing). With \sty{glossaries-accsupp} it's possible to
obtain the field values without the accessibility information if
required. (If in the future \cs{includegraphics} is given extra
options to provide replacement text then the image example here
won't be necessary. However, the example can be adapted for images
created with \TeX\ code.)

The acronym style is set using:
\begin{verbatim}
\setacronymstyle{long-short}
\end{verbatim}
The first abbreviation is straightforward:
\begin{verbatim}
\newacronym{eg}{e.g.}{for example}
\end{verbatim}
The \gloskey{shortaccess} replacement text is automatically set to
the long form. The next abbreviation is awkward as the long form contains
formatting commands which can't be included in the replacement text.
This means that the \gloskey{shortaccess} key must be supplied:
\begin{alltt}
\cs{newacronym}[\strong{shortaccess}=\mgroup{TiKZ ist kein Zeichenprogramm}]
\mgroup{tikz}\mgroup{Ti\cs{emph}\mgroup{k}Z}\mgroup{Ti\cs{emph}\mgroup{k}Z ist \cs{emph}\mgroup{kein} Zeichenprogramm}
\end{alltt}
In the above two cases, the short form obtained in \cs{gls} will use
the \qt{E} PDF element.

By way of comparison, there are some entries that are technically 
abbreviations but are defined using \ics{newglossaryentry} instead
of \ics{newacronym}. The replacement text is provided in the
\gloskey{access} key:
\begin{alltt}
\cs{newglossaryentry}\mgroup{Doctor}\mgroup{name=Dr,description=\mgroup{Doctor},\strong{access}=\mgroup{Doctor}}
\cs{newglossaryentry}\mgroup{Drive}\mgroup{name=\mgroup{Dr.},plural=\mgroup{Drvs},description=\mgroup{Drive},
  \strong{access}=\mgroup{Drive}}
\end{alltt}
These will use PDF's \qt{ActualText} element (not \qt{E}).

The next entry is a symbol (the integration symbol $\int$). This
could be defined simply as:
\begin{verbatim}
\newglossaryentry{int}{name={int},description={integral},
 symbol={\ensuremath{\int}}}
\end{verbatim}
and then referenced in the text like this:
\begin{verbatim}
Symbol: \gls{int} (\glssymbol{int}).
\end{verbatim}
This results in the text \qt{Symbol: integral ($\int$).} However if you
copy and paste this from the PDF you will find the resulting text is
\qt{Symbol: int (R).} This is what's actually read out by the
text-to-speech system.

It would be better if the actual text was the Unicode character
0x222B. This would not only assist the text-to-speech system but
also make it easier to copy and paste the text. The simplest method
is to identify the character by its hexadecimal code, but in order
to do this the \ics{BeginAccSupp} command needs to have the options adjusted.

In order to determine whether to use \qt{E}, \qt{ActualText} or
\qt{Alt} for a particular field, \sty{glossaries-accsupp} will check
if the command \csmeta{gls}{field}{accsupp} exists (where
\meta{field} is the internal field label, see \tableref{tab:fieldmap}). Only two of
these commands are predefined: \ics{glsshortaccsupp} and
\ics{glsshortplaccsupp}, which is why the \gloskey{shortaccess}
field uses \qt{E}. If the given command doesn't exist then the
generic \ics{glsaccsupp} command is used instead.

This means that in order to simply set \gloskey{symbolaccess} to the
hexadecimal character code, I need to provide a command called
\ics{glssymbolaccsupp}:
\begin{alltt}
\cs{newcommand}\mgroup{\cs{gls\strong{symbol}accsupp}}[2]\mgroup{\%
 \ics{glsaccessibility}[\strong{method=hex,unicode}]\mgroup{\strong{ActualText}}\mgroup{\#1}\mgroup{\#2}\%
}
\end{alltt} 
Now I can adjust the definition of the \texttt{int} entry:
\begin{alltt}
\cs{newglossaryentry}\mgroup{int}\mgroup{name=\mgroup{int},description=\mgroup{integral},
  symbol=\mgroup{\cs{ensuremath}\mgroup{\cs{int}}},\strong{symbolaccess=\mgroup{222B}}
}
\end{alltt}

The final entry has an image stored in the \gloskey{user1} key. (The
image file is provided with the \sty{mwe} package.) This should use
\qt{Alt} instead of \qt{ActualText} so I need to define
\ics{glsuseriaccsupp}:
\begin{alltt}
\cs{newcommand}\mgroup{\cs{gls\strong{useri}accsupp}}[2]\mgroup{\%
  \ics{glsaccessibility}\mgroup{\strong{Alt}}\mgroup{\#1}\mgroup{\#2}\%
}
\end{alltt}
The image description is provided in the \gloskey{user1access} key:
\begin{alltt}
\cs{newglossaryentry}\mgroup{sampleimage}\mgroup{name=\mgroup{sample image},
 description=\mgroup{an example image},
 user1=\mgroup{\cs{protect}\ics{includegraphics}[height=20pt]\mgroup{example-image}},
 \strong{user1access}=\mgroup{a boilerplate image used in examples}
}
\end{alltt}
(Note the need to protect the fragile \ics{includegraphics}. The alternative is
to use \cs{glsnoexpandfields} before defining the command. See
\sectionref{sec:expansion}.)

If you try this example and inspect the PDF\footnote{You can either
uncompress the PDF file and view it in a text editor or you can use
a tool such as the PDFDebugger provided with 
\href{https://pdfbox.apache.org/}{PDFBox}.}\ then you will find
content like:
\begin{verbatim}
/Span << /ActualText (Doctor) >> BDC
  BT
    /F8 9.9626 Tf
    73.102 697.123 Td
    [ (Dr) ] TJ
  ET
EMC
\end{verbatim}
This shows that \qt{ActualText} was used for \verb|\gls{Doctor}|.
The integral symbol ($\int$) created with \verb|\glssymbol{int}| is:
\begin{verbatim}
/Span << /ActualText (\376\377"+) >> BDC
  BT
    /F1 9.9626 Tf
    97.732 650.382 Td
    [ (R) ] TJ
  ET
EMC
\end{verbatim} 
Again, \qt{ActualText} has been used, but the character code has
been supplied. The image created with \verb|\glsuseri{sampleimage}| is:
\begin{verbatim}
/Span << /Alt (a boilerplate image used in examples) >> BDC
  1 0 0 1 106.588 618.391 cm
  q
    0.08301 0 0 0.08301 0 0 cm
    q
      1 0 0 1 0 0 cm
      /Im1 Do
    Q
  Q
EMC
\end{verbatim}
This shows that \qt{Alt} has been used.

The first use of \verb|\gls{eg}| produces the long form (not
reproduced here) followed by the short form:
\begin{verbatim}
/Span << /E (for example) >> BDC
  BT
    /F8 9.9626 Tf
    161.687 563.624 Td
    [ (e.g.) ] TJ
  ET
EMC
\end{verbatim}
The subsequent use also has the \qt{E} element:
\begin{verbatim}
/Span << /E (for example) >> BDC
  BT
    /F8 9.9626 Tf
    118.543 551.669 Td
    [ (e.g.) ] TJ
  ET
EMC
\end{verbatim}
Similarly for \verb|\acrshort{eg}|. You can also use the
\pkgopt[showaccsupp]{debug} package option. This will show the
replacement text in the document, but note that this is the content before
it's processed by \cs{BeginAccSupp}.

If the \ics{setacronymstyle} command is removed (or commented out)
then the result would be different. The \gls{firstuse} of \cs{gls} uses \qt{E} for
the short form but the subsequent use has \qt{ActualText} instead.
This is because without \ics{setacronymstyle} the original acronym
mechanism is used, which is less sophisticated than the newer
acronym mechanism that's triggered with \ics{setacronymstyle}.

\begin{important}
If you want to convert this example so that it uses
\gls{glossaries-extra}, make sure you have at least version 1.42 of
the extension package.
\end{important}

\glsxtrnote
If you want to convert this example so that it uses
\gls{glossaries-extra}, you need to replace the explicit loading of
\sty{glossaries-accsupp} with an implicit load through the
\pkgopt*{accsupp} package option:
\begin{alltt}
\cs{usepackage}[\xtrfont{abbreviations},\strong{\xtrfont{accsupp}}]\mgroup{\strong{glossaries-extra}}
\end{alltt}
I'm switching from \ics{newacronym} to \ics*{newabbreviation}, which
means that the default category is \cat{abbreviation} and also the
file extensions are different. If you are using \gls{makeglossaries}
or \gls{makeglossaries-lite.lua} you don't need to worry about it.
However, if you're not using those helper scripts then you will need
to adjust the file extensions in your document build process.

The style command \texttt{\cs{setacronymstyle}\mgroup{long-short}} needs
to be replaced with:
\begin{alltt}
\ics{setabbreviationstyle}\mgroup{long-short}
\end{alltt}
This is actually the default so you can simply delete the
\cs{setacronymstyle} line. Substitute the two instances of
\ics{newacronym} with \ics*{newabbreviation}. For example:
\begin{alltt}
\strong{\ics*{newabbreviation}}\mgroup{eg}\mgroup{e.g.}\mgroup{for example}
\end{alltt}
Note that for the \texttt{tikz} entry you can now remove the explicit assignment of
\gloskey{shortaccess} with \gls{glossaries-extra} v1.42 as it will
strip formatting commands like \cs{emph}: 
\begin{alltt}
\ics*{newabbreviation}
 \mgroup{tikz}\mgroup{Ti\cs{emph}\mgroup{k}Z}\mgroup{Ti\cs{emph}\mgroup{k}Z ist \cs{emph}\mgroup{kein} Zeichenprogramm}
\end{alltt}
It's also necessary to replace \cs{acrshort}, \cs{acrlong} and \cs{acrfull} with
\ics*{glsxtrshort}, \ics*{glsxtrlong} and \ics*{glsxtrfull}.

You may notice a slight difference from the original example. The
\gloskey{shortaccess} field now shows \meta{long} (\meta{short})
instead of just \meta{long}. This is because \gls{glossaries-extra}
redefines \ics{glsdefaultshortaccess} to include the short form.   

Now that the extension package is being used, there are some other
modifications that would tidy up the code and fix a few issues.

The \qt{Doctor} and \qt{Drive} entries should really be defined as
abbreviations but they shouldn't be expanded on first use. The
\abbrstyle{short-nolong} style can achieve this and it happens to be
the default style for the \cat{acronym} category. This means that
you can simply replace the \qt{Doctor} definition with:
\begin{alltt}
\ics{newacronym}\mgroup{Doctor}\mgroup{Dr}\mgroup{Doctor}
\end{alltt}
The \gls{firstuse} of \verb|\gls{Doctor}| is just \qt{Dr}.  This
means that the \qt{E} element will be used instead of \qt{ActualText}.
Now I don't need to supply the accessibility text as its obtained
from the long form.

The \qt{Drive} entry can be similarly defined but it has the awkward
terminating full stop. This means that I had to omit the end of
sentence terminator in:
\begin{verbatim}
\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive}
\end{verbatim}
This looks odd when reading the document source and it's easy to
forgot. This is very similar to the situation in the
\samplefile{-dot-abbr} example. I can again use the
\attr{discardperiod} attribute, but I need to assign a different
category so that it doesn't interfere with the \qt{Doctor} entry.

The category is simply a label that's used in the construction of
some internal command names. This means that it must be fully
expandable, but I can choose whatever label I like (\cat{general},
\cat{abbreviation}, \cat{acronym}, \cat{index}, \cat{symbol} and
\cat{number} are used by various commands provided by
\gls{glossaries-extra}).

In this case, I've decided to have a category called \texttt{shortdotted} 
to indicate an abbreviation that ends with a
dot but only the short form is shown on \gls{firstuse}:
\begin{alltt}
\ics*{setabbreviationstyle}[shortdotted]\mgroup{short-nolong-noreg}
\ics*{glssetcategoryattribute}\mgroup{shortdotted}\mgroup{discardperiod}\mgroup{true}
\ics*{newabbreviation}[category=shortdotted]\mgroup{Drive}\mgroup{Dr.\cs{@}}\mgroup{Drive}
\end{alltt}
In the \samplefile{-dot-abbr} example, I also used the
\attr{insertdots} attribute to automatically insert the dots and add
the space factor (which is adjusted if \attr{discardperiod} discards
a period). In this case I'm inserting the dot manually so I've also
added the space factor with \ics{@} in case the abbreviation is used
mid-sentence. For example:
\begin{verbatim}
\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive}. Next sentence.

\gls{Doctor} Smith lives at 2, Blueberry \gls{Drive} end of sentence.
\end{verbatim}
(The spacing is more noticeable if you first switch to a monospaced
font with \cs{ttfamily}.)

The \qt{e.g.}\ abbreviation similarly ends with a dot. It's not
usual to write \qt{for example (e.g.)}\ in a document, so it really
ought to have the same \texttt{shortdotted} category, but it has a
long-short form for illustrative purposes in this test document. In
this case I need to choose another category so that I can apply a
different style. For example:
\begin{alltt}
\ics*{setabbreviationstyle}[longshortdotted]\mgroup{long-short}
\ics*{glssetcategoryattribute}\mgroup{longshortdotted}\mgroup{discardperiod}\mgroup{true}
\ics*{newabbreviation}[category=longshortdotted]\mgroup{e.g.}\mgroup{e.g.\cs{@}}\mgroup{for
example}
\end{alltt}

To further illustrate categories, let's suppose the symbol and image
should be in the \gloskey{name} field instead of the
\gloskey{symbol} and \gloskey{user1} fields. Now the
\cs{glssymbolaccsupp} and \cs{glsuseriaccsupp} commands won't be
used. I can't deal with both cases if I just provide
\cs{glsnameaccsupp}. 

I could provide category-field versions, such as
\xtrfont{\cs{glsxtrsymbolnameaccsupp}}, but remember that this only covers
accessing the \gloskey{name} field, which is typically only done in
the glossary. I would also need similar commands for the
\gloskey{first}, \gloskey{firstplural}, \gloskey{text} and
\gloskey{plural} keys. This is quite complicated, but since I don't
need to worry about any of the other fields it's simpler to just
provide the \csmeta*{glsxtr}{category}{accsupp} version:
\begin{alltt}
\cs{newcommand}\mgroup{\xtrfont{\cs{glsxtr\strong{symbol}accsupp}}}[2]\mgroup{\%
 \ics{glsaccessibility}[method=hex,unicode]\mgroup{ActualText}\mgroup{\#1}\mgroup{#2}\%
}
\cs{newcommand}\mgroup{\xtrfont{\cs{glsxtr\strong{image}accsupp}}}[2]\mgroup{\%
  \ics{glsaccessibility}\mgroup{Alt}\mgroup{\#1}\mgroup{\#2}\%
}

\cs{newglossaryentry}\mgroup{int}\mgroup{\strong{\xtrfont{category}=symbol},
  \strong{name}=\mgroup{\cs{ensuremath}\mgroup{\cs{int}}},\strong{access}=\mgroup{222B},
  description=\mgroup{integral}
}

\cs{newglossaryentry}\mgroup{sampleimage}\mgroup{\strong{\xtrfont{category}=image},
 description=\mgroup{an example image},
 \strong{name}=\mgroup{\cs{protect}\cs{includegraphics}[height=20pt]\mgroup{example-image}},
 \strong{access}=\mgroup{a boilerplate image used in examples}
}
\end{alltt}
If it's necessary to provide support for additional fields, then the
category-field command \csmetameta*{glsxtr}{category}{}{field}{accsupp} could be used to
override the more general category command \csmeta*{glsxtr}{category}{accsupp}.

\exitem{-ignored} This document defines an ignored glossary for
common terms that don't need a definition. The document build is:
\begin{prompt}
pdflatex sample-ignored
makeglossaries sample-ignored
pdflatex sample-ignored
\end{prompt}
A new \qt{ignored} glossary is defined with:
\begin{alltt}
\ics{newignoredglossary}\mgroup{common}
\end{alltt}
There are no associated files with an ignored glossary. An entry is defined with 
this as its glossary type:
\begin{verbatim}
\newglossaryentry{commonex}{type=common,name={common term}}
\end{verbatim}
Note that the \gloskey{description} key isn't required. This term
may be referenced with \cs{gls} (which is useful for consistent
formatting) but it won't be indexed.

\exitem{-entrycount} This document uses \ics{glsenableentrycount}
and \ics{cgls} (described in \sectionref{sec:enableentrycount})
so that acronyms only used once don't appear in the list of
acronyms. The document build is:
\begin{prompt}
pdflatex sample-entrycount
pdflatex sample-entrycount
makeglossaries sample-entrycount
pdflatex sample-entrycount
\end{prompt}
Note the need to call \LaTeX\ twice before \gls{makeglossaries}, and
then a final \LaTeX\ call is required at the end.

\begin{xtr}
The \gls{glossaries-extra} package has additions that extend this
mechanism and comes with some other sample files related to entry counting.
\end{xtr}

\begin{bib2gls}
If you switch to \gls{bib2gls} you can use record counting instead.
See the \gls{bib2gls} manual for further details.
\end{bib2gls}

\chapter{Troubleshooting}
\label{sec:trouble}

In addition to the sample files listed in \sectionref{sec:samples}, 
the \styfmt{glossaries} package comes with some minimal example
files, \texttt{minimalgls.tex}, \texttt{mwe-gls.tex},
\texttt{mwe-acr.tex} and \texttt{mwe-acr-desc.tex}, which can be
used for testing. These should be located in the \texttt{samples}
subdirectory (folder) of the \styfmt{glossaries} documentation
directory. The location varies according to your operating system
and \TeX\ installation.  For example, on my Linux partition it can
be found in \texttt{/usr\slash local\slash texlive\slash
2014\slash texmf-dist\slash doc\slash latex\slash glossaries/}.
The \gls{makeglossariesgui} application can also be used to test for
various problems.
Further information on debugging \LaTeX\ code is available at
\url{http://www.dickimaw-books.com/latex/minexample/}.

If you have any problems, please first consult the 
\urlfootref{http://www.dickimaw-books.com/faqs/glossariesfaq.html}{\styfmt{glossaries} FAQ}. If that
doesn't help, try posting your query to somewhere like the
\texttt{comp.text.tex} newsgroup, the 
\urlfootref{http://www.latex-community.org/}{\LaTeX\ Community Forum} or 
\urlfootref{http://tex.stackexchange.com/}{\TeX\ on StackExchange}. 
Bug reports can be submitted via 
\urlfootref{http://www.dickimaw-books.com/bug-report.html}{my package bug report form}. 

\PrintIndex

\end{document}