summaryrefslogtreecommitdiff
path: root/macros/latex-dev/base/ltoutenc.dtx
blob: c6bfc149b7c6c6818bdbaffd306f4b7041115761 (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
% \iffalse meta-comment
%
% Copyright (C) 1993-2020
% The LaTeX3 Project and any individual authors listed elsewhere
% in this file.
%
% This file is part of the LaTeX base system.
% -------------------------------------------
%
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%    https://www.latex-project.org/lppl.txt
% and version 1.3c or later is part of all distributions of LaTeX
% version 2008 or later.
%
% This file has the LPPL maintenance status "maintained".
%
% The list of all files belonging to the LaTeX base distribution is
% given in the file `manifest.txt'. See also `legal.txt' for additional
% information.
%
% The list of derived (unpacked) files belonging to the distribution
% and covered by LPPL is defined by the unpacking scripts (with
% extension .ins) which are part of the distribution.
%
% \fi
% \iffalse
%%% From File: ltoutenc.dtx
%\NeedsTeXFormat{LaTeX2e}[2000/06/01]
%<OT1>\ProvidesFile{ot1enc.def}
%<T1>\ProvidesFile{t1enc.def}
%<OMS>\ProvidesFile{omsenc.def}
%<OML>\ProvidesFile{omlenc.def}
%<OT4>\ProvidesFile{ot4enc.def}
%<TS1>\ProvidesFile{ts1enc.def}[2001/06/05 v3.0e (jk/car/fm)
%<TU>\ProvidesFile{tuenc.def}
%<package>\ProvidesPackage{fontenc}
%<OT1|T1|OMS|OML|OT4|TU|package> [2020/08/10 v2.0s
%<OT1|T1|OMS|OML|OT4|TS1|TU>      Standard LaTeX file]
%<package>                        Standard LaTeX package]
%
%<*driver>
% \fi
\ProvidesFile{ltoutenc.dtx}
             [2020/08/10 v2.0s LaTeX Kernel (font encodings)]
% \iffalse
\documentclass{ltxdoc}
\GetFileInfo{ltoutenc.dtx}
\title{\filename}
\date{\filedate}
\author{%
  Johannes Braams\and
  David Carlisle\and
  Alan Jeffrey\and
  Frank Mittelbach\and
  Chris Rowley\and
  Rainer Sch\"opf}
\usepackage{textcomp}
\begin{document}
 \MaintainedByLaTeXTeam{latex}
 \maketitle
 \DocInput{\filename}
\end{document}
%</driver>
% \fi
%
%
%
% \changes{v1.99e}{2004/02/13}{Documentation fixes: typos}
% \changes{v1.9k}{1998/01/12}{Added \cs{ProvidesPackage}
%    for textcomp.sty}
% \changes{v1.9i}{1997/12/19}{Documentation corrections.}
% \changes{v1.9h}{1997/12/17}{Documentation changes and additions.}
% \changes{v1.9h}{1997/12/17}{Added textcomp.sty.}
% \changes{v1.9f}{1997/08/29}{Added OT4 encoding,
%    provided by Marcin Woli\'nski.}
% \changes{v1.7r}{1995/11/28}{doc fixes}
% \changes{v1.7h}{1995/04/21}{Added \cs{null} \cs{k}  latex/1274}
% \changes{v1.7f}{1994/12/14}{Added braces to \cs{copyright} so it
%    works unbraced in subscripts.}
% \changes{v1.7f}{1994/12/14}{Added check for math mode in
%    \cs{@changed@cmd}.}
% \changes{v1.7f}{1994/12/14}{Commented out \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textbackslash}, \cs{textbar},
%    \cs{textgreater}, \cs{texthyphenchar}, \cs{texthyphen} and
%    \cs{textless} to save memory.}
% \changes{v1.7e}{1994/12/10}{Added documentation for the OML encoding.}
% \changes{v1.7e}{1994/12/10}{Replaced width with \cs{@width} and
%    ditto height in vrules.}
% \changes{v1.7d}{1994/12/08}{Added \cs{null} and \cs{sh@ft} to \cs{b}
%    and \cs{d}.}
% \changes{v1.7c}{1994/12/05}{Added braces to \cs{textcircled}.}
% \changes{v1.7b}{1994/12/02}{Fixed a bug with \cs{a}.}
% \changes{v1.7a}{1994/11/30}{Added new code for encoding-specific
%    commands.  These now expand in the mouth, which means that
%    ligaturing and kerning can happen.}
% \changes{v1.6i}{1994/11/22}{Fixed empty accents.  Again.}
% \changes{v1.6i}{1994/11/22}{Corrected \cs{dots} so that there's no
%    kerning in monowidth fonts.}
% \changes{v1.6i}{1994/11/22}{Corrected typo with
%    \cs{mathunderscore}.}
% \changes{v1.6h}{1994/11/17}{(DPC) \cs{@tempa} to \cs{reserved@a}}
% \changes{v1.6d}{1994/11/02}{Wrapped lines longer than 70 characters.}
% \changes{v1.6d}{1994/10/30}{Added math commands.}
% \changes{v1.6d}{1994/10/30}{Added OML encoding.}
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Added \cs{DeclareTextCompositeCommand}.}
% \changes{v1.6c}{1994/10/29}{Renamed \cs{P}, \cs{S}, \cs{dag} and
%    \cs{ddag} to \cs{textparagraph}, \cs{textsection},
%    \cs{textdagger} and \cs{textdaggerdbl}.}
% \changes{v1.6b}{1994/10/27}{Removed the enc.def files}
% \changes{v1.6a}{1994/10/25}{Added \cs{ProvideTextCommand},
%    \cs{UseTextSymbol},
%    \cs{UseTextAccent},
%    \cs{DeclareTextSymbolDefault},
%    \cs{DeclareTextAccentDefault},
%    \cs{DeclareTextCommandDefault}, and
%    \cs{ProvideTextCommandDefault}.}
% \changes{v1.5m}{1994/10/18}{Added new definitions of \cs{patterns}
%    and \cs{hyphenation}.}
% \changes{v1.5l}{1994/10/07}{Moved the ogonek accent.}
% \changes{v1.5k}{1994/05/18}{Removed braces from \cs{pounds} and
%    \cs{dollar}.}
% \changes{v1.5k}{1994/05/18}{Replaced \cs{defaultencoding} with
%    \cs{encodingdefault}.}
% \changes{v1.5k}{1994/05/18}{Made dotted-i produce `i'.}
% \changes{v1.5j}{1994/05/17}{Added braces to \cs{pounds} so it works
%    as a subscript.}
% \changes{v1.5i}{1994/05/16}{Fixed a bug with \cs{d}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{NG}, \cs{ng}, \cs{TH},
%    \cs{th}, \cs{DH}, \cs{dh}, \cs{DJ} and \cs{dj}.}
% \changes{v1.5h}{1994/05/16}{Added \cs{r} (ring accent) and \cs{k}
%    (ogonek) accents.}
% \changes{v1.5h}{1994/05/16}{Removed \cs{P} from the OT1 definitions
%    file.}
% \changes{v1.5h}{1994/05/16}{Fixed a bug with \cs{pounds}.}
% \changes{v1.5g}{1994/05/16}{Made fontenc.sty use the new mixed-case
%    encoding files.}
% \changes{v1.5f}{1994/05/16}{Revert code so that the encoding
%                    given is used in \cs{DeclareTextCommand} (FMi)}
% \changes{v1.5f}{1994/05/16}{enc files now have uc encoding name
%                             parts (FMi)}
% \changes{v1.5e}{1994/05/14}{Replaced \cs{ENC@cmd} by \cs{ENC-cmd}.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
%    its argument to use the current encoding by default, rather than
%    the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.5d}{1994/05/14}{Tidied up the documentation.}
% \changes{v1.5c}{1994/05/14}{Added the fontenc package.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
%    if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5c}{1994/05/14}{Moved fontsmpl to its own dtx file.}
% \changes{v1.5b}{1994/05/13}{Added \cmd\{, \cmd\} and \cmd\$.}
% \changes{v1.5b}{1994/05/13}
%    {Replaces \cs{space} by `~' in \cs{csname}.}
% \changes{v1.5b}{1994/05/13}{Renamed \cs{DeclareProtectedCommand} to
%    \cs{DeclareRobustCommand}.}
% \changes{v1.5a}{1994/05/11}{Renamed the commands again.  Made the
%    encoding part of the command syntax.  Added the
%    \cs{DeclareTextCommand} interface.  Used
%    \cs{DeclareProtectedCommand}.}
% \changes{v1.4a}{1994/05/01}{Renamed the commands, removed the
%    \cs{EncodingSpecific} command.  Turned all slots into decimal.
%    Added \cs{a}.}
% \changes{v1.4a}{1994/05/01}{Removed Rokicki's encoding.}
% \changes{v1.3d}{1993/12/18}{Some T1 stuff had drifted into the OT1
%    file.}
% \changes{v1.3c}{1993/12/18}{A new syntax, separating
%    accent-definitions from encoding-specific definitions, and
%    allowing encoding-specific \cs{chardef}, \cs{let}, etc.}
% \changes{v1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{v1.3b}{1993/12/18}{Corrected typos.}
% \changes{v1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{v1.3a}{1993/12/18}{Replaced OT3 by XXX}
% \changes{v1.3}{1993/12/17}{Added \cs{EncodingSpecificAccent},
%   \cs{EncodingSpecificAccentedLetter} and
%   \cs{EncodingSpecificCommand}.}
% \changes{v1.3}{1993/12/17}{Made Rokicki's encoding a proper encoding
%    scheme rather than a variant of OT1.}
% \changes{v1.2b}{1993/12/13}{Corrected file name in driver code.}
% \changes{v1.2a}{1993/12/11}{Corrected for t1enc, math.}
% \changes{v1.2}{1993/12/10}{Added source code for t1enc.sty.}
% \changes{v1.1}{1993/12/07}{Made all character numbers decimal.}
% \changes{v1.1}{1993/12/07}{Removed a lot of equal signs and the
%   like.}
% \changes{v1.99m}{2015/02/21}
%         {Removed autoload code}
% \changes{v2.0p}{2020/04/22}
%         {corrected \=y unicode value in tuenc.def}
%
%
% \section{Font encodings}
%
%    This section of the kernel contains commands for declaring
%    encoding-specific
%    commands, such as accents.  It also contains the code for some of
%    the encoding files, including |omlenc.def|,
%    |omsenc.def|, |t1enc.def| and |ot1enc.def| files, which define
%    the |OLM|,
%    |OMS|, |T1| and |OT1| encodings, and the |fontenc| package
%    for selecting encodings.
%
%    The |fontenc| package has options for encodings, of which the
%    last option is the default encoding.  For example, to use the
%    |OT2|, |OT3| and |T1| encodings, with |T1| as the default, you
%    say:
%\begin{verbatim}
%    \usepackage[OT2,OT3,T1]{fontenc}
%\end{verbatim}
%    The standard kernel set-up loads font encoding files and selects
%    an encoding as follows.
%\begin{verbatim}
%    \input {omlenc.def}
%    \input  {t1enc.def}
%    \input {ot1enc.def}
%    \input {omsenc.def}
%    \fontencoding{OT1}
%\end{verbatim}
%    Note that the files in the standard |inputenc| package depend on
%    this behaviour of the kernel.
%
%    The syntax for declaring encoding-specific commands is:
%    \begin{quote}
%      |\DeclareTextCommand{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
%         \meta{number}|][|^^A
%         \meta{default}|]{|^^A
%         \meta{commands}|}|
%    \end{quote}
%    This command is like |\newcommand|, except that it defines a
%    command which is specific to one encoding.  The resulting command
%    is always robust, even if its definition is fragile.  For example,
%    the definition of |\l| in the |OT1| encoding is:
%\begin{verbatim}
%    \DeclareTextCommand{\l}{OT1}{{\@xxxii l}}
%\end{verbatim}
%    |\DeclareTextCommand| takes the same optional arguments as
%    |\newcommand|.
%    \begin{quote}
%      |\ProvideTextCommand{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}|\\\hspace*{\fill}|[|^^A
%         \meta{number}|][|^^A
%         \meta{default}|]{|^^A
%         \meta{commands}|}|
%    \end{quote}
%    This acts like |\DeclareTextCommand|, but does nothing if the
%    command is already defined.
%    \begin{quote}
%      |\DeclareTextSymbol{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{slot}|}|
%    \end{quote}
%    This command defines a text symbol, with a particular slot in that
%    encoding.  The commands:
% \changes{v1.9h}{1997/12/17}{Example corrected, braces removed.}
%\begin{verbatim}
%    \DeclareTextSymbol{\ss}{OT1}{25}
%    \DeclareTextCommand{\ss}{OT1}{\char25 }
%\end{verbatim}
%    have the same effect, but the |\DeclareTextSymbol| is faster.
%    \begin{quote}
%      |\DeclareTextAccent{|^^A
%         \meta{command}|}{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{slot}|}|
%    \end{quote}
% \changes{v1.8e}{1996/11/23}{Corrected description}
% \changes{v1.9k}{1997/12/31}{Further correction}
%    This command declares a text accent.  The commands:
%\begin{verbatim}
%    \DeclareTextAccent{\"}{OT1}{127}
%    \DeclareTextCommand{\"}{OT1}{\add@accent {127}}
%\end{verbatim}
%    have the same effect.
% \changes{v1.8c}{1996/10/27}
%      {Corrected syntax descriptions}
%    \begin{quote}
%      |\DeclareTextComposite{|^^A
%          \meta{command}|}|\\\hspace*{\fill}|{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{argument}|}{|^^A
%             \meta{slot}|}|
%    \end{quote}
%    This command declares a composite letter, for example in the |T1|
%    encoding |\'{a}| is slot 225, which is declared by:
%\begin{verbatim}
%    \DeclareTextComposite{\'}{T1}{a}{225}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Corrected description}
%    The \emph{command} will normally have been declared with
%    |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
%    |\DeclareTextComposite| is the most common example of using
%    the more general declaration
%    |\DeclareTextCompositeCommand|, which can define a composite
%    to be an arbitrary piece of text.
%    \begin{quote}
%      |\DeclareTextCompositeCommand{|^^A
%          \meta{command}|}|\\\hspace*{\fill}|{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{argument}|}{|^^A
%             \meta{text}|}|
%    \end{quote}
%    For example, in the OT1 encoding \r A has a hand-crafted
%    definition this is declared as follows
%\begin{verbatim}
%    \DeclareTextCompositeCommand{\r}{OT1}{A}
%     {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
%      \rlap{\raise.67\dimen@\hbox{\char23}}A}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Corrected description}
%    The \emph{command} will normally have been declared with
%    |\DeclareTextAccent|, or as a one-argument |\DeclareTextCommand|.
%
%    The commands defined using the above declarations can be used in
%    two ways.
%    Normally they are used by just calling the command in the
%    appropriate encoding, for example |\ss|.  However, sometimes you
%    may wish to use a command in an encoding where it is not defined.
%    If the command has no arguments, then you can use it in another
%    encoding by calling |\UseTextSymbol|:
%    \begin{quote}
%      |\UseTextSymbol{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{command}|}|
%    \end{quote}
%
% \task{?}{Document the problems of these commands, see pr/3160}
% \changes{v1.9e}{1997/08/05}{Corrected order of arguments in
%          \cs{UseTextSymbol} example.}
%    For example, |\UseTextSymbol{OT1}{\ss}| has the same effect as:
%\begin{verbatim}
%    {\fontencoding{OT1}\selectfont\ss}
%\end{verbatim}
%    If the command has one argument then you can use it in another
%    encoding by calling
%    |\UseTextAccent|:
%    \begin{quote}
%      |\UseTextAccent{|^^A
%         \meta{encoding}|}{|^^A
%         \meta{command}|}{|^^A
%         \meta{text}|}|
%    \end{quote}
%    For example, if the current encoding is |OT2| then
%    |\UseTextAccent{OT1}{\'}{a}| has the same effect as:
%\begin{verbatim}
%    {\fontencoding{OT1}\selectfont\'{\fontencoding{OT2}\selectfont a}}
%\end{verbatim}
% \changes{v1.8e}{1996/11/23}
%      {Extended description}
%    You can also declare a default definition for a text command, which
%    will be used if the current encoding has no appropriate definition.
%    Such use will also set the definition for this command in the
%    current encoding to equal this default definition; this makes
%    subsequent uses of the command much faster.
%    \begin{quote}
%      |\DeclareTextCommandDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{definition}|}|
%    \end{quote}
%    For example, the default definition of the command
%    |\textonequarter| (which produces the fraction $\frac14$) could be
%    built using math mode:
%\begin{verbatim}
%    \DeclareTextCommandDefault{\textonequarter}{\ensuremath {\frac14}}
%\end{verbatim}
%    There is a matching |\Provide| command which will not override an
%    existing default definition:
%    \begin{quote}
%      |\ProvideTextCommandDefault{|^^A
%         \meta{command}|}{|^^A
%         \meta{definition}|}|
%    \end{quote}
%    The most common use for these commands is to use symbols from
%    other encodings, so there are some optimizations provided:
%    \begin{quote}
%      |\DeclareTextSymbolDefault{|^^A
%         \meta{command}|}|^^A
%         \meta{encoding}|}|\\
%      |\DeclareTextAccentDefault{|^^A
%         \meta{command}|}|^^A
%         \meta{encoding}|}|
%    \end{quote}
%    are short for:
%    \begin{quote}
%      |\DeclareTextCommandDefault{|^^A
%         \meta{command}|}|\\\hspace*{\fill}^^A
%         |{\UseTextSymbol{|^^A
%         \meta{encoding}|}{|\meta{command}|}}| \\
%      |\DeclareTextCommandDefault[1]{|^^A
%         \meta{command}|}|\\\hspace*{\fill}^^A
%         |{\UseTextAccent{|^^A
%         \meta{encoding}|}{|\meta{command}|}{#1}}|
%    \end{quote}
%    For example, to make |OT1| the default encoding for |\ss| and
%    |\'| you say:
%\begin{verbatim}
%    \DeclareTextSymbolDefault{\ss}{OT1}
%    \DeclareTextAccentDefault{\'}{OT1}
%\end{verbatim}
%    Note that you can use these commands on any zero- or one-argument
%    commands declared with |\DeclareText*| or |\ProvideText*|, not
%    just those defined using |\DeclareTextSymbol| or
%    |\DeclareTextAccent|.
%
% \subsection{Removing encoding-specific commands}
%    \label{sec:removeencspec}
%
% \changes{v1.9o}{1998/03/20}{Documentation added for pr/2783}
%
% In some cases encoding definitions are given to provide some limited
% support since nothing better is available, for example, the definition
% for |\textdollar| in \texttt{OT1} is a hack since \$ and \pounds{}
% actually share the same slot in this encoding. Thus if such a glyph
% becomes available in a different encoding (e.g., \texttt{TS1}) one
% would like to get rid of the flacky one and make the default
% definition point to the new encoding. In such a case defining
%\begin{verbatim}
%   \DeclareTextSymbol{\textdollar}{TS1}{36}
%   \DeclareTextSymbolDefault{\textdollar}{TS1}
%\end{verbatim}
% is not enough since if typesetting in \texttt{OT1} \LaTeX{} will
% still find the encoding specific-definition for \texttt{OT1} and
% therefore ignore the new default.
% Therefore to ensure that in this case the \texttt{TS1} version is
% used  we have to remove the \texttt{OT1} declaration:
%\begin{verbatim}
%   \UndeclareTextCommand{\textdollar}{OT1}
%\end{verbatim}
%
% Since the \$ sign is a proper glyph in the \texttt{T1} encoding there
% is no point removing its definition and forcing \LaTeX{} to pick up
% the \texttt{TS1} version if typesetting in this encoding.
% However, assume you want to use the variant dollar sign,
% i.e., \textdollaroldstyle{}
% for your dollars. In that case you have to get rid of the \texttt{T1}
% declaration as well, e.g., the following would do that for you:
%\begin{verbatim}
%   \UndeclareTextCommand{\textdollar}{OT1}
%   \UndeclareTextCommand{\textdollar} {T1}
%   \DeclareTextCommandDefault{\textdollar}
%                             {\UseTextSymbol{TS1}\textdollaroldstyle}
%\end{verbatim}
%
% \subsection{The order of declarations}\label{sec:orderofdecls}
%
% \changes{v1.9o}{1998/03/20}{Documentation added about order of decls}
%
% If an encoding-specific command is defined for more than one encoding,
% then it will execute fastest in the encoding in which it was defined
% last since its top-level definition will be set up to execute in that
% encoding without any overhead.
%
% For this reason the file \texttt{fonttext.ltx} currently first loads
% the definitions for the \texttt{T1} encoding and then those for the
% \texttt{OT1} encoding so that typesetting in \texttt{OT1} is optimized
% since that is (still) the default. However, when \texttt{T1} is
% explicitly requested (via |\usepackage[T1]{fontenc}|) the
% top-level definitions are automatically changed to favour
% \texttt{T1} since its declarations are reloaded in the process.
%
% For the same reason default declarations should never come last since
% they are implemented as a special encoding themselves (with the
% name |?|).
% Specifying them last would simply mean to make those encoding-specific
% commands equally inefficient in all encodings. Therefore the
% \texttt{textcomp} package, for example, first sets up all defaults
% to point to \texttt{TS1} and then declares the commands in the
% \texttt{TS1} encoding.
%
%
% \StopEventually{}
%
% \subsection{Docstrip modules}
%
%    This |.dtx| file is be used to generate several related files
%    containing font encoding definitions. The mutually exclusive
%    docstrip options are listed here.
%    \begin{center}
%    \begin{tabular}{lp{10cm}}
%      |T1|       & generates |t1enc.def| for the Cork encoding. \\
%      |TS1|      & generates |ts1enc.def| for the Text Companion
%                   encoding. \\
%      |TS1sty|   & generates |textcomp.sty|, package that sets up use
%                   of the Text Companion encoding. \\
%      |OT1|      & generates |ot1enc.def| for Knuth's CM encoding. \\
%      |OMS|      & generates |omsenc.def| for Knuth's
%                   math symbol encoding. \\
%      |OML|      & generates |omlenc.def| for Knuth's
%                   math letters encoding. \\
%      |OT4|      & generates |ot4enc.def| for the Polish extension to
%                   the OT1 encoding, created by B.~Jackowski and
%                   M.~Ry\'cko for use with the Polish version of
%                   Computer Modern and Computer Concrete.\\
%      |TU|       & generates |tuenc.def| for Unicode font
%                   encoding. \\
%      |package|  & generates |fontenc.sty| for
%                   selecting encodings. \\
%      |2ekernel| & for the kernel commands.\\
%    \end{tabular}
%    \end{center}
% \changes{1.0d}{1993/07/17}{changed \cs{catcoding} @}
% \changes{1.0f}{1993/08/13}{Protected against active @ sign.}
% \changes{1.0g}{1993/08/16}{Needs space after \cs{string}}
% \changes{1.1}{1993/12/07}{Protected all special characters with
%                          \cs{string}.}
% \changes{1.3}{1993/12/17}{Removed the catcode hackery, since the file
%    is only read as a package in the preamble, and removed all the
%    messages on the screen, which just confuse users.  Replaced them
%    by the appropriate \cs{ProvidesPackage} commands. Added XXXenc.}
% \changes{1.3b}{1993/12/18}
%   {Fixed typos with \cs{ProvidesPackage} lines.
%    Added the \cs{NeedsTeXFormat} line.  Added the last argument to
%    \cs{DeclareEncoding}. Moved the use of the encodings to after their
%    declaration. }
% \changes{1.4a}{1994/04/29}{Removed Rokicki's OT1 variant encoding.
%    Moved the driver to the top.}
% \changes{1.5a}{1994/05/11}{Made T1 and OT1 generate packages rather
%    than def files.  Renamed the `package' module to `teststy'.}
% \changes{1.5d}{1994/05/14}{Moved the driver to the top.}
%
% \subsection{Definitions for the kernel}
%
% \subsubsection{Declaration commands}
%
% \changes{1.3}{1993/12/17}{Added this section}
% \changes{1.3c}{1993/12/18}{Split \cs{EncodingSpecificAccent} up into
%    \cs{EncodingSpecific} and \cs{DeclareAccent}.}
% \changes{1.4a}{1994/04/29}{Removed \cs{EncodingSpecific}.  Renamed
%    all the commands.  Added \cs{DeclareTextGlyph} and
%    \cs{UndeclareTextCommand}.}
% \changes{v1.5a}{1994/05/11}{Reimplemented \cs{DeclareTextCommand}
%    using \cs{@changed@cmd} and \cs{DeclareProtectedCommand}.}
% \changes{v1.5c}{1994/05/14}{Fixed a bug which caused an infinite loop
%    if \cs{f@encoding} was incorrectly set.}
% \changes{v1.5d}{1994/05/14}{Rewrote \cs{DeclareTextCommand} to define
%    its argument to use the current encoding by default, rather than
%    the encoding provided to \cs{DeclareTextCommand}.}
% \changes{v1.6a}{1994/10/25}{Added the \cs{Provide} commands,
%    and the default definitions.}
%
% This section contains definitions for commands such as accents which
% depend on the current encoding.  These commands will usually be kept
% in |.def| files, for example |ot1enc.def| contains the definitions
% for the |OT1| encoding.
%    \begin{macrocode}
%<*2ekernel>
\message{font encodings,}
%    \end{macrocode}
%
% \changes{v1.5d}{1994/10/27}{Rewrote \cs{DeclareTextSymbol} to define
%    its argument to use the current encoding by default, to fit with
%    \cs{DeclareTextCommand}.}
%
% \changes{v1.7a}{1994/11/30}{Redefined \cs{@changed@cmd} to expand in
%    the mouth.}
% \changes{v1.7a}{1994/11/30}{Removed \cs{@changed@x@mouth} since
%    \cs{@changed@x} now expands in the mouth.}
%
% \changes{v1.7r}{1995/11/28}{Renamed \cs{@changed@x@err} to
%    \cs{TextSymbolUnavailable}.}
% \changes{v1.7r}{1995/11/28}{Added math mode checks to text commands.}
% Far too many macros in one block here!
% \begin{macro}{\DeclareTextCommand}
% \begin{macro}{\ProvideTextCommand}
% \begin{macro}{\DeclareTextSymbol}
% \begin{macro}{\@dec@text@cmd}
% \begin{macro}{\chardef@text@cmd}
% \begin{macro}{\@changed@cmd}
% \begin{macro}{\@changed@x}
% \begin{macro}{\TextSymbolUnavailable}
% \begin{macro}{\@inmathwarn}
%    If you say:
%\begin{verbatim}
%    \DeclareTextCommand{\foo}{T1}...
%\end{verbatim}
%    then |\foo| is defined to be |\T1-cmd \foo \T1\foo|,
%    where |\T1\foo| is \emph{one} control sequence, not two!
%    We then call |\newcommand| to define |\T1\foo|.
%    \begin{macrocode}
\def\DeclareTextCommand{%
   \@dec@text@cmd\newcommand}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\ProvideTextCommand{%
   \@dec@text@cmd\providecommand}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@dec@text@cmd#1#2#3{%
   \expandafter\def\expandafter#2%
      \expandafter{%
         \csname#3-cmd\expandafter\endcsname
         \expandafter#2%
         \csname#3\string#2\endcsname
      }%
   \let\@ifdefinable\@rc@ifdefinable
   \expandafter#1\csname#3\string#2\endcsname}
%    \end{macrocode}
% \changes{v1.99d}{2004/02/06}{New command added to fix
%     severe bug: pr/3563}
%    This command was introduced to fix a major bug
%    in |\@dec@text@cmd| without changing that command itself.
%    This was thought to be necessary because it is defined
%    in more than one package. (Perhaps the more serious bug is to put
%    complex low-level commands like this in packages?)
%
%    The problem it solves is that whereas both |\newcommand| and
%    |\providecommand| (used just above) both handle the
%    resetting of |\@ifdefinable| (following its disabling in
%    |\@dec@text@cmd|), the primitive |\chardef| neither needs the
%    disabling, nor does the resetting.
%
%    \begin{macrocode}
\def\chardef@text@cmd{%
   \let\@ifdefinable\@@ifdefinable
   \chardef
  }
\def\DeclareTextSymbol#1#2#3{%
   \@dec@text@cmd\chardef@text@cmd#1{#2}#3\relax
  }
%    \end{macrocode}
%
%    The declarations are only available before |\begin{document}|.
% \changes{v1.7h}{1995/05/21}{Added several \cs{@onlypreamble}}
% \changes{v1.7k}{1995/06/05}{Removed \cs{protected@cmd} and replaced
%    with explicit \cs{noexpand}.}
%    \begin{macrocode}
\@onlypreamble\DeclareTextCommand
\@onlypreamble\DeclareTextSymbol
%    \end{macrocode}
%    The sneaky bit in all this is what |\T1-cmd \foo \T1\foo| does.
%    There are five possibilities, depending on the current values of
%    |\protect|, |\cf@encoding| and |\ifmmode|:
%    \begin{itemize}
%    \item If |\protect| is |\@typeset@protect| and |\cf@encoding| is
%       |T1|, then we execute |\T1\foo|.  This should be the normal
%       behaviour, and is optimized for speed.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, and |\OT1\foo| is defined, then we execute
%       |\OT1\foo|.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, we're in text mode,
%       and |\OT1\foo| is undefined, then we define
%       |\OT1\foo| to be the default value of |\foo|, and execute
%       |\OT1\foo|.
%    \item If |\protect| is |\@typeset@protect|, |\cf@encoding| is
%       (say) |OT1|, we're in math mode,
%       and |\OT1\foo| is undefined, then we execute the default value
%       of |\foo|.  (This is necessary so that things like
%       |$X_\copyright$| work properly.)
%    \item If |\protect| is not |\@typeset@protect| then we execute
%       |\noexpand\foo|.  For example, if we are writing to a file,
%       then this results in |\foo| being written.  If we are in a
%       |\mark|, then |\foo| will be put in the mark---since |\foo| is
%       robust, it will then survive all the things which may happen
%       to it whilst it's a |\mark|.
%    \end{itemize}
%    So after all that, we will either execute the appropriate
%    definition of |\foo| for the current encoding, or we will execute
%    |\noexpand\foo|.
%
%    The default value of |\foo| is |\?\foo| if it is defined, and an
%    error message otherwise.
%
%    When the encoding is changed from |T1| to |OT1|, |\T1-cmd| is
%    defined to be |\@changed@cmd| and |\OT1-cmd| is defined to be
%    |\@current@cmd|.  This means that the test for what the current
%    encoding is can be performed quickly.
%    \begin{macrocode}
\def\@current@cmd#1{%
   \ifx\protect\@typeset@protect
      \@inmathwarn#1%
   \else
      \noexpand#1\expandafter\@gobble
   \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\@changed@cmd#1#2{%
   \ifx\protect\@typeset@protect
      \@inmathwarn#1%
      \expandafter\ifx\csname\cf@encoding\string#1\endcsname\relax
         \expandafter\ifx\csname ?\string#1\endcsname\relax
            \expandafter\def\csname ?\string#1\endcsname{%
               \TextSymbolUnavailable#1%
            }%
         \fi
         \global\expandafter\let
               \csname\cf@encoding \string#1\expandafter\endcsname
               \csname ?\string#1\endcsname
      \fi
      \csname\cf@encoding\string#1%
         \expandafter\endcsname
   \else
      \noexpand#1%
   \fi}
%    \end{macrocode}
% \changes{v1.7m}{1995/10/09}{Autoload error}
% \changes{v1.7v}{1995/12/05}{Changed \cs{TextSymbolUnavailable} text}
%    \begin{macrocode}
\gdef\TextSymbolUnavailable#1{%
   \@latex@error{%
      Command \protect#1 unavailable in encoding \cf@encoding%
   }\@eha}
%    \end{macrocode}
%    The command |\@inmathwarn| produces a warning message if we are
%    currently in math mode.  Note that since this command is used
%    inside text commands, it can't call |\relax| before the
%    |\ifmmode|.  This means that it is possible for the warning to
%    fail to be issued at the beginning of a row of an halign whose
%    template enters math mode.  This is probably a bad feature, but
%    there's not much that can be done about it, since adding a |\relax|
%    would break ligatures and kerning between text symbols.
%
%    A more efficient solution would be to make |\@inmathwarn| and
%    |\@inmatherr| equal to |\@empty| and |\relax| by default, and
%    to have
%    |\everymath| reset them to their usual definitions.  This is left
%    for future investigation (for example it may break some third
%    party code).
%    \begin{macrocode}
\def\@inmathwarn#1{%
   \ifmmode
      \@latex@warning{Command \protect#1 invalid in math mode}%
   \fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v1.7k}{1995/06/05}{Allowed \cs{ProvideTextCommandDefault}
%    after the preamble.}
%
% \begin{macro}{\DeclareTextCommandDefault}
% \begin{macro}{\ProvideTextCommandDefault}
%    These define commands with encoding |?|.
%
%    Note that |\DeclareTextCommandDefault| can only be used in the
%    preamble, but that the |\Provide| version is allowed in inputenc
%    |.def| files, so is allowed anywhere.
%    \begin{macrocode}
\def\DeclareTextCommandDefault#1{%
   \DeclareTextCommand#1?}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\ProvideTextCommandDefault#1{%
   \ProvideTextCommand#1?}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextCommandDefault
%\@onlypreamble\ProvideTextCommandDefault
%    \end{macrocode}
%    They require |\?-cmd| to be initialized as |\@changed@cmd|.
%    \begin{macrocode}
\expandafter\let\csname?-cmd\endcsname\@changed@cmd
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareTextAccent}
% \changes{v1.5a}{1994/05/11}
%      {Reimplemented using \cs{DeclareTextCommand}.}
% \changes{v1.7z}{1996/05/23}
%      {Reimplemented using \cs{add@accent} to save space latex/2133}
%    This is just a disguise for defining a \TeX~|\accent| command.
%    \begin{macrocode}
\def\DeclareTextAccent#1#2#3{%
   \DeclareTextCommand#1{#2}{\add@accent{#3}}}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextAccent
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.7a}{1994/11/30}{Rewrote \cs{@text@composite} so it
%    allows an empty argument, or an argument containing lots of
%    commands.}
%
%  \begin{macro}{\add@accent}
% \changes{v1.7z}{1996/05/23}{macro added. latex/2133}
% \changes{v1.91}{2000/08/30}{Rearranged but no change to final code,
%    CAR (pr/3160)}
% To save space this code is shared between all text accents that are
% set using the |\accent| primitive.
% The argument is pre-set in a box so that any
% font loading that is needed is already done within the box.
% This is needed because font-loading involves grouping and that would
% prevent the accent mechanism from working so that the accent would
% not be positioned over the argument.
% Declarations that change the font should be allowed (only low-level
% ones are at present) inside the argument of an accent command,
% but not size changes, as they involve |\setbox| operations which
% also inhibit the mechanism of the |\accent| primitive.
%
% Note that the whole process is within a group.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    For a detailed discussion of this reimplementation and its
%    deficiencies, see pr/3160.
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
%    \begin{macrocode}
\def\add@accent#1#2{\hmode@bgroup
%    \end{macrocode}
%    Turn off the group in |\UseTextSymbol| in case this is used
%    inside the argument of |\add@accent|.
%    \begin{macrocode}
   \let\hmode@start@before@group\@firstofone
   \setbox\@tempboxa\hbox{#2%
%    \end{macrocode}
%    When presetting the argument in a box we record its |\spacefactor|
%    for later use after the accent got typeset. This way something like
%    |\`A| gets the spacefactor of |A| (i.e., 999) rather than the
%    default value of 1000.
% \changes{v1.9q}{1998/06/12}
%    {Explicitly set \cs{spacefactor} after \cs{accent} (pr/2877)}
%    \begin{macrocode}
      \global\mathchardef\accent@spacefactor\spacefactor}%
%    \end{macrocode}
%    The accent primitive doesn't allow things \cs{begingroup} to
%    interfere between accent and base character. Therefore we need to
%    avoid that (they are some hidden inside \cs{maybe@load@fontshape}).
%    As we don't have to load the fontshape in this case
%    (as that happened in the box above if necessary, we simply
%    disable that part of the code temporaily.
%    We also ignore \cs{ignorespaces} which has the same issue and may
%    show up as part of \cs{normalfont} if that is used.
% \changes{v2.0m}{2019/12/18}{Avoid code that breaks \cs{accent}}
%    \begin{macrocode}
   \let\maybe@load@fontshape\relax
   \let\ignorespaces\relax
   \accent#1 #2\egroup\spacefactor\accent@spacefactor}
%    \end{macrocode}
%
%
%    Default definition for |\accent@spacefactor| prevents a horrible
%    death of the above macro inside an unprotected |\edef|.
% \changes{v1.9w}{1999/10/28}{Give \cs{accent@spacefactor} a default
%    definition (pr/3084)}
%    \begin{macrocode}
\let\accent@spacefactor\relax
%    \end{macrocode}
%  \end{macro}
%
% \begin{macro}{\hmode@bgroup}
% \changes{v1.9y}{2000/01/30}{Macro added}
%    \begin{macrocode}
\def\hmode@bgroup{\leavevmode\bgroup}
%    \end{macrocode}
%  \end{macro}
%
%
% \begin{macro}{\DeclareTextCompositeCommand}
% \changes{v1.7z}{1996/05/23}
%      {Modified to cope with new \cs{add@accent} command: required
%      removal of check for one argument-command}
% \changes{v2.0h}{2017/02/24}{%
%     add check whether the accent command is defined for this encoding}
% \changes{v2.0i}{2017/04/05}{%
%     Declare accent command if not already declared when declaring a composite.}
% \begin{macro}{\DeclareTextComposite}
% \changes{v1.7l}{1995/06/09}{Rewrote \cs{DeclareTextComposite} to
%    define the composite as a no-argument command rather than a
%    two-argument command.}
% \begin{macro}{\@text@composite}
% \begin{macro}{\@text@composite@x}
% \begin{macro}{\@strip@args}
% \changes{v1.8c}{1996/10/27}
%      {Removed macro}
%    Another amusing game to play with |\expandafter|, |\csname|, and
%    |\string|.  When you say
%    |\DeclareTextCompositeCommand{\foo}{T1}{a}{bar}|, we look to see
%    if the expansion of |\T1\foo| begins with |\@text@composite|, and
%    if it doesn't, we redefine |\T1\foo| to be:
%\begin{verbatim}
%    #1 -> \@text@composite \T1\foo #1\@empty \@text@composite {...}
%\end{verbatim}
%    where |...| is the
%    previous definition of |\T1\foo|.  Finally, we define |\\T1\foo-a|
%    to expand to |bar|.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2017/04/15}{\DeclareTextCompositeCommand}
%<latexrelease>                             {test for undeclared accent}%
%<*2ekernel|latexrelease>
\def\DeclareTextCompositeCommand#1#2#3#4{%
  \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
  \ifx\reserved@a\relax
   \DeclareTextCommand#1{#2}{%
     \@latex@error{\string#1 undeclared in encoding #2}\@eha}%
   \@latex@info{Composite with undeclared \string#1 in encoding #2}%
   \expandafter\let\expandafter\reserved@a\csname#2\string#1\endcsname
  \fi
  \expandafter\expandafter\expandafter\ifx
  \expandafter\@car\reserved@a\relax\relax\@nil \@text@composite \else
      \edef\reserved@b##1{%
         \def\expandafter\noexpand
            \csname#2\string#1\endcsname####1{%
            \noexpand\@text@composite
               \expandafter\noexpand\csname#2\string#1\endcsname
               ####1\noexpand\@empty\noexpand\@text@composite
               {##1}}}%
      \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
   \fi
   \expandafter\def\csname\expandafter\string\csname
      #2\endcsname\string#1-\string#3\@empty\endcsname{#4}%
  }
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}{\DeclareTextCompositeCommand}
%<latexrelease>                            {test for undeclared accent}%
%<latexrelease>\def\DeclareTextCompositeCommand#1#2#3#4{%
%<latexrelease>  \expandafter\let\expandafter\reserved@a
%<latexrelease>                      \csname#2\string#1\endcsname
%<latexrelease>  \expandafter\expandafter\expandafter\ifx
%<latexrelease>  \expandafter\@car\reserved@a\relax\relax\@nil
%<latexrelease>                               \@text@composite \else
%<latexrelease>      \edef\reserved@b##1{%
%<latexrelease>         \def\expandafter\noexpand
%<latexrelease>           \csname#2\string#1\endcsname####1{%
%<latexrelease>           \noexpand\@text@composite
%<latexrelease>             \expandafter\noexpand\csname#2\string#1\endcsname
%<latexrelease>             ####1\noexpand\@empty\noexpand\@text@composite
%<latexrelease>             {##1}}}%
%<latexrelease>      \expandafter\reserved@b\expandafter{\reserved@a{##1}}%
%<latexrelease>   \fi
%<latexrelease>   \expandafter\def\csname\expandafter\string\csname
%<latexrelease>      #2\endcsname\string#1-\string#3\@empty\endcsname{#4}}
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextCompositeCommand
%    \end{macrocode}
%    This all works because:
%\begin{verbatim}
%    \@text@composite \T1\foo A\@empty \@text@composite {...}
%\end{verbatim}
%    expands to
%    |\\T1\foo-A| if |\\T1\foo-A| has been defined, and |{...}|
%    otherwise.
%
%    Note that |\@text@composite| grabs the first token of the
%    argument and puts just that in the
%    csname.  This is so that |\'{\textit{e}}| will work---it checks
%    whether |\\T1\'-\textit| is defined (which presumably it isn't)
%    and so expands to |{\accent 1 \textit{e}}|.
%
%    This trick won't always work, for example |\'{{\itshape e}}| will
%    expand to (with spaces added for clarity):
%\begin{verbatim}
%    \csname \string \T1\' - \string {\itshape e} \@empty \endcsname
%\end{verbatim}
%    which will die pretty horribly.  Unfortunately there's not much
%    can be done about this if we're going to use |\csname| lookups as a
%    fast way of accessing composites.
%
%    This has an unfortunate `misfeature' though, which is that in
%    the T1 encoding, |\'{aa}| produces \'a.  This is not the expected
%    behaviour, and should perhaps be fixed if the fix doesn't affect
%    performance too badly.
%
%    Finally, it's worth noting that the |\@empty| is used in
%    |\@text@composite| so that accents will work even when the
%    argument is empty.  If you say |\'{}| then this looks up
%    |\\T1\'-\@empty|, which ought to be |\relax|, and so all is well.
%    If we didn't include the |\@empty|, then |\'{}| would expand to:
%\begin{verbatim}
%    \csname \string \T1\' - \string \endcsname
%\end{verbatim}
%    so the |\endcsname| would be |\string|'ed and the whole of the
%    rest of the document would be put inside the |\csname|.  This
%    would not be good.
%    \begin{macrocode}
\def\@text@composite#1#2#3\@text@composite{%
   \expandafter\@text@composite@x
      \csname\string#1-\string#2\endcsname}
%    \end{macrocode}
%
% \changes{v1.7z}{1996/05/23}
%      {\cs{expandafter} added to match other changes for latex/2133}
% \changes{v1.9r}{1999/01/06}{New impl for latex/2930}
% \changes{v1.9s}{1999/01/13}{Simplified solution for latex/2930}
%    Originally the |\@text@composite@x| macro had two arguments and if
%    |#1| was not |\relax| it was executed, otherwise |#2| was executed.
%    All this happened within the |\ifx| code so that neither |#1|
%    nor |#2| could have picked up any additional arguments form
%    the input stream.
%    This has now being changed using the typical |\@firstoftwo| /
%    |\@secondoftwo| coding. This way the
%    final expansion will happen without any |\else| or |\fi|
%    intervening in the case that we need to get a further token
%    from the input stream.
%    \begin{macrocode}
\def\@text@composite@x#1{%
   \ifx#1\relax
      \expandafter\@secondoftwo
   \else
      \expandafter\@firstoftwo
   \fi
   #1}
%    \end{macrocode}
%    The command |\DeclareTextComposite| uses
%    |\DeclareTextCompositeCommand| to declare a command which
%    expands out to a single glyph.
% \changes{v1.8a}{1996/07/19}
%      {Use char 0 not @ as carrier for \cs{lowercase} /2197}
%    \begin{macrocode}
\catcode\z@=11\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareTextComposite#1#2#3#4{%
   \def\reserved@a{\DeclareTextCompositeCommand#1{#2}{#3}}%
   \bgroup
      \lccode\z@#4%
      \lowercase{%
   \egroup
      \reserved@a ^^@}}
%    \end{macrocode}
%
%    \begin{macrocode}
\catcode\z@=15\relax
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextComposite
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%
%
%
%
%
%    \begin{macrocode}
%</2ekernel>
%<*2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{2019/10/01}%
%<latexrelease>                 {\UseTextAccent}{Make commands robust}%
%    \end{macrocode}
%
% \begin{macro}{\UseTextAccent}
% \begin{macro}{\UseTextSymbol}
% \changes{v1.7p}{1995/11/17}{Support \cs{@wrong@font@char} latex/1676}
% \changes{v1.7q}{1995/11/18}{Modify message slightly}
% \begin{macro}{\@use@text@encoding}
% \changes{v1.91}{2000/08/30}{Rearranged but no change to final code,
%    CAR (pr/3160)}
%    These fragile commands access glyphs from different encodings.
%    They use grotty low-level calls to the font selection scheme for
%    speed, and in order to make sure that |\UseTextSymbol| doesn't
%    do anything which you're not allowed to do between an |\accent|
%    and its glyph.
%
%    For a detailed discussion of this reimplementation and its
%    deficiencies, see pr/3160.
% \task{?}{Improve this and document its problems, see pr/3160}
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\UseTextAccent[3]{%
  \hmode@start@before@group
   {%
%    \end{macrocode}
%    Turn off the group in |\UseTextSymbol| in case this is used
%    inside the arguments of |\UseTextAccent|.
%    \begin{macrocode}
    \let\hmode@start@before@group\@firstofone
    \let\@curr@enc\cf@encoding
    \@use@text@encoding{#1}%
    #2{\@use@text@encoding\@curr@enc#3}%
   }}
%    \end{macrocode}
%
% \changes{v1.9z}{2000/01/30}{Macro reimplemented (pr/3160)}
% \changes{v2.0r}{2020/07/27}{Don't make the command \cs{long} (gh/354)}
%    \begin{macrocode}
\DeclareRobustCommand*\UseTextSymbol[2]{%
       \hmode@start@before@group
       {%
          \def\@wrong@font@char{\MessageBreak
             for \noexpand\symbol`\string#2'}%
          \@use@text@encoding{#1}%
          #2%
       }%
    }
%    \end{macrocode}
%
%    \begin{macrocode}
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease>                 {\UseTextAccent}{Make commands robust}%
%<latexrelease>
%<latexrelease>\kernel@make@fragile\UseTextAccent
%<latexrelease>\kernel@make@fragile\UseTextSymbol
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
%<*2ekernel>
%    \end{macrocode}
%
%    Switch to a different text encoding without any grouping for use in
%    \cs{UseTextAccent} or \cs{UseTextSymbol} (and for \cs{oldstylenums}).
%    \begin{macrocode}
\def\@use@text@encoding#1{%
   \edef\f@encoding{#1}%
   \xdef\font@name{%
      \csname\curr@fontshape/\f@size\endcsname}%
   \pickup@font
   \font@name
   \@@enc@update}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\hmode@start@before@group}
%    The |\hmode@start@before@group| starts hmode and should be
%    immediately followed by an explicit |{...}|. Its purpose is to
%    ensure that hmode is started before this group  is opened. Inside
%    |\add@accent| and |\UseTextAccent| it is redefined to remove this
%    group so that it doesn't conflict with the |\accent| primitive.
%
%    For a detailed discussion see pr/3160.
% \changes{v1.9z}{2000/01/30}{Macro added (pr/3160)}
%    \begin{macrocode}
\let\hmode@start@before@group\leavevmode
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\DeclareTextSymbolDefault}
% \begin{macro}{\DeclareTextAccentDefault}
%    Some syntactic sugar.  Again, these should probably be optimized
%    for speed.
%    \begin{macrocode}
\def\DeclareTextSymbolDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextSymbol{#2}#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareTextAccentDefault#1#2{%
   \DeclareTextCommandDefault#1{\UseTextAccent{#2}#1}}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\DeclareTextSymbolDefault
\@onlypreamble\DeclareTextAccentDefault
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
%
% \begin{macro}{\UndeclareTextCommand}
%    This command safely removes an encoding specific declaration
%    for a given encoding. It is helpful if one intends to use the
%    default definition always and therefore wants to get rid of
%    a declaration for some specific encoding.
% \changes{v1.9o}{1998/03/20}{Macro added for pr/2783}
%    \begin{macrocode}
\def\UndeclareTextCommand#1#2{%
%    \end{macrocode}
%    If there is no declaration for the current encoding do nothing.
%    (This makes a hash table entry but without e\TeX{} we can't do
%    anything about that).
%    \begin{macrocode}
  \expandafter\ifx\csname#2\string#1\endcsname\relax
  \else
%    \end{macrocode}
%    Else: throw away that declaration.
%    \begin{macrocode}
     \global\expandafter\let\csname#2\string#1\endcsname
            \@undefined
%    \end{macrocode}
%    But this is unfortunately not enough, we have to take a look
%    at the top-level definition of the encoding specific command
%    which for a command |\foo| would look similar to
%    |\T1-cmd \foo \T1\foo| (three tokens).
%
%    Of course, instead of |T1| one could see a different encoding name;
%    which one depends the encoding for which |\foo| was declared
%    last.
%
%    Now assume we have just removed the declaration for |\foo| in |T1|
%    and the top-level of |\foo| expands to the above. Then we better
%    change that pretty fast otherwise we do get an ``undefined csname
%    error'' when we try to typeset |\foo| within |T1| instead of
%    getting the default definition for |\foo|.
%    And what is the best way to change that top-level definition? Well,
%    the only ``encoding'' we know for sure will still be around is
%    the default encoding denoted by |?|.
%
%    Thus in case the last token of the top-level expansion
%    is now undefined we change the declaration to look like
%    |\?-cmd \foo \?\foo| which is done by the following
%    (readable?) code:
%    \begin{macrocode}
     \expandafter\expandafter\expandafter
     \ifx\expandafter\@thirdofthree#1\@undefined
       \expandafter\gdef\expandafter#1\expandafter
          {\csname ?-cmd\expandafter\endcsname\expandafter
           #1\csname?\string#1\endcsname}%
     \fi
 \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\@onlypreamble\UndeclareTextCommand
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Hyphenation}
%
% \changes{v1.5l}{1994/10/18}{Added new definitions of \cs{patterns}
%    and \cs{hyphenation}.}
% \changes{v1.6g}{1994/11/05}{Added setting of \cs{@typeset@protect}
%    to \cs{patterns} and \cs{hyphenation}.}
% \changes{v1.6g}{1994/11/30}{Removed new definitions of \cs{patterns}
%    and \cs{hyphenation}, since encoding-specific commands now expand
%    in the mouth.}
%
% \begin{macro}{\patterns}
% \begin{macro}{\@@patterns}
% \begin{macro}{\hyphenation}
% \begin{macro}{\@@hyphenation}
%    We redefine |\patterns| and |\hyphenation| to allow the use of
%    commands declared with |\DeclareText*| to be used inside them.
%    \begin{macrocode}
%\let\@@patterns\patterns
%\let\@@hyphenation\hyphenation
%\def\patterns{%
%   \bgroup
%      \let\protect\@empty
%      \let\@typeset@protect\@empty
%      \let\@changed@x\@changed@x@mouth
%   \afterassignment\egroup
%   \@@patterns
%}
%\def\hyphenation{%
%   \bgroup
%      \let\protect\@empty
%      \let\@typeset@protect\@empty
%      \let\@changed@x\@changed@x@mouth
%   \afterassignment\egroup
%   \@@hyphenation
%}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \subsubsection{Miscellania}
%
% \changes{1.4a}{1994/05/01}{Added the \cs{a} command.}
% \changes{1.7a}{1994/11/30}{Redefined \cs{a} for the new scheme.}
% \changes{1.7b}{1994/12/02}{Redefined \cs{a} properly.}
% \changes{1.7g}{1995/03/03}{Corrected an error in documentation
%               referring to the tabular rather than the tabbing
%               environment.}
% \changes{v1.7n}{1995/11/02}{Changed internal name \cs{a} to
% \cs{@tabacckludge} to protect against redefinition by malicious
% users.}
%
% \begin{macro}{\a}
%    The |\a| command is used to access the accent commands even when
%    they have been redefined (for example by the |tabbing|
%    environment). Its internal name is |\@tabacckludge|.
%
%    The |\string| within the |\csname| guards against something
%    like |'| being active at the point of use.
% \changes{v1.9r}{1998/09/19}{Added \cs{string} (pr/2878)}
%    \begin{macrocode}
\def\@tabacckludge#1{\expandafter\@changed@cmd
                                 \csname\string#1\endcsname\relax}
\let\a=\@tabacckludge
%    \end{macrocode}
% \end{macro}
%
% \changes{v1.6a}{1994/10/25}{Added the files OT1enc.def, T1enc.def and
%    OMSenc.def.}
% \changes{v1.6b}{1994/10/27}{Removed the files OT1enc.def, T1enc.def
%    and OMSenc.def.}
%
% \subsubsection{Default encodings}
%
% We define the default encodings for most commands to be either OT1,
% OML or OMS.  These defaults are in the kernel and therefore
% fonts with these encodings must be available unless these
% defaults are redefined elsewhere.  Recall that the standard kernel
% loads the encoding files for these encodings, and also that for
% the T1 encoding.
%
% The naming conventions in the kernel are not what we would use if we
% were starting from scratch\dots\
% Those defined by DEK (like |\ae| and |\ss|) or by the \TeX{} Users
% Group Technical Working Group on multi-lingual typesetting (like
% |\th| and |\ng|) have short names.  Those which were added to the
% kernel in 1993 and early 1994 are named after their Adobe glyph
% names (like |\guillemotleft| and |\quotedblbase|).  Unfortunately,
% this naming scheme won't work for all glyphs, since some names (like
% |\space|) are already used, and some (like |\endash|) are very
% likely to be defined by users.  So we're now using the naming scheme
% of |\text| followed by the Adobe name, (like |\textendash| and
% |\textsterling|).  Except that some glyphs don't have Adobe names,
% so we're using the names used by fontinst for those (like
% |\textcompwordmark|).  Sigh.
%
% \changes{v1.6a}{1994/10/25}{Added the defaults.}
% \changes{v1.6b}{1994/10/27}{Added more defaults for OT1.}
% \changes{v1.6c}{1994/10/29}{Added commands like \cs{dots} for use in
%    text and math.}
%
% Some accents from OT1:
%    \begin{macrocode}
\DeclareTextAccentDefault{\"}{OT1}
\DeclareTextAccentDefault{\'}{OT1}
\DeclareTextAccentDefault{\.}{OT1}
\DeclareTextAccentDefault{\=}{OT1}
\DeclareTextAccentDefault{\H}{OT1}
\DeclareTextAccentDefault{\^}{OT1}
\DeclareTextAccentDefault{\`}{OT1}
\DeclareTextAccentDefault{\b}{OT1}
\DeclareTextAccentDefault{\c}{OT1}
\DeclareTextAccentDefault{\d}{OT1}
\DeclareTextAccentDefault{\r}{OT1}
\DeclareTextAccentDefault{\u}{OT1}
\DeclareTextAccentDefault{\v}{OT1}
\DeclareTextAccentDefault{\~}{OT1}
%    \end{macrocode}
% Some symbols from OT1:
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
%    \begin{macrocode}
%\DeclareTextSymbolDefault{\AA}{OT1}
\DeclareTextSymbolDefault{\AE}{OT1}
\DeclareTextSymbolDefault{\L}{OT1}
\DeclareTextSymbolDefault{\OE}{OT1}
\DeclareTextSymbolDefault{\O}{OT1}
%\DeclareTextSymbolDefault{\aa}{OT1}
\DeclareTextSymbolDefault{\ae}{OT1}
\DeclareTextSymbolDefault{\i}{OT1}
\DeclareTextSymbolDefault{\j}{OT1}
%    \end{macrocode}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\ij}{OT1}
\DeclareTextSymbolDefault{\IJ}{OT1}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\l}{OT1}
\DeclareTextSymbolDefault{\oe}{OT1}
\DeclareTextSymbolDefault{\o}{OT1}
\DeclareTextSymbolDefault{\ss}{OT1}
\DeclareTextSymbolDefault{\textdollar}{OT1}
\DeclareTextSymbolDefault{\textemdash}{OT1}
\DeclareTextSymbolDefault{\textendash}{OT1}
\DeclareTextSymbolDefault{\textexclamdown}{OT1}
%\DeclareTextSymbolDefault{\texthyphenchar}{OT1}
%\DeclareTextSymbolDefault{\texthyphen}{OT1}
\DeclareTextSymbolDefault{\textquestiondown}{OT1}
\DeclareTextSymbolDefault{\textquotedblleft}{OT1}
\DeclareTextSymbolDefault{\textquotedblright}{OT1}
\DeclareTextSymbolDefault{\textquoteleft}{OT1}
\DeclareTextSymbolDefault{\textquoteright}{OT1}
\DeclareTextSymbolDefault{\textsterling}{OT1}
%    \end{macrocode}
% Some symbols from OMS:
% \changes{v1.7t}{1995/11/29}{Added \cs{textbackslash} and
%    \cs{textbar}.}
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{textasteriskcentered}}
% \changes{v1.95}{2002/06/16}{Added default for \cs{textbardbl} (pr/3400)}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textasteriskcentered}{OMS}
\DeclareTextSymbolDefault{\textbackslash}{OMS}
\DeclareTextSymbolDefault{\textbar}{OMS}
\DeclareTextSymbolDefault{\textbardbl}{OMS}
\DeclareTextSymbolDefault{\textbraceleft}{OMS}
\DeclareTextSymbolDefault{\textbraceright}{OMS}
\DeclareTextSymbolDefault{\textbullet}{OMS}
\DeclareTextSymbolDefault{\textdaggerdbl}{OMS}
\DeclareTextSymbolDefault{\textdagger}{OMS}
\DeclareTextSymbolDefault{\textparagraph}{OMS}
\DeclareTextSymbolDefault{\textperiodcentered}{OMS}
\DeclareTextSymbolDefault{\textsection}{OMS}
\DeclareTextAccentDefault{\textcircled}{OMS}
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Added OML encoding.}
% \changes{v1.6d}{1994/10/30}{Made \cs{textless} and \cs{textgreater}
%    come from OML.}
% \changes{v1.6d}{1994/10/30}{Added \cs{t}.}
% \changes{v1.7k}{1995/06/05}{Commented out \cs{textless} and
%    \cs{textgreater}.}
%
% Some symbols from OML:
% \changes{v1.7t}{1995/11/29}{Added \cs{textless} and
%    \cs{textgreater}.}
%    \begin{macrocode}
\DeclareTextSymbolDefault{\textless}{OML}
\DeclareTextSymbolDefault{\textgreater}{OML}
\DeclareTextAccentDefault{\t}{OML}
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Rewrote \cs{copyright} to use
%    \cs{textcircled}.}
% \changes{v1.6d}{1994/10/30}{Removed \cs{textregistered}.}
% \changes{v1.7k}{1995/06/05}{Save some tokens in
%    \cs{textvisiblespace} and \cs{textunderscore}.}
% \changes{v1.7t}{1995/11/29}{Added \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textregistered} and \cs{texttrademark}.}
% \changes{v1.7u}{1995/12/01}{Made \cs{SS} a Default, rather than
%    having the default point to the OT1 definition.}
% \changes{v1.7w}{1995/12/11}{Modified \cs{copyright}}
% \changes{v1.9a}{1997/04/30}{Introduced \cs{textcopyright} and modified
%                             \cs{copyright}}
%
% Some defaults we can fake.
%
% The interface for defining |\copyright| changed, it used to
% use |\expandafter| to add braces at the appropriate points.
% \begin{macrocode}
\DeclareTextCommandDefault{\textcopyright}{\textcircled{c}}
% \expandafter\def\expandafter
%                 \copyright\expandafter{\expandafter{\copyright}}
%    \end{macrocode}
%
% \changes{v1.9a}{1997/04/30}{Modified \cs{textunderscore}, removing
%                                    \cs{mathunderscore}}
% \changes{v1.9b}{1997/04/30}{Added \cs{leavevmode} to
%                                   \cs{textunderscore}}
% \changes{v1.9d}{1997/05/07}{Added \cs{leavevmode} to
%                                   \cs{textcompwordmark}}
%    \begin{macrocode}
\DeclareTextCommandDefault{\textasciicircum}{\^{}}
\DeclareTextCommandDefault{\textasciitilde}{\~{}}
\DeclareTextCommandDefault{\textunderscore}{%
  \leavevmode \kern.06em\vbox{\hrule\@width.3em}}
%    \end{macrocode}
%
%    There is no good reason anymore to fake \cs{textcompwordmark}.
% \changes{v2.0m}{2019/12/18}{Don't fake \cs{textcompwordmark}; take
%    default from T1 instead}
%    \begin{macrocode}
%\DeclareTextCommandDefault{\textcompwordmark}{\leavevmode\kern\z@}
\DeclareTextSymbolDefault{\textcompwordmark}{T1}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextCommandDefault{\textvisiblespace}{%
   \mbox{\kern.06em\vrule \@height.3ex}%
   \vbox{\hrule \@width.3em}%
   \hbox{\vrule \@height.3ex}}
%    \end{macrocode}
%
%    Using |\fontdimen3| in the next definition is some sort of a
%    kludge (since it is the interword stretch) but it makes the
%    ellipsis come out right in mono-spaced fonts too (since there it
%    is zero).
%    \begin{macrocode}
\DeclareTextCommandDefault{\textellipsis}{%
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font}
%    \end{macrocode}
%
% \changes{v1.9a}{1997/04/30}{Changed \cs{textsc} to \cs{scshape}}
% \changes{v1.95}{2002/06/18}{Changed def for \cs{textregistered} to
%    avoid small caps (pr/3420)}
%    \begin{macrocode}
%\DeclareTextCommandDefault{\textregistered}{\textcircled{\scshape r}}
\DeclareTextCommandDefault{\textregistered}{\textcircled{%
     \check@mathfonts\fontsize\sf@size\z@\math@fontsfalse\selectfont R}}
\DeclareTextCommandDefault{\texttrademark}{\textsuperscript{TM}}
\DeclareTextCommandDefault{\SS}{SS}
%    \end{macrocode}
%
% \changes{v1.9n}{1998/03/05}{Added masc/fem ords as in pr/2579}
%    \begin{macrocode}
\DeclareTextCommandDefault{\textordfeminine}{\textsuperscript{a}}
\DeclareTextCommandDefault{\textordmasculine}{\textsuperscript{o}}
%    \end{macrocode}
%
% \subsubsection{Math material}
%
%    Some commands can be used in both text and math mode:
%    \begin{macrocode}
\DeclareRobustCommand{\$}{\ifmmode\mathdollar\else\textdollar\fi}
%    \end{macrocode}
%    We use \cs{protected} not \cs{DeclareRobustCommand} so that
%    \verb=\bigl\{= etc.\ works inside \cs{protected@edef}.
% \changes{v2.0n}{2020/01/20}{fix for gh/251}
%    \begin{macrocode}
\protected\def\{{\ifmmode\lbrace\else\textbraceleft\fi}
\protected\def\}{\ifmmode\rbrace\else\textbraceright\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareRobustCommand{\P}{\ifmmode\mathparagraph\else\textparagraph\fi}
\DeclareRobustCommand{\S}{\ifmmode\mathsection\else\textsection\fi}
\DeclareRobustCommand{\dag}{\ifmmode{\dagger}\else\textdagger\fi}
\DeclareRobustCommand{\ddag}{\ifmmode{\ddagger}\else\textdaggerdbl\fi}
%    \end{macrocode}
%
% For historical reasons |\copyright|
% needs |{}| around the definition in maths.
%
% \changes{v1.6f}{1994/11/04}{Added \cmd\_.}
%
% \changes{v1.9a}{1997/04/30}{Modified \cs{underscore}, removing
%                                    \cs{mathunderscore}}
% \changes{v1.9a}{1997/04/30}{Introduced \cs{textcopyright} and modify
%                             \cs{copyright}}
%    \begin{macrocode}
\DeclareRobustCommand{\_}{%
   \ifmmode\nfss@text{\textunderscore}\else\textunderscore\fi}
\DeclareRobustCommand{\copyright}{%
   \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
\DeclareRobustCommand{\pounds}{%
   \ifmmode\mathsterling\else\textsterling\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareRobustCommand{\dots}{%
   \ifmmode\mathellipsis\else\textellipsis\fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\let\ldots\dots
%    \end{macrocode}
% \changes{v1.99m}{2015/02/16}{Added \cs{textcommabelow} latex/4414}
% Default definition of the commabelow accent.
%    \begin{macrocode}
%</2ekernel>
%<latexrelease>\IncludeInRelease{2015/10/01}{\textcommabelow}{comma accent}%
%<*2ekernel|latexrelease>
\DeclareTextCommandDefault\textcommabelow[1]
  {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
   \hbox{\check@mathfonts\fontsize\ssf@size\z@
   \math@fontsfalse\selectfont,}\hidewidth}\egroup}
%<latexrelease>\EndIncludeInRelease
%</2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}{\textcommabelow}{comma accent}%
%<latexrelease>\let\textcommabelow\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-G\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-K\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-k\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-L\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-l\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-N\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-n\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-R\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-r\endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
% \changes{v1.99n}{2015/02/16}{Added \cs{textcommaabove}}
% Default definition of the commaabove accent(E.G.).
%    \begin{macrocode}
%<latexrelease>\IncludeInRelease{2016/02/01}{\textcommaabove}{comma above}%
%<*2ekernel|latexrelease>
\DeclareTextCommandDefault\textcommaabove[1]{%
  \hmode@bgroup
  \ooalign{%
    \hidewidth
    \raise.7ex\hbox{%
      \check@mathfonts\fontsize\ssf@size\z@\math@fontsfalse\selectfont`%
    }%
   \hidewidth\crcr
   \null#1\crcr
  }%
  \egroup
}
%<latexrelease>\EndIncludeInRelease
%</2ekernel|latexrelease>
%<latexrelease>\IncludeInRelease{0000/00/00}{\textcommaabove}{comma above}%
%<latexrelease>\let\textcommaabove\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\OT1\string\c-g\endcsname\@undefined
%<latexrelease>\expandafter
%<latexrelease>  \let\csname\string\T1\string\c-g\endcsname\@undefined
%<latexrelease>\EndIncludeInRelease
%    \end{macrocode}
%
% \changes{v1.6d}{1994/10/30}{Moved math commands here from ltmath.}
% \changes{v1.6f}{1994/11/04}{Added \cs{mathunderscore}.}
% \changes{v1.7k}{1995/06/05}{Moved math commands to fontdef.dtx.}
%
%
% \changes{1.4a}{1994/05/01}{Added the \cs{SaveAtCatcode} and
%    \cs{RestoreAtCatcode} commands.}
%
% \changes{1.5a}{1994/05/12}{Removed the \cs{SaveAtCatcode} and
%    \cs{RestoreAtCatcode} commands.}
%
%
% \subsection{Definitions for the OT1 encoding}
%
% \changes{1.3}{1993/12/17}{Removed all the hackery for use in
%    \cs{DeclareFontEncoding}, and redid everything using
%    \cs{DeclareTextFoo}.}
% \changes{1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{1.4a}{1994/05/01}{Rewrote for the new syntax.}
% \changes{1.5a}{1994/05/12}{Rewrote for the new syntax.}
% \changes{1.5h}{1994/05/16}{\cs{pounds} was still using u rather than
%    ui shape.}
% \changes{1.6b}{1994/10/27}{Added:
%   \cs{textemdash}
%   \cs{textendash}
%   \cs{textexclamdown}
%   \cs{texthyphenchar}
%   \cs{texthyphen}
%   \cs{textquestiondown}
%   \cs{textquotedblleft}
%   \cs{textquotedblright}
%   \cs{textquoteleft}
%   \cs{textquoteright}
% }
%
% The definitions for the `\TeX{} text' (OT1) encoding.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OT1>
\DeclareFontEncoding{OT1}{}{}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT1}{127}
\DeclareTextAccent{\'}{OT1}{19}
\DeclareTextAccent{\.}{OT1}{95}
\DeclareTextAccent{\=}{OT1}{22}
\DeclareTextAccent{\^}{OT1}{94}
\DeclareTextAccent{\`}{OT1}{18}
\DeclareTextAccent{\~}{OT1}{126}
\DeclareTextAccent{\H}{OT1}{125}
\DeclareTextAccent{\u}{OT1}{21}
\DeclareTextAccent{\v}{OT1}{20}
\DeclareTextAccent{\r}{OT1}{23}
%    \end{macrocode}
%    Some accents have to be built by hand:
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.7j}{1995/05/21}{Updated some plain macros}
% \changes{v1.7o}{1995/11/07}{Added \cs{leavevmode} at start of
% \cs{c}, otherwise the output routine might be invoked within the
% macro.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
%    \begin{macrocode}
\DeclareTextCommand{\b}{OT1}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{OT1}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
    \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
\DeclareTextCommand{\d}{OT1}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
%    \end{macrocode}
%
%    Declare the text symbols.
%    \begin{macrocode}
\DeclareTextSymbol{\AE}{OT1}{29}
\DeclareTextSymbol{\OE}{OT1}{30}
\DeclareTextSymbol{\O}{OT1}{31}
\DeclareTextSymbol{\ae}{OT1}{26}
\DeclareTextSymbol{\i}{OT1}{16}
\DeclareTextSymbol{\j}{OT1}{17}
\DeclareTextSymbol{\oe}{OT1}{27}
\DeclareTextSymbol{\o}{OT1}{28}
\DeclareTextSymbol{\ss}{OT1}{25}
\DeclareTextSymbol{\textemdash}{OT1}{124}
\DeclareTextSymbol{\textendash}{OT1}{123}
%    \end{macrocode}
%    Using the ligatures helps with OT1 fonts that have
%    |\textexclamdown| and |\textquestiondown| in unusual positions.
% \changes{v1.95}{2002/06/17}{Definition of \cs{textexclamdown} changed (pr/3368)}
% \changes{v1.95}{2002/06/17}{Definition of \cs{textquestiondown} changed (pr/3368)}
%    \begin{macrocode}
%\DeclareTextSymbol{\textexclamdown}{OT1}{60}
%\DeclareTextSymbol{\textquestiondown}{OT1}{62}
\DeclareTextCommand{\textexclamdown}{OT1}{!`}
\DeclareTextCommand{\textquestiondown}{OT1}{?`}
%\DeclareTextSymbol{\texthyphenchar}{OT1}{`\-}
%\DeclareTextSymbol{\texthyphen}{OT1}{`\-}
\DeclareTextSymbol{\textquotedblleft}{OT1}{92}
\DeclareTextSymbol{\textquotedblright}{OT1}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT1}{`\`}
\DeclareTextSymbol{\textquoteright}{OT1}{`\'}
%    \end{macrocode}
%    Some symbols which are faked from others:
% \changes{v1.7o}{1995/11/07}{Changed \cs{char}32 to \cs{@xxxii} (two
% tokens less).}
% \changes{v1.7o}{1995/11/07}{Replaced octal number 27 by decimal
% number 23 to protect against the quote character being active.}
% \changes{v1.7o}{1995/11/07}{Replaced some 0's by \cs{z@} (faster).}
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
% \DeclareTextCommand{\aa}{OT1}
%    {{\accent23a}}
\DeclareTextCommand{\L}{OT1}
   {\leavevmode\setbox\z@\hbox{L}\hb@xt@\wd\z@{\hss\@xxxii L}}
\DeclareTextCommand{\l}{OT1}
   {\hmode@bgroup\@xxxii l\egroup}
% \DeclareTextCommand{\AA}{OT1}
%    {\leavevmode\setbox\z@\hbox{h}\dimen@\ht\z@\advance\dimen@-1ex%
%     \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
%    In the OT1 encoding \r A has a hand-crafted definition, so we
%    have here the first recorded explicit use of
%    |\DeclareTextCompositeCommand|.
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{r} A}
% \changes{v1.96}{2002/10/28}{%
%   coding change, to follow bug fix by DEK in plain.tex (pr/3469)}
% \changes{v2.0f}{2017/02/19}{%
%     add \cs{@empty} to guard against 3rd argument being empty}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\r}{OT1}{A}
   {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
    \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%    The dutch language uses the letter `ij'. It is available in
%    \texttt{T1} encoded fonts, but not in the \texttt{OT1} encoded
%    fonts. Therefor we fake it for the \texttt{OT1} encoding.
%    \begin{macrocode}
\DeclareTextCommand{\ij}{OT1}{%
  \nobreak\hskip\z@skip i\kern-0.02em j\nobreak\hskip\z@skip}
\DeclareTextCommand{\IJ}{OT1}{%
  \nobreak\hskip\z@skip I\kern-0.02em J\nobreak\hskip\z@skip}
%    \end{macrocode}
%    In the OT1 encoding, \pounds~and \$ share a slot.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\textdollar}{OT1}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextCommand{\textsterling}{OT1}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \itshape
   \else
      \fontshape{ui}\selectfont
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%
%    Here we are adding some more composite commands to the |OT1|
%    encoding.  This makes the use of certain accents with |i|
%    compatible with their use with the |T1| encoding; this
%    enables them to become true \LaTeX{} internal representations.
%    However, it will make these accents work a little less fast since
%    a check will always be made for the existence of a composite.
%
% \changes{v1.93}{2001/05/28}{Added composites for compatibility with
%                             T1, pr/3295}
% \changes{v1.94}{2001/06/05}{Text composite Commands need kludges for
%                               `,' -- see tlb1903.lvt}
%    \begin{macrocode}
\DeclareTextComposite{\.}{OT1}{i}{`\i}
\DeclareTextComposite{\.}{OT1}{\i}{`\i}
\DeclareTextCompositeCommand{\`}{OT1}{i}{\@tabacckludge`\i}
\DeclareTextCompositeCommand{\'}{OT1}{i}{\@tabacckludge'\i}
\DeclareTextCompositeCommand{\^}{OT1}{i}{\^\i}
\DeclareTextCompositeCommand{\"}{OT1}{i}{\"\i}
%    \end{macrocode}
%
% T1 encoding is given more extensive set of overloads for \verb|\c|
% But here we just adjust \verb|\c{g}|.
% \changes{v1.99n}{2015/02/16}{Added composites for \cs{c}}
% \changes{v1.99m}{2016/06/19}{OT1 definition (was duplicate T1 definition)}
%    \begin{macrocode}
\ifx\textcommaabove\@undefined\else
\DeclareTextCompositeCommand{\c}{OT1}{g}{\textcommaabove{g}}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</OT1>
%    \end{macrocode}
%
% \subsection{Definitions for the T1 encoding}
%
% \changes{1.3}{1993/12/17}{Removed all the hackery for use in
%    \cs{DeclareFontEncoding}, and redid everything using
%    \cs{DeclareTextFoo}.}
% \changes{1.3b}{1993/12/18}{Replaced the missing last argument to
%    \cs{DeclareFontEncoding}.}
% \changes{1.3c}{1993/12/18}{Rewrote for the new syntax of
%    \cs{EncodingSpecific}.}
% \changes{1.4a}{1994/05/01}{Rewrote for the new syntax.}
% \changes{1.5a}{1994/05/12}{Rewrote for the new syntax.}
% \changes{1.6a}{1994/10/25}{Added \cs{textdollar},
%    \cs{textlbrace}, \cs{textrbrace}, \cs{textsterling},
%    \cs{textunderline}.}
% \changes{1.6a}{1994/10/25}{Removed
%    \cs{textlbrace}, \cs{textrbrace}, \cs{textunderline} to give them
%    their proper names.}
% \changes{1.6b}{1994/10/27}{Added
%   \cs{textasciicircum}
%   \cs{textasciitilde}
%   \cs{textbackslash}
%   \cs{textbar}
%   \cs{textbraceleft}
%   \cs{textbraceright}
%   \cs{textcompwordmark}
%   \cs{textemdash}
%   \cs{textendash}
%   \cs{textexclamdown}
%   \cs{textgreater}
%   \cs{texthyphenchar}
%   \cs{texthyphen}
%   \cs{textless}
%   \cs{textquestiondown}
%   \cs{textquotedblleft}
%   \cs{textquotedblright}
%   \cs{textquotedbl}
%   \cs{textquoteleft}
%   \cs{textquoteright}
%   \cs{textunderscore}
%   \cs{textvisiblespace}
% }
% \changes{v1.9h}{1997/12/17}
%    {Added \cs{textperthousand} and \cs{textpertenthousand}}
%
% The definitions for the `Extended \TeX{} text' (T1) encoding.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*T1>
\DeclareFontEncoding{T1}{}{}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\`}{T1}{0}
\DeclareTextAccent{\'}{T1}{1}
\DeclareTextAccent{\^}{T1}{2}
\DeclareTextAccent{\~}{T1}{3}
\DeclareTextAccent{\"}{T1}{4}
\DeclareTextAccent{\H}{T1}{5}
\DeclareTextAccent{\r}{T1}{6}
\DeclareTextAccent{\v}{T1}{7}
\DeclareTextAccent{\u}{T1}{8}
\DeclareTextAccent{\=}{T1}{9}
\DeclareTextAccent{\.}{T1}{10}
%    \end{macrocode}
%    Some accents have to be built by hand.
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.9h}{1997/12/17}{As in OT1, Added \cs{leavevmode} at
% start of \cs{c}, otherwise the output routine might be invoked
% within the macro.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.95}{2002/06/17}{Corrected \cs{c} for T1 (pr/3442)}
% \changes{v1.99b}{2004/01/03}{Use \cs{ooalign} for \cs{k} (pr/3532)}
% \changes{v1.99b}{2004/01/03}{Added \cs{textogonekcentered} (pr/3532)}
% \changes{v1.99c}{2004/01/04}{More adjustments for ogonek (pr/3532)}
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
%    \begin{macrocode}
\DeclareTextCommand{\b}{T1}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char9}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{T1}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent11 #1%
     \else{\ooalign{\unhbox\z@\crcr
        \hidewidth\char11\hidewidth}}\fi}
\DeclareTextCommand{\d}{T1}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
\DeclareTextCommand{\k}{T1}[1]
   {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\char12}\egroup}
\DeclareTextCommand{\textogonekcentered}{T1}[1]
   {\hmode@bgroup\ooalign{%
                \null#1\crcr\hidewidth\char12\hidewidth}\egroup}
%    \end{macrocode}
%
%    Some symbols are constructed.
%
% \changes{v1.9h}{1997/12/17}
%    {Added \cs{textperthousand} and \cs{textpertenthousand}}
%    Slot 24 contains a small circle intended for construction of
%    these two glyphs.
%
%    \begin{macrocode}
\DeclareTextCommand{\textperthousand}{T1}
   {\%\char 24 }          % space or `relax as delimiter?
\DeclareTextCommand{\textpertenthousand}{T1}
   {\%\char 24\char 24 }  % space or `relax as delimiter?
%    \end{macrocode}
%
%    For Maltese, \cs{Hwithstroke} and \cs{hwithstroke} are needed.
%
% \changes{v2.0k}{2018/11/19}
%    {Added \cs{Hwithstroke} and \cs{hwithstroke}}
%
%    \begin{macrocode}
\DeclareTextCommand{\Hwithstroke}{T1}
   {%
    \hmode@bgroup
    \vphantom{H}%
    \sbox\z@{H}%
    \ooalign{%
      H\cr
      \hidewidth
      \vrule
        height \dimexpr 0.7\ht\z@+0.1ex\relax
        depth  -0.7\ht\z@
        width  0.8\wd\z@
      \hidewidth\cr
    }%
    \egroup
   }
\DeclareTextCommand{\hwithstroke}{T1}
   {%
    \hmode@bgroup
    \vphantom{h}%
    \sbox\z@{h}%
    \ooalign{%
      h\cr
      \kern0.075\wd\z@
      \vrule
        height \dimexpr 0.7\ht\z@+0.1ex\relax
        depth  -0.7\ht\z@
        width  0.4\wd\z@
      \hidewidth\cr
    }%
    \egroup
   }
%    \end{macrocode}
%
%    Declare the text symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textasciicircum},
%    \cs{textasciitilde}, \cs{textbackslash}, \cs{textbar},
%    \cs{textgreater} and \cs{textless}.}
% \changes{v1.8c}{1996/10/27}
%      {Removed \cs{aa} and \cs{AA}}
% \changes{v1.99h}{2005/11/08}
%      {Added \cs{ij} and \cs{IJ} from babel. (pr/3771)}
%
%    \begin{macrocode}
%\DeclareTextSymbol{\AA}{T1}{197}
\DeclareTextSymbol{\AE}{T1}{198}
\DeclareTextSymbol{\DH}{T1}{208}
\DeclareTextSymbol{\DJ}{T1}{208}
\DeclareTextSymbol{\L}{T1}{138}
\DeclareTextSymbol{\NG}{T1}{141}
\DeclareTextSymbol{\OE}{T1}{215}
\DeclareTextSymbol{\O}{T1}{216}
\DeclareTextSymbol{\SS}{T1}{223}
\DeclareTextSymbol{\TH}{T1}{222}
%\DeclareTextSymbol{\aa}{T1}{229}
\DeclareTextSymbol{\ae}{T1}{230}
\DeclareTextSymbol{\dh}{T1}{240}
\DeclareTextSymbol{\dj}{T1}{158}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetleft}{T1}{19}
\DeclareTextSymbol{\guillemetright}{T1}{20}
% old Adobe names
\DeclareTextSymbol{\guillemotleft}{T1}{19}
\DeclareTextSymbol{\guillemotright}{T1}{20}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\guilsinglleft}{T1}{14}
\DeclareTextSymbol{\guilsinglright}{T1}{15}
\DeclareTextSymbol{\i}{T1}{25}
\DeclareTextSymbol{\j}{T1}{26}
\DeclareTextSymbol{\ij}{T1}{188}
\DeclareTextSymbol{\IJ}{T1}{156}
\DeclareTextSymbol{\l}{T1}{170}
\DeclareTextSymbol{\ng}{T1}{173}
\DeclareTextSymbol{\oe}{T1}{247}
\DeclareTextSymbol{\o}{T1}{248}
\DeclareTextSymbol{\quotedblbase}{T1}{18}
\DeclareTextSymbol{\quotesinglbase}{T1}{13}
\DeclareTextSymbol{\ss}{T1}{255}
\DeclareTextSymbol{\textasciicircum}{T1}{`\^}
\DeclareTextSymbol{\textasciitilde}{T1}{`\~}
\DeclareTextSymbol{\textbackslash}{T1}{`\\}
\DeclareTextSymbol{\textbar}{T1}{`\|}
\DeclareTextSymbol{\textbraceleft}{T1}{`\{}
\DeclareTextSymbol{\textbraceright}{T1}{`\}}
\DeclareTextSymbol{\textcompwordmark}{T1}{23}
\DeclareTextSymbol{\textdollar}{T1}{`\$}
\DeclareTextSymbol{\textemdash}{T1}{22}
\DeclareTextSymbol{\textendash}{T1}{21}
\DeclareTextSymbol{\textexclamdown}{T1}{189}
\DeclareTextSymbol{\textgreater}{T1}{`\>}
%\DeclareTextSymbol{\texthyphenchar}{T1}{127}
%\DeclareTextSymbol{\texthyphen}{T1}{`\-}
\DeclareTextSymbol{\textless}{T1}{`\<}
\DeclareTextSymbol{\textquestiondown}{T1}{190}
\DeclareTextSymbol{\textquotedblleft}{T1}{16}
\DeclareTextSymbol{\textquotedblright}{T1}{17}
\DeclareTextSymbol{\textquotedbl}{T1}{`\"}
\DeclareTextSymbol{\textquoteleft}{T1}{`\`}
\DeclareTextSymbol{\textquoteright}{T1}{`\'}
\DeclareTextSymbol{\textsection}{T1}{159}
\DeclareTextSymbol{\textsterling}{T1}{191}
\DeclareTextSymbol{\textunderscore}{T1}{95}
\DeclareTextSymbol{\textvisiblespace}{T1}{32}
\DeclareTextSymbol{\th}{T1}{254}
%    \end{macrocode}
%    Declare the composites.
% \changes{v1.93}{2001/05/28}{Changed the effect of
%                             \cs{.}\cs{i}, pr/3295}
%    \begin{macrocode}
\DeclareTextComposite{\.}{T1}{i}{`\i}
\DeclareTextComposite{\.}{T1}{\i}{`\i}
%    \end{macrocode}
% \changes{v1.9c}{1997/05/04}{Added `hex index tabs'}
%    "80 = 128
%    \begin{macrocode}
\DeclareTextComposite{\u}{T1}{A}{128}
\DeclareTextComposite{\k}{T1}{A}{129}
\DeclareTextComposite{\'}{T1}{C}{130}
\DeclareTextComposite{\v}{T1}{C}{131}
\DeclareTextComposite{\v}{T1}{D}{132}
\DeclareTextComposite{\v}{T1}{E}{133}
\DeclareTextComposite{\k}{T1}{E}{134}
\DeclareTextComposite{\u}{T1}{G}{135}
%    \end{macrocode}
%    "88 = 136
%    \begin{macrocode}
\DeclareTextComposite{\'}{T1}{L}{136}
\DeclareTextComposite{\v}{T1}{L}{137}
\DeclareTextComposite{\'}{T1}{N}{139}
\DeclareTextComposite{\v}{T1}{N}{140}
\DeclareTextComposite{\H}{T1}{O}{142}
\DeclareTextComposite{\'}{T1}{R}{143}
%    \end{macrocode}
%    "90 = 144
%    \begin{macrocode}
\DeclareTextComposite{\v}{T1}{R}{144}
\DeclareTextComposite{\'}{T1}{S}{145}
\DeclareTextComposite{\v}{T1}{S}{146}
\DeclareTextComposite{\c}{T1}{S}{147}
\DeclareTextComposite{\v}{T1}{T}{148}
\DeclareTextComposite{\c}{T1}{T}{149}
\DeclareTextComposite{\H}{T1}{U}{150}
\DeclareTextComposite{\r}{T1}{U}{151}
%    \end{macrocode}
%    "98 = 152
%    \begin{macrocode}
\DeclareTextComposite{\"}{T1}{Y}{152}
\DeclareTextComposite{\'}{T1}{Z}{153}
\DeclareTextComposite{\v}{T1}{Z}{154}
\DeclareTextComposite{\.}{T1}{Z}{155}
\DeclareTextComposite{\.}{T1}{I}{157}
%    \end{macrocode}
%    "A0 = 160
%    \begin{macrocode}
\DeclareTextComposite{\u}{T1}{a}{160}
\DeclareTextComposite{\k}{T1}{a}{161}
\DeclareTextComposite{\'}{T1}{c}{162}
\DeclareTextComposite{\v}{T1}{c}{163}
\DeclareTextComposite{\v}{T1}{d}{164}
\DeclareTextComposite{\v}{T1}{e}{165}
\DeclareTextComposite{\k}{T1}{e}{166}
\DeclareTextComposite{\u}{T1}{g}{167}
%    \end{macrocode}
%    "A8 = 168
%    \begin{macrocode}
\DeclareTextComposite{\'}{T1}{l}{168}
\DeclareTextComposite{\v}{T1}{l}{169}
\DeclareTextComposite{\'}{T1}{n}{171}
\DeclareTextComposite{\v}{T1}{n}{172}
\DeclareTextComposite{\H}{T1}{o}{174}
\DeclareTextComposite{\'}{T1}{r}{175}
%    \end{macrocode}
%    "B0 = 176
%    \begin{macrocode}
\DeclareTextComposite{\v}{T1}{r}{176}
\DeclareTextComposite{\'}{T1}{s}{177}
\DeclareTextComposite{\v}{T1}{s}{178}
\DeclareTextComposite{\c}{T1}{s}{179}
\DeclareTextComposite{\v}{T1}{t}{180}
\DeclareTextComposite{\c}{T1}{t}{181}
\DeclareTextComposite{\H}{T1}{u}{182}
\DeclareTextComposite{\r}{T1}{u}{183}
%    \end{macrocode}
%    "B8 = 184
%    \begin{macrocode}
\DeclareTextComposite{\"}{T1}{y}{184}
\DeclareTextComposite{\'}{T1}{z}{185}
\DeclareTextComposite{\v}{T1}{z}{186}
\DeclareTextComposite{\.}{T1}{z}{187}
%    \end{macrocode}
%    "C0 = 192
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{A}{192}
\DeclareTextComposite{\'}{T1}{A}{193}
\DeclareTextComposite{\^}{T1}{A}{194}
\DeclareTextComposite{\~}{T1}{A}{195}
\DeclareTextComposite{\"}{T1}{A}{196}
\DeclareTextComposite{\r}{T1}{A}{197}
\DeclareTextComposite{\c}{T1}{C}{199}
%    \end{macrocode}
%    "C8 = 200
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{E}{200}
\DeclareTextComposite{\'}{T1}{E}{201}
\DeclareTextComposite{\^}{T1}{E}{202}
\DeclareTextComposite{\"}{T1}{E}{203}
\DeclareTextComposite{\`}{T1}{I}{204}
\DeclareTextComposite{\'}{T1}{I}{205}
\DeclareTextComposite{\^}{T1}{I}{206}
\DeclareTextComposite{\"}{T1}{I}{207}
%    \end{macrocode}
%    "D0 = 208
%    \begin{macrocode}
\DeclareTextComposite{\~}{T1}{N}{209}
\DeclareTextComposite{\`}{T1}{O}{210}
\DeclareTextComposite{\'}{T1}{O}{211}
\DeclareTextComposite{\^}{T1}{O}{212}
\DeclareTextComposite{\~}{T1}{O}{213}
\DeclareTextComposite{\"}{T1}{O}{214}
%    \end{macrocode}
%    "D8 = 216
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{U}{217}
\DeclareTextComposite{\'}{T1}{U}{218}
\DeclareTextComposite{\^}{T1}{U}{219}
\DeclareTextComposite{\"}{T1}{U}{220}
\DeclareTextComposite{\'}{T1}{Y}{221}
%    \end{macrocode}
%    "E0 = 224
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{a}{224}
\DeclareTextComposite{\'}{T1}{a}{225}
\DeclareTextComposite{\^}{T1}{a}{226}
\DeclareTextComposite{\~}{T1}{a}{227}
\DeclareTextComposite{\"}{T1}{a}{228}
\DeclareTextComposite{\r}{T1}{a}{229}
\DeclareTextComposite{\c}{T1}{c}{231}
%    \end{macrocode}
%    "E8 = 232
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{e}{232}
\DeclareTextComposite{\'}{T1}{e}{233}
\DeclareTextComposite{\^}{T1}{e}{234}
\DeclareTextComposite{\"}{T1}{e}{235}
\DeclareTextComposite{\`}{T1}{i}{236}
\DeclareTextComposite{\`}{T1}{\i}{236}
\DeclareTextComposite{\'}{T1}{i}{237}
\DeclareTextComposite{\'}{T1}{\i}{237}
\DeclareTextComposite{\^}{T1}{i}{238}
\DeclareTextComposite{\^}{T1}{\i}{238}
\DeclareTextComposite{\"}{T1}{i}{239}
\DeclareTextComposite{\"}{T1}{\i}{239}
%    \end{macrocode}
%    "F0 = 240
%    \begin{macrocode}
\DeclareTextComposite{\~}{T1}{n}{241}
\DeclareTextComposite{\`}{T1}{o}{242}
\DeclareTextComposite{\'}{T1}{o}{243}
\DeclareTextComposite{\^}{T1}{o}{244}
\DeclareTextComposite{\~}{T1}{o}{245}
\DeclareTextComposite{\"}{T1}{o}{246}
%    \end{macrocode}
%    "F8 = 248
%    \begin{macrocode}
\DeclareTextComposite{\`}{T1}{u}{249}
\DeclareTextComposite{\'}{T1}{u}{250}
\DeclareTextComposite{\^}{T1}{u}{251}
\DeclareTextComposite{\"}{T1}{u}{252}
\DeclareTextComposite{\'}{T1}{y}{253}
%    \end{macrocode}
% \changes{v1.99b}{2004/01/03}{Added composites for \cs{k} (pr/3532)}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\k}{T1}{o}{\textogonekcentered{o}}
\DeclareTextCompositeCommand{\k}{T1}{O}{\textogonekcentered{O}}
%    \end{macrocode}
% \changes{v1.99n}{2015/02/16}{Added composites for \c{c}}
%    \begin{macrocode}
\ifx\textcommaabove\@undefined\else
\DeclareTextCompositeCommand{\c}{T1}{g}{\textcommaabove{g}}
\fi
\ifx\textcommabelow\@undefined\else
\DeclareTextCompositeCommand{\c}{T1}{G}{\textcommabelow{G}}
\DeclareTextCompositeCommand{\c}{T1}{K}{\textcommabelow{K}}
\DeclareTextCompositeCommand{\c}{T1}{k}{\textcommabelow{k}}
\DeclareTextCompositeCommand{\c}{T1}{L}{\textcommabelow{L}}
\DeclareTextCompositeCommand{\c}{T1}{l}{\textcommabelow{l}}
\DeclareTextCompositeCommand{\c}{T1}{N}{\textcommabelow{N}}
\DeclareTextCompositeCommand{\c}{T1}{n}{\textcommabelow{n}}
\DeclareTextCompositeCommand{\c}{T1}{R}{\textcommabelow{R}}
\DeclareTextCompositeCommand{\c}{T1}{r}{\textcommabelow{r}}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
%</T1>
%    \end{macrocode}
%
% \changes{1.4a}{1994/05/01}{Removed the uc/lc table settings, since
%    the T1 uc/lc table is now the default.}
%
% \subsection{Definitions for the OMS encoding}
%
% \changes{v1.6a}{1994/10/25}{Added the OMS encoding.}
% \changes{v1.6b}{1994/10/27}{Renamed \cs{textlbrace} to
%    \cs{textbraceleft} and \cs{textrbrace} to \cs{textbraceright}.}
% \changes{v1.6b}{1994/10/27}{Added \cs{textbackslash}.}
% \changes{v1.6d}{1994/10/30}{Added \cs{textcircled}.}
%
% The definitions for the `\TeX{} math symbol' (OMS) encoding.  Even
% though this is meant to be a math font, it includes some of the
% standard \LaTeX{} text symbols.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OMS>
\DeclareFontEncoding{OMS}{}{}
%    \end{macrocode}
%    Declare the symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textbackslash} and
%    \cs{textbar}.}
% \changes{v1.8c}{1996/10/27}
%      {Added \cs{textasteriskcentered}}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
% \changes{v1.95}{2002/06/16}{Added \cs{textbardbl} (pr/3400)}
% \changes{v1.99}{2004/02/02}{Added \cs{textbigcircle}}
%    Note that slot 13 has in places been named |\Orb|: please root
%    out and destroy this impolity wherever you find it!
%    \begin{macrocode}
\DeclareTextSymbol{\textasteriskcentered}{OMS}{3}   % "03
\DeclareTextSymbol{\textbackslash}{OMS}{110}        % "6E
\DeclareTextSymbol{\textbar}{OMS}{106}              % "6A
\DeclareTextSymbol{\textbardbl}{OMS}{107}           % "6B
\DeclareTextSymbol{\textbraceleft}{OMS}{102}        % "66
\DeclareTextSymbol{\textbraceright}{OMS}{103}       % "67
\DeclareTextSymbol{\textbullet}{OMS}{15}            % "0F
\DeclareTextSymbol{\textdaggerdbl}{OMS}{122}        % "7A
\DeclareTextSymbol{\textdagger}{OMS}{121}           % "79
\DeclareTextSymbol{\textparagraph}{OMS}{123}        % "7B
\DeclareTextSymbol{\textperiodcentered}{OMS}{1}     % "01
\DeclareTextSymbol{\textsection}{OMS}{120}          % "78
\DeclareTextSymbol{\textbigcircle}{OMS}{13}         % "0D
\DeclareTextCommand{\textcircled}{OMS}[1]{\hmode@bgroup
   \ooalign{%
      \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
      \char 13 % "0D
   }%
 \egroup}
%</OMS>
%    \end{macrocode}
%
% \subsection{Definitions for the OML encoding}
%
% \changes{v1.6d}{1994/10/30}{Added the OML encoding.}
%
% The definitions for the `\TeX{} math italic' (OML) encoding.  Even
% though this is meant to be a math font, it includes some of the
% standard \LaTeX{} text symbols.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OML>
\DeclareFontEncoding{OML}{}{}
%    \end{macrocode}
%    Declare the symbols.
% \changes{v1.7t}{1995/11/29}{Added \cs{textless} and
%    \cs{textgreater}.}
% \changes{v1.9h}{1997/12/17}{Changed to decimal codes.}
% \changes{v1.9m}{1998/01/16}{fixed decimal codes. latex/2734}
%    \begin{macrocode}
\DeclareTextSymbol{\textless}{OML}{`\<}
\DeclareTextSymbol{\textgreater}{OML}{`\>}
\DeclareTextAccent{\t}{OML}{127}  % "7F
%</OML>
%    \end{macrocode}
%
% \subsection{Definitions for the OT4 encoding}
%
% These definitions are for the Polish extension to the
% `\TeX\ text' (OT1) encoding.
% This encoding was created by B.~Jackowski and M.~Ry\'cko
% for use with the Polish version of Computer Modern and Computer
% Concrete.  In positions 0--127 it is identical to OT1 but it
% contains some additional characters in the upper half.  The \LaTeX{}
% support was developed by Mariusz Olko.
%
% The PL fonts that use it are available as follows:\\
% Metafont sources
% \texttt{ftp://ftp.gust.org.pl/TeX/language/polish/pl-mf.zip};
%
% Font files
% \texttt{ftp://ftp.gust.org.pl/TeX/language/polish/pl-tfm.zip}.
%
%    Declare the encoding.
%    \begin{macrocode}
%<*OT4>
\DeclareFontEncoding{OT4}{}{}
\DeclareFontSubstitution{OT4}{cmr}{m}{n}
%    \end{macrocode}
%    Declare the accents.
%    \begin{macrocode}
\DeclareTextAccent{\"}{OT4}{127}
\DeclareTextAccent{\'}{OT4}{19}
\DeclareTextAccent{\.}{OT4}{95}
\DeclareTextAccent{\=}{OT4}{22}
\DeclareTextAccent{\^}{OT4}{94}
\DeclareTextAccent{\`}{OT4}{18}
\DeclareTextAccent{\~}{OT4}{126}
\DeclareTextAccent{\H}{OT4}{125}
\DeclareTextAccent{\u}{OT4}{21}
\DeclareTextAccent{\v}{OT4}{20}
\DeclareTextAccent{\r}{OT4}{23}
%    \end{macrocode}
%    The ogonek accent is available only under a e A \& E.  But we
%    have to provide some definition for \cs{k}. Some other accents
%    have to be built by hand as in OT1:
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\k}{OT4}[1]{%
    \TextSymbolUnavailable{\k{#1}}#1}
%    \end{macrocode}
%  In these definitions we no longer use the helper function |\sh@ft|
%  from plain.tex since that now has two incompatible definitions.
% \changes{v1.99g}{2005/09/27}{Replace \cs{sh@ft} by \cs{ltx@sh@ft}}
%    \begin{macrocode}
\DeclareTextCommand{\b}{OT4}[1]
   {\hmode@bgroup\o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-3ex}%
     \vbox to.2ex{\hbox{\char22}\vss}\hidewidth}\egroup}
\DeclareTextCommand{\c}{OT4}[1]
   {\leavevmode\setbox\z@\hbox{#1}\ifdim\ht\z@=1ex\accent24 #1%
    \else{\ooalign{\unhbox\z@\crcr\hidewidth\char24\hidewidth}}\fi}
\DeclareTextCommand{\d}{OT4}[1]
   {\hmode@bgroup
    \o@lign{\relax#1\crcr\hidewidth\ltx@sh@ft{-1ex}.\hidewidth}\egroup}
%    \end{macrocode}
%    Declare the text symbols.
%    \begin{macrocode}
\DeclareTextSymbol{\AE}{OT4}{29}
\DeclareTextSymbol{\OE}{OT4}{30}
\DeclareTextSymbol{\O}{OT4}{31}
\DeclareTextSymbol{\L}{OT4}{138}
\DeclareTextSymbol{\ae}{OT4}{26}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetleft}{OT4}{174}
\DeclareTextSymbol{\guillemetright}{OT4}{175}
% old Adobe names
\DeclareTextSymbol{\guillemotleft}{OT4}{174}
\DeclareTextSymbol{\guillemotright}{OT4}{175}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\i}{OT4}{16}
\DeclareTextSymbol{\j}{OT4}{17}
\DeclareTextSymbol{\l}{OT4}{170}
\DeclareTextSymbol{\o}{OT4}{28}
\DeclareTextSymbol{\oe}{OT4}{27}
\DeclareTextSymbol{\quotedblbase}{OT4}{255}
\DeclareTextSymbol{\ss}{OT4}{25}
\DeclareTextSymbol{\textemdash}{OT4}{124}
\DeclareTextSymbol{\textendash}{OT4}{123}
\DeclareTextSymbol{\textexclamdown}{OT4}{60}
%\DeclareTextSymbol{\texthyphenchar}{OT4}{`\-}
%\DeclareTextSymbol{\texthyphen}{OT4}{`\-}
\DeclareTextSymbol{\textquestiondown}{OT4}{62}
\DeclareTextSymbol{\textquotedblleft}{OT4}{92}
\DeclareTextSymbol{\textquotedblright}{OT4}{`\"}
\DeclareTextSymbol{\textquoteleft}{OT4}{`\`}
\DeclareTextSymbol{\textquoteright}{OT4}{`\'}
%    \end{macrocode}
%    Definition for \r A as in OT1:
% \changes{v1.96}{2002/10/28}{%
%   coding change, to follow bug fix by DEK in plain.tex (pr/3469)}
%    \begin{macrocode}
\DeclareTextCompositeCommand{\r}{OT4}{A}
   {\leavevmode\setbox\z@\hbox{!}\dimen@\ht\z@\advance\dimen@-1ex%
    \rlap{\raise.67\dimen@\hbox{\char23}}A}
%    \end{macrocode}
%    In the OT4 encoding, \pounds~and \$ share a slot.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\textdollar}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \slshape
   \else
      \upshape
   \fi
   \char`\$\egroup}
\DeclareTextCommand{\textsterling}{OT4}{\hmode@bgroup
   \ifdim \fontdimen\@ne\font >\z@
      \itshape
   \else
      \fontshape{ui}\selectfont
   \fi
   \char`\$\egroup}
%    \end{macrocode}
%    Declare the composites.
%    \begin{macrocode}
\DeclareTextComposite{\k}{OT4}{A}{129}
\DeclareTextComposite{\'}{OT4}{C}{130}
\DeclareTextComposite{\k}{OT4}{E}{134}
\DeclareTextComposite{\'}{OT4}{N}{139}
\DeclareTextComposite{\'}{OT4}{S}{145}
\DeclareTextComposite{\'}{OT4}{Z}{153}
\DeclareTextComposite{\.}{OT4}{Z}{155}
\DeclareTextComposite{\k}{OT4}{a}{161}
\DeclareTextComposite{\'}{OT4}{c}{162}
\DeclareTextComposite{\k}{OT4}{e}{166}
\DeclareTextComposite{\'}{OT4}{n}{171}
\DeclareTextComposite{\'}{OT4}{s}{177}
\DeclareTextComposite{\'}{OT4}{z}{185}
\DeclareTextComposite{\.}{OT4}{z}{187}
\DeclareTextComposite{\'}{OT4}{O}{211}
\DeclareTextComposite{\'}{OT4}{o}{243}
%</OT4>
%    \end{macrocode}
%
%
% \subsection{Definitions for the TS1 encoding}
%
% \changes{v1.9c}{1997/05/04}{Added TS1 encoding v2.2.beta}
% \changes{v1.9g}{1997/11/23}
%    {Use \cs{textperthousand}, \cs{textpertenthousand} and
%          \cs{textfractionsolidus} not
%         \cs{textpermill}, \cs{textpertenmill} and \cs{textfraction}.
%         /2673 }
% \changes{v1.9h}{1997/12/17}
%     {Removed default settings, see next section.}
%
%    \begin{macrocode}
%<*TS1>
\DeclareFontEncoding{TS1}{}{}
\DeclareFontSubstitution{TS1}{cmr}{m}{n}
%    \end{macrocode}
%    Some accents have to be built by hand.
%    Note that |\ooalign| and |\o@lign| must be inside a group.
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextCommand{\capitalcedilla}{TS1}[1]
   {\hmode@bgroup
    \ooalign{\null#1\crcr\hidewidth\char11\hidewidth}\egroup}
\DeclareTextCommand{\capitalogonek}{TS1}[1]
   {\hmode@bgroup
    \ooalign{\null#1\crcr\hidewidth\char12\hidewidth}\egroup}
%    \end{macrocode}
%
% Accents for capital letters.
%
% These commands can be used by the end user either directly or through
% definitions of the type
% \begin{verbatim}
% \DeclareTextCompositeCommand{\'}{T1}{X}{\capitalacute X}
% \end{verbatim}
% None of the latter definitions are provided by default, since they
% are probably rarely used.
%
%    "00 = 0
%    \begin{macrocode}
\DeclareTextAccent{\capitalgrave}{TS1}{0}
\DeclareTextAccent{\capitalacute}{TS1}{1}
\DeclareTextAccent{\capitalcircumflex}{TS1}{2}
\DeclareTextAccent{\capitaltilde}{TS1}{3}
\DeclareTextAccent{\capitaldieresis}{TS1}{4}
\DeclareTextAccent{\capitalhungarumlaut}{TS1}{5}
\DeclareTextAccent{\capitalring}{TS1}{6}
\DeclareTextAccent{\capitalcaron}{TS1}{7}
%    \end{macrocode}
%    "08 = 8
%    \begin{macrocode}
\DeclareTextAccent{\capitalbreve}{TS1}{8}
\DeclareTextAccent{\capitalmacron}{TS1}{9}
\DeclareTextAccent{\capitaldotaccent}{TS1}{10}
%    \end{macrocode}
% Tie accents.
%
% The tie accent was borrowed from the |cmmi| font. The tc fonts
% now provide four tie accents, the first two are done in the
% classical way with assymetric glyphs hanging out of their boxes;
% the new ties are centered in their boxes like all other accents.
% They need a name: please tell us if you know what to call them.
%
%    " =
%    \begin{macrocode}
\DeclareTextAccent{\t}{TS1}{26}
\DeclareTextAccent{\capitaltie}{TS1}{27}
\DeclareTextAccent{\newtie}{TS1}{28}
\DeclareTextAccent{\capitalnewtie}{TS1}{29}
%    \end{macrocode}
%
% Compund word marks.
%
% The text companion fonts contain two compound word marks of
% different heights, one has |cap_height|, the other |asc_height|.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textcapitalcompwordmark}{TS1}{23}
\DeclareTextSymbol{\textascendercompwordmark}{TS1}{31}
%    \end{macrocode}
%
% The text companion symbols.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textquotestraightbase}{TS1}{13}
%    \end{macrocode}
%    "10 = 16
%    \begin{macrocode}
\DeclareTextSymbol{\textquotestraightdblbase}{TS1}{18}
\DeclareTextSymbol{\texttwelveudash}{TS1}{21}
\DeclareTextSymbol{\textthreequartersemdash}{TS1}{22}
%    \end{macrocode}
%    "18 = 24
%    \begin{macrocode}
\DeclareTextSymbol{\textleftarrow}{TS1}{24}
\DeclareTextSymbol{\textrightarrow}{TS1}{25}
%    \end{macrocode}
%    "20 = 32
%    \begin{macrocode}
\DeclareTextSymbol{\textblank}{TS1}{32}
\DeclareTextSymbol{\textdollar}{TS1}{36}
\DeclareTextSymbol{\textquotesingle}{TS1}{39}
%    \end{macrocode}
%    "28 = 40
%    \begin{macrocode}
\DeclareTextSymbol{\textasteriskcentered}{TS1}{42}
%    \end{macrocode}
% Note that '054 is a comma and '056 is a full stop: these make
% numbers using oldstyle digits easier to input.
%    \begin{macrocode}
\DeclareTextSymbol{\textdblhyphen}{TS1}{45}
\DeclareTextSymbol{\textfractionsolidus}{TS1}{47}
%    \end{macrocode}
%
% Oldstyle digits.
%
%    "30 = 48
%    \begin{macrocode}
\DeclareTextSymbol{\textzerooldstyle}{TS1}{48}
\DeclareTextSymbol{\textoneoldstyle}{TS1}{49}
\DeclareTextSymbol{\texttwooldstyle}{TS1}{50}
\DeclareTextSymbol{\textthreeoldstyle}{TS1}{51}
\DeclareTextSymbol{\textfouroldstyle}{TS1}{52}
\DeclareTextSymbol{\textfiveoldstyle}{TS1}{53}
\DeclareTextSymbol{\textsixoldstyle}{TS1}{54}
\DeclareTextSymbol{\textsevenoldstyle}{TS1}{55}
%    \end{macrocode}
%    "38 = 56
%    \begin{macrocode}
\DeclareTextSymbol{\texteightoldstyle}{TS1}{56}
\DeclareTextSymbol{\textnineoldstyle}{TS1}{57}
%    \end{macrocode}
%
% More text companion symbols.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textlangle}{TS1}{60}
\DeclareTextSymbol{\textminus}{TS1}{61}
\DeclareTextSymbol{\textrangle}{TS1}{62}
%    \end{macrocode}
%    "48 = 72
%    \begin{macrocode}
\DeclareTextSymbol{\textmho}{TS1}{77}
%    \end{macrocode}
%
% \changes{v1.9r}{1999/01/06}{Minor documentation fix.}
% The big circle is here to define the command \cs{textcircled}.
% Formerly it was taken from the |cmsy| font.
% \changes{v1.9h}{1997/12/17}{Changed to decimal codes in \cs{ooalign}.}
% \changes{v1.9k}{1998/01/12}{Adding missing braces and \cs{ushape}.}
% \changes{v1.9y}{2000/01/30}{Use \cs{hmode@bgroup} where applicable
%    (pr/3160)}
%    \begin{macrocode}
\DeclareTextSymbol{\textbigcircle}{TS1}{79}
\DeclareTextCommand{\textcircled}{TS1}[1]{\hmode@bgroup
   \ooalign{%
      \hfil \raise .07ex\hbox {\upshape#1}\hfil \crcr
      \char 79   % '117 = "4F
   }%
 \egroup}
%    \end{macrocode}
%
% More text companion symbols.
%
%    "50 = 80
%    \begin{macrocode}
\DeclareTextSymbol{\textohm}{TS1}{87}
%    \end{macrocode}
%    "58 = 88
%    \begin{macrocode}
\DeclareTextSymbol{\textlbrackdbl}{TS1}{91}
\DeclareTextSymbol{\textrbrackdbl}{TS1}{93}
\DeclareTextSymbol{\textuparrow}{TS1}{94}
\DeclareTextSymbol{\textdownarrow}{TS1}{95}
%    \end{macrocode}
%    "60 = 96
%    \begin{macrocode}
\DeclareTextSymbol{\textasciigrave}{TS1}{96}
\DeclareTextSymbol{\textborn}{TS1}{98}
\DeclareTextSymbol{\textdivorced}{TS1}{99}
\DeclareTextSymbol{\textdied}{TS1}{100}
%    \end{macrocode}
%    "68 = 104
%    \begin{macrocode}
\DeclareTextSymbol{\textleaf}{TS1}{108}
\DeclareTextSymbol{\textmarried}{TS1}{109}
\DeclareTextSymbol{\textmusicalnote}{TS1}{110}
%    \end{macrocode}
%    "78 = 120
%    \begin{macrocode}
\DeclareTextSymbol{\texttildelow}{TS1}{126}
%    \end{macrocode}
%
% This glyph, |\textdblhyphenchar| is hanging, like the hyphenchar of
% the ec fonts.
%
%    \begin{macrocode}
\DeclareTextSymbol{\textdblhyphenchar}{TS1}{127}
%    \end{macrocode}
%    "80 = 128
%    \begin{macrocode}
\DeclareTextSymbol{\textasciibreve}{TS1}{128}
\DeclareTextSymbol{\textasciicaron}{TS1}{129}
%    \end{macrocode}
%
% This next glyph is \emph{not} the same as |\textquotedbl|.
%
% \changes{v1.9p}{1998/06/12}{Corrected 130 and 131, see pr/2834}
%    \begin{macrocode}
\DeclareTextSymbol{\textacutedbl}{TS1}{130}
\DeclareTextSymbol{\textgravedbl}{TS1}{131}
\DeclareTextSymbol{\textdagger}{TS1}{132}
\DeclareTextSymbol{\textdaggerdbl}{TS1}{133}
\DeclareTextSymbol{\textbardbl}{TS1}{134}
\DeclareTextSymbol{\textperthousand}{TS1}{135}
%    \end{macrocode}
%    "88 = 136
%    \begin{macrocode}
\DeclareTextSymbol{\textbullet}{TS1}{136}
\DeclareTextSymbol{\textcelsius}{TS1}{137}
\DeclareTextSymbol{\textdollaroldstyle}{TS1}{138}
\DeclareTextSymbol{\textcentoldstyle}{TS1}{139}
\DeclareTextSymbol{\textflorin}{TS1}{140}
\DeclareTextSymbol{\textcolonmonetary}{TS1}{141}
\DeclareTextSymbol{\textwon}{TS1}{142}
\DeclareTextSymbol{\textnaira}{TS1}{143}
%    \end{macrocode}
%    "90 = 144
%    \begin{macrocode}
\DeclareTextSymbol{\textguarani}{TS1}{144}
\DeclareTextSymbol{\textpeso}{TS1}{145}
\DeclareTextSymbol{\textlira}{TS1}{146}
\DeclareTextSymbol{\textrecipe}{TS1}{147}
\DeclareTextSymbol{\textinterrobang}{TS1}{148}
\DeclareTextSymbol{\textinterrobangdown}{TS1}{149}
\DeclareTextSymbol{\textdong}{TS1}{150}
\DeclareTextSymbol{\texttrademark}{TS1}{151}
%    \end{macrocode}
%    "98 = 152
%    \begin{macrocode}
\DeclareTextSymbol{\textpertenthousand}{TS1}{152}
\DeclareTextSymbol{\textpilcrow}{TS1}{153}
\DeclareTextSymbol{\textbaht}{TS1}{154}
\DeclareTextSymbol{\textnumero}{TS1}{155}
%    \end{macrocode}
% This next name may change.
% For the following sign we know only a german name, which is
% abz\"uglich. The meaning is something like ``commercial minus''.
% An ASCII ersatz is ./. (dot slash dot).
% The temporary English name is |\textdiscount|.
%    \begin{macrocode}
\DeclareTextSymbol{\textdiscount}{TS1}{156}
\DeclareTextSymbol{\textestimated}{TS1}{157}
\DeclareTextSymbol{\textopenbullet}{TS1}{158}
\DeclareTextSymbol{\textservicemark}{TS1}{159}
%    \end{macrocode}
%    "A0 = 160
%    \begin{macrocode}
\DeclareTextSymbol{\textlquill}{TS1}{160}
\DeclareTextSymbol{\textrquill}{TS1}{161}
\DeclareTextSymbol{\textcent}{TS1}{162}
\DeclareTextSymbol{\textsterling}{TS1}{163}
\DeclareTextSymbol{\textcurrency}{TS1}{164}
\DeclareTextSymbol{\textyen}{TS1}{165}
\DeclareTextSymbol{\textbrokenbar}{TS1}{166}
\DeclareTextSymbol{\textsection}{TS1}{167}
%    \end{macrocode}
%    "A8 = 168
%    \begin{macrocode}
\DeclareTextSymbol{\textasciidieresis}{TS1}{168}
\DeclareTextSymbol{\textcopyright}{TS1}{169}
\DeclareTextSymbol{\textordfeminine}{TS1}{170}
\DeclareTextSymbol{\textcopyleft}{TS1}{171}
\DeclareTextSymbol{\textlnot}{TS1}{172}
%    \end{macrocode}
%
% The meaning of the circled-P is ``sound recording copyright''.
%
% \changes{v1.9p}{1998/06/12}{Renamed \cs{textmacron} pr/2840}
%    \begin{macrocode}
\DeclareTextSymbol{\textcircledP}{TS1}{173}
\DeclareTextSymbol{\textregistered}{TS1}{174}
\DeclareTextSymbol{\textasciimacron}{TS1}{175}
%    \end{macrocode}
%    "B0 = 176
%    \begin{macrocode}
\DeclareTextSymbol{\textdegree}{TS1}{176}
\DeclareTextSymbol{\textpm}{TS1}{177}
\DeclareTextSymbol{\texttwosuperior}{TS1}{178}
\DeclareTextSymbol{\textthreesuperior}{TS1}{179}
\DeclareTextSymbol{\textasciiacute}{TS1}{180}
\DeclareTextSymbol{\textmu}{TS1}{181} % micro sign
\DeclareTextSymbol{\textparagraph}{TS1}{182}
\DeclareTextSymbol{\textperiodcentered}{TS1}{183}
%    \end{macrocode}
%    "B8 = 184
%    \begin{macrocode}
\DeclareTextSymbol{\textreferencemark}{TS1}{184}
\DeclareTextSymbol{\textonesuperior}{TS1}{185}
\DeclareTextSymbol{\textordmasculine}{TS1}{186}
\DeclareTextSymbol{\textsurd}{TS1}{187}
\DeclareTextSymbol{\textonequarter}{TS1}{188}
\DeclareTextSymbol{\textonehalf}{TS1}{189}
\DeclareTextSymbol{\textthreequarters}{TS1}{190}
\DeclareTextSymbol{\texteuro}{TS1}{191}
%    \end{macrocode}
%    "E0 = 208
%    \begin{macrocode}
\DeclareTextSymbol{\texttimes}{TS1}{214}
%    \end{macrocode}
%    "F0 = 240
%    \begin{macrocode}
\DeclareTextSymbol{\textdiv}{TS1}{246}
%</TS1>
%    \end{macrocode}
%
% \subsection{Definitions for the TU encoding}
%
% \changes{v2.0a}{2016/12/04}{Added TU encoding}
% \changes{v2.0b}{2017/01/23}{Added TU specific commands in ASCII range pr/4500}
% \changes{v2.0c}{2017/01/24}{TeX ligature syntax for xetex and luatex reversed}
% \changes{v2.0c}{2017/01/24}{Make \cs{textasteriskcentered} U+2217 not U+204E}
% \changes{v2.0c}{2017/01/24}{Declare TU composites for i and j}
% \changes{v2.0d}{2017/01/24}{Declare macron composites for YyGg}
% \changes{v2.0e}{2017/02/12}{Declare fallback code for \cs{textasteriskcentered}}
% \changes{v2.0f}{2017/02/19}{%
%     declare composites with empty base for hat and tilde,
%     use same slots for \cs{textasciicircum} ans \cs{textasciitilde}}
% \changes{v2.0f}{2017/02/19}{%
%     declare straight quotes using new \cs{remove@tlig} command}
% \changes{v2.0g}{2017/02/22}{Fix typo introduced at 2.0f}
% \changes{v2.0h}{2017/02/24}{introduce \cs{DeclareUnicodeAccent}}%
% The TU encoding was originally introduced in the contributed
% package \texttt{fontspec} as a Unicode encoding for XeTeX and
% LuaTeX.
%
% Normally for these engines, the input consists of Unicode characters
% encoded in UTF-8. There is therefore little need to use the
% traditional (ASCII) encoding-specific commands
%
% However, sometimes (e.g. for backwards compatibility) it can be
% useful to access these Unicode characters via such ASCII-based
% markup. The commands provided here
% Cover the characters in the T1 and TS1 encodings, but specified in
% Unicode position. Almost all the command names have been
% mechanically extracted form the \texttt{inputenc} UTF-8 support,
% which is essentially doing a reverse mapping from UTF-8 data to
% \LaTeX\ LICR commands.
%
% A few additional names for character which were supported in the
% original \texttt{fontspec} version of this file have also been
% added, even though they are not currently in the default
% \texttt{inputenc} UTF-8 declarations.
%
%    \begin{macrocode}
%<*TU>
%    \end{macrocode}
% In the base interface the Unicode encoding is always known as TU
% But we parameterise the encoding name to allow for modelling
% differences in Unicode support by different fonts.
%    \begin{macrocode}
\providecommand\UnicodeEncodingName{TU}
%    \end{macrocode}
% As the Unicode encoding, TU, is only currently available with XeTeX
% or LuaTeX, we detect these engines first, and make adjustments for the
% differing font loading syntax. For other engines, we issue a warning
% then abort this file, switching back to T1 encoding.
%    \begin{macrocode}
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXrevision\endcsname\relax
%    \end{macrocode}
%
%    \begin{macrocode}
  \begingroup\expandafter\expandafter\expandafter\endgroup
  \expandafter\ifx\csname directlua\endcsname\relax
%    \end{macrocode}
%
% Not LuaTeX or XeTeX, abort with a warning.
%    \begin{macrocode}
    \PackageWarningNoLine{fontenc}
      {\UnicodeEncodingName\space
       encoding is only available with XeTeX and LuaTeX.\MessageBreak
       Defaulting to T1 encoding}
      \def\encodingdefault{T1}
    \expandafter\expandafter\expandafter\endinput
%    \end{macrocode}
%
%    \begin{macrocode}
  \else
%    \end{macrocode}
%
% LuaTeX.
% For Lua\TeX~1.10+, define a Lua function to disable any handing by the font code.
% Otherwise we reload the font without TeX ligatures.
% \changes{v2.0q}{2020/07/04}{%
%      Implement \cs{remove@tlig} in Lua\TeX without font reloading}
%    \begin{macrocode}
    \def\UnicodeFontTeXLigatures{+tlig;}
    \ifnum\luatexversion<110
%    \end{macrocode}
%
%    \begin{macrocode}
      \def\reserved@a#1{%
        \def\@remove@tlig##1{\@remove@tlig@##1\@nil#1\@nil\relax}
        \def\@remove@tlig@##1#1{\@remove@tlig@@##1}}
      \edef\reserved@b{\detokenize{+tlig;}}
      \expandafter\reserved@a\expandafter{\reserved@b}
      \def\@remove@tlig@@#1\@nil#2\relax{#1}
%    \end{macrocode}
%
%    \begin{macrocode}
      \def\remove@tlig#1{%
        \begingroup
        \font\remove@tlig
        \expandafter\@remove@tlig\expandafter{\fontname\font}%
        \remove@tlig
        \char#1\relax
        \endgroup
      }
    \else
      \newluafunction\@remove@tlig@@@@
%    \end{macrocode}
% Now we can define the function. Mostly we just have to insert a protected glyph
% node, which is a glyph node with subtype 256. But we have to keep track of the
% current mode to avoid inserting the glyph into a vlist.
%    \begin{macrocode}
      \now@and@everyjob{\directlua{
        local rawchar_func = token.create'@remove@tlig@@@@'.index
        local forcehmode = tex.forcehmode
        local put_next = token.put_next
        local glyph_id = node.id'glyph'
        local rawchar_token = token.new(rawchar_func, token.command_id'lua_call')
        lua.get_functions_table()[rawchar_func] = function()
          local mode = tex.nest.top.mode
          if mode == 1 or mode == -1 then
            put_next(rawchar_token)
            return forcehmode(true)
          end
          local n = node.new(glyph_id, 256)
          n.font = font.current()
          n.char = token.scan_int()
          return node.write(n)
        end
        token.set_lua('@remove@tlig@@@', rawchar_func, 'global', 'protected')
      }}
%    \end{macrocode}
% Now \verb+\remove@tlig+ can be implemented almost as in XeTeX.
%    \begin{macrocode}
      \def\remove@tlig#1{\@remove@tlig@@@#1\relax}
    \fi
%    \end{macrocode}
%
%    \begin{macrocode}
  \fi
\else
%    \end{macrocode}
%
% XeTeX
%    \begin{macrocode}
  \def\UnicodeFontTeXLigatures{mapping=tex-text;}
%    \end{macrocode}
%
%    \begin{macrocode}
  \def\remove@tlig#1{\XeTeXglyph\numexpr\XeTeXcharglyph#1\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}
%
%    \begin{macrocode}
\def\UnicodeFontFile#1#2{"[#1]:#2"}
\def\UnicodeFontName#1#2{"#1:#2"}
%    \end{macrocode}
%
% Declare the encoding
%    \begin{macrocode}
\DeclareFontEncoding\UnicodeEncodingName{}{}
%    \end{macrocode}
%
% Declare accent command to use a postpended combining character
% rather than the TeX |\accent| primitive
%    \begin{macrocode}
\def\add@unicode@accent#1#2{%
  \if\relax\detokenize{#2}\relax^^a0\else#2\fi
  \char#1\relax}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\DeclareUnicodeAccent#1#2#3{%
  \DeclareTextCommand{#1}{#2}{\add@unicode@accent{#3}}%
}
%    \end{macrocode}
%
% Wrapper around |\DeclareTextCompositeCommand| that uses the declared
% composite if it exists in the current font or falls back to the default
% definition for the TU accent if not.
%    \begin{macrocode}
{
\catcode\z@=11\relax
\gdef\DeclareUnicodeComposite#1#2#3{%
   \def\reserved@a##1##2{%
     \DeclareTextCompositeCommand#1\UnicodeEncodingName{#2}{%
   \iffontchar\font#3 ##2%
      \else ##1\fi}}%
    \expandafter\expandafter\expandafter\extract@default@composite
    \csname\UnicodeEncodingName\string#1\endcsname{#2}\@nil
   \bgroup
      \lccode\z@#3 %
      \lowercase{\egroup
      \expandafter\reserved@a\expandafter{\reserved@b}{^^@}}}%
}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\extract@default@composite#1{%
 \ifx\@text@composite#1%
   \expandafter\extract@default@composite@a
 \else
   \expandafter\extract@default@composite@b\expandafter#1%
 \fi}
%    \end{macrocode}
%
%    \begin{macrocode}
\def\extract@default@composite@a#1\@text@composite#2\@nil{%
  \def\reserved@b{#2}}
\def\extract@default@composite@b#1#2\@nil{%
  \def\reserved@b{#1#2}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextCommand\textquotesingle \UnicodeEncodingName{%
                                                \remove@tlig{"0027}}
\DeclareTextCommand\textasciigrave  \UnicodeEncodingName{%
                                                \remove@tlig{"0060}}
\DeclareTextCommand\textquotedbl    \UnicodeEncodingName{%
                                                \remove@tlig{"0022}}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\textdollar}          \UnicodeEncodingName{"0024}
\DeclareTextSymbol{\textless}            \UnicodeEncodingName{"003C}
\DeclareTextSymbol{\textgreater}         \UnicodeEncodingName{"003E}
\DeclareTextSymbol{\textbackslash}       \UnicodeEncodingName{"005C}
\DeclareTextSymbol{\textasciicircum}     \UnicodeEncodingName{"005E}
\DeclareTextSymbol{\textunderscore}      \UnicodeEncodingName{"005F}
\DeclareTextSymbol{\textbraceleft}       \UnicodeEncodingName{"007B}
\DeclareTextSymbol{\textbar}             \UnicodeEncodingName{"007C}
\DeclareTextSymbol{\textbraceright}      \UnicodeEncodingName{"007D}
\DeclareTextSymbol{\textasciitilde}      \UnicodeEncodingName{"007E}
\DeclareTextSymbol{\textexclamdown}      \UnicodeEncodingName{"00A1}
\DeclareTextSymbol{\textcent}            \UnicodeEncodingName{"00A2}
\DeclareTextSymbol{\textsterling}        \UnicodeEncodingName{"00A3}
\DeclareTextSymbol{\textcurrency}        \UnicodeEncodingName{"00A4}
\DeclareTextSymbol{\textyen}             \UnicodeEncodingName{"00A5}
\DeclareTextSymbol{\textbrokenbar}       \UnicodeEncodingName{"00A6}
\DeclareTextSymbol{\textsection}         \UnicodeEncodingName{"00A7}
\DeclareTextSymbol{\textasciidieresis}   \UnicodeEncodingName{"00A8}
\DeclareTextSymbol{\textcopyright}       \UnicodeEncodingName{"00A9}
\DeclareTextSymbol{\textordfeminine}     \UnicodeEncodingName{"00AA}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetleft}       \UnicodeEncodingName{"00AB}
% old Adobe name
\DeclareTextSymbol{\guillemotleft}       \UnicodeEncodingName{"00AB}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\textlnot}            \UnicodeEncodingName{"00AC}
\DeclareTextSymbol{\textregistered}      \UnicodeEncodingName{"00AE}
\DeclareTextSymbol{\textasciimacron}     \UnicodeEncodingName{"00AF}
\DeclareTextSymbol{\textdegree}          \UnicodeEncodingName{"00B0}
\DeclareTextSymbol{\textpm}              \UnicodeEncodingName{"00B1}
\DeclareTextSymbol{\texttwosuperior}     \UnicodeEncodingName{"00B2}
\DeclareTextSymbol{\textthreesuperior}   \UnicodeEncodingName{"00B3}
\DeclareTextSymbol{\textasciiacute}      \UnicodeEncodingName{"00B4}
\DeclareTextSymbol{\textmu}              \UnicodeEncodingName{"00B5}
\DeclareTextSymbol{\textparagraph}       \UnicodeEncodingName{"00B6}
\DeclareTextSymbol{\textperiodcentered}  \UnicodeEncodingName{"00B7}
\DeclareTextSymbol{\textonesuperior}     \UnicodeEncodingName{"00B9}
\DeclareTextSymbol{\textordmasculine}    \UnicodeEncodingName{"00BA}
%    \end{macrocode}
%  \changes{v2.0j}{2018/08/11}{Provide \cs{guillemetleft} and \cs{guillemetright}}
%    \begin{macrocode}
\DeclareTextSymbol{\guillemetright}      \UnicodeEncodingName{"00BB}
% old Adobe name
\DeclareTextSymbol{\guillemotright}      \UnicodeEncodingName{"00BB}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareTextSymbol{\textonequarter}      \UnicodeEncodingName{"00BC}
\DeclareTextSymbol{\textonehalf}         \UnicodeEncodingName{"00BD}
\DeclareTextSymbol{\textthreequarters}   \UnicodeEncodingName{"00BE}
\DeclareTextSymbol{\textquestiondown}    \UnicodeEncodingName{"00BF}
\DeclareTextSymbol{\AE}                  \UnicodeEncodingName{"00C6}
\DeclareTextSymbol{\DH}                  \UnicodeEncodingName{"00D0}
\DeclareTextSymbol{\texttimes}           \UnicodeEncodingName{"00D7}
\DeclareTextSymbol{\O}                   \UnicodeEncodingName{"00D8}
\DeclareTextSymbol{\TH}                  \UnicodeEncodingName{"00DE}
\DeclareTextSymbol{\ss}                  \UnicodeEncodingName{"00DF}
\DeclareTextSymbol{\ae}                  \UnicodeEncodingName{"00E6}
\DeclareTextSymbol{\dh}                  \UnicodeEncodingName{"00F0}
\DeclareTextSymbol{\textdiv}             \UnicodeEncodingName{"00F7}
\DeclareTextSymbol{\o}                   \UnicodeEncodingName{"00F8}
\DeclareTextSymbol{\th}                  \UnicodeEncodingName{"00FE}
\DeclareTextSymbol{\DJ}                  \UnicodeEncodingName{"0110}
\DeclareTextSymbol{\dj}                  \UnicodeEncodingName{"0111}
\DeclareTextSymbol{\i}                   \UnicodeEncodingName{"0131}
\DeclareTextSymbol{\IJ}                  \UnicodeEncodingName{"0132}
\DeclareTextSymbol{\ij}                  \UnicodeEncodingName{"0133}
\DeclareTextSymbol{\L}                   \UnicodeEncodingName{"0141}
\DeclareTextSymbol{\l}                   \UnicodeEncodingName{"0142}
\DeclareTextSymbol{\NG}                  \UnicodeEncodingName{"014A}
\DeclareTextSymbol{\ng}                  \UnicodeEncodingName{"014B}
\DeclareTextSymbol{\OE}                  \UnicodeEncodingName{"0152}
\DeclareTextSymbol{\oe}                  \UnicodeEncodingName{"0153}
\DeclareTextSymbol{\textflorin}          \UnicodeEncodingName{"0192}
\DeclareTextSymbol{\j}                   \UnicodeEncodingName{"0237}
\DeclareTextSymbol{\textasciicaron}      \UnicodeEncodingName{"02C7}
\DeclareTextSymbol{\textasciibreve}      \UnicodeEncodingName{"02D8}
\DeclareTextSymbol{\textacutedbl}        \UnicodeEncodingName{"02DD}
\DeclareTextSymbol{\textgravedbl}        \UnicodeEncodingName{"02F5}
\DeclareTextSymbol{\texttildelow}        \UnicodeEncodingName{"02F7}
\DeclareTextSymbol{\textbaht}            \UnicodeEncodingName{"0E3F}
\DeclareTextSymbol{\SS}                  \UnicodeEncodingName{"1E9E}
\DeclareTextSymbol{\textcompwordmark}    \UnicodeEncodingName{"200C}
\DeclareTextSymbol{\textendash}          \UnicodeEncodingName{"2013}
\DeclareTextSymbol{\textemdash}          \UnicodeEncodingName{"2014}
\DeclareTextSymbol{\textbardbl}          \UnicodeEncodingName{"2016}
\DeclareTextSymbol{\textquoteleft}       \UnicodeEncodingName{"2018}
\DeclareTextSymbol{\textquoteright}      \UnicodeEncodingName{"2019}
\DeclareTextSymbol{\quotesinglbase}      \UnicodeEncodingName{"201A}
\DeclareTextSymbol{\textquotedblleft}    \UnicodeEncodingName{"201C}
\DeclareTextSymbol{\textquotedblright}   \UnicodeEncodingName{"201D}
\DeclareTextSymbol{\quotedblbase}        \UnicodeEncodingName{"201E}
\DeclareTextSymbol{\textdagger}          \UnicodeEncodingName{"2020}
\DeclareTextSymbol{\textdaggerdbl}       \UnicodeEncodingName{"2021}
\DeclareTextSymbol{\textbullet}          \UnicodeEncodingName{"2022}
\DeclareTextSymbol{\textellipsis}        \UnicodeEncodingName{"2026}
\DeclareTextSymbol{\textperthousand}     \UnicodeEncodingName{"2030}
\DeclareTextSymbol{\textpertenthousand}  \UnicodeEncodingName{"2031}
\DeclareTextSymbol{\guilsinglleft}       \UnicodeEncodingName{"2039}
\DeclareTextSymbol{\guilsinglright}      \UnicodeEncodingName{"203A}
\DeclareTextSymbol{\textreferencemark}   \UnicodeEncodingName{"203B}
\DeclareTextSymbol{\textinterrobang}     \UnicodeEncodingName{"203D}
\DeclareTextSymbol{\textfractionsolidus} \UnicodeEncodingName{"2044}
\DeclareTextSymbol{\textlquill}          \UnicodeEncodingName{"2045}
\DeclareTextSymbol{\textrquill}          \UnicodeEncodingName{"2046}
\DeclareTextSymbol{\textdiscount}        \UnicodeEncodingName{"2052}
\DeclareTextSymbol{\textcolonmonetary}   \UnicodeEncodingName{"20A1}
\DeclareTextSymbol{\textlira}            \UnicodeEncodingName{"20A4}
\DeclareTextSymbol{\textnaira}           \UnicodeEncodingName{"20A6}
\DeclareTextSymbol{\textwon}             \UnicodeEncodingName{"20A9}
\DeclareTextSymbol{\textdong}            \UnicodeEncodingName{"20AB}
\DeclareTextSymbol{\texteuro}            \UnicodeEncodingName{"20AC}
\DeclareTextSymbol{\textpeso}            \UnicodeEncodingName{"20B1}
\DeclareTextSymbol{\textcelsius}         \UnicodeEncodingName{"2103}
\DeclareTextSymbol{\textnumero}          \UnicodeEncodingName{"2116}
\DeclareTextSymbol{\textcircledP}        \UnicodeEncodingName{"2117}
\DeclareTextSymbol{\textrecipe}          \UnicodeEncodingName{"211E}
\DeclareTextSymbol{\textservicemark}     \UnicodeEncodingName{"2120}
\DeclareTextSymbol{\texttrademark}       \UnicodeEncodingName{"2122}
\DeclareTextSymbol{\textohm}             \UnicodeEncodingName{"2126}
\DeclareTextSymbol{\textmho}             \UnicodeEncodingName{"2127}
\DeclareTextSymbol{\textestimated}       \UnicodeEncodingName{"212E}
\DeclareTextSymbol{\textleftarrow}       \UnicodeEncodingName{"2190}
\DeclareTextSymbol{\textuparrow}         \UnicodeEncodingName{"2191}
\DeclareTextSymbol{\textrightarrow}      \UnicodeEncodingName{"2192}
\DeclareTextSymbol{\textdownarrow}       \UnicodeEncodingName{"2193}
\DeclareTextSymbol{\textminus}           \UnicodeEncodingName{"2212}

%    \end{macrocode}
%  \changes{v2.0k}{2018/11/18}{Provide \cs{Hwithstroke} and \cs{hwithstroke}}
%    \begin{macrocode}
\DeclareTextSymbol{\Hwithstroke}         \UnicodeEncodingName{"0126}
\DeclareTextSymbol{\hwithstroke}         \UnicodeEncodingName{"0127}
%    \end{macrocode}
%
% Not all fonts have U+2217 but using U+002A requires some adjustment.
%    \begin{macrocode}
\DeclareTextCommand{\textasteriskcentered}\UnicodeEncodingName{%
  \iffontchar\font"2217 \char"2217 \else
    \begingroup
      \fontsize
       {\the\dimexpr1.2\dimexpr\f@size pt\relax}%
       {\f@baselineskip}%
      \selectfont
      \raisebox{-0.6ex}[\dimexpr\height-0.6ex][0pt]{*}%
    \endgroup
  \fi
}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareTextSymbol{\textsurd}            \UnicodeEncodingName{"221A}
\DeclareTextSymbol{\textlangle}          \UnicodeEncodingName{"2329}
\DeclareTextSymbol{\textrangle}          \UnicodeEncodingName{"232A}
\DeclareTextSymbol{\textblank}           \UnicodeEncodingName{"2422}
\DeclareTextSymbol{\textvisiblespace}    \UnicodeEncodingName{"2423}
\DeclareTextSymbol{\textopenbullet}      \UnicodeEncodingName{"25E6}
\DeclareTextSymbol{\textbigcircle}       \UnicodeEncodingName{"25EF}
\DeclareTextSymbol{\textmusicalnote}     \UnicodeEncodingName{"266A}
\DeclareTextSymbol{\textmarried}         \UnicodeEncodingName{"26AD}
\DeclareTextSymbol{\textdivorced}        \UnicodeEncodingName{"26AE}
\DeclareTextSymbol{\textinterrobangdown} \UnicodeEncodingName{"2E18}
%    \end{macrocode}
% Accents must be declared before the composites that use them.
%    \begin{macrocode}
\DeclareUnicodeAccent{\`}                \UnicodeEncodingName{"0300}
\DeclareUnicodeAccent{\'}                \UnicodeEncodingName{"0301}
\DeclareUnicodeAccent{\^}                \UnicodeEncodingName{"0302}
\DeclareUnicodeAccent{\~}                \UnicodeEncodingName{"0303}
\DeclareUnicodeAccent{\=}                \UnicodeEncodingName{"0304}
\DeclareUnicodeAccent{\u}                \UnicodeEncodingName{"0306}
\DeclareUnicodeAccent{\.}                \UnicodeEncodingName{"0307}
\DeclareUnicodeAccent{\"}                \UnicodeEncodingName{"0308}
\DeclareUnicodeAccent{\r}                \UnicodeEncodingName{"030A}
\DeclareUnicodeAccent{\H}                \UnicodeEncodingName{"030B}
\DeclareUnicodeAccent{\v}                \UnicodeEncodingName{"030C}
\DeclareUnicodeAccent{\b}                \UnicodeEncodingName{"0332}
\DeclareUnicodeAccent{\d}                \UnicodeEncodingName{"0323}
\DeclareUnicodeAccent{\c}                \UnicodeEncodingName{"0327}
\DeclareUnicodeAccent{\k}                \UnicodeEncodingName{"0328}
\DeclareTextCommand\textcommabelow       \UnicodeEncodingName[1]
  {\hmode@bgroup\ooalign{\null#1\crcr\hidewidth\raise-.31ex
   \hbox{\check@mathfonts\fontsize\ssf@size\z@
   \math@fontsfalse\selectfont,}\hidewidth}\egroup}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeComposite{\^}              {}{"005E}
\DeclareUnicodeComposite{\~}              {}{"007E}
%    \end{macrocode}
%
%    \begin{macrocode}
\DeclareUnicodeComposite{\`}             {A}{"00C0}
\DeclareUnicodeComposite{\'}             {A}{"00C1}
\DeclareUnicodeComposite{\^}             {A}{"00C2}
\DeclareUnicodeComposite{\~}             {A}{"00C3}
\DeclareUnicodeComposite{\"}             {A}{"00C4}
\DeclareUnicodeComposite{\r}             {A}{"00C5}
\DeclareUnicodeComposite{\c}             {C}{"00C7}
\DeclareUnicodeComposite{\`}             {E}{"00C8}
\DeclareUnicodeComposite{\'}             {E}{"00C9}
\DeclareUnicodeComposite{\^}             {E}{"00CA}
\DeclareUnicodeComposite{\"}             {E}{"00CB}
\DeclareUnicodeComposite{\`}             {I}{"00CC}
\DeclareUnicodeComposite{\'}             {I}{"00CD}
\DeclareUnicodeComposite{\^}             {I}{"00CE}
\DeclareUnicodeComposite{\"}             {I}{"00CF}
\DeclareUnicodeComposite{\~}             {N}{"00D1}
\DeclareUnicodeComposite{\`}             {O}{"00D2}
\DeclareUnicodeComposite{\'}             {O}{"00D3}
\DeclareUnicodeComposite{\^}             {O}{"00D4}
\DeclareUnicodeComposite{\~}             {O}{"00D5}
\DeclareUnicodeComposite{\"}             {O}{"00D6}
\DeclareUnicodeComposite{\`}             {U}{"00D9}
\DeclareUnicodeComposite{\'}             {U}{"00DA}
\DeclareUnicodeComposite{\^}             {U}{"00DB}
\DeclareUnicodeComposite{\"}             {U}{"00DC}
\DeclareUnicodeComposite{\'}             {Y}{"00DD}
\DeclareUnicodeComposite{\`}             {a}{"00E0}
\DeclareUnicodeComposite{\'}             {a}{"00E1}
\DeclareUnicodeComposite{\^}             {a}{"00E2}
\DeclareUnicodeComposite{\~}             {a}{"00E3}
\DeclareUnicodeComposite{\"}             {a}{"00E4}
\DeclareUnicodeComposite{\r}             {a}{"00E5}
\DeclareUnicodeComposite{\c}             {c}{"00E7}
\DeclareUnicodeComposite{\`}             {e}{"00E8}
\DeclareUnicodeComposite{\'}             {e}{"00E9}
\DeclareUnicodeComposite{\^}             {e}{"00EA}
\DeclareUnicodeComposite{\"}             {e}{"00EB}
\DeclareUnicodeComposite{\`}             \i {"00EC}
\DeclareUnicodeComposite{\`}             {i}{"00EC}
\DeclareUnicodeComposite{\'}             \i {"00ED}
\DeclareUnicodeComposite{\'}             {i}{"00ED}
\DeclareUnicodeComposite{\^}             \i {"00EE}
\DeclareUnicodeComposite{\^}             {i}{"00EE}
\DeclareUnicodeComposite{\"}             \i {"00EF}
\DeclareUnicodeComposite{\"}             {i}{"00EF}
\DeclareUnicodeComposite{\~}             {n}{"00F1}
\DeclareUnicodeComposite{\`}             {o}{"00F2}
\DeclareUnicodeComposite{\'}             {o}{"00F3}
\DeclareUnicodeComposite{\^}             {o}{"00F4}
\DeclareUnicodeComposite{\~}             {o}{"00F5}
\DeclareUnicodeComposite{\"}             {o}{"00F6}
\DeclareUnicodeComposite{\`}             {u}{"00F9}
\DeclareUnicodeComposite{\'}             {u}{"00FA}
\DeclareUnicodeComposite{\^}             {u}{"00FB}
\DeclareUnicodeComposite{\"}             {u}{"00FC}
\DeclareUnicodeComposite{\'}             {y}{"00FD}
\DeclareUnicodeComposite{\"}             {y}{"00FF}
\DeclareUnicodeComposite{\=}             {A}{"0100}
\DeclareUnicodeComposite{\=}             {a}{"0101}
\DeclareUnicodeComposite{\u}             {A}{"0102}
\DeclareUnicodeComposite{\u}             {a}{"0103}
\DeclareUnicodeComposite{\k}             {A}{"0104}
\DeclareUnicodeComposite{\k}             {a}{"0105}
\DeclareUnicodeComposite{\'}             {C}{"0106}
\DeclareUnicodeComposite{\'}             {c}{"0107}
\DeclareUnicodeComposite{\^}             {C}{"0108}
\DeclareUnicodeComposite{\^}             {c}{"0109}
\DeclareUnicodeComposite{\.}             {C}{"010A}
\DeclareUnicodeComposite{\.}             {c}{"010B}
\DeclareUnicodeComposite{\v}             {C}{"010C}
\DeclareUnicodeComposite{\v}             {c}{"010D}
\DeclareUnicodeComposite{\v}             {D}{"010E}
\DeclareUnicodeComposite{\v}             {d}{"010F}
\DeclareUnicodeComposite{\=}             {E}{"0112}
\DeclareUnicodeComposite{\=}             {e}{"0113}
\DeclareUnicodeComposite{\u}             {E}{"0114}
\DeclareUnicodeComposite{\u}             {e}{"0115}
\DeclareUnicodeComposite{\.}             {E}{"0116}
\DeclareUnicodeComposite{\.}             {e}{"0117}
\DeclareUnicodeComposite{\k}             {E}{"0118}
\DeclareUnicodeComposite{\k}             {e}{"0119}
\DeclareUnicodeComposite{\v}             {E}{"011A}
\DeclareUnicodeComposite{\v}             {e}{"011B}
\DeclareUnicodeComposite{\^}             {G}{"011C}
\DeclareUnicodeComposite{\^}             {g}{"011D}
\DeclareUnicodeComposite{\u}             {G}{"011E}
\DeclareUnicodeComposite{\u}             {g}{"011F}
\DeclareUnicodeComposite{\.}             {G}{"0120}
\DeclareUnicodeComposite{\.}             {g}{"0121}
\DeclareUnicodeComposite{\c}             {G}{"0122}
\DeclareUnicodeComposite{\c}             {g}{"0123}
\DeclareUnicodeComposite{\^}             {H}{"0124}
\DeclareUnicodeComposite{\^}             {h}{"0125}
\DeclareUnicodeComposite{\~}             {I}{"0128}
\DeclareUnicodeComposite{\~}             \i {"0129}
\DeclareUnicodeComposite{\~}             {i}{"0129}
\DeclareUnicodeComposite{\=}             {I}{"012A}
\DeclareUnicodeComposite{\=}             \i {"012B}
\DeclareUnicodeComposite{\=}             {i}{"012B}
\DeclareUnicodeComposite{\u}             {I}{"012C}
\DeclareUnicodeComposite{\u}             \i {"012D}
\DeclareUnicodeComposite{\u}             {i}{"012D}
\DeclareUnicodeComposite{\k}             {I}{"012E}
\DeclareUnicodeComposite{\k}             \i {"012F}
\DeclareUnicodeComposite{\k}             {i}{"012F}
\DeclareUnicodeComposite{\.}             {I}{"0130}
\DeclareUnicodeComposite{\^}             {J}{"0134}
\DeclareUnicodeComposite{\^}             \j {"0135}
\DeclareUnicodeComposite{\^}             {j}{"0135}
\DeclareUnicodeComposite{\c}             {K}{"0136}
\DeclareUnicodeComposite{\c}             {k}{"0137}
\DeclareUnicodeComposite{\'}             {L}{"0139}
\DeclareUnicodeComposite{\'}             {l}{"013A}
\DeclareUnicodeComposite{\c}             {L}{"013B}
\DeclareUnicodeComposite{\c}             {l}{"013C}
\DeclareUnicodeComposite{\v}             {L}{"013D}
\DeclareUnicodeComposite{\v}             {l}{"013E}
\DeclareUnicodeComposite{\'}             {N}{"0143}
\DeclareUnicodeComposite{\'}             {n}{"0144}
\DeclareUnicodeComposite{\c}             {N}{"0145}
\DeclareUnicodeComposite{\c}             {n}{"0146}
\DeclareUnicodeComposite{\v}             {N}{"0147}
\DeclareUnicodeComposite{\v}             {n}{"0148}
\DeclareUnicodeComposite{\=}             {O}{"014C}
\DeclareUnicodeComposite{\=}             {o}{"014D}
\DeclareUnicodeComposite{\u}             {O}{"014E}
\DeclareUnicodeComposite{\u}             {o}{"014F}
\DeclareUnicodeComposite{\H}             {O}{"0150}
\DeclareUnicodeComposite{\H}             {o}{"0151}
\DeclareUnicodeComposite{\'}             {R}{"0154}
\DeclareUnicodeComposite{\'}             {r}{"0155}
\DeclareUnicodeComposite{\c}             {R}{"0156}
\DeclareUnicodeComposite{\c}             {r}{"0157}
\DeclareUnicodeComposite{\v}             {R}{"0158}
\DeclareUnicodeComposite{\v}             {r}{"0159}
\DeclareUnicodeComposite{\'}             {S}{"015A}
\DeclareUnicodeComposite{\'}             {s}{"015B}
\DeclareUnicodeComposite{\^}             {S}{"015C}
\DeclareUnicodeComposite{\^}             {s}{"015D}
\DeclareUnicodeComposite{\c}             {S}{"015E}
\DeclareUnicodeComposite{\c}             {s}{"015F}
\DeclareUnicodeComposite{\v}             {S}{"0160}
\DeclareUnicodeComposite{\v}             {s}{"0161}
\DeclareUnicodeComposite{\c}             {T}{"0162}
\DeclareUnicodeComposite{\c}             {t}{"0163}
\DeclareUnicodeComposite{\v}             {T}{"0164}
\DeclareUnicodeComposite{\v}             {t}{"0165}
\DeclareUnicodeComposite{\~}             {U}{"0168}
\DeclareUnicodeComposite{\~}             {u}{"0169}
\DeclareUnicodeComposite{\=}             {U}{"016A}
\DeclareUnicodeComposite{\=}             {u}{"016B}
\DeclareUnicodeComposite{\u}             {U}{"016C}
\DeclareUnicodeComposite{\u}             {u}{"016D}
\DeclareUnicodeComposite{\r}             {U}{"016E}
\DeclareUnicodeComposite{\r}             {u}{"016F}
\DeclareUnicodeComposite{\H}             {U}{"0170}
\DeclareUnicodeComposite{\H}             {u}{"0171}
\DeclareUnicodeComposite{\k}             {U}{"0172}
\DeclareUnicodeComposite{\k}             {u}{"0173}
\DeclareUnicodeComposite{\^}             {W}{"0174}
\DeclareUnicodeComposite{\^}             {w}{"0175}
\DeclareUnicodeComposite{\^}             {Y}{"0176}
\DeclareUnicodeComposite{\^}             {y}{"0177}
\DeclareUnicodeComposite{\"}             {Y}{"0178}
\DeclareUnicodeComposite{\'}             {Z}{"0179}
\DeclareUnicodeComposite{\'}             {z}{"017A}
\DeclareUnicodeComposite{\.}             {Z}{"017B}
\DeclareUnicodeComposite{\.}             {z}{"017C}
\DeclareUnicodeComposite{\v}             {Z}{"017D}
\DeclareUnicodeComposite{\v}             {z}{"017E}
\DeclareUnicodeComposite{\v}             {A}{"01CD}
\DeclareUnicodeComposite{\v}             {a}{"01CE}
\DeclareUnicodeComposite{\v}             {I}{"01CF}
\DeclareUnicodeComposite{\v}             \i {"01D0}
\DeclareUnicodeComposite{\v}             {i}{"01D0}
\DeclareUnicodeComposite{\v}             {O}{"01D1}
\DeclareUnicodeComposite{\v}             {o}{"01D2}
\DeclareUnicodeComposite{\v}             {U}{"01D3}
\DeclareUnicodeComposite{\v}             {u}{"01D4}
\DeclareUnicodeComposite{\=}             \AE{"01E2}
\DeclareUnicodeComposite{\=}             \ae{"01E3}
\DeclareUnicodeComposite{\v}             {G}{"01E6}
\DeclareUnicodeComposite{\v}             {g}{"01E7}
\DeclareUnicodeComposite{\v}             {K}{"01E8}
\DeclareUnicodeComposite{\v}             {k}{"01E9}
\DeclareUnicodeComposite{\k}             {O}{"01EA}
\DeclareUnicodeComposite{\k}             {o}{"01EB}
\DeclareUnicodeComposite{\v}             \j {"01F0}
\DeclareUnicodeComposite{\v}             {j}{"01F0}
\DeclareUnicodeComposite{\'}             {G}{"01F4}
\DeclareUnicodeComposite{\'}             {g}{"01F5}
\DeclareUnicodeComposite{\textcommabelow}{S}{"0218}
\DeclareUnicodeComposite{\textcommabelow}{s}{"0219}
\DeclareUnicodeComposite{\textcommabelow}{T}{"021A}
\DeclareUnicodeComposite{\textcommabelow}{t}{"021B}
\DeclareUnicodeComposite{\=}             {Y}{"0232}
\DeclareUnicodeComposite{\=}             {y}{"0233}
\DeclareUnicodeComposite{\.}             {B}{"1E02}
\DeclareUnicodeComposite{\.}             {b}{"1E03}
\DeclareUnicodeComposite{\d}             {B}{"1E04}
\DeclareUnicodeComposite{\d}             {b}{"1E05}
\DeclareUnicodeComposite{\d}             {D}{"1E0C}
\DeclareUnicodeComposite{\d}             {d}{"1E0D}
\DeclareUnicodeComposite{\=}             {G}{"1E20}
\DeclareUnicodeComposite{\=}             {g}{"1E21}
\DeclareUnicodeComposite{\d}             {H}{"1E24}
\DeclareUnicodeComposite{\d}             {h}{"1E25}
\DeclareUnicodeComposite{\d}             {K}{"1E32}
\DeclareUnicodeComposite{\d}             {k}{"1E33}
\DeclareUnicodeComposite{\d}             {L}{"1E36}
\DeclareUnicodeComposite{\d}             {l}{"1E37}
\DeclareUnicodeComposite{\d}             {M}{"1E42}
\DeclareUnicodeComposite{\d}             {m}{"1E43}
\DeclareUnicodeComposite{\d}             {N}{"1E46}
\DeclareUnicodeComposite{\d}             {n}{"1E47}
\DeclareUnicodeComposite{\d}             {R}{"1E5A}
\DeclareUnicodeComposite{\d}             {r}{"1E5B}
\DeclareUnicodeComposite{\d}             {S}{"1E62}
\DeclareUnicodeComposite{\d}             {s}{"1E63}
\DeclareUnicodeComposite{\d}             {T}{"1E6C}
\DeclareUnicodeComposite{\d}             {t}{"1E6D}
\DeclareUnicodeComposite{\d}             {V}{"1E7E}
\DeclareUnicodeComposite{\d}             {v}{"1E7F}
\DeclareUnicodeComposite{\d}             {W}{"1E88}
\DeclareUnicodeComposite{\d}             {w}{"1E89}
\DeclareUnicodeComposite{\d}             {Z}{"1E92}
\DeclareUnicodeComposite{\d}             {z}{"1E93}
\DeclareUnicodeComposite{\d}             {A}{"1EA0}
\DeclareUnicodeComposite{\d}             {a}{"1EA1}
\DeclareUnicodeComposite{\d}             {E}{"1EB8}
\DeclareUnicodeComposite{\d}             {e}{"1EB9}
\DeclareUnicodeComposite{\d}             {I}{"1ECA}
\DeclareUnicodeComposite{\d}             {i}{"1ECB}
\DeclareUnicodeComposite{\d}             {O}{"1ECC}
\DeclareUnicodeComposite{\d}             {o}{"1ECD}
\DeclareUnicodeComposite{\d}             {U}{"1EE4}
\DeclareUnicodeComposite{\d}             {u}{"1EE5}
\DeclareUnicodeComposite{\d}             {Y}{"1EF4}
\DeclareUnicodeComposite{\d}             {y}{"1EF5}
%    \end{macrocode}
%
%    \begin{macrocode}
%</TU>
%    \end{macrocode}
%
% \section{Package files}
%
% \changes{v1.9h}{1997/12/17}{Added section.}
% \changes{v1.9h}{1997/12/17}{Added code for textcomp.sty.}
%    This file now also contains some packages that provide access to
%    the more specialised encodings.
%
% \subsection{The fontenc package}
%
% \changes{v1.5c}{1994/05/14}{Added the fontenc package}
% \changes{v1.5g}{1994/05/16}{Removed the lowercasing of the filename.}
% \changes{v1.7a}{1994/11/30}{Always load the enc.def file, so that
%    the default encoding for the commands will change.}
% \changes{v1.7x}{1996/05/18}{Produce error if encoding not found.
%                             pr/2054}
% \changes{v1.7y}{1996/05/21}{Corrected error message (CAR)}
% \changes{v1.8d}{1996/11/18}
%     {(DPC) lowercase external file names. internal/1044}%
% This package allows authors to specify which encodings they will use.
% For each encoding |FOO|, the package looks to see if the encoding
% |FOO| has already been declared.  If it has not, the file |fooenc.def|
% is loaded.  The default encoding is set to be |FOO|.
%
% In addition the package at the moment contains extra code to extend
% the |\@uclclist| (list of upper/lower case pairs) for encodings that
% involve cyrillic characters. THIS IS A TEMPORARY SOLUTION and will not
% stay this way forever (or so we hope) but right now we are missing a
% proper interface for this and didn't wanted to rush it.
% \changes{v1.9r}{1999/01/07}{Hackery to temp support cyrillic uc/lc}
% \changes{v1.9t}{1999/02/24}{Corrected hackery cyrillic uc/lc list}
% \changes{v1.9x}{1999/12/08}{Changed \cs{CYRRHOOK} and  \cs{cyrrhook}
%    to\cs{CYRRHK} and  \cs{cyrrhk} as name changed in the cyrillic
%    bundle for naming consistency with other ``hook'' glyphs.}
%    \begin{macrocode}
%<*package>
%    \end{macrocode}
%
% Here we define a macro that extends the |\@uclclist| if needed and
% afterwards turns itself in a noop.
%    \begin{macrocode}
\def\update@uclc@with@cyrillic{%
 \expandafter\def\expandafter\@uclclist\expandafter
  {\@uclclist
  \cyra\CYRA\cyrabhch\CYRABHCH\cyrabhchdsc\CYRABHCHDSC\cyrabhdze
  \CYRABHDZE\cyrabhha\CYRABHHA\cyrae\CYRAE\cyrb\CYRB\cyrbyus
  \CYRBYUS\cyrc\CYRC\cyrch\CYRCH\cyrchldsc\CYRCHLDSC\cyrchrdsc
  \CYRCHRDSC\cyrchvcrs\CYRCHVCRS\cyrd\CYRD\cyrdelta\CYRDELTA
  \cyrdje\CYRDJE\cyrdze\CYRDZE\cyrdzhe\CYRDZHE\cyre\CYRE\cyreps
  \CYREPS\cyrerev\CYREREV\cyrery\CYRERY\cyrf\CYRF\cyrfita
  \CYRFITA\cyrg\CYRG\cyrgdsc\CYRGDSC\cyrgdschcrs\CYRGDSCHCRS
  \cyrghcrs\CYRGHCRS\cyrghk\CYRGHK\cyrgup\CYRGUP\cyrh\CYRH
  \cyrhdsc\CYRHDSC\cyrhhcrs\CYRHHCRS\cyrhhk\CYRHHK\cyrhrdsn
  \CYRHRDSN\cyri\CYRI\cyrie\CYRIE\cyrii\CYRII\cyrishrt\CYRISHRT
  \cyrishrtdsc\CYRISHRTDSC\cyrizh\CYRIZH\cyrje\CYRJE\cyrk\CYRK
  \cyrkbeak\CYRKBEAK\cyrkdsc\CYRKDSC\cyrkhcrs\CYRKHCRS\cyrkhk
  \CYRKHK\cyrkvcrs\CYRKVCRS\cyrl\CYRL\cyrldsc\CYRLDSC\cyrlhk
  \CYRLHK\cyrlje\CYRLJE\cyrm\CYRM\cyrmdsc\CYRMDSC\cyrmhk\CYRMHK
  \cyrn\CYRN\cyrndsc\CYRNDSC\cyrng\CYRNG\cyrnhk\CYRNHK\cyrnje
  \CYRNJE\cyrnlhk\CYRNLHK\cyro\CYRO\cyrotld\CYROTLD\cyrp\CYRP
  \cyrphk\CYRPHK\cyrq\CYRQ\cyrr\CYRR\cyrrdsc\CYRRDSC\cyrrhk
  \CYRRHK\cyrrtick\CYRRTICK\cyrs\CYRS\cyrsacrs\CYRSACRS
  \cyrschwa\CYRSCHWA\cyrsdsc\CYRSDSC\cyrsemisftsn\CYRSEMISFTSN
  \cyrsftsn\CYRSFTSN\cyrsh\CYRSH\cyrshch\CYRSHCH\cyrshha\CYRSHHA
  \cyrt\CYRT\cyrtdsc\CYRTDSC\cyrtetse\CYRTETSE\cyrtshe\CYRTSHE
  \cyru\CYRU\cyrushrt\CYRUSHRT\cyrv\CYRV\cyrw\CYRW\cyry\CYRY
  \cyrya\CYRYA\cyryat\CYRYAT\cyryhcrs\CYRYHCRS\cyryi\CYRYI\cyryo
  \CYRYO\cyryu\CYRYU\cyrz\CYRZ\cyrzdsc\CYRZDSC\cyrzh\CYRZH
  \cyrzhdsc\CYRZHDSC}%
 \let\update@uclc@with@cyrillic\relax
}
%    \end{macrocode}
%
% Here we process each option:
%    \begin{macrocode}
\DeclareOption*{%
   \let\encodingdefault\CurrentOption
%    \end{macrocode}
%    From 2020/02/02 release onward we only load the encoding files if
%    they haven't be loaded already. To check this we look if
%    \verb=\T@=\textit{encoding} is already defined. If not we load
%    (indicated by setting the switch
%    \texttt{@tempswa} to true and we always load if we run in an older
%   format (or rather in a rollback situation).
% \changes{v2.0m}{2020/01/25}{Load each encoding file only once (gh/255)}
%    \begin{macrocode}
   \@tempswafalse
   \@ifl@t@r\fmtversion{2020/02/02}%
       {\expandafter\ifx\csname T@\CurrentOption\endcsname\relax
         \@tempswatrue\fi}%
       {\@tempswatrue}%
%    \end{macrocode}
%    Load if necessary:
%    \begin{macrocode}
   \if@tempswa
%    \end{macrocode}
%
%    \begin{macrocode}
     \edef\reserved@f{%
       \lowercase{\def\noexpand\reserved@f{\CurrentOption enc.def}}}%
     \reserved@f
     \InputIfFileExists\reserved@f
          {}{\PackageError{fontenc}%
           {Encoding file `\reserved@f' not found.%
            \MessageBreak
             You might have misspelt the name of the encoding}%
           {Necessary code for this encoding was not
            loaded.\MessageBreak
            Thus calling the encoding later on will
            produce further error messages.}}%
    \let\reserved@f\relax
%    \end{macrocode}
%
% In case the current encoding is one of a list of known
% cyrillic ones we extend the |\@uclclist|:
%    \begin{macrocode}
    \expandafter\in@\expandafter{\CurrentOption}%
                                {T2A,T2B,T2C,X2,LCY,OT2}%
    \ifin@
%    \end{macrocode}
%
% But only if it hasn't already been extended. This might happen if
% there are several calls to fontenc loading one of the above
% encodings. If we don't do this check the |\@uclclist| gets
% unnecessarily big, slowing down the processing at runtime.
% \changes{v1.9v}{1999/06/12}{Extend \cs{@uclclist} only once}
%    \begin{macrocode}
       \expandafter\in@\expandafter\cyra\expandafter
                                {\@uclclist}%
       \ifin@
       \else
         \update@uclc@with@cyrillic
       \fi
    \fi
  \fi
}
%    \end{macrocode}
%
%    \begin{macrocode}
\ProcessOptions*
%    \end{macrocode}
%
%    We select the new font encoding default (i.e., the last encoding
%    specified in the option list. But this encoding may not work with
%    the current |\f@shape|, e.g., \texttt{LY1} is not defined for
%    \texttt{cmr} and therefore packages switching to \texttt{LY1}
%    usually also change \cs{rmdefault}. But that only applies at
%    |\begin{document}| so we get a spurious warning if we use what
%    \LaTeX{} previously used:
% \changes{v2.0l}{2019/11/22}{Avoid spurious if fontenc selects LY1 as
%    default encoding (gh/199)}
%    \begin{macrocode}
%\fontencoding\encodingdefault\selectfont
%    \end{macrocode}
%    So instead we do this here:
%    \begin{macrocode}
\usefont\encodingdefault\familydefault\seriesdefault\shapedefault
%    \end{macrocode}
%
% To save some space we get rid of the macro extending the
% |\@uclclist| (might have happened already).
%    \begin{macrocode}
\let\update@uclc@with@cyrillic\relax
%    \end{macrocode}
%
% Finally we pretend that the fontenc package wasn't read in. This
% allows for using it several times, e.g., in a class file and in the
% preamble (at the cost of not getting any version info).
% That kind of hackery shows that using a general purpose
% package just for loading an encoding is not the right kind
% of interface for setting up encodings --- it will get replaced at
% some point in the future.
% \changes{v1.9r}{1999/01/07}{Hackery to allow using fontenc several
%    times}
% \changes{v1.9u}{1999/06/10}{Ensure that we also forget old options
%                             (pr/2888)}
% \changes{v2.0o}{2020/02/11}{Update \cs{@fontenc@load@list}
%        with option list (gh/273)}
%    \begin{macrocode}
\let\@elt\relax
\xdef\@fontenc@load@list{\@fontenc@load@list
  \@elt{\csname opt@fontenc.sty\endcsname}}
%    \end{macrocode}
%
%    \begin{macrocode}
\global\expandafter\let\csname ver@fontenc.sty\endcsname\relax
\global\expandafter\let\csname opt@fontenc.sty\endcsname\relax
\global\let\@ifl@ter@@\@ifl@ter
\def\@ifl@ter#1#2#3#4#5{\global\let\@ifl@ter\@ifl@ter@@}
%</package>
%    \end{macrocode}
%
%
%
% \Finale
%
\endinput