summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/mathastext/mathastext.dtx
blob: 30f0d90af61c5207e0c02784e21303d292ba0a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
% -*- coding: iso-latin-1; time-stamp-format: "%02d-%02m-%:y at %02H:%02M:%02S %Z" -*-
% N.B.: this dtx file does NOT use \DocInput, it only uses docstrip.
% The LaTeX source of the documentation is NOT prefixed with percent characters.
%<*dtx>
\def\dtxtimestamp {Time-stamp: <16-11-2019 at 21:27:02 CET>}%
\def\docdate{2019/11/16}
%</dtx>
%<*drv>
\def\MSTpkgdate    {2019/11/16}
\def\MSTpkgversion {1.3w}
%</drv>
%<*dtx>
\iffalse % meta-comment
%</dtx>
%<*readme>
<!-- -->
            +-------------------------------------------+
            +                                           +
            +                mathastext                 +
            +                                           +
            +     'Use the text font in math mode'      +
            +                                           +
            +-------------------------------------------+

This Work may be distributed and/or modified under the conditions
of the [LPPL1.3c](http://www.latex-project.org/lppl/lppl-1-3c.txt)

The Author of this Work is Jean-Francois Burnol

Copyright (C) 2011-2019 Jean-Francois Burnol (`jfbu at free dot fr`)

      Source: mathastext.dtx 1.3w 2019/11/16

%</readme>
%<*dtx>
Generating the documentation from source:

1a) tex (or etex) mathastext.dtx to extract generated files
1b) then latex mathastext.tex (thrice) and dvipdfmx mathastext.dvi
2) alternative to 1a)+1b): pdflatex mathastext.dtx. The documentation does
not include the documented source code then, in contrast to 1a)+1b) method
\fi % end of meta-comment
%</dtx>
%<*!readme&!changelog>
%%----------------------------------------------------------------
%% Package: mathastext
%% Info:    Use the text font in math mode (JFB)
%% Version: 1.3w 2019/11/16
%% License: LPPL 1.3c (http://www.latex-project.org/lppl/lppl-1-3c.txt)
%% Copyright (C) 2011-2019 Jean-Francois Burnol <jfbu at free dot fr>
%% Examples of use of mathastext:
%%        http://jf.burnol.free.fr/mathastext.html
%%        http://jf.burnol.free.fr/showcase.html
%%----------------------------------------------------------------
%</!readme&!changelog>
%<*dtx>
\chardef\noetex 0
\ifx\numexpr\undefined\chardef\noetex 1 \fi
\ifnum\noetex=1 \chardef\extractfiles 0 % extract files, then stop
\else
    \ifx\ProvidesFile\undefined
      \chardef\extractfiles 0 % etex etc.. on mathastext.dtx
    \else % latex/pdflatex on mathastext.tex or on mathastext.dtx
      \ifx\Withdvipdfmx\undefined
        % latex run is on mathastext.dtx, we will extract all files
        \chardef\extractfiles 1 % 1 = extract all and typeset doc
        \chardef\Withdvipdfmx 0 % 0 = pdflatex or latex+dvips
        \chardef\NoSourceCode 1 % 
        \NeedsTeXFormat{LaTeX2e}%
        \PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}% 
      \else % latex run is on mathastext.tex, 
        \chardef\extractfiles 2 % no extractions
      \fi
    \ProvidesFile{mathastext.dtx}%
    [bundle source (\MSTpkgversion, \MSTpkgdate) and documentation (\docdate)]%
    \fi
\fi
\ifnum\extractfiles<2 % extract files
\def\MessageDeFin{\newlinechar10 \let\Msg\message
\Msg{^^J}%
\Msg{********************************************************************^^J}%
\Msg{*^^J}%
\Msg{* To finish the installation you have to move the following^^J}%
\Msg{* file into a directory searched by TeX:^^J}%
\Msg{*^^J}%
\Msg{*\space\space\space\space mathastext.sty^^J}%
\Msg{*^^J}%
\Msg{* To produce the documentation with source code included run latex^^J}%
\Msg{* thrice on file mathastext.tex and then dvipdfmx on mathastext.dvi^^J}%
\Msg{*^^J}%
\Msg{* Happy TeXing!^^J}%
\Msg{*^^J}%
\Msg{********************************************************************^^J}%
}%
\begingroup
\input docstrip.tex
\askforoverwritefalse
\def\testfilepreamble{\string\def\string\testfileincipit{Test file
    to accompany \string\texttt{mathastext}^^J%
    version \string\texttt{\MSTpkgversion} of \string\texttt{\MSTpkgdate}}}
\generate{\nopreamble\nopostamble
    \file{README.md}{\from{mathastext.dtx}{readme}}
    \file{ChangeLog.md}{\from{mathastext.dtx}{changelog}}
  \usepostamble\defaultpostamble
    \file{mathastext.tex}{\from{mathastext.dtx}{drv}}
  \usepreamble\testfilepreamble
    \file{mathastexttestmathversions.tex}{\from{mathastext.dtx}{mathversions}}
    \file{mathastexttestunicodemacos.tex}{\from{mathastext.dtx}{macos}}
    \file{mathastexttestunicodelinux.tex}{\from{mathastext.dtx}{linux}}
    \file{mathastexttestalphabets.tex}{\from{mathastext.dtx}{alphabets}}
  \usepreamble\defaultpreamble
    \file{mathastext.sty}{\from{mathastext.dtx}{package}}%
}
\endgroup
\fi % end of file extractions
\ifnum\extractfiles=0 
% tex/etex/xetex/etc on mathastext.dtx, files are now extracted, stop
  \MessageDeFin\expandafter\end
\fi
% no file extractions if latex compilation was on mathastext.tex
\ifdefined\MessageDeFin\AtEndDocument{\MessageDeFin}\fi
\begingroup\catcode1 0 \catcode`\\ 12 
% this is to fool TeX's recognition of \if/\else/\fi like tokens in test files
^^Aiffalse
%</dtx>
%<*readme>

DESCRIPTION
===========

Optimal typographical results for documents containing
mathematical symbols can only be hoped for with math fonts
specifically designed to match a given text typeface.
Although the list of freely available math fonts (alongside
the Computer Modern and AMS extension fonts) is slowly
expanding (fourier, kpfonts, mathdesign, pxfonts, txfonts,
newpx, newtx, ...) it remains limited, and the situation is
even worse with Unicode fonts (XeTeX/LuaTeX). So if you can't
find a math font which fits well with your favorite text
font, and wish to still be able to typeset mathematical
documents, perhaps not of the highest typographical quality,
but at least not subjected to obvious visual incompatibilities 
between your text font and the math fonts, try out mathastext: 
it will simply use the text font also for the math!

- http://jf.burnol.free.fr/mathastext.html
- http://jf.burnol.free.fr/showcase.html


USAGE
=====

`mathastext` is a LaTeX package

      \usepackage{mathastext}

The document will use in math mode the text font as configured at
package loading time, for these characters:

      abcdefghijklmnopqrstuvwxyz
      ABCDEFGHIJKLMNOPQRSTUVWXYZ
      0123456789
      !?,.:;+-=()[]/#$%&<>|{}\
%$ because emacs buffer fontification

Main options: `italic`, `subdued`, `LGRgreek`.
- Use the `italic` option to get the Latin letters in math mode
  be in italics. Digits and log-like operator names (pre-defined
  as well as user-defined) will be in the same shape as the text
  font (usually this means upright).
- each `\Mathastext[<name>]` in the preamble defines a math version
  to be later activated in the document body via the command
  `\MTversion{<name>}`.
- With the `subdued` option, mathastext will be active
  only inside such math versions.
- For documents needing Greek letters the following is
  possible:
  - no option: Greek letters defined by other packages,
  - `eulergreek`: use the Euler font for the Greek letters,
  - `symbolgreek`: use the Postscript Symbol font for the
     Greek letters.
  - `LGRgreek`: use the document text font in LGR encoding.
     Further options specify the shape of the lowercase
     and uppercase Greek glyphs; starting with v1.15c it is
     possible to use multiple distinct LGR fonts in the
     same document.
- Commands are provided to scale the Euler and Symbol fonts by an
  arbitrary factor to let them fit better with the document text
  font.
- `\MTsetmathskips` allows to set up extra spacings around letters.


RECENT CHANGES
==============

1.3w \[2019/11/16\]
----

* LaTeX 2019-10-01 release (up to patch level 3 inclusive)
  together with `amsmath` conspired `:-)` to break `mathastext`,
  in connexion with math accents. This has been fixed upstream,
  but I am releasing nevertheless a hot fix to this
  [issue](https://github.com/latex3/latex2e/issues/216)
  (this is compatible with future LaTeX releases).

* Fix: the `\hbar` is originally a robust command but
  becomes a `\mathchardef` token if (e.g.) `amsfonts` is
  loaded and then with recent LaTeX `\hbar<space>` is
  made undefined and `mathastext` definition of it
  remained without effect. The `\mathastext` own `\hbar`
  is now defined `\protected`.

* Fix: option `noendash` (or `symboldelimiters` which implies
  it) caused (since `1.3u`) a bug under Unicode engines when
  setting up the minus sign.

* Version names declared via the optional argument of
  `\Mathastext` or as first argument of `\MTDeclareVersion`
  must not be `normal` or `bold`. Enforce that! (this was
  marked as a bug to fix since `2012/10/24`...)


1.3v \[2019/09/19\]
----

* LaTeX 2019-10-01 release has made more math macros robust.
  This applies in particular to the math accents and to the
  `\hbar`. This required for mathastext to adapt. Also
  `\leftarrowfill` and `\rightarrowfill` are now defined
  robust by the kernel, hence mathastext does the same. These
  changes are dropped if mathastext detects an older LaTeX
  format.

* These LaTeX kernel changes motivated an examination of some
  redefinitions done (optionally) by mathastext:
  - The user math alphabet macros got redefined as expanding
    to some other (robust) math alphabet macros, but were not
    robust in the strict sense. This does cause some issues
    for moving arguments in the context of multiple math
    versions, hence it was a bug. The special behaviour of the
    math alphabet commands (they redefine themselves and other
    macros on first use) makes is somewhat problematic for
    mathastext to keep them updated across math versions and
    at the same time strictly LaTeX2e robust. Thus mathastext
    now requires the e-TeX primitive `\protected` and uses it
    for the definitions of the user level math alphabet
    macros.
  - There are a number of `\mathchardef` tokens which (under
    certain options and/or configuration via the package user
    interface), mathastext redefines as macros. These macros
    cause no issue in moving arguments (they are not
    "fragile"), still it is probably better if they expand
    only at the time of typesetting. To this effect they are
    now also `\protected`: `\exists`, `\forall`, `\colon`,
    `\setminus`, `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.
  - The macro `\vert` (which expands to a `\delimiter`) is now
    defined robust by LaTeX. Its mathastext redefinition is a
    `\protected` one rather.
  - The `\{` and `\}` (which get redefined only under
    `\MTexplicitbracesobeymathxx` regime) are now strictly
    robust in the LaTeX2e sense (formerly they were `\let` to
    some robust macros, and this did not make them strictly
    LaTeX2e-robust entities).

* The various changes in mathastext described in the previous item
  apply independently of the LaTeX release version. The
  LaTeX format itself requires the e-TeX extensions since 2015.


1.3u (2019/08/20)
---

* new feature: the initial release dealt with only one font, and
  although shortly thereafter the 1.11 version added support for
  extended math versions, it was documented that some font-dependent
  set-up (minus as endash, dotless i and j, hbar, math accents) was
  done only once. This release makes the relevant characters font
  encoding savvy in each mathastext-extended math version. Thus,
  they should render correctly even with multiple math versions
  using fonts with varying encodings.

  This reinforces importance of using `\MTversion` and not the
  LaTeX `\mathversion` when switching to a new math version (which
  got declared via the package interface). The implementation is
  compatible with Unicode engines and mixed usage of `TU` encoding
  (OpenType fonts) with traditional 8bits TeX font encodings. For
  all engines, all used (8bits) encodings must have been passed as
  options to the `fontenc` package.

  Thanks to Falk Hanisch for feature request and code suggestions.

* new option `unimathaccents`: this adds to option `mathaccents`
  the demand to use the text font accents for OpenType fonts in math
  mode via the `\Umathaccent` primitive. Indeed, as my testing
  showed that this gave non-satisfactory results both with XeTeX
  and LuaTeX regarding the horizontal placement of the accents,
  the main option `mathaccents` acts only on 8bits encoded fonts.
  
* bugfix: the `\Mathastext` without optional argument forgot to
  repeat some font-encoding dependent initialization set-up done
  originally during package loading.

* bugfix: under the `subdued` option macros `\MTmathactiveletters`
  or `\MTnonlettersobeymathxx` now act like no-ops if
  issued explicitly while in the `normal` or `bold` math version.
  Formerly, this was not the case and could cause bugs such as a
  disappearing minus sign in math mode.

* bugfix: the letter `h` used in the `\hbar` obeyed the extra
  skips as set-up by `\MTsetmathskips`, badly interfering with the
  horizontal positioning of the bar accent. They are now ignored
  (as well as the added italic correction).

%</readme>
%<*changelog>
MATHASTEXT CHANGE LOG
=====================

1.3w \[2019/11/16\]
----

* LaTeX 2019-10-01 release (up to patch level 3 inclusive)
  together with `amsmath` conspired `:-)` to break `mathastext`,
  in connexion with math accents. This has been fixed upstream,
  but I am releasing nevertheless a hot fix to this
  https://github.com/latex3/latex2e/issues/216 issue
  (this is compatible with future LaTeX releases).

* Fix: the `\hbar` is originally a robust command but
  becomes a `\mathchardef` token if (e.g.) `amsfonts` is
  loaded and then with recent LaTeX `\hbar<space>` is
  made undefined and `mathastext` definition of it
  remained without effect. The `\mathastext` own `\hbar`
  is now defined `\protected`.

* Fix: option `noendash` (or `symboldelimiters` which implies
  it) caused (since `1.3u`) a bug under Unicode engines when
  setting up the minus sign.

* Version names declared via the optional argument of
  `\Mathastext` or as first argument of `\MTDeclareVersion`
  must not be `normal` or `bold`. Enforce that! (this was
  marked as a bug to fix since `2012/10/24`...)


1.3v \[2019/09/19\]
----

* LaTeX 2019-10-01 release has made more math macros robust.
  This applies in particular to the math accents and to the
  `\hbar`. This required for mathastext to adapt. Also
  `\leftarrowfill` and `\rightarrowfill` are now defined
  robust by the kernel, hence mathastext does the same. These
  changes are dropped if mathastext detects an older LaTeX
  format.

* These LaTeX kernel changes motivated an examination of some
  redefinitions done (optionally) by mathastext:

  - The user math alphabet macros got redefined as expanding
  to some other (robust) math alphabet macros, but were not
  robust in the strict sense. This does cause some issues for
  moving arguments in the context of multiple math versions,
  hence it was a bug. The special behaviour of the math
  alphabet commands (they redefine themselves and other macros
  on first use) makes is somewhat problematic for mathastext
  to keep them updated across math versions and at the same
  time strictly LaTeX2e robust. Thus mathastext now requires
  the e-TeX primitive `\protected` and uses it for the
  definitions of the user level math alphabet macros.

  - There are a number of `\mathchardef` tokens which (under
  certain options and/or configuration via the package user
  interface), mathastext redefines as macros. These macros
  cause no issue in moving arguments (they are not "fragile"),
  still it is probably better if they expand only at the time
  of typesetting. To this effect they are now also
  `\protected`: `\exists`, `\forall`, `\colon`, `\setminus`,
  `\mid`, `\prod`, `\sum`, `\imath`, `\jmath`.

  - The macro `\vert` (which expands to a `\delimiter`) is now
  defined robust by LaTeX. Its mathastext redefinition is a
  `\protected` one rather.

  - The `\{` and `\}` (which get redefined only under
  `\MTexplicitbracesobeymathxx` regime) are now strictly
  robust in the LaTeX2e sense (formerly they were `\let` to
  some robust macros, and this did not make them strictly
  LaTeX2e-robust entities).

* The various changes in mathastext described in the previous item
  apply independently of the LaTeX release version. The
  LaTeX format itself requires the e-TeX extensions since 2015.


1.3u \[2019/08/20\]
----

* new feature: the initial release dealt with only one font, and
  although shortly thereafter the 1.11 version added support for
  extended math versions, it was documented that some font-dependent
  set-up (minus as endash, dotless i and j, hbar, math accents) was
  done only once. This release makes the relevant characters font
  encoding savvy in each mathastext-extended math version. Thus,
  they should render correctly even with multiple math versions
  using fonts with varying encodings.

  This reinforces importance of using `\MTversion` and not the
  LaTeX `\mathversion` when switching to a new math version (which
  got declared via the package interface). The implementation is
  compatible with Unicode engines and mixed usage of `TU` encoding
  (OpenType fonts) with traditional 8bits TeX font encodings. For
  all engines, all used (8bits) encodings must have been passed as
  options to the `fontenc` package.

  Thanks to Falk Hanisch for feature request and code suggestions.

* new option `unimathaccents`: this adds to option `mathaccents`
  the demand to use the text font accents for OpenType fonts in math
  mode via the `\Umathaccent` primitive. Indeed, as my testing
  showed that this gave non-satisfactory results both with XeTeX
  and LuaTeX regarding the horizontal placement of the accents,
  the main option `mathaccents` acts only on 8bits encoded fonts.
  
* bugfix: the `\Mathastext` without optional argument forgot to
  repeat some font-encoding dependent initialization set-up done
  originally during package loading.

* bugfix: under the `subdued` option macros `\MTmathactiveletters`
  or `\MTnonlettersobeymathxx` now act like no-ops if
  issued explicitly while in the `normal` or `bold` math version.
  Formerly, this was not the case and could cause bugs such as a
  disappearing minus sign in math mode.

* bugfix: the letter `h` used in the `\hbar` obeyed the extra
  skips as set-up by `\MTsetmathskips`, badly interfering with the
  horizontal positioning of the bar accent. They are now ignored
  (as well as the added italic correction).


1.3t \[2018/08/22\]
----

* bugfix: the 1.3s bugfix about `subdued` compatibility with
  `fontspec` was deficient.

* bugfix: very old (v1.2, 2012/12/20) bug causing low-level TeX error
  during package loading (with pdflatex) when setting up the math minus
  sign to be the text font endash character, in cases with
  `\encodingdefault` other than OT1, T1 or LY1, e.g. something like
  T2A.

* `\imath` and `\jmath` obey the `subdued` regime. And the minus sign
  is now handled especially to ensure perfect compatibility with the
  `subdued` option.

* breaking change: `mathastext` does not redefine anymore
  `\i` and `\j` to let them be usable both in text and math mode.


1.3s \[2018/08/21\]
----

* fix to an issue with `subdued` option in a `fontspec` context.

% https://tex.stackexchange.com/q/444565/4686

1.3r \[2016/11/06\]
----

* documentation tweaks.


1.3q \[2016/10/31\]
----

* new option `unicodeminus`.

* the `Recent Changes` section of the documentation has been removed as it
  was a duplicate of information available in the `Change Log`.

* some other
  changes in the documentation, in particular the use of straight quotes
  in verbatim.


1.3p \[2016/05/13\]
----

* bugfix: release `1.3n` had forgotten to activate by default its new
  customization of the amsmath macro `\newmcodes@` (it was done from
  using `\MTversion` in the document body but not by default at start
  of body.)

* public name `\MTfixmathfonts` for a `1.3o` macro.


1.3o \[2016/05/03\]
----

* `mathastext` fixes an issue related to a feature of `LuaLaTeX` and
  `luaotfload` that OpenType fonts are declared in one of two modes:
  `node` and `base`, and only the latter is functional in math mode. But
  by default text fonts are declared in mode `node`. Thus `mathastext`
  now intervenes to make it so that the font it declares in math mode
  will use mode `base`. This fixes issues with for example old style
  figures being used while the text font used lining figures (or vice
  versa, depending on the font). But see the code comments for more.


1.3n \[2016/04/22\]
----

* at long last, `mathastext` takes care properly of annoying and perplexing
  amsmath's `\newmcodes@`. The very recent change in `amsopn.sty` finally
  made it compatible with Unicode engines, but anyhow, `mathastext` must do
  its own patch to use the correct font. All of this taking into account
  the various options passed to the package. Lots of trouble for a tiny thing.


1.3m \[2016/04/02\]
----

* minor code maintenance before annual TL freeze.
 
 
1.3l \[2016/01/29\]
----

* compatibility with fontspec's upcoming switch from `EU1/EU2` to
  `TU` common to both Unicode engines.
 
 
1.3k \[2016/01/24\]
----

* typos fixed in the documentation. In particular, the README link to
  the package homepage had remained broken from day one of the package
  releases: `mathastext.html` therein was misspelled as
  `mathsastext.html` ! (but the pdf documentation had the correct link;
  as well as the CTAN catalogue).
 
 
1.3j \[2016/01/15\]
----

* renamed and modified recent `1.3i`'s `\MTactivemathoff` into
  `\MTeverymathoff`. Added `\MTeverymathdefault`.

* `subdued` mode is a bit stronger: also the asterisk reverts to the
  default (if it was modified due to option `asterisk`), the added
  extra `\mskip`'s (useful with upright fonts) for `'`, `\exists`,
  and `\forall` are suppressed rather than re-configured to use `0mu`.
  Related new commands `\MTexistsdoesskip`, `\MTforalldoesskip`,
  `\MTprimedoesskip`, `\MTnormalexists`, `\MTnormalforall`,
  `\MTnormalprime`.

* the toggle for using mathematically active letters is only emitted
  once during package loading; the `\Mathastext` command does not do
  it anymore; the use in the preamble of `\MTmathstandardletters`,
  or `\MTnoicinmath` and related commands is not overruled by later
  use of `\Mathastext`.

* quite a few documentation improvements and rewrites, particularly
  in the description of commands which are related to the
  modifications of mathcodes (mainly for math activation of
  characters or letters) as done by mathastext at `\everymath` or
  `\everydisplay`.


1.3i \[2016/01/06\]
----

* `\url` from `url.sty` as well as `\url` and `\nolinkurl` from
  `hyperref.sty` use math mode and (by default) the monospace text
  font. To avoid mathastext overwriting the special preparation done
  by `{url,hyperref}.sty` the commands `\url/\nolinkurl` are patched
  to do automatically `\MTactivemathoff` (now `\MTeverymathoff`)
  before entering math mode.

* the extra skips specified by `\MTsetmathskips` are not inserted
  around letters if inside the arguments of math alphabet commands,
  or within operator names.

* the added explicit italic corrections (for non-oblique fonts) were
  disabled within math alphabet scopes, except `mathnormal`; they
  are now disabled within all math alphabets, inclusive of
  `mathnormal`.


1.3h \[2015/10/31\]
----

* bugfixes: since `1.3d 2014/05/23` the option `symbolgreek` caused
  `\ell` to become undefined, and, similarly but far worse, options
  `selfGreek`, `selfGreeks` caused all lowercase Greek letters
  `\alpha`, `\beta`, etc.. to become undefined.
  

1.3g \[2015/10/15\]
----

* following `2015/10/01` LaTeX release, removal of the `"luatex"` 
  prefix from the names of the LuaLaTeX math primitives. Compatibility
  maintained with older LaTeX formats.
  

1.3f \[2015/09/12\]
----

* the replacement of amsmath's `\resetMathstrut@`, when it is
  done, emits an Info rather than a Warning as this could be
  potentially stressful to some users.

* the `README` self-extracts from the `dtx` source, as a text
  file `README.md` with Markdown syntax.


1.3e \[2015/09/10\]
----

* bugfix: under option nosmalldelims, `\lbrace` and `\rbrace` were
  redefined as math symbols and could not be used as delimiters.


1.3d \[2015/02/26\]
----

* the documentation mentions the improved compatibility of mathastext
  with the latest (3.34) beamer release: no more need for
  `\usefonttheme{professionalfonts}`.

1.3d \[2014/05/23\]
----

* new commands `\MTstandardgreek` and `\MTcustomgreek`.

* The Greek letters, in case of use of one of the package related
  options, are left to their defaults in the normal and bold math
  versions if the subdued option was also used (this was so far
  the case only with options LGRgreek/LGRgreeks).

* `\newmcodes@` of amsmath is left untouched if package
  lualatex-math is detected.

1.3c \[2013/12/14\]
----

* added a starred variant to `\MTversion` which tells mathastext to
  only do the math set-up and not modify the text fonts.

* added second optional version name argument to `\Mathastext` and
  to `\MTDeclareVersion`, to transfer settings for things not
  otherwise changed by mathastext from a math version to the one
  declared. This is mainly for symbols and large symbols to be the
  bold ones when the user sets up the series of a mathastextified
  font to be bold in a mathastext-declared version.

* renamed `\defaultprod` to `\MToriginalprod`, `\defaultsum` to
  `\MToriginalsum`, (this is in case of option symbolmisc).

* changes to the dtx organization; options for generating the
  documentation can be customized in generated mathastext.tex file.

* 1.2d code for `\#`, `\$`, `\%`, and `\&` modified erroneously the
  earlier correct 1.2c code and created a bug showing up with more
  than 16 math families (a possibility only with lualatex or
  xelatex).

1.3a \[2013/09/04\]
----

* the somewhat silly `\string`'s are removed from the
  `\MTsetmathskips` command of release 1.3, thus allowing its first
  argument to be a macro, or any expandable code, giving a letter.

* the amsmath `\resetMathstrut@`, which is incompatible with a
  mathematically active parenthesis ( is now modified only if
  necessary (i.e. only when `\MTnonlettersobeymathxx` is issued) and
  is restored to its original value if not needed anymore (i.e.
  after `\MTnonlettersdonotobeymathxx`, as for example when
  switching to the normal version under option subdued).

* improved documentation.

1.3  \[2013/09/02\]
----

* commands `\MTsetmathskips` and `\MTunsetmathskips` added.

* commands `\MTmathactiveletters` and `\MTmathstandardletters` to
  govern the math activation of letters independently of its use
  for insertion of the italic corrections (`\MTicinmath` and
  `\MTnoicinmath` correspondingly modified).

* the new `\luatexUmathcodenum` as available since TL2013 allows
  identical treatment by mathastext of = and - under both LuaTeX
  and XeTeX.

* `\newmcodes@` of amsmath is left untouched in case of option basic.

* a sentence containing | which was written to the log during the
  loading caused a problem if | was active (typically if
  `\MakeShortVerb`{\|} was added to the preamble prior to the
  loading of mathastext).

* some preemptive measures taken regarding things such as `\mid`,
  `\lbrace`, and `\rbrace`, as some packages define these things in
  manners which made the re-definitions done by mathastext issue
  errors.

1.2f \[2013/01/21\]
----

* minor code improvements. Change log added to the user manual.

1.2e \[2013/01/10\]
----

This version should be the last one in the 1.2 series as it seems to
correct most of the main problems which were introduced with the massive
use of mathematically active characters in versions 1.2 and 1.2b.

* It is indeed a thorny point when one wants to modify an active character in
  math mode only (without breaking usage in label's and ref's for example).
  The package now does that _only_ if the activation originated in the Babel
  system as it is then possible to modify appropriately the Babel macros
  `\user@active<char>` and `\normal@char<char>`, at the time of entering math
  mode (mathastext does all its activation job at `\everymath` and
  `\everydisplay`).

  The relevant issues are discussed in section 2.10 of the user manual, in the
  test file mathastexttestalphabets.tex, and in the source code comments for
  macro `\mst@mathactivate`. The inherent incompatibility of Babel with
  packages having made mathematically active the characters itself makes
  document active is circumvented by this interference of mathastext. A
  generally applicable Babel patch could be derived from the method used by
  mathastext.

  For the non catcode active characters, mathematical activation is used.
  This is done at the entrance in math mode.

* Sadly, the feature of added italic corrections introduced in
     version 1.2b did not behave as described in the user manual, due to
     forgotten group braces. Fixed.

* The command `\MTlowerast` from the user manual of v1.2d was not the
     one implemented in the source code. Fixed.

* The test files automatically extracted from a latex run on the dtx
     file have been revised and extended.

* The code is better documented.

1.2d \[2013/01/02\]
----

*  an incompatibility with amsmath (its macro `\resetMathstrut@`),
      exists since version 1.2 of the package. This is fixed
      here.

*  various improvements in dealing with the asterisk and in the
      mechanism of letting non-letter symbols obey the math alphabet
      commands.

*  documentation extended and improved.

1.2c \[2012/12/31\]
----

*  mathastext now inserts automatically after all (latin)
      letters in math mode their italic corrections, if the font
      used is upright (sic). This improves the spacings for the
      positioning of subscripts. The feature is de-activated
      inside the math alphabets commands (apart from `\mathnormal`),
      so as to not prohibit the formation of ligatures.

*  the documentation has been extended to explain in detail the
      issues which are relevant to the new feature of added italic
      corrections.

* version 1.2 had some bad bugs when confronted to active
  characters. This is corrected and additionally
  `\MTnonlettersdonotobeymathxx` is made the default, as the user
  input is too much constrained in its absence.

*  a less fatal, but still annoying, typo had made the dot in 1.2
      of type `\mathpunct` rather than `\mathord`.

*  the inner namespace has been rationalized a bit.

1.2 \[2012/12/20\]
----

*  a new command sets up the amount of space to be automatically
      inserted before the derivative glyph (useful when using an
      upright font).

*  the scope of the math alphabets has been extended to apply
      to the non-alphabetical characters, and also to operator
      names.

*  the format of the dtx file has changed. The package file
      is self-extracting from the dtx, and four additional test
      files are also produced during `latex mathastext.dtx`.

1.15f and 1.15g \[2012/10/25\]
----

*  `\$`, `\#`, `\&`, and `\%` had been re-defined by mathastext since its
      inception in a rather strange (but working) way, which
      could cause surprises to other packages. Fixed.

*  the subdued mechanism for the math alphabets is implemented
      in a simpler and more efficient manner than in 1.15e.

*  the `defaultxx` options act a bit differently, and are more
      useful in case of a `too many math alphabets` situation.

*  various improvements in the documentation.

*  general clean up and better commenting of the source code.

1.15e \[2012/10/22\]
----

*  new user commands to specify skip or glue to be
      inserted after the math symbols `\exists` and `\forall`

*  complete (user transparent) rewrite of the code
      implementing the subdued option; and its action has
      been extended to apply also to the `\mathbf`, `\mathit`,
      `\mathsf`, `\mathtt` alphabets and not only to `\mathrm` and
      `\mathnormal` as in the previous versions.

*  improvements in the documentation.

1.15d \[2012/10/13\]
----

* the Unicode situation is now correctly treated, throughout the
  code (this had been left in a half-done way from version 1.14 of
  April 2011).

* this includes an issue related to amsmath and its
  DeclareMathOperator macro which has been fixed,

* and the code related to `\relbar` and `\Relbar` (and
  `\models`) has been revised.

1.15c \[2012/10/05\]
----

*  it is now possible to use distinct fonts in LGR encoding
      for the Greek letters according to the current math
      version.

*  improvements to the documentation.

1.15b
----

*  corrected a 'feature' of 1.15 which was backward-incompatible

*  improvements to the pdf documentation

1.15  \[2012/09/26\]
----

*  the subdued option allows the mathastextification to
      act only locally.

*  some measures taken to deal with amsmath related
      issues when using xetex or luatex.

1.14c
----

*  a bug is fixed: the `\Mathastext` macro reinitializes
      the fonts in the normal and bold math versions, but it
      also erroneously redeclared the math alphabet changing
      commands which could have been set up in previously
      defined math versions (via earlier calls to
      `\Mathastext`\[version_name\]).

1.14b \[2011/04/03\]
----

*  there was a bug with `\$`, `\#`, `\&`, `\%` in math mode which
      showed up when ten or more math families had been
      declared. This bug affected also the minus sign under
      the same circumstances, when Unicode engines were
      used. Fixed.

*  the options LGRgreek and selfGreek act now a bit
      differently, and new options LGRgreeks and selfGreeks
      have been defined.

*  I also cleaned up a bit the code, for a more
      structured namespace.

1.14
----

*  mathastext now modifies also the math alphabets `\mathit`,
      `\mathsf` and `\mathtt`, thus making it a quite generic
      complete manner to adapt the math configuration to fonts
      provided with no math support.

1.13b
----

*  when the Symbol font is used for `\prod` and `\sum` this
      will be only for inline math; display math will use the
      default glyphs

1.13 \[2011/03/11\]
----

*  the LGRgreek option is added.

*  internal changes for better readability of the code.

1.12
----

*  various bugs have been corrected.

*  the endash and alldelims options are active by default.

*  the package is more Unicode aware.

*  the `\Mathastext` command has been improved to
      facilitate the mechanism of math versions also when
      using XeTeX or LuaTeX (with package fontspec.)

*  the en-dash and dotless i and j now work with all
      encodings, Unicode inclusive.

1.11 \[2011/02/06\]
----

*  optional argument to `\Mathastext` macro.

1.1  \[2011/02/01\]
----

*  options italic and frenchmath.

1.0  \[2011/01/25\]
----

*  Initial version.

%</changelog>
%<*drv>
%% This is a generated file. Run latex thrice on this file mathastext.tex then
%% run dvipdfmx on mathastext.dvi to produce the documentation mathastext.pdf,
%% with the package source code included.
%%
%% Customize as desired the class options and the two toggles below.
%%
%% See mathastext.dtx for the copyright and the conditions for distribution
%% and/or modification of this work.
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{mathastext.tex}%
[\MSTpkgdate\space v\MSTpkgversion\space 
       driver file for mathastext documentation (JFB)]%
\PassOptionsToClass{a4paper,fontsize=11pt}{scrdoc}
\chardef\Withdvipdfmx 1 % replace 1<space> by 0<space> for using latex/pdflatex
\chardef\NoSourceCode 0 % replace 0<space> by 1<space> for no source code
\input mathastext.dtx
%%% Local Variables:
%%% mode: latex
%%% End:
%</drv>
%<*mathversions>
%% This file `mathastexttestversions.tex' is for testing the enhanced
%% concept of math versions provided by the package `mathastext'.
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{newcent}
\usepackage[subdued]{mathastext}
\Mathastext[newcent]
\renewcommand\familydefault\ttdefault
\Mathastext[courier]
\renewcommand\familydefault\sfdefault
\Mathastext[avantgarde]
\renewcommand\familydefault\rmdefault
\begin{document}
\testfileincipit

text in NewCentury and $math\ as\ in\ default$,%
\MTversion{courier} text in Courier and $math\ in\ Courier$,%
\MTversion{avantgarde} text in AvantGarde and $math\ in\ AvantGarde$,%
\MTversion[newcent]{courier} text in NewCentury and $math\ in\
Courier$,\MTversion{bold} text in bold NewCentury and $math\ as\ in\
bold\ default$,\MTversion[courier]{avantgarde} text in Courier and
$math\ in\ AvantGarde$. 
\end{document}
%</mathversions>
%<*macos>
%% This file `mathastexttestunicodemacos.tex' is for testing the use 
%% of the package `mathastext' with the unicode engines XeTeX or LuaLaTeX.
%%
%% Mac OS X specific fonts are used (initially tested on 10.8.2).
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\documentclass{article}
\usepackage[hscale=0.85]{geometry}
\usepackage{multicol}
\usepackage[no-math]{fontspec}
\usepackage{lmodern}
\usepackage{metalogo}
\usepackage{iftex}
\ifXeTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \XeLaTeX)}
\else
\ifLuaTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \LuaLaTeX)}
\fi\fi
\usepackage[subdued,italic,asterisk]{mathastext}
\setmainfont[Color=FF0000]{Hoefler Text}  \Mathastext[Hoefler]
\setmainfont[Color=336633]{American Typewriter}\Mathastext[Typewriter]
\setmainfont[Color=0000FF]{Herculanum}    \Mathastext[Herculanum]
\setmainfont[Color=FF00FF]{Didot}         \Mathastext[Didot]
\setmainfont[Color=999999]{Comic Sans MS} \Mathastext[Comic]
\MTDeclareVersion{Times}{T1}{ptm}{m}{n}
\begin{document}
\MTversion{normal}
\testfileincipit

This test uses \verb|mathastext| with its \emph{italic}, \emph{asterisk}, and
\emph{subdued} options. The base document fonts are the Latin Modern ones (in
OpenType format). The other OpenType fonts were chosen from those available on
a Mac OS machine. We also used the Times font in traditional \TeX\ font T1
encoding, to demonstrate the removal since release \texttt{1.3u} of a former
limitation that all math versions had to share the same font encoding, else
some characters such as the dotless \texttt{i} ($\imath$), or the minus sign
could well vanish from the output in the non-normal math versions.

Furthermore we test (last line of each block, on the left) if the non-letter
characters obey the math alphabet \verb|\mathbf|. In the normal and bold math
versions, this feature is de-activated, as option \emph{subdued} was used; and
if activated we should then use in these math versions the package
\verb|\Mathbf| rather than \verb|\mathbf| which is there still the original
one, which will use encoding \verb|OT1| in the normal and bold versions, as we
loaded \verb|fontspec| with its option \emph{no-math}.

Some among the fonts tested have no bold variant or no italic variant.

Note (tested 2013/09/03): for some reason the \verb|Color| specifications in the
\verb|\setmainfont| commands work only
with \XeLaTeX{}, not with \LuaLaTeX{}; a few months back I had not noticed
such a difference between the two engines.

Update (tested 2016/01/15 with reasonably up-to-date TL2015): \verb|Color|
spec in use of \verb|\setmainfont| command now functional again with
\LuaLaTeX.

Note (tested 2019/08/11, reasonably up-to-date TL2019): spacing with the Didot
font differs widely between \XeLaTeX\ and \LuaLaTeX{} (perhaps related to
italic corrections, see the package documentation), and also it seems
\LuaLaTeX{} will not find (from our generic usage of the \verb|fontspec|
interface, at least) bold variants of the Hoefler Text and American Typewriter
fonts, contrarily to \XeLaTeX. Also, the \emph{italic} option remains
seemingly without effect with \LuaLaTeX{} in the case of the Hoefler Text font
(see the package source code comments on some problems with the two ``modes''
for text fonts under \LuaLaTeX, which may be related with this specific issue
here).

\newcommand\TEST[1]{\MTversion{#1}\def\tmpa{#1}%
  \def\tmpb{normal}\def\tmpc{bold}%
  \ifx\tmpa\tmpb\else\ifx\tmpa\tmpc\else \MTnonlettersobeymathxx
  \MTexplicitbracesobeymathxx\fi\fi
\begin{multicols}{2}
\hbox to\columnwidth{\hbox to\columnwidth{\hfil
                $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}}
   \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ }
   \centerline{ $0123456789$ }
   \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ }
   \centerline{ $\mathbf{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash}$ }
\columnbreak
   \centerline{ abcdefghijklmnopqrstuvwxyz }
   \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ }
   \centerline{ 0123456789 }
   \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
   \centerline{\bfseries !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
\end{multicols}}
\begin{multicols}{2} 
   \centerline{\textbf{math mode}} 
\columnbreak
   \centerline{ \textbf{text} }
\end{multicols}
\TEST{Didot}\TEST{Comic}\TEST{normal}\TEST{Herculanum}
\TEST{Hoefler}\TEST{Typewriter}\TEST{bold}\TEST{Times}
\end{document}
%</macos>
%<*linux>
%% This file `mathastexttestunicodelinux.tex' is for testing the use 
%% of the package `mathastext' with the unicode engines XeTeX or LuaLaTeX.
%%
%% Fonts which were available on a Linux machine are used. Beware that
%% compilation with LuaLaTeX will abort with errors if specified fonts do not
%% exist on your system.
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\documentclass{article}
\usepackage[hscale=0.8]{geometry}
\usepackage{multicol}
\usepackage[no-math]{fontspec}
\usepackage{lmodern}
\usepackage{metalogo}
\usepackage{iftex}
\ifXeTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \XeLaTeX)}
\else
\ifLuaTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \LuaLaTeX)}
\fi\fi
\usepackage[subdued,italic,asterisk]{mathastext}
\setmainfont[Color=999999]{Verdana}      \Mathastext[Verdana]
\setmainfont[Color=0000FF]{Arial}        \Mathastext[Arial]
\setmainfont[Color=00C000]{DejaVu Serif} \Mathastext[DejaVu]
\setmainfont[Color=FF0000]{Andale Mono}  \Mathastext[Andale]
%% commented out as these fonts do not exist anymore on the Linux box
%% I have access to (test last done 2016/01/15)
%%\setmainfont[Color=C000C0]{URW Chancery L}    \Mathastext[Chancery]
%%\setmainfont[Color=800080]{URW Palladio L}    \Mathastext[Palladio]
\setmainfont[Color=808000]{Liberation Serif}  \Mathastext[Liberation]
\MTDeclareVersion{Times}{T1}{ptm}{m}{n}
\begin{document}
\MTversion{normal}
\testfileincipit

This test uses \verb|mathastext| with its \emph{italic}, \emph{asterisk}, and
\emph{subdued} options. The base document fonts are the Latin Modern ones (in
OpenType format). The other OpenType fonts were chosen from those available on
a Linux machine. We also used the Times font in traditional \TeX\ font T1
encoding, to demonstrate the removal since release \texttt{1.3u} of a former
limitation that all math versions had to share the same font encoding, else
some characters such as the dotless \texttt{i} ($\imath$), or the minus sign
could well vanish from the output in the non-normal math versions.

Furthermore we test (last line of each block, on the left) if the non-letter
characters obey the math alphabet \verb|\mathbf|. In the normal and bold math
versions, this feature is de-activated, as option \emph{subdued} was used; and
if activated we should then use in these math versions the package
\verb|\Mathbf| rather than \verb|\mathbf| which is there still the original
one, which will use encoding \verb|OT1| in the normal and bold versions, as we
loaded \verb|fontspec| with its option \emph{no-math}.

Some among the fonts tested have no bold variant or no italic variant.

Note: the two unicode engines \XeLaTeX\ and \LuaLaTeX\ give likely not fully
identical results particularly for the math mode. At least this is what I
observed regularly over the years with the variant of this file prepared for
fonts available on Mac OS, which is my main system where I develop
|\mathastext|. Lastly for example (TL2019, august 2019), \LuaLaTeX\ could not
find the bold variant of some system font, but \XeLaTeX\ did. And the spacing
for the letters of the Didot font was vastly different between the two
engines.

\newcommand\TEST[1]{\MTversion{#1}\def\tmpa{#1}%
  \def\tmpb{normal}\def\tmpc{bold}%
  \ifx\tmpa\tmpb\else\ifx\tmpa\tmpc\else \MTnonlettersobeymathxx
  \MTexplicitbracesobeymathxx\fi\fi
\begin{multicols}{2}
\hbox to\columnwidth{\hbox to\columnwidth{\hfil
                $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}}
   \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ }
   \centerline{ $0123456789$ }
   \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ }
   \centerline{ $\mathbf{!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash}$ }
\columnbreak
   \centerline{ abcdefghijklmnopqrstuvwxyz }
   \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ }
   \centerline{ 0123456789}
   \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
   \centerline{\bfseries !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
\end{multicols}}
\begin{multicols}{2} 
   \centerline{\textbf{math mode}} 
\columnbreak
   \centerline{ \textbf{text} }
\end{multicols}
\TEST{DejaVu}
\TEST{Verdana}
\TEST{Andale}
%%\TEST{Palladio}
\TEST{Arial}
%%\TEST{Chancery}
\TEST{Liberation}
\TEST{bold}\TEST{normal}\TEST{Times}
\end{document}
%</linux>
%<*alphabets>
%% This file `mathastexttestalphabets.tex' is for testing the extended
%% scope of the math alphabet commands with package `mathastext', via
%% the package command \MTnonlettersobeymathxx.
%%
%% Compile either with latex, pdflatex, lualatex (pdf output) or xelatex.
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\documentclass{article}
\usepackage[hscale=0.66, vscale=0.72]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}\mathtoolsset{centercolon}
%% WARNING THIS IS INCOMPATIBLE WITH BABEL+FRENCHB
%% BUT WITH MATHASTEXT LOADED THIS IS CORRECTED
%% *IF* \MTnonlettersobeymathxx IS MADE USE OF.
\usepackage{iftex}
\ifXeTeX
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \XeLaTeX)}
\usepackage[no-math]{fontspec}
\setmainfont[ExternalLocation,
             Mapping=tex-text,
             BoldFont=texgyretermes-bold,
             ItalicFont=texgyretermes-italic,
             BoldItalicFont=texgyretermes-bolditalic]{texgyretermes-regular}
\setmonofont[ExternalLocation,
             Mapping=tex-text]{texgyrecursor-regular}
\setsansfont[ExternalLocation,
             Mapping=tex-text]{texgyreheros-regular}
\else
\ifLuaTeX % for pdf output
\expandafter\def\expandafter\testfileincipit\expandafter
 {\testfileincipit\ (compiled with \LuaLaTeX)}
\usepackage[no-math]{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setmonofont[Ligatures=TeX]{TeX Gyre Cursor}
\setsansfont[Ligatures=TeX]{TeX Gyre Heros}
\else
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tgtermes}
\usepackage{tgcursor}
\usepackage{tgheros}
\fi\fi
\usepackage{metalogo} % must be loaded /after/ [no-math]fontspec
\usepackage[french]{babel}
\usepackage[italic,asterisk]{mathastext}
\MTlettershape{n}\Mathastext[upright]
\MTnonlettersobeymathxx
\MTexplicitbracesobeymathxx
\delimitershortfall-1pt
\usepackage{color}
\begin{document}
\testfileincipit

\begin{center}
  \bfseries Two features of \texttt{mathastext}:\\
extended scope of the math alphabets and added italic corrections\par
\end{center}

The package makes
${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}\,{\{}\,{\}}$,
the asterisk $*$, and $.\,/\,\vert\,\backslash\,{\#}\,{\$}\,{\%}\,{\&}$ obey the
math alphabet commands (this is the maximal list, some characters may have been
excluded by the corresponding package options). For the characters listed first
the mechanism involves a `mathematical activation'.

As this process may create incompatibilities, it will be put into action
for
${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}$
only if the user makes use of the package command
\verb|\MTnonlettersobeymathxx| (and the braces necessitate
\verb|\MTexplicitbracesobeymathxx|).

It could be that one such character has been made `active' in the entire
document by some other package, typically a language definition file for the
\verb|babel| system. Here for example we have used \verb|babel| with the
\verb|french| option, which makes the high punctuation characters !?:; active
throughout the document (extra spacing is put in front of the character when
used in text; no change in math but perhaps for other languages and characters
this could happen, it is up to the language definition file to decide).

When \verb|mathastext| detects that a character it wants to `mathematically
activate' is already `active', it does not go further except if it seems that
the activation was done by Babel. If the activation was done by Babel, then
\verb|mathastext| replaces the expansion of the active character in math mode by
what is necessary to achieve its goal. It does not additionally mathematically
activate the character; rather it makes sure that the character is \emph{not}
mathematically active. In the present document the colon was made mathematically
active by \verb|mathtools| but this was already canceled in the preamble by
\verb|mathastext| as it was loaded later. And it is better so, because the
combination \verb|babel| (with option \verb|frenchb|) +\verb|mathtools| (with
\verb|centercolon|) makes \verb|$:$| create an infinite loop!

But even if someone had mathematically activated the colon after the preamble,
or after the loading of \verb|mathastext|, this would be canceled again
automatically for each inline or displayed mathematical formula (if the user
does \verb|\MTnonlettersobeymathxx|).

The conclusion with \verb|\MTnonlettersobeymathxx| is: if some package has tried
to make the character mathematically active, this will be overruled by
\verb|mathastext|; if some package has made the character globally active, then
the package wins except if it is Babel, as \verb|mathastext| may in the latter
case safely modify the action in math mode (paying attention to the fact that
the character should be usable in \verb|\label| and \verb|\ref| in and outside
of math mode). 

The displayed equations next illustrate the extended scope of the math alphabets
which now apply to $=$, $-$, $($, $)$, $[$, $]$ (but not to the large delimiters
of course). Furthermore, for testing purposes the equations were labeled using
such characters, for example the last one has label \verb|eq=7|, to check that
the mathematical activation of $=$ does not cause problems with
\verb|\label/\ref|. 

\def\testformula{\quad\Biggl\lbrace\biggl(\left(\left[[\sin(a) + \cos(b) - \log(c) = 
\sec(d)]\right]\right)\biggr)\Biggr\rbrace}
\begin{equation}\testformula\label{eq:1}\end{equation}
\begin{equation}\mathnormalbold{mathnormalbold:\testformula}\label{eq;2}\end{equation}
\begin{equation}\mathrm{mathrm:\testformula}\label{eq?3}\end{equation}
\begin{equation}\mathbf{mathbf:\testformula}\label{eq!4}\end{equation}
\begin{equation}\mathit{mathit:\testformula}\label{eq(5}\end{equation}
\begin{equation}\mathtt{mathtt:\testformula}\label{eq)6}\end{equation}
\begin{equation}\mathsf{mathsf:\testformula}\label{eq=7}\end{equation}

Equations above are numbered \ref{eq:1}, \ref{eq;2}, \ref{eq?3}, \ref{eq!4}, and
$\ref{eq(5}$, $\ref{eq)6}$, and $\ref{eq=7}$.

\def\testline#1{$#1$&$\mathnormalbold{#1}$&$\mathrm{#1}$&$\mathbf{#1}$&$\mathit{#1}$&$\mathtt{#1}$&$\mathsf{#1}$}

\centerline{\begin{tabular}{ccccccc}
\testline{a!b}\\
\testline{a?b}\\
\testline{a,b}\\
\testline{a;b}\\
\testline{a:b}\\
\testline{a:=b}\\
\testline{a\vcentcolon= b}\\
\testline{a\colon b}\\
\testline{a.b}\\
\testline{a-b}\\
\testline{a+b}\\
\testline{a=b}\\
\testline{a<b}\\
\testline{a>b}\\
\testline{<x,y>}\\
\testline{\mathopen{<} x,y\mathclose{>}}\\
\testline{\left< x,y\right>}\\
\testline{a/b}\\
\testline{a\backslash b}\\
\testline{a\setminus b}\\
\testline{a|b}\\
\testline{a\mid b}\\
\testline{(a,b)}\\
\testline{[a,b]}\\
\testline{\{a,b\}}
\end{tabular}}

The question mark has been made active by \verb|babel+frenchb|. 
\verb|mathastext| has imposed in math mode its ways (now \verb|$\mathbf{???}$|
gives $\mathbf{???}$). As the extra spacing is added by \verb|frenchb| only in
text, we had to use the math alphabet to check that indeed \verb|mathastext|
overruled Babel. 

To double-check we will now make \string? mathematically active:
\verb|\mathcode`?="8000|\mathcode`?="8000. This is a sure cause for disaster
normally with Babel (don't do this at home without \verb|mathastext|!). But here
with \verb|$?$| no bad surprise (infinite loop!) awaits us: just $?$.

Let's take some other character, for example the opening parenthesis, and make
it catcode active:
\verb|\catcode`(=\active \def ({X}|. 
Let's try the input 
\verb|( and $($|.
\begingroup
\catcode`(=\active \gdef ({X} 
This gives ( and $($. We see that \verb|mathastext| does not attempt to modify
the definition of the active character, as this activation was not done via the
\verb|babel| services. \catcode`\(=12 \mathcode`(="8000 We now revert the
parenthesis to catcode other (but maintain \verb|\def ({X}| as definition of its
active version), and then make it mathematically active using the command
\verb|\mathcode`(="8000|. If we try \verb|$((($| we see that the parenthesis is
not converted into an $X$: $((($. The mathematically active character was
overruled by \verb|mathastext|.

Issuing \verb|\MTnonlettersdonotobeymathxx|\MTnonlettersdonotobeymathxx\ we do
get the $X$'s from the input \verb|$((($|: $((($ 
\endgroup 
This shows that \verb|mathastext| now does not modify in math mode the
non-letter \verb|(|.

\MTversion{upright}\MTnonlettersobeymathxx
We defined in the preamble of the document a \verb|mathastext|-enhanced
math version (named \verb|upright|) having the Latin letters upright in
math mode. Let's switch to
it: \newline
\hbox to\linewidth{\hss\verb|\MTversion{upright}|\hss}

With a font which is neither italic nor slanted, \verb|mathastext| automatically
inserts italic corrections for better positioning of the subscript:
\verb|$f_i^i$| gives
$f_i^i$.
After \verb|\MTnoicinmath| which turns off this feature\MTnoicinmath{}, the same
input gives $f_i^i$, which is different. 
\footnote{last time I tried, this only worked with PDF\LaTeX{}, not with
  \LuaLaTeX{} or \XeTeX{}.}

Again with italic corrections on (\verb|\MTicinmath|)\MTicinmath{} 
\verb|$f_{abc}^{def}$| gives $f_{abc}^{def}$, and here is another one:
$f^{f_{abc}^{def}}_u$. Without italic corrections\MTnoicinmath: $f_{abc}^{def}$,
and respectively $f^{f_{abc}^{def}}_u$.

\MTicinmath 

\verb|mathastext| does not add these italic corrections inside arguments of
math alphabets, as this would prevent the formation of ligatures:
$\mathnormal{ff}$, $\mathrm{ff}$, $\mathit{ff}$, $\mathbf{ff}$, $\mathtt{ff}$
(no ligature in teletype) and $\mathsf{ff}$.\footnote{\llap{\textcolor{magenta}{\bfseries Changed!\kern3em}}Prior to 1.3i,
  italic corrections were added to the \string\mathnormal\ arguments.}

\centerline{\begin{tabular}{ccccccc}
\testline{a!b}\\
\testline{a?b}\\
\testline{a,b}\\
\testline{a;b}\\
\testline{a:b}\\
\testline{a:=b}\\
\testline{a\vcentcolon= b}\\
\testline{a\colon b}\\
\testline{a.b}\\
\testline{a-b}\\
\testline{a+b}\\
\testline{a=b}\\
\testline{a<b}\\
\testline{a>b}\\
\testline{<x,y>}\\
\testline{\mathopen{<} x,y\mathclose{>}}\\
\testline{\left< x,y\right>}\\
\testline{a/b}\\
\testline{a\backslash b}\\
\testline{a\setminus b}\\
\testline{a|b}\\
\testline{a\mid b}\\
\testline{(a,b)}\\
\testline{[a,b]}\\
\testline{\{a,b\}}
\end{tabular}}

\end{document}
%</alphabets>
%<*dtx>
^^Afi^^Aendgroup % end of big \iffalse block including generated files
% customization should be done in mathastext.tex, not here.
\documentclass[abstract]{scrdoc}
\ifnum\NoSourceCode=1 \OnlyDescription\fi
\makeatletter
\ifnum\Withdvipdfmx=1
% peut-être je devrais plutôt passer dvipdfmx en option à la classe.
   \@for\@tempa:=hyperref,bookmark,graphicx,color\do
            {\PassOptionsToPackage{dvipdfmx}\@tempa}
   %
   \PassOptionsToPackage{dvipdfm}{geometry}
   \PassOptionsToPackage{bookmarks=true}{hyperref}
   \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref}
   \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark}
   %
   \def\pgfsysdriver{pgfsys-dvipdfm.def}
\else
   \PassOptionsToPackage{bookmarks=true}{hyperref}
\fi
\makeatother

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}\allowdisplaybreaks
\usepackage{lmodern}
\usepackage{enumitem}

\DeclareSymbolFont{largesymbols}{OMX}{txex}{m}{n}
\SetSymbolFont{largesymbols}{bold}{OMX}{txex}{bx}{n}
\DeclareFontSubstitution{OMX}{txex}{m}{n}

% in order to cancel the removal done by ltxdoc
% of comment characters inside verbatim blocks.
\makeatletter\let\check@percent\relax\makeatother

\usepackage{color}
\definecolor{DarkMagenta}{RGB}{139,0,139} 
\definecolor{joli}{RGB}{225,95,0}
\usepackage{xspace}
\usepackage{metalogo}
\usepackage{framed}

\usepackage[hscale=0.66]{geometry}

\usepackage[pdfencoding=pdfdoc]{hyperref}

\hypersetup{linktoc=all,%
%hidelinks,%
colorlinks=true,%
breaklinks=true,%
linkcolor={blue},%
urlcolor={joli},
pdfauthor={Jean-Fran\c cois Burnol},%
pdftitle={The mathastext package},%
pdfsubject={LaTeX, math fonts},%
pdfkeywords={LaTeX, Fonts},%
pdfstartview=FitH,%
pdfpagemode=UseOutlines,%
}

\usepackage{bookmark}

% ---- \centeredeline: OUR OWN LITTLE MACRO FOR CENTERING LINES (fait
% initialement pour la documentation de mes autres paquetages etoc et xint)

% 7 mars 2013
% This macro allows to conveniently center a line inside a paragraph and still
% use therein \verb or other commands changing catcodes.
% A proposito, the \LaTeX \centerline uses \hsize and not \linewidth ! 
% (which in my humble opinion is bad)

% \ignorespaces ajouté le 9 juin. Cela m'aurait évité des dizaines de % lorsque
% plusieurs \centeredline se suivent (car on reste en mode horizontal si on y
% est au début).

\makeatletter
\newcommand*\centeredline {%
      \ifhmode \\\relax
        \def\centeredline@{\hss\egroup\hskip\z@skip\ignorespaces }%
      \else 
        \def\centeredline@{\hss\egroup }%
      \fi
      \afterassignment\@centeredline
      \let\next=}
\def\@centeredline 
    {\hbox to \linewidth \bgroup \hss \bgroup \aftergroup\centeredline@ }
\makeatother

\DeclareRobustCommand\cs[1]% j'utilisais avant 189, j'ai essayé 23
        {{\ttfamily\hyphenchar\font=127 \char`\\#1}}
\DeclareRobustCommand\csb[1]%
        {\hyperref[#1]{\ttfamily\hyphenchar\font=127 \char`\\#1}}

\newcommand*\blueit[1]{\texorpdfstring{\blueitaux #1\relax}{#1}}
\def\blueitaux #1#2\relax{\hyperref[#2]{\ttfamily #1#2}}

% 2 septembre 2013, 22:25
% je réussis avec un minimum de modifs dans la source à convertir tous mes
% mots-clés bleus en hyperliens; les labels sont créés simplement en modifiant
% plus loin \@jfendshrtverb
\catcode`\§=13
\makeatletter
\def§{\begingroup
           \let\do\@makeother\dospecials
      \@jfendshrtverb }
\def\@jfendshrtverb #1#2§{\hyperref[#2]{\ttfamily\hyphenchar\font=127 #1#2}\endgroup}
\makeatother

\newcommand\mst{%
\texorpdfstring{{\color{joli}\ttfamily\bfseries mathastext}}
{mathastext}\xspace}

\let\oldexists\exists\let\oldforall\forall

\usepackage[italic,subdued,asterisk,defaultmathsizes,symbolmisc,symbolre,
LGRgreek]{mathastext}

\Mathastext[italic]
\MTlettershape{\updefault}
\Mathastext[upright]

\MTupgreek
\MTgreekfont{cmtt}
\MTDeclareVersion[n]{lmvtt}{T1}{lmvtt}{m}{n}

\MTlettershape{\itdefault}

\usepackage{newcent}
\Mathastext[newcent]
\MTseries{b}
\Mathastext[boldnewcent][bold]

\MTseries{m}
\MTitgreek\MTupGreek
\MTgreekfont{txr}
\usepackage{times}
\Mathastext[times]
\MTlettershape{\updefault}
\MTseries{bx}
\Mathastext[timesbold][bold]

\MTlettershape{\itdefault}
\MTseries{m}
\usepackage[scaled]{helvet}
\renewcommand\familydefault\sfdefault
\MTgreekfont{cmss}
\Mathastext[helvet]

\usepackage{etoc}

% - à partir de 1.3j: _très très_ peu satisfaisant mais pas envie d'y passer
% du temps.
%
% - je refais très vite pour 1.3q: \RLNote remplace \RightNote et est fait
% différemment, \CHANGED aussi a été refait. Finalement 1.3r utilise ttfamily.

\def\RLNote #1#2{\leavevmode\strut\vadjust{\kern-\dp\strutbox
 \hbox to\textwidth
  {\vtop to \dp\strutbox{}%
   \footnotesize\normalfont\ttfamily
   \color{magenta}%
   \llap{\smash{#1\kern10pt}}\kern\textwidth\rlap{\smash{\kern10pt(#2)}}%
  }%
 }%
}

\def\RightNote {\RLNote {}}

% modifié pour la doc de 1.3q. Bordel de Koma-Script. Il utilise des em.
% À droite je vais normaliser à 10pt pour que ça soit coordonné avec \RightNote.
% refait pour 1.3r
% ** À utiliser au tout début d'une footnote **
\def\CHANGED #1{\leavevmode\kern-1em
 {\ttfamily\color{magenta}\llap{changed:\kern10pt}%
  \kern\textwidth\rlap{\kern10pt(#1)}\kern-\textwidth}%
 \kern1em }

% pour 1.3q
% attention que doc.sty n'utilise pas \@noligs
% or upquote ne patche que \@noligs
\usepackage{textcomp}
\begingroup\makeatletter
  \catcode`'=\active
  \catcode``=\active
  \g@addto@macro\verbatim@nolig@list{\let'\textquotesingle\let`\textasciigrave}
\endgroup

% KOMA-script est HORRIPILANT.
\def\rm {\normalfont}
\def\bf {\normalfont\bfseries}
\def\tt {\normalfont\ttfamily}
% mais bon, en fait je ne les utilise pas.

\begin{document}
\MTversion{normal}
\renewcommand\familydefault\sfdefault
\pdfbookmark[1]{Title page}{TOP}

\frenchspacing

\begin{center}
  {\normalfont\LARGE The \mst  package}\\
\textsc{\small Jean-François Burnol}\par
  \footnotesize \ttfamily 
  jfbu (at) free (dot) fr\par
  \let\thefootnote\empty
  Package version: \MSTpkgversion\ (\MSTpkgdate)%
  \footnote{Documentation generated from the
    source file with \dtxtimestamp.}\par
\end{center}
\setcounter{footnote}{0}


 \begin{small}
   \noindent The \mst package changes the fonts which are used in math
   mode for letters, digits and a few other punctuation and symbol signs
   to replace them with the font as used for the document text. Thus,
   the package makes it possible to use a quite arbitrary font without
   worrying too much that it does not have specially designed
   accompanying math fonts. Also, \mst provides a simple mechanism in
   order to use more than one math-as-text font in the same
   document.\baselineskip.9\baselineskip\par
 \end{small}

\medskip

\begin{verbatim}
          `mathastext' is a LaTeX package

              \usepackage{mathastext}

          The document will use in math mode the text font
          as configured at package loading time, for these
          characters:

              abcdefghijklmnopqrstuvwxyz
              ABCDEFGHIJKLMNOPQRSTUVWXYZ
              0123456789
              !?,.:;+-=()[]/#$%&<>|{}\

          The command \MTsetmathskips allows to set up extra
          spacings around each given letter.

          Use multiple \Mathastext[name]'s to define in the
          preamble various math versions using each a given
          text font, to be later activated in the document  
          body via the command \MTversion{name}.

          With the subdued option, mathastext will be active
          only inside such math versions distinct from the
          normal and bold.

          Main options: italic, defaultmathsizes, subdued,
                        asterisk, LGRgreek.
\end{verbatim}

\clearpage

\etoctoclines
\renewcommand\etocaftertitlehook
   {\hypersetup{hidelinks}% added 1.3
      \setlength{\columnseprule}{.4pt}%
      \renewcommand{\columnseprulecolor}{\color{DarkMagenta}}%
      }
\renewcommand\etocbelowtocskip{1ex}
\etocruledstyle{\color{DarkMagenta}\normalfont\large\bfseries\contentsname }
% pdfbookmark added 2013/12/11. Attention si je le mets dans ruled style
% il est exécuté deux fois et ça cause un problème.
% et le aftertitlehook est trop bas.
\pdfbookmark[1]{Table of contents}{MAINTOC}
\tableofcontents
{\color{DarkMagenta}\hrule}%
\vskip 5ex plus 2ex minus 1ex


\section{What \mst does}

For changes see \autoref{sec:changelog}.

\subsection{Examples}

\mst's basic aim is to have the same font for text and mathematics. With
hundreds of free text fonts packaged for \LaTeX{} and only a handful of
math ones, chances are your favorite text font does not mix so well with
the available math ones; \mst may then help. Note that \mst was initially
developed for the traditional \TeX{} fonts and engines, and that compatibility
with Unicode engines and OpenType fonts is partial.

Here is an example with
Latin Modern typewriter proportional:

{\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth
 \MTversion{lmvtt}
Let $(X,Y)$ be two functions of a variable $a$. If they obey  the differential
system  $(VI_{\nu,n})$: 
  \begin{align*} 
  a\frac{d}{da} X &= \nu
  X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\  
a\frac{d}{da} Y &= -(\nu+1) Y
 + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} 
  \end{align*}
then the quantity $q = a \frac{aX+Y}{X+aY}$
satisfies as function of $b= a^2$  the $P_{VI}$ differential equation:
\begin{equation*}
\begin{split}
  \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1}
  +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1}
  +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta
    b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta
    b(b-1)}{(q-b)^2}\right\}
\end{split}
\end{equation*}
with
parameters
$(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2,
\frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par
}
Notice that the Latin (and Greek letters) are in upright shape. But perhaps we
insist on obeying the standardized habits:


{\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth
\MTversion{times}
Let $(X,Y)$ be two functions of a variable $a$. If they obey  the differential
system $(VI_{\nu,n})$: 
  \begin{align*} 
  a\frac{d}{da} X &= \nu
  X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\  
a\frac{d}{da} Y &= -(\nu+1) Y
 + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} 
  \end{align*}
then the quantity $q = a \frac{aX+Y}{X+aY}$
satisfies as function of $b= a^2$  the $P_{VI}$ differential equation:
\begin{equation*}
\begin{split}
  \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1}
  +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1}
  +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta
    b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta
    b(b-1)}{(q-b)^2}\right\}
\end{split}
\end{equation*}
with
parameters
$(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2,
\frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par
}

  This was typeset using the Times font (available in any \TeX{}
  distribution). Let us now be a bit more original and have our mathematics
  with italic letters from the sans serif font Helvetica, while the letters in
  text use New Century Schoolbook.


{\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth
\MTversion[newcent]{helvet}
Let $(X,Y)$ be two functions of a variable $a$. If they obey  the differential
system $(VI_{\nu,n})$: 
  \begin{align*} 
  a\frac{d}{da} X &= \nu
  X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\  
a\frac{d}{da} Y &= -(\nu+1) Y
 + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} 
  \end{align*}
then the quantity $q = a \frac{aX+Y}{X+aY}$
satisfies as function of $b= a^2$  the $P_{VI}$ differential equation:
\begin{equation*}
\begin{split}
  \frac{d^2 q}{db^2} = \frac12\left\{\frac1q+\frac1{q-1}
  +\frac1{q-b}\right\}\left(\frac{dq}{db}\right)^2 - \left\{\frac1b+\frac1{b-1}
  +\frac1{q-b}\right\}\frac{dq}{db}\\+\frac{q(q-1)(q-b)}{b^2(b-1)^2}\left\{\alpha+\frac{\beta
    b}{q^2} + \frac{\gamma (b-1)}{(q-1)^2}+\frac{\delta
    b(b-1)}{(q-b)^2}\right\}
\end{split}
\end{equation*}
with
parameters
$(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2,
\frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par
}

And after all that, we may wish to return to the default math typesetting (let's
shorten the extract here in case the reader makes an indigestion \dots):

{\advance\leftskip.1\linewidth\advance\rightskip.1\linewidth
Let $(X,Y)$ be two functions of a variable $a$. If they obey  the differential
system  $(VI_{\nu,n})$: 
  \begin{align*} 
  a\frac{d}{da} X &= \nu
  X - (1 - X^2)\frac{2n a}{1 - a^2}\frac{aX+Y}{1+a XY} \\  
a\frac{d}{da} Y &= -(\nu+1) Y
 + (1 - Y^2)\frac{2n a}{1 - a^2}\frac{X+aY}{1+a XY} 
  \end{align*}
then the quantity $q = a \frac{aX+Y}{X+aY}$
satisfies as function of $b= a^2$  the $P_{VI}$ differential equation with
parameters
$(\alpha,\beta,\gamma,\delta) = (\frac{(\nu+n)^2}2,
\frac{-(\nu+n+1)^2}2, \frac{n^2}2, \frac{1 - n^2}2)$.\par
}

  \vskip\baselineskip Notice that the Greek letters also changed
  according to the \emph{math version}: \mst has indeed some (limited)
  capabilities to this effect, with its §LGRgreek§ option. This
  document uses the |LGR| encoded fonts |cmtt|, |cmss|, and |txr|,
  which are part of standard \TeX{}
  distributions.\footnote{The first two are available (with no need to
  load explicitly any package in the document) via the combination
  |cbfonts| (|cbgreek-complete|) \& |babel|, and the |LGR| encoded |txr| font
  (again no package loading is necessary) is part of the files of the
  |txfontsb| package.}

% \href{http://mirrors.ctan.org/help/Catalogue/entries/cbgreek-complete.html}{cbfonts},
% \href{http://mirrors.ctan.org/help/Catalogue/entries/txfontsb.html}{txfontsb}.

\subsection{Overview}

\subsubsection{Basic use}

The initial ideology of \mst was to produce mathematical texts with
a very uniform look, not separating math from text as strongly as
is usually done. 

As soon as one tries out other fonts for text than the Computer Modern
ones one realizes how extremely ``thin'' are the default \TeX{} fonts
for mathematics: they definitely do not fit well visually with the
majority of text fonts. With \mst one can get one's (simple\dots{} or
not) mathematics typeset in a manner more compatible with the text,
without having to look for an especially designed font.

Here is a minimal example of what may go into
the preamble:
\begin{verbatim}
\usepackage[T1]{fontenc}
\usepackage{times}
\usepackage[italic]{mathastext}
\end{verbatim}
The package records which font is set up for text, at the time it is
loaded,\footnote{alternatively it is possible to configure the text font after
  loading \mst, and then the command \cs{Mathastext} will accomplish the
  necessary changes to the font for letters, digits and a few extra ascii
  symbols in math mode.} and
then arranges things in order for this text font to be used in math mode as
well. So, with the preamble as above
all letters, digits, and punctuation signs inside math mode will then be
typeset in Times.\footnote{let's do as if we did not know the excellent
  |txfonts| package which employs Times for text and has a very complete
  math support, including many additional mathematical glyphs in
  comparison to the CM fonts.} The exact list of characters concerned by
\mst is a subset of the basic |ASCII| set:

  \begin{framed}\centering\MTversion{timesbold}%
    \begingroup\color{joli}%
      $abcdefghijklmnopqrstuvwxyz$\par
      $ABCDEFGHIJKLMNOPQRSTUVWXYZ$\par
      $0123456789$\par
      \DeleteShortVerb{\|}% global!
      ${!}\,{?}\,{*}\,{,}\,{.}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,
       {[}\,{]}\,{/}\,{\#}\,{\$}\,{\%}\,{\&}\,{<}\,{>}\,{|}\,{\{}\,{\}}
       \textrm{ \color{black}\mdseries and }{\backslash}$%
   \endgroup\par\MakeShortVerb{\|}%
  \end{framed}

As one can see, this is a very limited list! some possibilities are offered by
\mst for Greek letters and will be described later. 

The text characters {}'{} and  {}-{} are not used, and the asterisk is
done optionally:
\begin{itemize}
\item the derivative sign ${}'$ is left to its default as the text font
  glyph {}'{} is not, as a rule, a satisfying alternative.\footnote{|v1.2| adds
 a customizable tiny space before ${}'$ to separate it from the previous
 letter, this is really needed when using upright letters in math mode with
 the CM derivative glyph.{\MTversion{upright}\sffamily\MTprimeskip{.5mu}%
   Compare $f'$ with \MTprimeskip{0mu}$f'$.} }
\item   for the minus sign \mst uses the endash character
  \textendash, if available, and not the hyphen character -.%
%
\footnote{see the §unicodeminus§ option if using an OpenType font.}
%
\item the §asterisk§ option is mandatory for \mst to replace the binary math
  operator $*$ (and the equivalent control sequence \cs{ast}) with a version
  which uses the text asterisk * suitably lowered\footnote{the amount of
    lowering can be customized.} (and with the correct spaces around it as
  binary operator). The reason is that after this inputs such as |$R^*$|
  or |$R^\ast$| raise errors and \emph{must} be written |$R^{*}$| or |$R^{\ast}$|.
\end{itemize}

Nothing is changed to the ``large'' math symbols, except for
$\MToriginalprod$ and $\MToriginalsum$ in inline math which, like here:
$\prod\sum$, will be taken from the Symbol Font if option §symbolmisc§
was used. 

The left and right delimiters are taken from
the text font only for the base size: any |\big|, |\bigl|, |\bigr|,
etc\dots reverts to the original math symbols. 


\subsubsection{always load \mst last}

The ``large'' math symbols are not modified in any way by \mst. Only loading
some math font packages such as |fourier|, |kpfonts|, |mathabx|, |mathdesign|,
|txfonts|, |newtxmath|, etc\dots{} will change them. Think of loading these
packages before \mst, else they might undo what \mst did.

More generally any package (such as |amsmath|) dealing with math mode should be
loaded \emph{before} \mst.

\subsubsection{sans in math}

The following set-up often gives esthetically pleasing results: it is to
use the sans-serif member of the font family for math, and the serif for
text. 
\begin{verbatim}
\renewcommand\familydefault\sfdefault
\usepackage{mathastext}
\renewcommand\familydefault\rmdefault
\begin{document}
\end{verbatim}

\subsubsection{using \mst with \texttt{beamer}}\label{ssec:beamer}

%\noindent\llap{\textcolor{green}{\bfseries 2015/02/26}\hspace{1em}}

Starting
with release |3.34| of |beamer|, \mst is recognized as a ``math font package''.

\emph{Only with \emph{{\bfseries earlier} |beamer| versions} is it necessary to issue}
\centeredline{|\usefonttheme{professionalfonts}|}
\emph{in the preamble.} Example:

\begin{verbatim}
\documentclass{beamer}
%\usefonttheme{professionalfonts}% obsolete for mathastext since beamer 3.34
\usepackage{newcent}
\usepackage[scaled=.9]{helvet}
\renewcommand{\familydefault}{\rmdefault}
\usepackage[defaultmathsizes,symbolgreek]{mathastext}
\renewcommand{\familydefault}{\sfdefault}
\begin{document}
\begin{frame}
  This is some text and next comes some math: $E=mc^2$
  \[
  E=mc^2=a^n+b^n-c^n=\alpha\beta\gamma
  \]
  \begin{align}
    E&=mc^2\\
    E&=h\nu
  \end{align}
  And again some text.
\end{frame}
\end{document}
\end{verbatim}

\subsubsection{option \blueit{LGRgreek}}

  There is the issue of Greek letters. Sometimes the text font has
  Greek glyphs, in |LGR| encoding (this will be mentioned in the
  documentation of the font package). Then option §LGRgreek§ tells
  \mst to pick up these Greek letters. And it is possible to specify
  whether the Greek letters should be upright, or
  ``italic''.%
%
\footnote{the default CM and its replacement Latin Modern for european
  languages are (transparently to the user) extended with |LGR|
  encoded fonts from the |cbfonts| (|cbgreek-complete|)
  package.} 

It is naturally possible to leave the
  responsability to set up Greek letters to some other packages
  loaded previously to \mst. And even if \mst has been loaded with one of its
Greek related options the command §\MTstandardgreek§ will locally cancel its
customization of Greek letters. See also §\MTcustomgreek§.

  % \href{http://mirrors.ctan.org/help/Catalogue/entries/cbgreek-complete.html}{cbfonts}

\subsubsection{avoid \texorpdfstring{\texttt{OT1}}{OT1} encoding}

  We specified in our minimal working example a |T1| encoding (|LY1| would
  have been ok, too) because the default |OT1| does not have the
  {\color{joli}\DeleteShortVerb{\|}
  $\mathord{<}\,\mathord{>}\,\mathord{|}$\,\{\,\}} and
  {\color{joli}$\backslash$\MakeShortVerb{\|}} glyphs. If
  \mst detects |OT1| as the default encoding it will leave these characters to
  their defaults from the math fonts.\footnote{the §subdued§ option, described next,
  acts a bit otherwise, it forces, contrarily to its usual low-key character,
  the replacement of |OT1| by |T1| for the fonts ultimately used with letters
  and digits in math mode.}
\begin{framed}
  If \mst detects the obsolete |OT1| encoding it does not do anything with
  \DeleteShortVerb{\|}<, >, |, \{, and \} which (except for monospace fonts)
  are not available in that encoding.\MakeShortVerb{\|}
   To fully benefit from \mst it is
  recommended to use some other encoding having these glyphs such as |T1| or
  |LY1|.
\end{framed}

\subsection{Main options}

   \subsubsection{The \blueit{italic} option}

In the initial version |1.0|, the Latin letters in
mathematical mode assumed the exact same shape as in
text mode, and this meant, generally speaking, that
they would turn up upright. Doing this gives a very
uniform look to the document, so that one has to make
an effort and read it with attention, and this was
one of the design goals of \mst.

Nevertheless, soon after I posted the initial version
of the package to CTAN, I was overwhelmed by
numerous\footnote{this means ``more then one.''}
questions\footnote{I thank in particular
\textsc{Tariq~Perwez} and \textsc{Kevin~Klement} for
their kind remarks (chronological order).}  on how to
have the letters be in italic shape.

The default is still, as in version |1.0|, for everything to be in
upright shape, but it suffices to pass to the package the option
§italic§\RightNote{1.1} to have the Latin letters in math mode in italic
shape.\footnote{more precisely stated, the value of \cs{itdefault}
is used.} There is also an option §frenchmath§ to make the
uppercase letters nevertheless upright, because this is the way of
traditional French mathematical typography.\footnote{more precisely
stated, the value of \cs{shapedefault} is used.}


\subsubsection{The \blueit{defaultmathsizes} option}

The default sizes give for subscripts of subscripts barely legible glyphs
(author's opinion!). So \mst makes more reasonable choices. It  also
redefines \cs{Huge} and defines a \cs{HUGE} size, copied from 
the |moresize| package. To cancel all of this use option
§defaultmathsizes§.

\subsubsection{The \blueit{subdued} option}\label{sec:subdued}

This option was introduced in |v1.15|.\RightNote{1.15} It provides a manner to
switch on the \mst-\emph{ification} only for limited portions of
the document, with the help  of the mechanism of math versions. Without the
§subdued§ option, the \emph{mathastextification} applies by default
to the whole of the document (and one may also define additional
math versions in the preamble); with the §subdued§ option the
\emph{mathastextification} is done only in \emph{math versions} distinct from
the standard and bold ones.

Despite some limitations I will now partially describe, the §subdued§ option
has its utility, as I think is illustrated enough by the examples given at the
start of this document and it works reasonably well.

\begin{framed}
  \mst was not written initially in order to allow its action to
  be completely canceled. It does not store (all) mathcodes nor
  does it set them (all) when changing math versions; only that would
  allow a perfect subdued mode (and \LaTeX\ is rather obstinate in
  making that tricky or at least uneasy if sticking to its
  official interface to math mode, as it is almost entirely
  preamble only).

  Releases |1.3t| and |1.3u| do this kind of things to maintain
  usability across multiple \mst-ified math versions of characters
  which are obviously font encoding dependent such as the minus
  sign as en-dash (or unicode minus), the dotless i, the |\hbar|,
  the text accents.

  But this should be extended to all \mst-ified characters which
  basically would amount to an extensive rewrite of large legacy
  portions of the code. Currently the support for the |subdued|
  mode and to multiple math versions amounts to some kind of a
  kludge, added to an initial design which handled a single unique
  text font.
\end{framed}

To get the displayed math
(almost) as if \mst had not been loaded, one must also
use the option §defaultmathsizes§. But this does not quite suffice,
as, for example, the colon, the dot, and the minus sign belong
in the default \LaTeX{} math mode set-up to three distinct fonts
whereas \mst will pick (even subdued) the three of them in the same
font,%
\footnote{\CHANGED{1.3t}The minus sign is now perfectly subdued,
because its original mathcode is stored and restored; this was only
way to handle the case with Unicode engines
where the math operator font is in a classic
\TeX\ encoding, but the minus sign is configured by \mst to use a Unicode
en-dash or minus character in non-subdued math versions.}
%
and although it will make a reasonable choice of this font,
this is not an exact re-installement of the previously prevailing situation. And
then other packages could have done arbitrary things regarding character
mathcodes, so to
be on the safe side one needs the §basic§ option which limits the
mathastextification to letters and digits.%
%
\footnote{\CHANGED{1.3d}The §subdued§ mode does extinguish
in the normal and bold math versions the action of options §selfGreek§,
§eulergreek§, and §symbolgreek§ (previously only §LGRgreek§ was
subdue-able).}
\footnote{\CHANGED{1.3t}The \texttt{\string\imath} and
\texttt{\string\jmath} now obey the subdued regime.}
\footnote{\CHANGED{1.3u}Also \texttt{\string\hbar} 
and the math accents (see §mathaccents§ option) obey the subdued regime.}
%
Even then, in some circumstances, this
may not suffice: for example the \emph{euler} package puts
the digits in the same font as the Latin letters in math mode, but
the subdued \mst will pick them up in the same font as used for
operator names, which for example in the case of the \emph{euler} package, is
the main document font.




\subsection{Math versions}\label{sec:mathversions}

\LaTeX{} has the concept of \emph{math versions}, but most font packages
do not define any such version beyond the default normal and bold (that
they possibly customize to use such or such math font). The package
|unicode-math| for unicode engines fruitfully uses this concept. \mst
uses math versions in order to allow the math mode fonts (for letters,
digits, punctuation and a few other ascii symbols) used in the different
parts of the document to be kept in sync with the text fonts. However
the other math symbols (sums, products, integrals, logical signs,
etc\dots) will be the same throughout the document as it is not in \mst
power to modify them. There are some possibilities to use different sets
of fonts for the Greek letters, though.

The present document illustrated the use of various fonts, here is its
preamble (slightly stripped-down):
\begin{center}
  \begin{minipage}{.8\linewidth}
\begin{verbatim}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[subdued,italic,defaultmathsizes]{mathastext}
\MTDeclareVersion[n]{lmvtt}{T1}{lmvtt}{m}{n}
\usepackage{newcent}
\Mathastext[newcent]
\usepackage{times}
\Mathastext[times]
\usepackage[scaled]{helvet}
\renewcommand\familydefault\sfdefault
\Mathastext[helvet]
\begin{document}\MTversion{normal}
\end{verbatim}
  \end{minipage}
\end{center}
Let us examine this code: it uses once the command §\MTDeclareVersion§
and three times the command §\Mathastext§, thus defining four 
|math versions|\footnote{|math versions| are discussed in the document
|fntguide.pdf| from your \TeX{} distribution.}: |lmvtt|, |newcent|,
|times|, and |helvet|. The names can be taken arbitrarily (they only
need to be suitable arguments to the \LaTeX{} \cs{DeclareMathVersion}
command which is invoked internally). Two
additional math versions preexist: the |normal| and |bold|, which,
because there was the §subdued§ option, were left untouched by \mst.

Once these |math versions| are defined, §\MTversion§|{name_of_version}|, or
equivalently §\Mathastextversion§|{name_of_version}|, enacts the font switches
in the body of the document. As is usual with \LaTeX{} one can limit the scope
to the inside of a group, or also switch back to the main set-up through issuing
\cs{Mathastextversion\{normal\}}.

When \cs{Mathastext} is used in the preamble, it records the current font
defaults and (except for the |normal| and |bold| versions under the §subdued§
regime) sets up the math font to be used in that version to be the text font
as found in \cs{familydefault}. But it is still possible for a \mst-declared
math version to have distinct fonts for text and math:
\begin{enumerate}
\item in the body of the \TeX{} source, an optional argument (the name
  of a \mst-declared math version) to \cs{MTversion} is allowed, and
  for example we used in the source of this document
  \cs{MTversion[newcent]\{helvet\}} meaning ``New Century Schoolbook
  for the text and Helvetica for the math.''
\item there are preamble-only commands \cs{MTencoding}, \cs{MTfamily},
  \cs{MTseries}, \cs{MTshape}, \cs{MTlettershape} which tell \mst what
  to do (for math \emph{only}) in each math version declared
  \emph{afterwards}, independently of the text fonts.
\end{enumerate}

The native \LaTeX{} command
\cs{mathversion}\marg{version\_name} would change only the fonts used in math
mode. It is important to use rather the package command
\csb{MTversion} (or one of its synonyms \cs{mathastextversion},
\cs{Mathastextversion}, \cs{MTVersion}), with its mandatory argument
\marg{version\_name}, as it does additional actions:
\begin{itemize}
\item it sets the font for math mode (letters, math operator names, digits,
  punctuations, some other symbols) according to the version name given as
  mandatory argument,
\item it resets the text font of the document and the
  |\(family,rm,sf,...)default|s to their values as registered at the time of
  definition of the version. \emph{Use the starred variant in case this is not
    desired.} It is possible to also specify within brackets an extra optional
  version name, and the text font will be set according to it.
\end{itemize}
For all math versions if not using the §subdued§ option, or only
for the non-\emph{normal} and non-\emph{bold} math versions if
using the §subdued§ option, \cs{MTversion} does further additional tasks:
\begin{itemize}
\item it resets\RLNote{NEW FEATURE!}{1.3u} the §\hbar§, \cs{imath}
  (see §\inodot§), \cs{jmath}, math accents (see option
  §mathaccents§) and minus sign as en dash according to the used
  font encoding for the \mst-ified text font,
\item (see sections \ref{sec:mathskips} and \ref{sec:ic}) it re-issues the
  command §\MTmathactiveletters§ to let a to z, A to Z, be mathematically
  active in order to automatically insert the skips as defined by the user
  with §\MTsetmathskips§, and the italic corrections (if the font is not
  italic or slanted),
\item (see section \ref{sec:extraskips}) it resets the extra spaces after the
  symbols $\exists$, $\forall$ and before the derivative ${}'$ to the values as
  decided by the user in the preamble on a \emph{per version} basis,
\item (see section \ref{sec:mathxx}) it re-issues the commands
  §\MTmathoperatorsobeymathxx§ and §\MTeasynonlettersobeymathxx§  to let
  the math operator names and (`easy') non letter characters obey the math
  alphabets,
\item in case of option §asterisk§, it re-issues §\MTactiveasterisk§,
\item it does the additional set-up for Greek letters in case of the package
  received one of the Greek related options.
\end{itemize}
The scope is limited to the current \LaTeX{}
environment or group.
%  When switching to the \emph{normal} or \emph{bold} math
% versions under option §subdued§ most of the above is canceled.


It is sometimes not compatible with \mst to load a font package after it, as the
font package may contain instructions which will modify the math set-up. This
may be a bit hidden to the user: for example the |epigrafica| package loads
|pxfonts|. Hence it will interfere with \mst if it is loaded after
it.\footnote{may typically give a `too many math alphabets' error message.} But
one can use instead |\renewcommand{\rmdefault}{epigrafica}|,\footnote{sometimes
  one needs to look in the |.sty| file of the font package to figure out the
  font name (it is rarely as |epigrafica|, the same as the package name), and,
  if one does not know the arcanes of finding |.fd| files in one's \TeX{}
  distribution, one should look at the log file of a test document to see if for
  example |T1| is available for that font; for |epigrafica| it is not, only
  |OT1| and |LGR| are possible.} followed with \cs{Mathastext}, or also
|\MTfamily{epigrafica}\Mathastext| which will only change the font in math.

To use |epigrafica| for Greek in math mode one can use the
package option §LGRgreek§ and the command
|\MTgreekfont{epigrafica}\Mathastext|. Or
\cs{usepackage}|{epigrafica}| followed with
|\usepackage[LGRgreek]{mathastext}|.

\subsection{Extra spaces around letters}
\label{sec:mathskips}

This is a new feature added with release |1.3|: the command §\MTsetmathskips§
allows the user to set up some spaces (more precisely, `mu glue'; but stretch
and shrink are discarded) to be
automatically inserted around the letters in math mode. Some (very) unrealistic
uses:
\begin{verbatim}
% this may be anywhere in the document (also within a math group):
\MTsetmathskips{x}{20.33mu}{15.66mu}% 20.33mu before all x's and 15.66mu after.
\MTsetmathskips{y}{\thickmuskip}{\thickmuskip}%
\MTsetmathskips{z}{10mu}{5mu}% stretch and shrink are anyhow without effect.
\MTsetmathskips{A}{\muexpr \thickmuskip*2}{\muexpr \medmuskip-\thinmuskip/2}%
\end{verbatim}
Here is what |$wxtytz^{wxtytz}=BAC^{BAC}$| then gives using the Times font: 
\begingroup
\MTsetmathskips{x}{20.33mu}{15.66mu}%
\MTsetmathskips{y}{\thickmuskip}{\thickmuskip}%
\MTsetmathskips{z}{10mu}{5mu}%
\MTsetmathskips{A}{\muexpr \thickmuskip*2}{\muexpr \medmuskip-\thinmuskip/2}%
\MTversion{times}%
$wxtytz^{wxtytz}=BAC^{BAC}$.\endgroup{} Any \TeX{} group or \LaTeX{} environment
limits as usual the scope of this command. Furthermore the command
§\MTunsetmathskips§ cancels previous use of \cs{MTsetmathskips} for a given
letter.

The implementation relies on the `mathematical activation' of letters, which is
done by default by the package since release |1.2b|. Should this cause
compatibility problems, the command §\MTmathstandardletters§ cancels it
entirely. To reactivate it, there is §\MTmathactiveletters§. Note that
\cs{MTmathactiveletters} is done automatically by \mst when loaded, and also
each time the package enhanced math-version-switch command §\MTversion§ is used,
except for the normal and bold math versions under the §subdued§ option.

% Earlier this `mathematical activation' of letters had been used by the package
% only to add automatically italic corrections, as described in the next
% section.

\begin{framed}
  The extra skips are set at natural width; they do not contribute to the
  overall stretchability or shrinkability of the math formula and do not
  create break points. 

  \textcolor{magenta}{\bfseries Changed with |1.3i|}: they are \emph{not}
  applied within the scope of math alphabet commands.
\end{framed}

\subsection{Italic corrections}
\label{sec:ic}

{\small Note: this is somewhat technical discussion which may well be skipped in
  its entirety on first reading.\par}

\begingroup
\fboxsep0pt\fboxrule.1pt

With the §italic§ option the letters in math will be generally in italic shape
(and, normally, upright in operator names).

For the built-in placement routines of \TeX{} in math mode to work as well as
they usually do, the characters from the math italic font obviously should have
their bounding boxes wide enough for the glyphs not to collide with other
symbols. A letter from a text italic font  such as \emph{f} 
extends way out of its declared bounding box; let us
compare the bounding boxes\footnote{let's be honest, we are lying here about
  what exactly the first of these is bounding; this is explained later!} for the
letter $f$ in the math italic font to the one from the text italic font:
\fbox{$f$} vs. {\itshape\fbox{f}}.

This could make us think that attempting to use in math a text italic font will
lead to disaster. Well, surprisingly the situation is not that bad. Sure
|$f(x)$| is wider with the standard math italic \fbox{$f(x)$}
(\setbox0=\hbox{$f(x)$}\texttt{\the\wd0}) than it is with the text italic font
used in math:\footnote{we used simply \texttt{\$\string\mathit\{f(x)\}\$}.}
\fbox{$\mathit{f(x)}$} (\setbox0=\hbox{$\mathit{f(x)}$}\texttt{\the\wd0}) but we
should be surprised that our text italic {\itshape f} did not end up even closer
to the opening parenthesis. Why is it so?

The explanation is that \TeX{} uses in such a situation the \emph{italic
  correction} for the letter {\itshape f}. The italic correction also exists and
is used for the math italic font, it was inserted in |$f$| without us having to
ask anything. Its value is \texttt{1.17865pt} for the math italic $f$ and
\texttt{1.8919pt} for the text italic \emph{f}.\footnote{these values are for
  the Latin Modern fonts of course.} With the italic corrections included our
bounding boxes are indeed more alike: \fbox{\usefont{OML}{lmm}{m}{it}f\/} vs
\fbox{\itshape f\/}.

Without the italic corrections\footnote{here we give correctly the bounding box
  for the math italic $f$... without its italic correction!} it is
\fbox{\usefont{OML}{lmm}{m}{it}f} 
vs \fbox{\itshape f}. I said that |$f$| included the italic correction
automatically, 
but if we  tell \TeX{} to use the text italic in math, and typeset the alphabet,
we obtain something exactly identical to typing the letters in text, hence
without any italic
correction:\par
{\leftskip2cm\rightskip5cm%
  \noindent{\itshape abcdefghijklmnopqrstuvwxyz}\hfill\rlap{\texttt{text italic
      in text}}\break $\mathit{abcdefghijklmnopqrstuvwxyz}$\hfill
\rlap{\texttt{text italic in math}}\break
$abcdefghijklmnopqrstuvwxyz$\hfill
\rlap{\texttt{math italic in math}}\break
  {\usefont{OML}{cmm}{m}{it}abcdefghijklmnopqrstuvwxyz}\hfill 
\rlap{\texttt{math italic in text}}\par} 
Where are our italic corrections gone? the last line
was done with \cs{usefont\{OML\}\{lmm\}\{m\}\{it\}} and confirms that italic
corrections have been used for the math italic in math.

Turning to the \TeX book (and its Appendix G) we learn that in such
circumstances, for the italic corrections to be put in from the font, one of its
parameters, the interword space (aka \cs{fontdimen2}), should
be zero. It is indeed zero for the math italic font, not for the text italic.

It is possible to make \TeX{} believe it is. Doing so, we obtain in math mode
with the text italic:\par
{\leftskip2cm\rightskip5cm%
\noindent{\mathastextversion{italic}%
$\xdef\mstrestorefontdimen{\fontdimen2\textfont\symmtletterfont=
\the\fontdimen2\textfont\symmtletterfont}%
\fontdimen2\textfont\symmtletterfont=0pt%
   abcdefghijklmnopqrstuvwxyz$}\hfill\rlap{\texttt{text italic in math}}\break
   $abcdefghijklmnopqrstuvwxyz$\hfill\rlap{\texttt{math italic in math}}\par}


 We saw that the italic correction was taken into acount automatically
 (independently of the value of the interword space font parameter) in
 expressions such as |$f(x)$|. Another clever thing done by \TeX{} is to use it
 for the placement of superscripts; the next examples systematically
 use the text italic in math. We see that
 {\mathastextversion{italic}$\mstrestorefontdimen f^j$} is very different
 from $\hbox{\itshape f}^j$... where the latter was coded with 
|$\hbox{\itshape f}^j$|. The inputs |$\mathit{\hbox{\itshape f\/}^j}$| and
|$\mathit{f^j}$| give almost identical results: \fbox{$\mathit{\hbox{\itshape
      f\/}^j}$}  vs.
 \fbox{$\mathit{f^j}$}. Close examination reveals
 that the horizontal spacing is exactly identical, however the exponent in the
 second case is a bit lower. Anyway, the point is that in the second case the
 italic correction for $\mathit f$ was indeed used.

 Subscripts are another matter: they do \emph{not} take into
 account the italic correction. For example |$\mathit{f_i}$|
 gives the same horizontal positions as
 |$\mathit{\hbox{\itshape f}_i}$|: $\mathit{f_i}$ vs.
 $\mathit{\hbox{\itshape f}_i}$. Printing them one on another
 gives \rlap{$\mathit{f_i}$}$\mathit{\hbox{\itshape f}_i}$ and
 reveals (use the zoom of your viewer!) that only the vertical
 placement was affected, not the horizontal placement.

We learn in Appendix G of the \TeX book that the italic correction is used for
the horizontal shift of the superscript with respect to the position of
the subscript: $\mathit{f_i^j}$, or, 
going back now to the standard math italics $f_i^j$. In the next paragraphs
we use $f_i^i$ for more accurate comparison of the positioning of the sub- and superscript.

If we try something like this: |${f\/}_i^i$| we obtain ${f\/}_i^i$. Our
overlapping game with |\rlap{$f_i^i$}${f\/}_i^i$| gives
\rlap{$f_i^i$}${f\/}_i^i$. We discover that the effect of the explicit italic
correction has mainly been to translate the subscript horizontally to be
positioned exactly below the superscript!\footnote{there are also some tiny
  vertical displacements of the sub- and superscripts.} We most probably do
\emph{not} want this to happen for our indices and exponents in math mode. So
perhaps we can rejoice in how astute \TeX{} has been in judiciously using the
italic correction data, and there seems to be no need into fiddling with this
algorithm which seems to work well even when applied to a text italic font. Actually we may even be of the opinion that the text italic
version $\mathit{f_i^i}$  is a bit better-looking than the
true math italic $f_i^i$ . . .


But wait... \mst was initially developed to easily use in math mode the document
text font not in its italic variant, but as is, so, usually, upright. And
upright \TeX{} fonts may also have italic correction data! And what I just said
about the shift of the superscript with respect to the subscript apply equally
well to such a font, if \TeX{} has been told to use it. Let's try Latin Modern
Upright for letters in math: |$f_i^i$| now gives\footnote{we just use
  \texttt{\$\string\mathrm\{f\_i\^{}i\}\$}.} $\mathrm{f_i^i}$. We see the italic
correction in action for the positioning of the superscript! Compare with
|$\mathrm{\hbox{f}_i^i}$|: $\mathrm{\hbox{f}_i^i}$. Overlapping with
|\rlap{$\mathrm{f_i^i}$}$\mathrm{\hbox{f}_i^i}$| gives
\rlap{$\mathrm{f_i^i}$}$\mathrm{\hbox{f}_i^i}$ and shows that the upright
$\mathrm{f}$ has an italic correction which was used to shift the superscript to
the right (and it is now in a slightly lower position). Let's now do
|$\mathrm{{f\/}_i^i}$|: this gives $\mathrm{{f\/}_i^i}$ and the subscript is
shifted to the right, and is now on the same vertical axis as the superscript.
There are also some slight vertical displacements,
|\rlap{$\mathrm{f_i^i}$}$\mathrm{{f\/}_i^i}$| gives
\rlap{$\mathrm{f_i^i}$}$\mathrm{{f\/}_i^i}$. 

People will tell me crazy, but if we decide for using upright fonts in math,
wouldn't it be satisfying to have the subscript and superscript positioned
on the same vertical axis? the letter has no slant, why should the indices
display one?

We end up in this strange situation that it is attractive to systematically
incorporate the italic corrections after the upright Latin letters in math! But
we don't want to do this inside the arguments to math alphabets as this would
make impossible the formation of ligatures (the standard |$\mathrm{ff}$|,
|$\mathit{ff}$|, |$\mathbf{ff}$|, |$\mathsf{ff}$| all give ligatures
$\mathrm{ff}$, $\mathit{ff}$, $\mathbf{ff}$, and $\mathsf{ff}$ and we would like
to preserve this behavior).
% http://tex.stackexchange.com/questions/35298/error-with-hyperref-tabular-footnotes-in-tabular
% pas le temps aujourd'hui de regarder plus, j'ai déjà rencontré ce problème,
% j'avais peut-être autre chose. Voir aussi
% http://tex.stackexchange.com/questions/6090/clickable-table-footnote

\makeatletter
\begin{framed}\kern-.75\baselineskip
  \begin{framed}
    Starting with version |v1.2b|, \mst adds the italic correction automatically
    after each letter of the Latin alphabet in math mode, \emph{except} when
    these letters are italic or slanted.\footnotemark\par
 \global\let\saved@Href@A\Hy@footnote@currentHref 
    These
    italic corrections are canceled inside the arguments to the math alphabet
    commands, to allow the formation of ligatures as
    is expected in the standard default \TeX{} font set-up in math.%
\footnotemark
 \global\let\saved@Href@B\Hy@footnote@currentHref 
  \end{framed}\vskip-.75\baselineskip
\end{framed}
\addtocounter{footnote}{-1}%
\let\Hy@footnote@currentHref\saved@Href@A 
%
\footnotetext{the situation is rather ironical! by the way, the warnings in
  section \ref{sec:mathxx} with \texttt{\$x\^{}?\$} or similar are less of an
  issue here, because the letter is only \emph{followed} by \texttt{\char92/}
  and anyhow the whole is put by \mst within group braces, so no surprises
  with \texttt{\$x\^{}y\$} or \texttt{\$\char92mathbin x\$}. Nevertheless it
  is still true that (in math mode only) the letters |a-z|, |A-Z|, expand to
  composite objects, something which could surprise other packages. The
  command \csb{MTmathstandardletters} cancels this mechanism.}
%
\addtocounter{footnote}{1}%
\let\Hy@footnote@currentHref\saved@Href@B 
%
\footnotetext{\CHANGED{1.3i}Formerly, italic corrections were added to the
  \cs{mathnormal} arguments.}

\makeatother

The feature-implementing commands §\MTicinmath§, §\MTnoicinmath§,
§\MTicalsoinmathxx§ are described in section \ref{sec:cmds}.
\endgroup

\textbf{\hbox{Note:}} \emph{from brief testing on 2012/12/28, \XeTeX{} seems not
  to obey in math mode italic corrections for OpenType fonts. Hence the \TeX{}
  placement algorithms for math mode described in this section do not work well
  when an OpenType (text) font is used for the letters in math mode, and the
  document is compiled with the \XeTeX{} engine. On the other hand \LuaLaTeX{}
  seems to implement the italic corrections when using OpenType fonts, but only
  with italic fonts (as far as I could tell). Try the following (which will use
  the OpenType Latin Modern font) on a recent \TeX{}
  installation and compare the output of both engines:}\par
\kern-.5\baselineskip
\indent\vbox{\begin{verbatim}
\documentclass{article}
\usepackage{fontspec}
\begin{document}
\Huge
$\mathit{f_i^i}$\par $\mathrm{f_i^i}$
\end{document}\end{verbatim}
\kern-.75\baselineskip}\\%\end{verbatim} FIX DU FONT-LOCKING DE AUCTEX (11.89.6)
\emph{Comment out the} |fontspec| \emph{line and use pdf\LaTeX{}. All
  three outputs are different on my \TeX{} installation. \XeTeX{} does not have
  the italic corrections. \LuaLaTeX{} does, but only for the italic font.
  pdf\LaTeX{} has them for both the italic and the upright font.%
\footnotemark }

\footnotetext {2016/11/04: the situation hasn't changed a iota since,
at least on current TL2016.}

% For more see
% \url{http://tex.stackexchange.com/a/337076} which explores also the differences
% between the two Unicode engines regarding italic corrections in pure text mode.}

\subsection{Extra  glue after \texorpdfstring{\cs{exists}}{\textbackslash
exists}, \texorpdfstring{\cs{forall}}{\textbackslash forall}, and before the prime glyph}
\label{sec:extraskips}

\begingroup\MTversion{upright}\renewcommand\familydefault\sfdefault
\makeatletter % c'est parce que sinon ils sont pris dans Symbol
\let\mst@exists@original\oldexists
\let\mst@forall@original\oldforall
\makeatother

\csb{MTforallskip}, \csb{MTexistsskip}, and \csb{MTprimeskip} are three
commands with each a mandatory argument like for example 
|3mu plus 1mu minus 1mu| or just |2.5mu|. They are especially useful 
when using an
upright font in math mode. {The |mu| is a unit length used in
  math mode (`math unit', 1/18th of the `quad' value of the symbol font
  in the current style). Its value is relative to the current math
  style. Its use is \textcolor{DarkMagenta}{mandatory} in the commands
  described here.}
\begin{itemize}
\item compare $\forall B$ with\MTforallskip{2mu} $\forall B$, typeset after 
|\MTforallskip{2mu}|, 
\item compare $\exists N$ with\MTexistsskip{2mu} $\exists N$, typeset after
|\MTexistsskip{2mu}|, 
\item and finally compare $f'$ with\MTprimeskip{2mu} $f'$, typeset after 
|\MTprimeskip{2mu}|.
\end{itemize}

These three commands may be used throughout the document, or also in the
preamble, in which case the declared math versions will record the then current
values of the skips. \mst applies the following (small) default skips:
|0.6667mu| for the skip after $\forall$, |1mu| for the skip after $\exists$, and
|0.5mu| for the skip before the prime. The examples above become
\MTforallskip{.6667mu}\MTexistsskip{1mu}\MTprimeskip{.5mu}$\forall B$, $\exists
N$ and $f'$.\footnote{the derivative glyph from the |txfonts| math symbols
  adapts itself better to an upright letter, no skip seems to be needed then.}

With the §italic§ option the defaults are set to zero.
\MTversion{italic}\renewcommand\familydefault\sfdefault Indeed
$\forall B$, $\exists N$ and $f'$ look fine without additional skips. If the
document decides then to declare in the preamble a math version with an upright
font it is thus recommended to use the commands in the preamble before the
\cs{Mathastext}\oarg{version\_name} (or \cs{MTDeclareVersion}) command defining
the version. They will be remembered when this math version is entered in the
document. The commands may also be used directly in the document body.

Under the §subdued§ option, the \emph{normal} math version (at the start of
the document body, or after |\MTversion{normal}|) and the \emph{bold} math
version (either at the start of the document body after \cs{boldmath}, or after
|\MTversion{bold}|) do not have any extra skip inserted (even one of zero
width) after $\oldforall$, $ \oldexists$, or before the ${}'$.%
%
\footnote{\CHANGED{1.3j}Formerly, skips of zero widths were inserted.}

\endgroup


\subsection{Extended scope of the math alphabets commands}
\label{sec:mathxx}

\begingroup
\MTversion{italic}\renewcommand\familydefault\sfdefault
% il faudra peut-être que j'annule cette façon qu'à mathastext de tripatouiller
% \familydefault... 
\makeatletter\let\mst@doasterisk\relax\makeatother

Ever since the initial version of the package, some characters usually
unaffected by the math alphabet commands \cs{mathbf}, \cs{mathtt},
\cs{mathsf}\dots{} are declared to be of `variable family type', in order for
them to obey these commands: for example the hash sign $\#$ gives $\mathbf{\#}$
if input as |$\mathbf{\#}$| (\mst, especially in its beginnings, wanted as many
characters as possible to be picked up from the text font and to behave
similarly to letters and digits).

So it was especially frustrating that mathematical characters such as $+$, or
$<$, or $]$ could not be declared of `variable family' (in addition to being
picked up in the text font) as this would, for reasons of the inner workings of
\TeX{}, not be compatible with the automatically inserted spaces around them.

A revolutionary\RightNote{1.2} ;-) novelty is introduced with version |1.2| of the package:
\begin{enumerate}
\item the pre-declared or user-declared (using the |amsmath|
  \cs{DeclareMathOperator} or equivalent) operator names obey the math
  alphabet commands,\footnote{contrarily to the next feature, this one is not
    likely to create incompatibilities with other packages, so it is
    activated by default.}
\item and, \emph{optionally}, all non alphabetical
  characters\footnote{of course some of them are input preceded by a
    backslash, and the backslash itself is input as \cs{backslash}.} treated by
  \mst, \emph{i.e.}, if not disabled by options,
  ${!}\,{?}\,{,}\,{:}\,{;}\,{+}\,{-}\,{=}\,{(}\,{)}\,{[}\,{]}\,{<}\,{>}\,{\{}\,{\}}$,
  the asterisk $*$, and
  $.\,/\,\vert\,\backslash\,{\#}\,{\$}\,{\%}\,{\&}$\footnote{%
    ${\#}\,{\$}\,{\%}\,{\&}$
    obey the math alphabets since the initial version of \mst; the dot
    $.$, the slash $/$, the vertical bar $\vert$ and the backslash
    $\backslash$ do not have specific spacings inserted by \TeX{} around
    them, and the procedure is then not a devilish one, this is why it
    is made the default for these characters which are listed apart. The
    math symbols \cs{mid} (which is $\vert$ with type \cs{mathrel}) and
    \cs{setminus} ($\backslash$ with type \cs{mathbin}) are counted
    among the `difficult' cases, not the `easy non-letters'.} will also obey
  the math alphabet commands (when not used as delimiters). The
  important thing is that the spaces added by \TeX{} before and after
  are not modified.

\end{enumerate}
Let us compare, for example, the new behavior of \cs{mathtt} and \cs{mathbf}
\MTmathoperatorsobeymathxx\MTnonlettersobeymathxx\MTeasynonlettersobeymathxx
\[ \mathtt{(\sin(n!)<\cos(m-p)?)}\qquad \mathbf{[\sin(x+y)=\cos(z-t)]}\] 
with the traditional default behavior:
\MTmathoperatorsdonotobeymathxx\MTnonlettersdonotobeymathxx
\MTeasynonlettersdonotobeymathxx
\[ \mathtt{(\sin(n!)<\cos(m-p)?)}\qquad \mathbf{[\sin(x+y)=\cos(z-t)]}\] 

The first feature is activated by default, except of course for the normal and
bold math versions when the package was given the \emph{subdued} option. The
second feature is \emph{off} by default for the characters listed first. It is
\emph{on} for the `easy' cases
${\#}\,{\$}\,{\%}\,{\&}\,.\,/\,\vert\,\backslash$ (activating the feature for
them puts no constraint on the user input and should not be too upsetting to
other packages), and also for $*$ but only if this was required explicitly by
the option §asterisk§, as the user then is supposed to know that |$R^*$| is no
valid input anymore and should be replaced by |$R^{*}$|. The remaining `difficult'
cases create similar
constraints, which will be commented more upon next. The relevant commands are\\
\mbox{}\hspace{2cm}\csb{MTmathoperatorsdonotobeymathxx}\\
\mbox{}\hspace{2cm}\csb{MTnonlettersdonotobeymathxx}\\
\mbox{}\hspace{2cm}\csb{MTeasynonlettersdonotobeymathxx}\\
for deactivation and \\
\mbox{}\hspace{2cm}\csb{MTmathoperatorsobeymathxx}\\
\mbox{}\hspace{2cm}\csb{MTnonlettersobeymathxx}\\
\mbox{}\hspace{2cm}\csb{MTeasynonlettersobeymathxx}\\
for activation.\footnote{these commands are to be used outside of math mode.
  Their scope is limited to the current \LaTeX{} environment or group. They use
  the \cs{everymath} and \cs{everydisplay} mechanism so if the document needs to
  modify these token lists it has to do so in a responsible manner, extending
  not annihilating their previous contents.} 
%% suppression de cette note de bas de page à 1.3u car elle est obsolète
%% (pas sûr si à 100%, mais en tout cas l'exemple avec \mathbf{-} n'a plus
%% de problème.
% \footnote{when in subdued mode, the
%   math alphabets are the default ones, not the ones modified by \mst to use the
%   document text fonts. As a result, matters of font encodings may then give
%   unexpected results, for example for $-$. On the present document page we
%   switched to a math version to escape from the |subdued| mode and avoid the
%   problem with \cs{mathbf\{-\}} giving in the normal (subdued) math version
%   {\MTversion{normal}\MTnonlettersobeymathxx$\mathbf-$\sffamily, when
%     `non-letters' are declared to obey math alphabets.}}

\begin{framed}
  \textbf{Important:} the package does \csb{MTnonlettersdonotobeymathxx} by
  default. The reason is that activating the mechanism adds some constraints to
  the way things must be input, adding
\centeredline{|\usepackage{mathastext}|\csb{MTnonlettersobeymathxx}}
  to a pre-existing
  document might well create errors: 
  all these characters treated by \mst, such
  as |?|, |[|, |<| now represent (in math mode only!) \emph{two} `tokens' and
  this will utterly confuse \TeX{} if some precautions are not taken: |$x^?$|,
  |$R^+$| or |$\mathopen<A\mathclose>$| \emph{must} now be coded as |$x^{?}$|,
  |$R^{+}$| and |$\mathopen{<}A\mathclose{>}$| (the rule is to do as if |?|,
  |+|, |<| or |>| were each really \emph{two} characters).

  Even if this rule is respected in the document source, it is still a
  possibility that incompatibilities with other packages will arise because
  \mst does a \emph{mathematical activation} of the characters which could be
  unexpected and unchecked for by other packages. This is precisely the case
  with the |amsmath| package, and the problem goes away by just making sure
  that |amsmath| is loaded before \mst{} (generally speaking, \mst should be
  loaded last after all packages dealing with math things).
\end{framed}

The braces |\{| and |\}| remain unresponsive to the alphabet changing commands
even after \csb{MTnonlettersobeymathxx}. One must issue also
\csb{MTexplicitbracesobeymathxx}, but it has the disadvantage that |\{| and
|\}| become then unusable as variable-size delimiters: |\big\{| or |\big\}|
create errors and one must make use of |\big\lbrace| and |\big\rbrace|. But
\MTmathoperatorsobeymathxx\MTnonlettersobeymathxx\MTexplicitbracesobeymathxx
one can now enjoy $\mathtt{\{a, a>b\}}$, $\mathbf{\{a, a>b\}}$,
$\mathsf{\{a, a>b\}}$, or even $\mathnormalbold{\{a, a>b\}}$.\footnote{this
  last example uses the \cs{mathnormalbold} additional alphabet defined by
  \mst.}\footnote{Let me recall that braces will anyhow not be handled at all
  by \mst if the document
  font encoding is |OT1|, except under option |alldelims|.}

Even with \csb{MTnonlettersobeymathxx}, the parenthese-like symbols $($, $)$, 
$[$, $]$, $<$ and $>$ and the slashes $/$, $\backslash$, \emph{if used as
  left/right delimiters} (i.e. with |\left/\right|) do not react to math
alphabet commands. This is mainly explained by the fact that the text font
will not contain suitable glyphs, hence no attempt was made to make the
delimiters pick up their glyphs there.

But \mst does try to pick up most of the `small variants' of the delimiters
from the text font: |$\left<x\right>$| gives $\left<x\right>$ (but
|$\left<b\right>$| gives $\left<b\right>$.) Notice that this differs from
standard \LaTeX{} for which |$\left< x\right>$| gives $\langle x\rangle$. As
it is perhaps a bit strange to have $\left< x\right>$ next to
$\left< X\right>$ there is option §nosmalldelims§: with this option the
small-sized variants of the delimiters are not modified by \mst (option
§nosmalldelims§ has the side effect that, for the non-delimiter uses of 
|\{, \}| 
to be \mst-ified it is necessary to issue \csb{MTnonlettersobeymathxx} and
\csb{MTexplicitbracesobeymathxx}.)

At any rate, as said above, whether `small' or not, delimiters are
unresponsive to math alphabet commands, due to technical aspects of \TeX, and
the way \mst handles these things. Examples: |\mathbf{<a,b>}| gives
$\mathbf{<a,b>}$
%{\setbox0\hbox{$\mathbf{<a,b>}$}\typeout{ICI}\showboxdepth\maxdimen
%  \showboxbreadth\maxdimen \showbox0} 
(no use of |\left/\right|, hence brackets do obey the math alphabets --- as we
issued §\MTnonlettersobeymathxx§ a bit earlier), |\mathbf{\left<a,b\right>}|
gives $\mathbf{\left<a,b\right>}$ (brackets used with |\left/\right| do not
obey the math alphabets), |\mathbf{\mathopen{<}a,b \mathclose{>}}| gives
$\mathbf{\mathopen{<} a,b \mathclose{>}}$ (no |\left/\right|, brackets
do obey the math alphabets).

\endgroup
For comparison, the \LaTeX{} standard behavior for
\centeredline{|\mathbf{\mathopen{<}a,b\mathclose{>}}|}
is $\mathbf{\mathopen{<} a,b
  \mathclose{>}}$ (neither brackets nor the comma do respond).

\subsection{Greek letters}

The Computer Modern fonts are very light and thin in comparison
to many text fonts, and as a result rarely mix
well with them (particularly if the Latin letters in
math mode are upright). The following options are
provided by \mst:
\begin{description}
\item[no option:] nothing is done by the
  package, Greek letters are the default Computer
  Modern ones or have been set-up by other packages;
  for example by the |fourier| package with option
  `upright', which gives upright Greek letters.
\item[§LGRgreek§:] this is for fonts which additionally to Latin
  letters also provide Greek letters in |LGR| encoding. Here is
  a list from a 2012 standard \TeX{} installation: the Computer
  Modern, Latin Modern, and the CM-LGC fonts; the Greek Font
  Society fonts (such as GFS Didot), the epigrafica and kerkis
  packages, the txfontsb package which extends the txfonts
  package with LGR-encoded Greek letters; the Droid fonts, the
  DejaVu fonts, the Comfortaa font, and the Open Sans font. The
  |LGR| encoded |CM/LM| fonts (in serif, sans-serif and typewriter
  family) give the nice Greek letters in upright shape from the
  |cbfonts| package. To get these letters in your \mst math
  mode, you can do the following:
\begin{verbatim}
% instructions to load the document fonts:
\usepackage{nice_font}
% and then the following:
\renewcommand{\familydefault}{cmr} % or cmss or cmtt for sans resp. mono
\usepackage[LGRgreek]{mathastext}
\renewcommand{\familydefault}{\rmdefault} 
\Mathastext % this re-initializes mathastext with the nice_font,
% without changing the LGR font cmr/cmss/cmtt used for Greek letters
% in math mode.
\begin{document}
\end{verbatim}
 If you use the §italic§ option note that the italic Greek
 letters from the |cbfonts| are not the same glyphs as 
  the default Greek letters from the |OML| encoded font |cmmi|.
\item[§eulergreek§:] the Greek letters will be taken from the Euler font (the
  document does not have to load the eulervm package, \mst directly uses
  some file included in this package, as it provides a mechanism to scale
  by an arbitrary factor the Euler font.) The letters are upright.
\item[§symbolgreek§:] the Greek letters will be taken
  from the (Adobe Postscript) Symbol font. A command is provided
  so that the user can scale the Symbol font to let it
  better fit with the text font. The letters are upright.
\item[§selfGreek§:] this option concerns only the eleven Greek
  capitals from the |OT1|-encoding. It does nothing for the
  lowercase Greek letters. The encoding used in the document does
  not have to be |OT1|.
\end{description}

There is also §LGRgreeks§ which tells \mst to pick up in each math
version the letters from the |LGR| encoded font used in that version,
and §selfGreeks§ to tell \mst to do as for §selfGreek§ but
separately in all math versions. 

Under the §subdued§ option the Greek letters in the normal and bold math
versions are kept to their defaults as found at the time of loading the
package. 

The commands §\MTstandardgreek§  allow at any point
in the document to turn inactive any Greek related option passed to \mst. And
conversely §\MTcustomgreek§ reactivates it.


\subsubsection{Shape of Greek letters}

Classic \TeX{} uses in math mode italic lowercase and
upright uppercase Greek letters. French typography uses
upright shape for both lowercase and uppercase. And the
ISO standard is to use italic shape for both lowercase
and uppercase.

The Euler and Symbol fonts not being available in other than their
default upright shape, this question of shapes for Greek letters
raises issues only in the case of the options §LGRgreek§ and
§selfGreek§.

The options §frenchmath§, §itgreek§, §upgreek§, §itGreek§ and §upGreek§
modify the Greek letter shapes according to the following rules, listed
from the lowest to the highest priority:
\begin{description}
\item[no option:] the lowercase Greek letters are in the same shape as
  Latin letters, and the uppercase in the same shape as applied to digits
  and operator names,
\item[§frenchmath§:] both lowercase and uppercase are in the same shape as
  the digits and operator names (most of the time this means ``upright
  shape'', but it can be otherwise),
\item[§itgreek§, §upgreek§:] both lowercase and uppercase are in the
  \cs{itdefault}, respectively the \cs{updefault} shape (at the time of
  loading the package or at the time of a subsequent call to 
  \cs{Mathastext} or \cs{MathastextWillUse}),
\item[§itGreek§, §upGreek§:] same as above, but only for the uppercase
  letters.
\end{description}

So, the default gives the classic \TeX{} behavior when option §italic§
was passed. Each call to \cs{Mathastext} (or \cs{MathastextWillUse})
macros (described in a later section) reinitializes the computation of
the shapes.

As mentioned already the package allows to define various ``math
versions''. In the case of §eulergreek§ or §symbolgreek§ they apply
to all these versions. In the case of the options §LGRgreeks§ or
§selfGreeks§ (notice the additional ``s''), each math version is
assumed to have its text font available in |LGR| (or |OT1|
encoding) and also the shapes will be local to the math version.

Finally version |1.15c| of \mst introduces new preamble-only
commands to change the shapes, and even the font, used for Greek
letters, in case of package options §LGRgreek§/§selfGreek§. They
are §\MTitgreek§, §\MTupgreek§, §\MTitGreek§, §\MTupGreek§: these
are used like the options and change only the shapes for the math
versions which will be declared \emph{next} in the preamble; and
§\MTgreekfont§|{name_of_font}| will tell the \emph{next} math
versions to use that font family. To use this command you need to
know the (little) name of a suitable font family available in |LGR|
encoding: for example |lmr|, |txr| (needs |txfontsb|
package on your system), |DejaVuSerif-TLF| (needs |dejavu| package
on your system), etc\dots

\enlargethispage{\baselineskip}

\subsection{Unicode engines}

\mst is minimally Unicode aware since |1.12| and can be used with \XeTeX{} or
\LuaLaTeX{}. Starting with release |1.3|, it needs |luatex| to be at least
as recent as the one which was provided with the TL2013 distribution.

\subsubsection{Caveat emptor}

With \XeTeX{} the user is strongly advised to first consider using the
|mathspec| package, which is designed for Unicode, with a key-value interface.
With both \XeTeX{} and \LuaLaTeX{}, |unicode-math| is recommended for OpenType
math fonts.

Particularly in the latter case (\emph{i.e.} using |unicode-math|) you probably don't need, don't want, and should
not use \mst: it is extremely far from being able to define a math font, as it
applies basically only to a subset of the |32-127| ascii range, and in particular
it does not know how to use a given Unicode font simultaneously for Latin and
Greek letters. Again the user is strongly advised to look at |mathspec| and
|unicode-math|.

Let me point out explicitly that \mst has not been tested in any systematic
manner under the Unicode engines; and that it is expected to be most definitely
incompatible with |unicode-math|, although your mileage may vary and some
features may appear to work.

When using \mst with either \XeTeX{} or \LuaLaTeX{} it is recommended to use
the |fontspec| package (see remark below on \cs{encodingdefault}).
Furthermore, it is \emph{necessary} to load |fontspec| with its |no-math|
option, and this \emph{must} happen before loading \mst.

\begin{framed}
\begin{itemize}[label=$\bullet$, leftmargin=1em]
\item
  Use |fontspec| with its
  \emph{no-math} option, and load it \emph{prior} to \mst. As some packages
  load |fontspec| themselves (for example |polyglossia|), a
  \centeredline{|\PassOptionsToPackage{no-math}{fontspec}|} early in the
  preamble might be needed.

\item
  The |amsmath| package, if used, \emph{must} be loaded \emph{prior} to \mst.

\item
  Under |lualatex| engine, it has long been recommended to also load the package
  |lualatex-math|. Please check its documentation as possibly it has now
  been incorporated upstream (I am not following up on the situation).
\end{itemize}
\end{framed}

% obsolete with release 1.3:
% A little piece of the functionality of \mst is less fully
% realized under the \LuaLaTeX{} engine than it is with
% \XeTeX{}. This is a temporary situation as the needed feature
% of \LuaLaTeX{} has been implemented in its latest development
% release. I will update \mst when these binaries will have
% reached the distribution stage.

I already mentioned in the section \ref{sec:ic} the fact that
the italic corrections were not available for OpenType fonts
under the \XeTeX{} engine and only partially available for the
\LuaLaTeX{} engine, with the result that the spacings in math
mode when using for the letters an upright text font will be
less satisfying than with the standard PDF\TeX{} engine (the
OpenType fonts not being usable with the latter engine, this is
not a criterion of choice anyhow).

To define math versions when using unicode fonts, use |fontspec|'s
\cs{setmainfont} before the \cs{Mathastext}\oarg{version} command, or simply
before loading \mst for the default math versions.

It is possible to mix usage of Unicode fonts and classical \TeX{}
fonts. All used 8bits font encoding must have been passed as
options to the |fontenc| package.

\subsubsection{The unicodeminus option}

For legacy reason, \mst uses by default the |EN DASH U+2013| for the minus
sign in math mode, if the font is determined to be a ``Unicode'' font.

There is now the §unicodeminus§\RightNote{1.3q} to use rather
% BORDEL DE BORDEL DE FAIT CHIER \verb ET Text for \verb command ended by end
% of line. je l'ai patché dans etoc et xint mais pas ici encore.
|MINUS SIGN U+2212|.%
\footnote{Thanks to \textsc{Tobias~Brink} who asked for this feature.}
%
Check \hyperref[nicodeminus]{\ttfamily\hyphenchar\font=189 its documentation}
on page \pageref{nicodeminus}.

\subsubsection{Two examples}

I include
here two examples which compiled successfully with \XeTeX{} and
\LuaLaTeX{}, the first one on a Linux machine, the second one on a Mac
OS X machine.\footnote{A |tex mathastext.dtx| (in a temporary repertory) on a
  copy of |kpsewhich mathastext.dtx| will extract extended versions of
  these examples as test files.}
\begin{verbatim}
\documentclass{article}
\usepackage[hscale=0.8]{geometry}
\usepackage{multicol}
\usepackage[no-math]{fontspec}
\usepackage{lmodern}
\usepackage[subdued,italic]{mathastext}
\setmainfont[Color=999999]{Verdana}      \Mathastext[Verdana]
\setmainfont[Color=0000FF]{Arial}        \Mathastext[Arial]
\setmainfont[Color=00FF00]{DejaVu Serif} \Mathastext[DejaVu]
\MTDeclareVersion{times}{T1}{ptm}{m}{n}
\setmainfont[Color=FF0000]{Andale Mono}  \Mathastext[Andale]
\begin{document}
\newcommand\TEST[1]{\MTversion{#1}%
\begin{multicols}{2}
\hbox to\columnwidth{\hbox to\columnwidth{\hfil
                $abcdefghijklmnopqrstuvwxyz$\hfil}\kern-2.5em{#1}}
   \centerline{ $ABCDEFGHIJKLMNOPQRSTUVWXYZ$ }
   \centerline{ $0123456789$ }
   \centerline{ $!\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\backslash$ }
\columnbreak
   \centerline{ abcdefghijklmnopqrstuvwxyz }
   \centerline{ ABCDEFGHIJKLMNOPQRSTUVWXYZ }
   \centerline{ 0123456789}
   \centerline{ !\,?\,*\,,\,.\,:\,;\,+\,-\,=\,(\,)\,[\,]\,/\,\#\,%
   \$\,\%\,\&\,<\,>\,|\,\{\,\}\,\char92 }
\end{multicols}}
\begin{multicols}{2} 
   \centerline{\textbf{math mode}} 
\columnbreak
   \centerline{ \textbf{text} }
\end{multicols}
\TEST{DejaVu}\TEST{Verdana}\TEST{times}\TEST{Andale}
\TEST{Arial}\TEST{bold}\TEST{normal}
\end{document}
\end{verbatim}
And now the same thing with fonts available on Mac OS X:
\begin{verbatim}
\documentclass{article}
\usepackage[hscale=0.8]{geometry}
\usepackage{multicol}
\usepackage[no-math]{fontspec}
\usepackage{lmodern}
\usepackage[subdued,italic]{mathastext}
\setmainfont[Color=FF0000]{Hoefler Text}  \Mathastext[Hoefler]
\setmainfont[Color=336633]{American Typewriter}\Mathastext[Typewriter]
\setmainfont[Color=0000FF]{Herculanum}    \Mathastext[Herculanum]
\setmainfont[Color=FF00FF]{Didot}         \Mathastext[Didot]
\setmainfont[Color=999999]{Comic Sans MS} \Mathastext[Comic]
\begin{document}
   --- copy here the code from the previous example ---
\TEST{Didot}\TEST{Comic}\TEST{normal}\TEST{Herculanum}
\TEST{Hoefler}\TEST{Typewriter}\TEST{bold}
\end{document}
\end{verbatim}
% The test files which will be produced by running |latex| on
% |mathastext.dtx| are more extent.

\subsection{Compatibility issues}\label{sec:compat}

Compatibility issues (or just questions of who decides last) are naturally to
be expected with packages dealing with the math setting; the fix is simply to
load \mst last. And one should always load |amsmath| before \mst (this is
especially true when using Unicode engines but applies in general as well).

Any definition made in a package loaded before \mst of the font to be
used for letters or for the common characters in the |ascii| basic range
will be overruled by the loading of \mst (this includes the case
when the earlier package had made the character `mathematically active').
Conversely most of the set-up done by \mst may well be overruled by
packages loaded later which do math related things.

In case of a `too many math alphabets' message try the |defaultalphabets|
option or one of its |defaultnormal|, |defaulttt|, etc\dots sub-options.

Starting with version |1.2|, \mst makes some characters `mathematically
active' to achieve certain effects: automatic insertion of the italic
corrections when using an upright text font in math, extended scope of
the math alphabet commands which now apply to non-letter symbols (and
also to math operator names, but this is much easier to achieve). And
the (already mathematically active) right quote is modified to have some
extra space added before the derivative glyph ${}'$.

This is compatible with using \cs{label} and \cs{ref} in and outside of
math mode. But a difficulty arises when some other package has made the
character `globally active' everywhere in the document. The action of
\mst is made anew at each mathematical inline or displayed formula. If
it is detected that a character has been activated then nothing further
will be done (so the \mst feature\footnote{italic correction insertion
  for the latin letters, receptivity to the math alphabet action for the
  other characters.} for that character is lost) \emph{except} if it
appears that this activation was done by the Babel system. In that case
\mst does not make the character mathematically active but it modifies
in the appropriate manner the action of Babel for that character in math
mode. Furthermore \mst makes the character mathematically
\emph{inactive}.\footnote{only the characters
  {{;}\,{,}\,{:}\,{!}\,{?}\,{+}\,{\textendash}\,{=}\,{<}\,{>}\,{(}\,{)}\,{[}\,{]}\,*}
  mentioned in section \ref{sec:mathxx} as `difficult non letters' (and
  the right quote {'}) and
  the latin letters are concerned here; it seems highly unprobable that
  a latin letter ${\in}\{a\mbox{--}z,A\mbox{--}Z\}$ will have been made
  globally active (only letters never being used in command names are
  possible candidates), but \mst has been
  designed to cope with it, should it happen ...}

Here is indeed some code that you should \textbf{not} try at
home:
\begin{verbatim}
    \documentclass{article}
    \usepackage[french]{babel}
    \usepackage{mathtools}\mathtoolsset{centercolon}
    \begin{document}
    $:$
    \end{document}
\end{verbatim}
\fbox{DO NOT DO THIS AT HOME}\thinspace: it creates an infinite
loop.\footnote{This seems to still be the case with Babel |3.9f| and
  frenchb.ldf |2.6e|, as tested on Sep. 2, 2013. Again tested with up-to-date
  TL2015 Jan. 15, 2016 with same result.} This is due
to the fact that the colon is simultaneously active (this is made by
|babel+frenchb| at begin document) and mathematically active (done by
|mathtools| in the preamble). The interaction gives an infinite loop. Such a
situation will be cured by |mathastext|, even loaded before |mathtools|,
\emph{if} use is made of \cs{MTnonlettersobeymathxx}. At each math formula
\mst will detect that Babel has activated the colon, and will cancel the
mathematical activation (the precise definition done by |mathtools| was
already lost at begin document due to overwriting by |babel| but the fact that
the character was mathematically active remained true).



  So far I have briefly described the problem of document active
  characters (see the test file |mathastexttestalphabets.tex| for more
  explanations and illustrations,  and the commented source code of the
  package). Pure mathematical activation revealed an incompatibility of
  another type with |amsmath|. To fix it, \mst now replaces
  an inner macro of |amsmath|
  (\cs{resetMathstrut@}) with its own version.\\
  \null\hspace{1cm}\fbox{Always load |amsmath| before \mst.}\\
  Actually this last commandment was already made necessary by the use of the
  text endash to represent the minus sign in math mode, and, especially for
  Unicode engines, some aspects of the \cs{DeclareMathOperator} macro from
  |amsmath|.

  \begin{framed}\kern-.75\baselineskip
    \begin{framed}
      \textbf{Important!} As is mentioned in the section \ref{sec:mathxx},
      after command §\MTnonlettersobeymathxx§, characters such as
      |?|, or |[|, now represent \emph{two} `tokens' and this will utterly
      confuse \TeX{} if some precautions are not taken. Examples: |$0^+$| or
      |$x\mathrel?y$| or |$R^*$| \emph{must} be input now as |$0^{+}$|
      and, respectively, 
      |$x\mathrel{?}y$| or |$R^{*}$|. This is why the package does
      §\MTnonlettersdonotobeymathxx§ by default.
    \end{framed}\vskip-.75\baselineskip
  \end{framed}
  One thing to take note of is that this mechanism uses the \cs{everymath}
  and \cs{everydisplay}, so if it is needed to add to these \TeX{} `token
  lists' some additional things this should be done in a way preserving the
  former contents.

  If one issues (after |\begin{document}|) |\everymath={}| and
    |\everydisplay={}| this annihilates not only all the \mst (evil ?) doings
    with math active characters but also everything else some other package
    might have put in these token registers, so it is better, if the need
    arises to cancel the math activation of characters done by \mst to use the
    command §\MTeverymathoff§, which does all of
    §\MTmathoperatorsdonotobeymathxx§, §\MTnonlettersdonotobeymathxx§ (already
    default), §\MTmathstandardletters§, §\MTnormalprime§, and
    §\MTnormalasterisk§. This is supposed to be used in a group or
    environment (as there is no |\MTactivemathon|). It must be used prior to
    entering math mode.

    \begin{framed}
      \textcolor{magenta}{\bfseries New with 1.3i:} \mst patches |\url| of
      packages |url| and |hyperref|, and also |\nolinkurl|, to force them
      to do automatically §\MTeverymathoff§. Indeed they use math mode, and it
      is better to turn \mst off for their dealings.
    \end{framed}
   
\section{Package options and commands}

\subsection{Summary of main options}
   \begin{description}
\item[{§italic§, §frenchmath§}:] italic letters in
math, upright uppercase if §frenchmath§.
 \item[{§subdued§}:] acts in a subdued way. The \LaTeX{} normal and bold
 math versions are left (quasi) unchanged. With version |1.15e| of
 the package this statement applies also to the math alphabets
 \cs{mathbf}, \cs{mathit}, \cs{mathsf}, and \cs{mathtt} (and not
 only to \cs{mathnormal} and \cs{mathrm} as in previous versions.)
\item[{§LGRgreek§, §eulergreek§, §symbolgreek§}:] the
  Greek letters will be taken, respectively from the
  text font itself (in |LGR| encoding), or from the Euler
  font, or from the Postscript Symbol font.
\item[{§symbolmax§}:] all characters
  other than letters and digits, are taken from the
  Symbol font. This option also makes a number of
  further glyphs available, such as some basic
  mathematical arrows, and the sum and product
  signs. For documents with very simple needs in
  mathematical symbols, \mst with option
  §symbolmax§ may give in the end a PDF file quite
  smaller than the one one would get without the
  package.
\item[{§defaultmathsizes§}:] \mst sets up bigger sizes
for subscripts (it also copies code from the |moresize| package to redefine
  \cs{Huge} and define \cs{HUGE}). Use this option to prevent it from
  doing so.
\item[{§defaultalphabets§}:] by default, \mst redeclares the math
  alphabets \cs{mathrm}, \cs{mathit}, \cs{mathtt} etc\dots{} (but not
  \cs{mathcal} of course) to refer to the current document text fonts (at the
  time of loading the package and in each \mst math version). Use
  this option to prevent it from doing so (each alphabet also has
  its own disabling option).
\end{description}

\subsection{Miscellaneous}

\begin{description}
\item[the en-dash as minus sign:] very often the -
  character from the text font does not give a good
  minus sign. So by default, the package uses the
  en-dash sign \textendash{}. Use §noendash§ to
  deactivate it. Starting with version |1.12| of the
  package this `en-dash as minus' should work in all
  encodings, including Unicode (if |fontspec| has been
  loaded); see also |unicodeminus| for OpenType fonts.

\item[amsmath:] \strut the behaviour of the
  \cs{DeclareMathOperator}\RLNote{changed:}{1.3n} command
  of |amsmath| is modified by \mst for it to use the correct font.
  Additionally, release |1.3n| of \mst at long last also handles an extra
  operation done by |amsmath| for |'.:/-*| to be used in operator names
  without the extra math spacing.%
%
\footnote{To the experts: there is a long story here that \cs{newmcodes@}
  hardcodes the font, that it was not compatible with Unicode engines, that
  during some time (2013-2016) \texttt{lualatex-math} fixed that and very
  recently |amsopn.sty 2016/03/08 v2.02| also, so now \texttt{lualatex-math
    1.6} does nothing as it is already fixed ``upstream'' in |amsopn.sty|, but
  anyhow in both cases, this still hardcoded the font, so finally \mst does
  the right thing from its point of view. See the code comments for more,
  there is an issue here with \LuaLaTeX\ not applying the curly right quote
  contrarily to \XeLaTeX.}
%
This customization is suppressed in §subdued§ mode for the |normal| and |bold|
math versions.

\item[hbar:] the default \LaTeX\ definition of §\hbar§ would in our context
  make use of the |h| of the current math font (so for us, it is also the text
  font, perhaps in italic shape), but with a bar accross the |h| from the
  original default math font for letters (usually |cmmi|). We redefine
  \cs{hbar} to use the text font macron accent (|\=|) as a mock math accent
  (this takes into account the §italic§ option and is compatible with
  subscripts and superscripts).

  Since |1.12| \mst when dealing with a Unicode font sets the \cs{hbar}
  to be the character from the font having hexadecimal codepoint |U+0127|.

  Since |1.3u| the general 8bits font encoding is
  supported\RLNote{changed:}{1.3u} (see discussion of the |mathaccents| option
  at end of this list for the shared limitations). Brief testing with
  various usual \TeX\ fonts shows that the vertical positioning of
  the bar isn't satisfying. It is planned to either add a parameter to
  adjust it or to modify altogether the mode of construction of the |\hbar|.

  Use §nohbar§ to tell \mst not do provide its own |\hbar|.


\item[dotless i and j:] by default the package redefines \cs{imath} and
  \cs{jmath} to give (in math mode) the dotless i and j (if it exists at
  all) from the text font.%
%
\footnote{\CHANGED{1.3t}Since \texttt{1.12} it also redefined \cs{i} and
  \cs{j} for usability both in text and math modes, but this has been
  dropped at \texttt{1.3t}. Breaking change!}

\item[asterisk:] versions of \mst earlier than |1.2d [2013/01/02]|
  did not do anything
  with the \cs{ast} control sequence but did pick the asterisk
  $*$ in the document text font, and this often was a rather
  silly thing as the text asterisk is generally in a raised
  position. Furthermore, the $*$ lost its status of a binary
  operator and was treated as an `ordinary' symbol. An option
  |noasterisk| turned this feature off. Starting with |1.2d|,
  the |noasterisk| option is deprecated and the new default is
  to do nothing. But when option §asterisk§ is received by the
  package, then both \cs{ast} and $*$ are simultaneously
  modified to use (as binary operators) the text asterisk,
  slightly lowered. The amount of lowering\footnote{with the
    option \texttt{symbolmisc}, the asterisk is picked from
    the Symbol font, and the amount of lowering is
    non-customizable; however if a math alphabet command is
    used, the asterisk is then again from a text font and the
    lowering will be as specified by \cs{MTlowerast}.} is
  decided by the mandatory argument to the command
  \csb{MTlowerast}\marg{dimen}. The package initially does
  \cs{MTlowerast}|{.3\height}|. Doing \cs{MTlowerast}|{.5ex}| is
  not a good idea as it does not scale properly in the script
  and scriptscript styles. With an argument given as a
  multiple of |\height|, the asterisk will behave as expected
  in subscripts and subscripts of subscripts. But $*$ is now
  `mathematically active'\thinspace\footnote{in a hopefully
    safe way, for example {\ttfamily\$\string\label\{eq*1\}\$}
    is ok.} and |$R^*$| or |$R^\ast$| \emph{must} be input as
  |$R^{*}$| and |$R^{\ast}$|. Furthermore, they will obey the
  math alphabet commands.

\item[\XeTeX{} and \LuaLaTeX{}:] regarding the en-dash and the
  dotless i and j, the package is now under the Unicode engines
  compatible not only with the ``Unicode'' \LaTeX\ font encodings
  EU1 (\XeTeX, old fontspec), EU2 (\LuaLaTeX, old fontspec), TU
  (\XeTeX\ and \LuaLaTeX, modern fontspec), but also with
  traditional 8bits-encodings declared as a |fontenc|
  option.\RLNote{NEW FEATURE!}{1.3u} Formerly, with a Unicode engine,
  only OT1, T1 and LY1 were supported by \mst as the 8bit encoding
  of the document text font, regarding the minus as en-dash and
  the dotless i and j.

 \item[fontspec:] one more note to users of
\XeTeX{}/\LuaLaTeX{} with |fontspec|:\newline 
\fbox{it has to be
loaded {with the option} |no-math|}, 
and \emph{before} \mst.

\item[vec accent:] The default \cs{vec} accent is not
  appropriate for upright letters, so  \mst
  provides a \cs{fouriervec} which takes its glyph in a
  Fourier font, and an Ersatz \cs{pmvec} 
  which is reasonably good looking on upright letters
  and works with the \cs{rightarrow} glyph. Contrarily
  to version |1.0|, the default \cs{vec} is not
  overwritten with \cs{fouriervec}. And contrarily to
  version |1.1|, one now needs to pass the option
  §fouriervec§ to have the math accent \cs{fouriervec}
  defined by the package.%
%
\footnote{this costs a math family, as I never came back to this to try to
  do otherwise.}


\item[math alphabets:] 
  \begin{itemize}
  \item We define a new math alphabet command
    \cs{mathnormalbold} which gives direct access to
    the bold version of the \cs{mathnormal} alphabet
    (rather than using either the \cs{bm} command from
    the |bm| package or the \cs{boldsymbol} command
    from the |amsbsy| package). As it does not
    exist in the default \LaTeX{} math font set-up, this
    alphabet is \emph{not} subjected to the {subdued option} action.
  \item The other math alphabet changing commands
    defined by the package are \cs{MathEulerBold},
    \cs{MathEuler} and \cs{MathPSymbol}.
  \item \cs{mathnormal}, \cs{mathrm}, \cs{mathbf},
  \cs{mathit}, \cs{mathsf} and \cs{mathtt} are modified
  to make reference to the document text fonts (this
  can be disabled by suitable package options).
\item version |1.2| of \mst has extended the scope of the math
  alphabets to apply to non-alphabetical characters and to
  operator names. This respects the automatic white spaces
  added by \TeX{} around math symbols.
\item the\RightNote{1.3i}
  extra skips around letters (see \autoref{sec:mathskips} and
  \autoref{sec:ic}) are removed in the scope of the math alphabets.
  \end{itemize}

\item[math accents:] if option §mathaccents§ is used then \mst attempts to let
  the math accents |\acute|, |\grave|, etc... use the suitable glyphs from the
  text font. Prior to |1.3u| only |OT1|, |T1|, and |LY1| were supported (via
  hardcoded slots). It should now work with any 8bits font
  encoding\RLNote{NEW FEATURE!}{1.3u} having been declared as an option to the
  |fontenc| package (and of course providing the ten needed text accents which
  will mock math accents).%
  %
  \footnote{The code will raise low-level \TeX\ errors if the user attempts to
    use an 8bits font encoding whose \LaTeX\ definition file is lacking the
    suitable uses of \cs{DeclareTextAccent} or if the low level \LaTeX\ macro
    implementation of text accents changes significantly; in such cases please
    report the problem to the author, so that it can be documented in future
    releases!}

  The |\vec| math accent is not handled here, as it is not available in the
  usual 8bits font encodings. See the §fouriervec§ option or the §\pmvec§
  command.

  The math accents obey the §subdued§ option\RLNote{NEW FEATURE!}{1.3u}
  and will change in sync with the \mst-ified text font used in
  each non subdued math version.

  (Very) brief testing during |1.3u| development with \XeTeX\ and \LuaTeX\ let
  the author conclude that usage with the \cs{Umathaccent} primitive of an
  OpenType accent glyph slot (which in the text font is for usage as a
  postpended combining character) gives definitely bad horizontal placements
  for both engines (each in its own way). Thus, the redefinitions of accents
  for a \mst declared math version with an OpenType font is by default
  canceled.%
%
\footnote{I.e., the \cs{grave} etc... control sequences will, in math versions
  with an OpenType \mst-ified font, expand to macros holding their initial
  meanings, unmodified by \mst, which was in force at the
  |\string\begin\string{document\string}|.}
%
  Use §unimathaccents§ to force usage of the OpenType font text
  accents glyph slots with the \cs{Umathaccent} primitive. Expert users are
  invited to check out the code and to contribute suggestions if some extras
  can improve it.
 
\item[varying font encodings:] the very first release of \mst dealt with only
  one font; very soon thereafter it acquired the capacity to define multiple
  math versions, each one using its own text font. But, as was documented at
  this location formerly, various encoding dependent decisions were done once
  and for all during package loading.

  This meant in particular that the minus sign (using the text endash), the
  dotless |i| and |j|, the |\hbar|, the math accents were all set up for only
  one unique font encoding. It was thus recommended that all math versions
  share the same font encoding.

  The |1.3u| release has lifted this restriction.\RLNote{NEW FEATURE!}{1.3u}
\end{description}

% 2 septembre 2013; finalisé 22:58
\makeatletter
\def\@jfendshrtverb #1#2§{\@ifundefined{FLAG#2}%
             {\color{blue}\ttfamily #1#2\endgroup
              \global\@namedef{FLAG#2}{}\label{#2}}%
             {\hyperref[#2]{\ttfamily #1#2}\endgroup}}
\makeatother

\subsection{Commands}

A few preliminary comments, mainly destined to advanced users aware of some
\TeX\ innards (more extensive explanations are to be found in the code
comments).

The timing for actions of \mst falls into three cases:

\begin{enumerate}
\item things done during the loading of the package, or delayed to
  |\AtBeginDocument|,
\item things done as the result of user commands, either in the preamble or in
  the body of the document,
\item things done everytime math mode is entered.
\end{enumerate}

The second category overlaps with the others, as the (preamble) use of some
commands can have either immediate effect or only trigger some actions in
|\AtBeginDocument| or perhaps only influence the things done later by \mst
each time math mode is entered.

The third category deserves some brief additional comments: it mainly (but not
exclusively) regards the ``math activation'' of characters, and conversely all
``math activations'' fall into this category. The package re-checks each time
math mode is entered if some characters have been made in-between catcode
active, or math active, and takes appropriate decisions: one important aspect
of this issue is that |babel|'s mechanism for activating character was not, last
time I checked, very robust against math active characters. I now checked
again (on January 15, 2016) that
\begin{verbatim}
    \documentclass{article}
    \usepackage[french]{babel}
    \usepackage{mathtools}\mathtoolsset{centercolon}
    \begin{document}
    $:$
    \end{document}
\end{verbatim}
creates an infinite loop (see section \ref{sec:compat} where this was
mentioned already, some years ago). Thus \mst has (since |1.2e 2013/01/10|) a
somewhat elaborate mechanism related to these issues (see the code comments),
installed into the list of things done by \TeX\ systematically each time
it enters math mode. For some legacy reason the package also puts into
this list a few other things which could arguably be done elsewhere once and
for all. The command \csb{MTeverymathoff} cancels all actions done by
\mst.


\newsavebox\boite

\subsubsection{Preamble-only commands}
These commands mainly facilitate the definition of math versions, in a \mst
extended sense. It is not necessary to use them to activate the package
basic functionalities, as loading \mst is enough (except with the |subdued|
option). 
\begin{enumerate}[label=$\bullet$, leftmargin=1em]
\item §\Mathastext§ (or §\mathastext§) reinitializes \mst: it sets the
  fonts used in math mode (in versions |normal| and |bold|) for letters,
  digits and a few ascii symbols to the \emph{current} defaults of encoding,
  family, series and shape.\footnote{\texttt{\char92Mathastext} updates also
    the font and shapes for the Greek letters (|LGRgreek| option), and the
    skips to be inserted after the symbols $\oldforall$ and $\oldexists$,
    see \emph{infra.}} Both the normal and bold math version are modified by
  this action of §\Mathastext§.
  \begin{enumerate}[label=$\bullet$]
  \item \textbf{math versions:} 
    \csb{Mathastext} accepts an optional argument \oarg{name}. With
    this (within square brackets) argument, rather than redefining the
    fonts for math mode, §\Mathastext§ declares a new \emph{math version}, and
    it is this 
    math version which will use the then current text font in math
    mode.\footnote{The allowed version names are as for 
      the \LaTeX{} \cs{DeclareMathVersion} macro. \emph{Do not use}
        |\string\Mathastext[foo]| \emph{with
        |foo| equal to ``normal'' or ``bold'';} this is already taken care of by the
      initial loading of the package or a later command \cs{Mathastext}
      without any optional argument.}
  \item \textbf{inheritance:} starting\RightNote{1.3c} with version |1.3c| a second optional
    argument \oarg{other\_version} will transfer its set-up for things not
    affected by \mst action, like large symbols, to the declared math
    version whose name was given as first optional argument. The main use
    will be with |[bold]| in order for the symbols and large symbols to be
    typeset as in the |bold| math version. For example, this document has in
    its preamble:\hfill\break\begingroup\small
    \begin{lrbox}{\boite}|\usepackage{newcent}% this package makes New Century the roman font|\end{lrbox}\rlap{\usebox{\boite}}\hfill\break
    |\Mathastext[newcent]% this math version will use New Century|\hfill\break
    |\MTseries{b}        % next \Mathastext will use a bold font|\hfill\break
    \begin{lrbox}{\boite}|\Mathastext[boldnewcent][bold]% large symbols, etc, will be bold too|\end{lrbox}\rlap{\usebox{\boite}}\hfill\break\endgroup
    We can check that it does work:
    \centeredline{|\MTversion{newcent}:|\MTversion{newcent}
      $abcde\displaystyle\ointop\bigvee\biguplus\bigotimes\bigoplus$}
    \centeredline{|\MTversion{boldnewcent}:|\MTversion{boldnewcent}
      $abcde\displaystyle\ointop\bigvee\biguplus\bigotimes\bigoplus$}
    Naturally, for this one needs an initial math font setup with some nice
    bold fonts also for large symbols. This is the case with the excellent
    |txfonts| package of \textsc{Young~Ryu}. As the present document must
    use many fonts and declares many math alphabets, we did not load the full
    package and fonts but only the |largesymbols|:\hfill\break
    |\DeclareSymbolFont{largesymbols}{OMX}{txex}{m}{n}|\hfill\break
    |\SetSymbolFont{largesymbols}{bold}{OMX}{txex}{bx}{n}|\hfill\break
    |\DeclareFontSubstitution{OMX}{txex}{m}{n}|
  \end{enumerate}

  \item §\Mathastext§ may be preceded optionally by one or
    more of\footnote{these commands exist also with
    long names: \texttt{\char92Mathastextencoding},
    etc\dots{} The same applies to the other commands
    mentioned in this section.}
    §\MTencoding§\marg{enc},
    §\MTfamily§\marg{fam},
    §\MTseries§\marg{ser},
    §\MTshape§\marg{sh}, and §\MTlettershape§\marg{sh}. For
    example valid values are, respectively, \meta{T1},
    \meta{phv}, \meta{m}, \meta{n}, and \meta{it}: this
    is the Helvetica font in T1-encoding, regular
    (medium) series, upright shape, and the letters
    will be in italic shape. Once used their effect applies to all
    succeeding calls to \cs{Mathastext}, and can only be undone by using
    them again.

  \item
    §\MTWillUse§\oarg{ltsh}\marg{enc}\marg{fam}\marg{ser}\marg{sh}
    tells \mst to use the font with the
    specified encoding, family, series, and shape for
    the letters and digits (and all other afflicted
    characters) in math mode. The optional argument
    \meta{ltsh} specifies a shape for the letters, for
    example \cs{itdefault}, or directly \meta{it} or
    \meta{sc}. 
  
\item  §\MTDeclareVersion§\oarg{ltsh}\marg{name}\marg{enc}\marg{fam}\marg{ser}\marg{sh}\oarg{other\_version}:
  declares that the document will have access to the font
  with the specified characteristics, under the math version name
  \meta{name}. For example:
  \centeredline{|\MTDeclareVersion[sc]{palatino}{T1}{ppl}{b}{sl}|}
  declares under the name |palatino| a version where
  mathematics will be typeset using the Palatino font in
  T1-encoding, bold, slanted, and the letters will in fact be
  in caps and small caps (and bold).\footnote{I do not
  especially recommend to use this in real life!} When the initial
  optional argument is absent, and \mst was loaded
  with the \blueit{italic} option, then the default letter shape
  will be |it|,\footnote{more precisely, the shape is the
  latest value passed in one of the previously used package
  commands to specify the shape of letters, or the \cs{itdefault}
  of the time of loading the package.}  else letters will
  have the same shape as used for digits and operator-names.

  Another optional argument may be used as last argument.\RightNote{1.3c}
  Similarly as its
  use with §\Mathastext§ this makes the declared math version inherit, for
  things not modified by \mst like large symbols, the font set up of the math
  version whose name was passed as optional argument (typical use will be
  with |[bold]|).

\item §\MTboldvariant§\marg{var}: when used before §\Mathastext§,
  specifies which bold
  (|b|, |sb|, |bx|, \dots) to be used by \cs{mathbf} (and
  \cs{boldmath}). Default is the \cs{bfdefault} at the time of
  loading \mst. When used before the declaration
  of a version, decides the way \cs{mathbf} will act in this version.
\item §\MTEulerScale§\marg{factor}: scales the Euler font by
  \meta{factor}.
\item §\MTSymbolScale§\marg{factor}: scales the Symbol font by
  \meta{factor}.
\item §\MTitgreek§, §\MTupgreek§, §\MTitGreek§, §\MTupGreek§:
optional commands, active only in
the case of the \blueit{LGRgreek} option, to decide the shape of the
Greek letters in the versions which will be declared next. 
 \item §\MTgreekfont§\marg{fontfamily}: optional command with a mandatory
 argument which specifies the font for Greek letters in all \mst math
 versions declared afterwards via \cs{Mathastext} or \cs{MTDeclareVersion}. Only effective with \blueit{LGRgreek} option.
\end{enumerate}

\subsubsection{Commands usable only outside of math mode}\label{sec:cmdsoutmath}

They are usable only from outside math mode because they act via turning on
or off the execution, each time math mode is entered, of certain macros added
by \mst to the \cs{everymath} and \cs{everydisplay} token list variables.

\begin{enumerate}[label=$\bullet$, leftmargin=1em]

\item §\MTmathactiveletters§: activates the `math activation' of Latin
  letters. This is done by the package during loading, except under the
  |subdued| option.\footnote{\CHANGED{1.3j}Formerly, it was also executed
    from each \cs{Mathastext} in the preamble.} It is again executed in the
  body at each \cs{MTversion}, except under the |subdued| option when
  switching to the \emph{normal} or \emph{bold} math versions.

  The letters are made mathematically active\footnote{the |mathcode|'s are
    only modified at the time of execution of \cs{everymath},
    \cs{everydisplay}.} to insert the extra skips as specified by
  \csb{MTsetmathskips} (see section \ref{sec:mathskips}), and also possibly
  the italic corrections when using upright fonts (see section \ref{sec:ic}).

\item §\MTmathstandardletters§: cancels the `math activation' of the letters.
  Must be re-issued after each \csb{MTversion}, but see
  \csb{MTeverymathdefault}.

\item §\MTicinmath§: this command is executed by default by \mst except in
  case of option |subdued| or if the user chosen letter shape is oblique (|it|
  or |sl|). It tells \mst to add italic corrections after all letters in math
  mode, except within the scope of math alphabets.\footnote{\CHANGED{1.3i}%
Formerly, italic corrections were added to the (non-oblique) letters of
    \cs{mathnormal} arguments.}

  This command and the next ones in this item can be used in the preamble as
  well as in the body of the document (in case of |subdued| option, using the
  commands from within the preamble will remain without effect, as the
  document body will start in the subdued normal math version anyhow.) But
  each \cs{MTversion} in the body will re-emit \cs{MTicinmath} (in case of
  non-oblique letter shape), except if the
  |subdued| option was used and the chosen math version is \emph{normal} or
  \emph{bold}.

  The effect of this and the other commands of this item is local to the group
  or environment in which it has been issued.

{\footnotesize

  It may theoretically be used from inside math mode, but the included
  §\MTmathactiveletters§ will have an effect only if issued prior to
  entering math mode.

  §\MTnoicinmath§: this command deactivates the package added
  italic corrections. It can be used inside as well as outside
  of math mode (or in the preamble of the document).

  §\MTICinmath§, §\MTnoICinmath§: these commands activate the italic
  corrections only for the uppercase letters (but recall that \cs{MTicinmath}
  is done by default, thus this will typically have to follow
  \cs{MTnoicinmath}.)

% obsolète 1.3i
  % Following some decision of the package author whose rationale has been
  % forgotten, afer \cs{MTICinmath} italic corrections for uppercase letters in
  % arguments to all math alphabets (\emph{i.e.} also \cs{mathnormal}) are
  % suppressed (with \cs{MTicinmath} the italic corrections are suppressed
  % inside the scope of math alphabets \emph{except} \cs{mathnormal}.)
  % No italic corrections are explicitly added inside arguments of math
  % alphabets.

 §\MTicalsoinmathxx§: this command de-activates the de-activation of
  the italic corrections inside the arguments to the math alphabet
  commands. 
% apart from \cs{mathnormal}. 
  It can be issued inside as well as outside of math mode. Will be effective
  only if §\MTicinmath§ or §\MTICinmath§ is in force.
% obsolète 1.3i
    % \footnote{it is provided
    % for the \mst defined math alphabet \cs{mathnormalbold} which
    % contrarily to \cs{mathnormal} is not treated apart from the other
    % math alphabets.}
  To cancel its effect either enclose it in a group or
    environment or re-issue §\MTicinmath§ after it.

}

\item §\MTnormalasterisk§, §\MTactiveasterisk§: the latter will use for |*|
  and |\ast| the text font asterisk, suitably lowered; the former tells \mst
  to not modify the \LaTeX\ default. Both are no-op without option
  §asterisk§.

\item §\MTeasynonlettersobeymathxx§, §\MTeasynonlettersdonotobeymathxx§: the
  former is done by default, it makes characters \verb+.+, \verb+/+, \verb+|+,
  \verb+\+, \verb+#+, \verb+$+, \verb+%+, and \verb+&+
  (if not excluded by package options) obey math alphabet commands. See also
  section \ref{sec:mathxx}. This functionality does \emph{not} make the
  characters ``math active'' (but it does modify |\mathcode|'s, naturally).

\item §\MTnonlettersobeymathxx§, §\MTnonlettersdonotobeymathxx§: the former
  will make (except if excluded by relevant package options) \verb|!|,
  \verb|?|, \verb|,|, \verb|:|, \verb|;|, \verb|+|, \verb|-|, \verb|=|,
  \verb|(|, \verb|)|, \verb|[|, \verb|]|, \verb|<|, and \verb|>| obey the math
  alphabet commands (when not used as delimiters). These characters are made
  ``math active'', and each one now expands to two
  tokens. This makes for example |$a^!$| illegal input and
  it will have to be coded |$a^{!}$|. Hence, by default, the package does
  §\MTnonlettersdonotobeymathxx§.

  \begin{framed}
    Under |subdued| option, \cs{MTnonlettersobeymathxx} effect is of course
    canceled in the \emph{normal} and \emph{bold} math versions; but please
    note that when switching back to a non-subdued math version it will be
    mandatory to issue again \cs{MTnonlettersobeymathxx} explicitly if its
    effect is to be re-activated.

    In particular, executing \cs{MTnonlettersobeymathxx} in the preamble or at
    the start of the document body serves nothing, because the document is in
    the subdued \emph{normal} math version regime then. It must thus be
    executed after the first usage of \cs{Mtversion} switching to a
    non-subdued math version, and again on each successive exit from the
    \emph{normal} or \emph{bold} math versions.
  \end{framed}

  {\footnotesize 
§\MTexplicitbracesobeymathxx§ extends an earlier §\MTnonlettersobeymathxx§
  to also treat  \verb|\{| and \verb|\}|. But then |\left\{|, |\right\}| must
  be coded |\left\lbrace|, |\right\rbrace| rather. There is also
  §\MTexplicitbracesdonotobeymathxx§.\par}

\item \RightNote{1.3j}§\MTnormalprime§, §\MTprimedoesskip§: the latter (done by default if not
  |subdued|, and also on each use of \csb{MTversion} in the body of the document
  except for the |subdued| \emph{normal} and \emph{bold} math version)
  makes it so that $'$ takes into account the math glue as specified by
  \csb{MTprimeskip}. The former is its opposite. In all cases the right quote
  |'| is a mathematically active character producing ${}'$ as is the default
  in \TeX, it is only its meaning which changes to include or not an extra
  skip. For some (legacy) reason, this change of meaning is done anew
  by \mst each time math mode is entered. The commands of this item are thus
  no-op from inside math mode.


\item \RightNote{1.3j}§\MTeverymathdefault§: this hook is executed by
  \csb{MTversion}\marg{version\_name}, except under option |subdued|
  when switching to the \emph{normal} or \emph{bold} math versions. Its
  default meaning is:
\begin{verbatim}
    \MTactiveasterisk % this has no effect without option asterisk
    \MTprimedoesskip  % this makes prime glyph obey extra space
    \MTeasynonlettersobeymathxx
    \MTicinmath       % this does \MTmathactiveletters, hence also skips from
                      % \MTsetmathskips are obeyed.
    \MTfixfonts       % only operant under LuaLaTeX.
\end{verbatim}
  {\footnotesize Notice that under |subdued| option, switching to the
    \emph{normal} or \emph{bold} version does \csb{MTeverymathoff} which
    includes \cs{MTnonlettersdonotobeymathxx}.

    The default
    §\MTeverymathdefault§ which is issued when going back to a
    non-\emph{normal} or \emph{bold} math version doesn't do
    \cs{MTnonlettersobeymathxx}: thus it is up to the user to correct this if
    needed (no issue without |subdued| option).


Notice also that \csb{MTversion}\marg{version\_name}, except for \emph{normal}
or \emph{bold} if |subdued| does \csb{MTforalldoesskip} and
\csb{MTexistsdoesskip}, which are not included in \cs{MTeverymathdefault}
actions as they are not related to \cs{everymath} and \cs{everydisplay}.\par}

\item \RightNote{1.3j}§\MTeverymathoff§: does §\MTnormalasterisk§,
  §\MTnormalprime§, §\MTnonlettersdonotobeymathxx§,
  §\MTeasynonlettersdonotobeymathxx§, §\MTmathstandardletters§ and
  §\MTdonotfixfonts§.

  {\footnotesize \RightNote{1.3i}The commands
    |\url/\nolinkurl| of package |hyperref| and |url| from |url.sty| (which
    use math mode under the hood) are patched by \mst to do §\MTeverymathoff§
    automatically: this is needed because \mst modifies anew some mathcodes
    \emph{each time math mode is entered,} hence may overwrite to some extent
    the specific preparation done by |{url,hyperref}.sty|.
        % {\parfillskip0pt\hfill
        % \rlap{\kern10pt\textcolor{magenta}{\bfseries New! (1.3i)}}\par}

    Automatically done by \csb{MTversion} under option |subdued|
    if switching to the \emph{normal} or \emph{bold} math versions; and
    \csb{MTversion} then does also \csb{MTnormalexists} and
    \csb{MTnormalforall}.
\par}

\small

\item \RightNote{1.3o}§\MTfixfonts§: this is operant only under
  \LuaLaTeX{}. It has the effect that each time math mode is entered macro
  \csb{MTfixmathfonts} will be executed. The latter forces so-called |base|
  mode for the used text font in math mode, in an effort to (only partially,
  see code comments) fix the fact that OpenType features such as Lining
  Figures were in some cases not being applied in math mode when one uses text
  fonts there (text fonts are declared by \LuaTeX+|luaotfload| to use |node|
  mode, which is non-functional in math.) It is invoked automatically by the
  package (except for |normal| and |bold| math versions under §subdued§
  option), and in normal situations, there is no reason to use it directly.

% pas envie de perdre mon temps là-dessus. D'ailleurs peut-être déjà pour
% commencer bm ne fonctionne pas avec fontes OpenType.

% Notice (not tested) that package |bm| is presumably not compatible.

\item \RightNote{1.3o}§\MTdonotfixfonts§: cancels the job of
  |\MTfixfonts|. Done automatically in §subdued§ mode when in the |normal| or
  |bold| math version; in normal contexts, there is no reason to use this
  command. Only operant under \LuaLaTeX.

\end{enumerate}

\footnotesize

\subsubsection{Commands usable only in math mode}\label{sec:mathonlycmds}

%\begin{enumerate}
%\item
\RightNote{1.3p}§\MTfixmathfonts§: this used to be an inner macro
  but it is given a public name by |1.3p| because I discovered that
  |$..\hbox{\mathversion{foo}$..$}..$| causes an
  issue and one needs to invoke again \cs{MTfixmathfonts} \emph{after} the
  \verb|\hbox|, for some reason. To be used \emph{only} under \LuaLaTeX{} and only for
  such rare cases where it may be needed.
%\end{enumerate}

\normalsize

\subsubsection{Commands usable everywhere}\label{sec:cmds}

\begin{enumerate}[label=$\bullet$, leftmargin=1em]

\DeleteShortVerb{\|}%

\item §\MTsetmathskips§\marg{a-z|A-Z}\marg{muglue\_before}\marg{muglue\_after}:
  \MakeShortVerb{\|}is\RightNote{1.3a} used to specify extra skips (or rather mu glue) to be
  inserted in math mode, before and after a letter. The rationale is that
  standard text fonts used in math mode may sometimes cause glyph (near-)
  collisions with math symbols, as \TeX{} has some implicit expectations on the
  design of fonts for math letters. 

  \begin{framed}
    These extra skips around letters are set at their natural width and do not
    add any stretchability or shrinkability to the math formula as a whole,
    nor do they result in extra potential break points.
  \end{framed}
  
  Random (silly) examples:
  \centeredline{|\MTsetmathskips{x}{\medmuskip}{\thickmuskip}|} \centeredline
  {|\MTsetmathskips{A}{.5mu}{2.3mu}|} and the effect:
  \begingroup\MTversion{italic}\MTsetmathskips{x}{\medmuskip}{\thickmuskip}%
             \MTsetmathskips{A}{.5mu}{2.3mu}%
  $vwxyzABC^{vwxyzABC}$\endgroup. The effect obeys the usual \LaTeX{} scoping
  rules.

  The first argument of §\MTsetmathskips§ may be any expandable code giving a
  letter; this facilitates use of |\MTsetmathskip| in |\@for| loops such as
  this one:
\begin{verbatim}
\makeatletter
\@for\@tempa:=a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z\do{%
              \MTsetmathskips{\@tempa}{2mu}{2mu}}%
\makeatother
\end{verbatim}

  \begin{framed}
    \emph{\color{magenta}\bfseries Starting with |v1.3i|:} the extra skips are
    \emph{not} applied to the letters within the scope of math alphabet
    commands, or the letters from operator names (pre-defined or user
    declared).
  \end{framed}

{\footnotesize
  Note that contrarily to the \csb{MTexistsskip}, \csb{MTforallskip}, and
  \csb{MTprimeskip} commands described next, these extra skips (which may be
  specified in the preamble) are not recorded in the definition of the math
  version (as defined via §\Mathastext§ with its optional argument or via
  §\MTDeclareVersion§). The declared skips hold thoughout the document
  until modified or canceled, independently of math versions (of
  course, \mst cancels the skips in the normal and bold math versions if
  package option \blueit{subdued} was used).\par}

\DeleteShortVerb{\|}

\item §\MTunsetmathskips§\marg{a-z|A-Z}: \MakeShortVerb{\|} cancels the skips 
  for that letter (they are not set to |0mu| but completely removed).


  % setting the skips to |0mu| which prevents formation of ligatures
  % when the letter is used inside a \cs{mathbf} for example). Example (using a
  % version with upright Latin Modern): \centeredline
  % {|\MTsetmathskips{f}{8mu}{0mu}$gffg\MTunsetmathskips{f}ff\mathbf{ff}$|}
  % gives: \begingroup\MTversion{upright}%
  % \MTsetmathskips{f}{8mu}{0mu}$gffg\MTunsetmathskips{f}ff\mathbf{ff}$\endgroup.
  % The ligature was correctly formed.

  The argument may be a macro (or any expandable code) expanding to a letter.


\item §\MTexistsskip§\marg{math glue}: specifies the amount of skip or more
  generally glue to put after each $\oldexists$ math symbol. Indeed, upright
  letters (or digits for that matter) often appear to be positioned a bit too
  close to the quantifier: $\oldexists\mathrm{B}$. The package default is to
  add a |1mu| skip (this default is set to zero in the case of |italic|):
  $\oldexists\mskip 1mu\mathrm{B}$. One can change the default with the
  following syntax: |\MTexistsskip{2mu plus 1mu minus 1mu}|, which if used in
  the preamble and followed with a \csb{Mathastext} command (or
  \csb{MTDeclareVersion}), will be recorded in the definition of this math
  version (and subsequent ones). One may also use the command at any time in
  the document. In the case of the option |subdued|, the skip is canceled in
  the \emph{normal} and \emph{bold} math versions.\footnote{\CHANGED{1.3j}%
Formerly, it was set to |0mu|.} In the case of the option |italic|, the
  default skip is set to zero.

\item \RightNote{1.3j}§\MTnormalexists§, §\MTexistsdoesskip§: the
  latter (done by default if not |subdued|, and also on each use of
  |\MTversion| in the body of the document) makes it so that $\oldexists$
  takes into account the math glue as specified by \csb{MTexistsskip}. The
  former is its opposite.

\item §\MTforallskip§\marg{math glue}: the default is to add a |.6667mu| math
  skip after each $\oldforall$ (except with the option |italic| for which the
  default skip is set to zero). Compare $\oldforall\mskip.6667mu\mathrm{F}$
  (has the skip) with $\oldforall\mathrm{F}$ (has no skip). Use this command
  in the preamble to set up the skip or glue to be used in the \emph{next to
    be declared} math versions. In the case of the option |subdued|, the skip
  is canceled in the \emph{normal} and \emph{bold} math
  versions.\footnote{\CHANGED{1.3j}Formerly, it was set to |0mu|.} In the
  case of the option |italic|, the default skip is zero for all math versions.
  One may use the command at any location in the document.

\item \RightNote{1.3j}§\MTnormalforall§, §\MTforalldoesskip§: the
  latter (done by default if not |subdued|, and also on each use of
  |\MTversion| in the body of the document) makes it so that $\oldforall$
  takes into account the math glue as specified by \csb{MTforallskip}. The
  former is its opposite.

\item §\MTprimeskip§\marg{math glue}: the default is to add a |0.5mu| skip
  before the derivative glyph, except for the |italic| option. In the case of
  the option |subdued|, the skip is canceled in the \emph{normal} and
  \emph{bold} math versions.\footnote{\CHANGED{1.3j}Formerly, it was set to
    |0mu|.}

% obsolete et même faux avec 1.3j
% \footnote{if \cs{begin\{document\}} is not followed
%     with \cs{MTversion\{normal\}}, the latest values set in the preamble by
%     these commands are used at the beginning of the document,
%     even under option \texttt{subdued}.}

\item §\MTlowerast§\marg{dimen}: a \cs{raisebox} command is
  used to lower the text asterisk to produce a reasonable math
  asterisk. The package uses this command initially with
  argument |0.3\height|, this will have to be fine-tuned for
  each given text font but worked out ok with the fonts we
  tried. Note that the dimension argument will be used also in
  sub-scripts and sub-sub-scripts, so it is best not to use an
  absolute dimension.

\item §\MTmathoperatorsobeymathxx§, §\MTmathoperatorsdonotobeymathxx§: the
  former is done by default, it makes operator names obey math alphabets. See
  also section \ref{sec:mathxx}. This functionality \emph{does
    {\normalfont\bfseries not} rely}
  on ``math active characters''. Automatically issued by each \cs{MTversion},
  except under option |subdued| when switching to \emph{normal} or \emph{bold}.

  \item §\MTcustomgreek§:\RightNote{1.3d} in case \mst has been loaded with one of its
    Greek related options, this activates the corresponding
    customization of Greek letters in math mode. It is issued
    automatically by the package in the preamble (except if loaded with
    |subdued| option) and at each switch of math version via
    |\MTversion| or |\MTversion*| (except for the normal and bold math
    versions in subdued mode). Also available as
    |\Mathastextcustomgreek|. May be used even inside of math mode.

  \item §\MTstandardgreek§:\RightNote{1.3d} in case \mst was loaded with one of the Greek
    related options this command reverts the customization, it resets the Greek
    letters to their definitions in force at package loading time. Can be used
    in the preamble, but is mainly for the document body (may even be used
    inside math mode ...). Done automatically
    under the |subdued| option when switching to the normal or bold math
    version. Also available as |\Mathastextstandardgreek|.

\end{enumerate}

\subsubsection{Body-only commands}

\begin{enumerate}[label=$\bullet$, leftmargin=1em]
\item §\MTversion§\oarg{nametext}\marg{namemath},
  §\MTversion§$\ast$\marg{namemath}, also known as
  §\Mathastextversion§ (and as \cs{MTVersion}, and
  \cs{mathastextversion}):
  \begin{enumerate}[label=$\bullet$]
  \item the non-starred version changes
    \emph{both} the document text fonts and the math fonts (for those characters
    treated by \mst): the mandatory argument is the math version to be used
    for math; the optional argument is the name of (another) \mst-declared math
    version, the font which was chosen during its declaration will be set as
    document text font (and |\familydefault| etc\dots also are
    redefined). In the absence of the optional argument, the mandatory one is
    used. The versions \emph{must} be either |normal|, or |bold|, or previously
    declared ones via §\Mathastext§ or §\MTDeclareVersion§. 
  \item the starred variant\RightNote{1.3c} does the math set-up, but changes \emph{nothing} to
    the text fonts (see \autoref{sec:mathversions} for a description of the math
    set-up, which summarizes 
    what is done additionally to only using \LaTeX{}'s |\mathversion|).
  \end{enumerate}
  \cs{MTversion}\oarg{nametext}\marg{namemath} does §\MTeverymathdefault§
  (except for |\MTversion{normal}| and |\MTversion{bold}| under package option
  |subdued|), which in particular activates the insertion of skips around
  letters specified by §\MTsetmathskips§ and also, if the font used is not
  oblique the insertion of italic corrections (for better positioning of
  subscripts; see the discussion in \autoref{sec:ic}). Under the |frenchmath|
  option the package checks separately the letter shape for lowercase and
  uppercase. 

  \RightNote{1.3j}\cs{MTversion} also does §\MTexistsdoesskip§,
  §\MTforalldoesskip§, and also §\MTprimedoesskip§,
  \csb{MTmathoperatorsobeymathxx}, except under the |subdued| option for
  \emph{normal} and \emph{bold}, in which case it does the opposite actions.
\end{enumerate}

All further commands are usable only inside math mode.
\begin{enumerate}[label=$\bullet$]
\item §\hbar§: this macro is by default redefined (in a way compatible with
  the |italic| option) combining the |h| letter and the \={ } accent from the
  \mst font. Note that \cs{mathrm}|{\hbar}| and \cs{mathbf}|{\hbar}| will
  work and that \cs{hbar} does scale in subscripts and exponents. Since
  |1.3u|, this is a priori compatible with all 8bits text font
  encodings\RLNote{changed:}{1.3u} supporting the |\=| text accent in
  the LaTeX way.%
%
\footnote{\CHANGED{1.3u}The horizontal skips for letter |h| from
  \cs{MTsetmathskips} are ignored for \cs{hbar}. Formerly, a positive
  ``before'' skip was not properly taken into account for the horizontal
  positioning of the accent and thus gave a bad result. The user can extend
  the package \cs{hbar} definition to add skips.}
\footnote{\CHANGED{1.3u}The \cs{hbar} redefinition is canceled in normal and
  bold math versions under the |subdued| option.}
  
\item §\fouriervec§: this is a |\vec| accent taken from the Fourier font;
the |fourier| package need not be loaded. Active only
if option §fouriervec§.
\item §\pmvec§: this provides a poor man \cs{vec} accent command, for
upright letters. It uses the right arrow. Does not change
size in subscripts and exponents.
 \item §\mathnormal§, §\mathrm§, §\mathbf§, §\mathit§, §\mathsf§,
§\mathtt§: modifications of the original \cs{mathnormal},
\cs{mathrm}, \cs{mathbf}, \cs{mathit}, \cs{mathsf}, \cs{mathtt} to
use the mathastextified font. The
underlying internal \LaTeX{} structures related to the original
commands are not overwritten, so the original commands can be saved under
other names before |\usepackage{mathastext}|, to be used in case of
necessity  (this is what option |subdued| does.) 
 \item §\mathnormalbold§: a bold version of \cs{mathnormal}. Differs
from §\mathbf§ when the |italic| option has been used, or when use
has been made of §\MTlettershape§ to specify a shape for letters
distinct from the one for digits and operator names, or similarly
when the math version has been declared via §\MTDeclareVersion§ with
its optional parameter for shape of letters.
\item §\inodot§, §\jnodot§: the corresponding glyphs in the \mst-ified
  font for use in math mode. By default, |\imath| and |\jmath| are redefined to use
  them. Since \texttt{1.3t}, these macros obey the \texttt{subdued}
  regime.
%
\footnote{\CHANGED{1.3t}Formerly (i.e. since \texttt{1.12}) \mst
  redefined the \texttt{\string\i} and \texttt{\string\j} as robust
  commands usable both in text and math mode and using the above macros
  in the latter. I have decided it wasn't such a good idea and there is
  from now on \texttt{1.3t} no such redefinition of \texttt{\string\i}
  and \texttt{\string\j}!}
\item §\MathEuler§, §\MathEulerBold§: math alphabets to access
all the glyphs of the Euler font, if option |eulergreek| (or
|eulerdigits| was passed to the package.
\item §\MathPSymbol§: math alphabet to access the Symbol font.
\item when one of the options \blueit{symbolgreek},
  \blueit{eulergreek}, or \blueit{selfGreek} is passed to the package
  the capital Greek letters which look like their Latin
  counterparts acquire  names: \cs{Digamma},
  \cs{Alpha}, \cs{Beta}, \cs{Epsilon}, \cs{Zeta},
  \cs{Eta}, \cs{Iota}, \cs{Kappa}, \cs{Mu}, \cs{Nu},
  \cs{Omicron}, \cs{Rho}, \cs{Tau}, \cs{Chi} (no
  \cs{Digamma} for Symbol). Also an \cs{omicron}
  control sequence is provided.
\item |LGR| Greek and `var'-letters: only the
  \cs{varsigma} is available in this encoding, so using
  for example \cs{varphi} will load the previous default math
  font. It might thus be suitable when recompiling
  already written \LaTeX{} sources to add to the preamble
  \cs{let}\cs{varphi}$=$\cs{phi},
  \cs{let}\cs{varepsilon}$=$\cs{epsilon}, etc\dots,
  in case only the `variant' form of the letter was used
  in the documents.
\item \hypertarget{symbolmisc}{Miscelleneous mathematical symbols} from the
  postscript Symbol font are made available (or replaced) by option
  §symbolmisc§.\footnote{option \blueit{asterisk} is also required to treat the
    $*$. 
    Recall from \autoref{sec:mathxx} that the asterisk in math mode (also
    when using the control sequence \cs{ast}) appears then to \TeX{} to be
    a composite object.}
  \makeatletter\let\mst@doasterisk\mst@@doasterisk\makeatother They are
  \cs{prod}~$\prod$ \cs{sum}~$\sum$ \cs{implies}~$\implies$
  \cs{impliedby}~$\impliedby$ \cs{iff}~$\iff$ \cs{shortiff}~$\shortiff$
  \cs{to}~$\to$ \cs{longto}~$\longto$ \cs{mapsto}~$\mapsto$
  \cs{longmapsto}~$\longmapsto$ \cs{aleph}~$\aleph$ \cs{inftypsy}~$\inftypsy$
  \cs{emptyset}~$\emptyset$ \cs{surd}~$\surd$ \cs{nabla}~$\nabla$
  \cs{angle}~$\angle$ \cs{forall}~$\forall$ \cs{exists}~$\exists$
  \cs{neg}~$\neg$ \cs{clubsuit}~$\clubsuit$ \cs{diamondsuit}~$\diamondsuit$
  \cs{heartsuit}~$\heartsuit$ \cs{spadesuit}~$\spadesuit$
  \cs{smallint}~$\smallint$ \cs{wedge}~$\wedge$ \cs{vee}~$\vee$ \cs{cap}~$\cap$
  \cs{cup}~$\cup$ \cs{bullet}~$\bullet$ \cs{div}~$\div$ \cs{otimes}~$\otimes$
  \cs{oplus}~$\oplus$ \cs{pm}~$\pm$ \cs{ast}~$\ast$ \cs{times}~$\times$
  \cs{proptopsy}~$\proptopsy$ \cs{mid}~$\mid$ \cs{leq}~$\leq$ \cs{geq}~$\geq$
  \cs{approx}~$\approx$ \cs{supset}~$\supset$ \cs{subset}~$\subset$
  \cs{supseteq}~$\supseteq$ \cs{subseteq}~$\subseteq$ \cs{in}~$\in$
  \cs{sim}~$\sim$ \cs{cong}~$\cong$ \cs{perp}~$\perp$ \cs{equiv}~$\equiv$
  \cs{notin}~$\notin$ \cs{langle}~$\langle$ \cs{rangle}~$\rangle$. And a
  \cs{DotTriangle}~$\DotTriangle$ is made available by option §symbolre§ (which
  overwrites \cs{Re} and \cs{Im}: $\Re,\Im$). The \cs{inftypsy} and
  \cs{proptopsy} have these names to leave up to the user the choice to replace
  (or no) the original (larger) \cs{infty} $\infty$ and \cs{propto} $\propto$.

  Regarding the \cs{prod} and \cs{sum} commands: they will use the Symbol
  glyphs $\prod\sum$ in inline math, and in display math the Computer Modern
  ones (or whatever is set up by other packages; here we have the symbols from
  |txfonts|): \[\prod\sum\] The package
  provides \cs{prodpsy} and \cs{sumpsy}: if one really wants in all
  situations the Symbol glyphs, one can do \cs{let}\cs{prod}\cs{prodpsy} and
  \cs{let}\cs{sum}\cs{sumpsy}. Also \cs{MToriginalprod} and \cs{MToriginalsum}
  will refer to the \cs{prod} and \cs{sum} before redefinition by the
  package: this is to allow constructs such as |$\displaystyle\MToriginalprod$|
  or |\[\textstyle\MToriginalprod\]|, because they would not work with the
  \cs{prod} and \cs{sum} as re-defined by the package.
\end{enumerate}

 \subsection{Complete list of options}

 \begin{enumerate}[label=$\bullet$, leftmargin=1em]
 \item §basic§: only mathastextify letters and digits.
 \item §subdued§: do not change the default fonts or the math alphabets in math
   mode for the normal and bold math versions, turn on the \mst-ification only
   after an explicit \csb{MTversion} (or \cs{mathastextversion}) command
   activating an additional math version as declared in the preamble. With
   option |subdued| \cs{MTversion\{normal\}} and \cs{MTversion\{bold\}} do
   \csb{MTmathoperatorsdonotobeymathxx}, \csb{MTeasynonlettersdonotobeymathxx},
   \csb{MTnonlettersdonotobeymathxx}, \csb{MTmathstandardletters}.
 \item §italic§: the letters  default to italic shape in
  math mode.
 \item §frenchmath§: italic lowercase Latin letters, but
  uppercase Latin letters in the same font as for digits and
  operator names. In general this means that they will be
  upright. In case of the \blueit{LGRgreek} option, §frenchmath§
  influences also the shape of the Greek letters.
\item §endash§, §emdash§: use the text font en-dash (\textendash) or even
 the em-dash (\textemdash, but this seems crazy) for the minus sign
 rather than {}-{}. §endash§ option is default for the package.
\item §unicodeminus§:\RightNote{1.3q} use the |MINUS SIGN U+2212| (requires
  |fontspec|.) Or, in the form |unicodeminus=HHHH| with four \emph{uppercased}
  hexadecimal digits: use the |U+HHHH| code point. As §noendash§ really means
  ``use the hyphen from the text font'', §unicodeminus§ remains without effect
  under it, or, naturally, under §nominus§. Without this option,
  \mst uses the |EN DASH U+2013| by default for OpenType fonts.
\item §asterisk§: use the text font (or the Symbol font) asterisk in math mode. 
\item §nohbar§: prevents \mst from defining its own
  \cs{hbar}.
\item §noendash§: the minus sign will be the - from the
 text font, not the en-dash \textendash.
\item §nolessnomore§: besides
  !\,?\,,\,.\,:\,;\,+\,\textendash\,=\,(\,)\,[\,]\,/\,\#\,\$\,\%\,\&
  \mst treats also \DeleteShortVerb{\|}
  $\mathord{<}\,\mathord{>}\,\mathord{|}$\, \{\,\} and
  $\backslash$.\MakeShortVerb{\|} Use this option to let it not
  do it. This is the default
  in case of |OT1|-encoding.
\item further excluding options: §noexclam§ !\,?\
\ §nopunctuation§ ,\,.\,:\,;\ §noplus§,
§nominus§, §noplusnominus§\ +\,\textendash{} §noequal§ =\
§noparenthesis§ (\,)\,[\,]\,/\ §nospecials§
\#\,\$\,\%\,\&\ and §nodigits§.
 \item §alldelims§: true by default, means that the
characters excluded by §nolessnomore§ are
treated. Use this option in case of a mono-width
|OT1|-encoded font.
\item §nosmalldelims§: this prevents \mst from trying to pick up in the text
  font the `small variants' of some math delimiters; it only affects what
  happens when a character such as a left parenthesis $($ or $[$ is used as a
  delimiter, and in the event that \TeX{} has chosen the smallest sized
  variant. This has no impact on what happens when they are not used as
  delimiters: then, and if not disabled by the corresponding options, these
  characters are always picked up from the text font.\footnote{in this very
    special situation of option nosmalldelims, the braces are an exception to
    this rule and they require both of \csb{MTnonlettersobeymathxx} and
    \csb{MTexplicitbracesobeymathxx} for being picked up from the text font
    when not used as delimiters.}
 \item §symbolgreek§, §symboldigits§: to let Greek letters (digits) use the
Symbol font.
 \item §symbolre§: replaces \cs{Re} and \cs{Im} by the
 Symbol glyphs $\Re, \Im$ and defines a
\cs{DotTriangle} command ($\DotTriangle$).
\item §symbolmisc§: takes quite a few glyphs, including logical arrows, product
  and sum signs from Symbol. They are listed
  \hyperlink{symbolmisc}{\emph{supra}}. Doing
  \cs{renewcommand\{\string\int\}\{\string\smallint\}} will maximize
  even more the use of the Symbol font.
 \item §symboldelimiters§: the characters apart from
 letters and digits will be taken from the Symbol font. 
 \item §symbol§: combines §symbolgreek§, §symbolre§, and §symbolmisc§.
 \item §symbolmax§: combines §symbol§ and §symboldelimiters§.
 \item §eulergreek§, §eulerdigits§: to let Greek letters (digits) use the
Euler font.
 \item §LGRgreek§: this is for a font which is also available in
 LGR-encoding. It is possible to change the font per math version, via
 the use of the §\MTgreekfont§ command in the preamble.
 \item §LGRgreeks§: each declared math version will be supposed to be with a
 font which is also available in LGR-encoding.
 \item §selfGreek§: this is for a font which is also available in
 |OT1|-encoding and contains the glyphs for the default eleven capital Greek
letters.
 \item §selfGreeks§: each declared math version will be supposed to be with
 a font with the eleven capital Greek letters in its |OT1|-encoded
 version.
 \item §upgreek§, §itgreek§, §upGreek§, §itGreek§:
 options to tell to use \cs{itdefault} or \cs{updefault} for the lowercase
 and uppercase (or only the uppercase) Greek letters. Only operant
 in the case of the |LGRgreek(s)| and |selfGreek(s)| options.
 \item §mathaccents§: use the text font also for the math
accents. As in vanilla \LaTeX{}, they are taken from the font
for the digits and \cs{log}-like names. Obey the alphabet
changing commands.
 \item §unimathaccents§:\RLNote{new:}{1.3u} extends |mathaccents| to
OpenType fonts. Gave bad results in my brief testing.
 \item §defaultbf§, §defaultit§, §defaultsf§, §defaulttt§: do not
set up, respectively, the \cs{mathbf}, \cs{mathit}, \cs{mathsf},
and \cs{mathtt} commands to use the mathastext-ified
font. This also prevents \mst to create internally
\cs{Mathxx} alphabets (it never overwrites the original
\cs{mathxx} things but let \cs{mathxx} point to \cs{Mathxx}
instead), so one can use these options if one encounters a `too
many math alphabets' \LaTeX{} error.
\item §defaulnormal§, §defaultrm§: do not identify the default
\cs{mathnormal} (resp. \cs{mathrm}) with the newly created
\cs{Mathnormal} (resp. \cs{Mathrm}) commands which use the
mathastextified fonts in each math version.
\item §defaultalphabets§: all the §defaultxx§ options together, and
additionally tells \mst not to create the \cs{mathnormalbold} alphabet either.
 \item §defaultimath§: do not overwrite \cs{imath} and
 \cs{jmath} to use \cs{inodot} and \cs{jnodot}.
 \item §defaultmathsizes§: do not change the \LaTeX{} defaults for the sizes
 of exponents and subscripts.
 \item §fouriervec§: provides a \cs{fouriervec} command. The user can then
 add in the preamble \cs{let}\cs{vec}$=$\cs{fouriervec}. There is also
 always available a ``poor man'' vec accent \cs{pmvec} for upright letters.
 \end{enumerate}

Thanks to Kevin~\textsc{Klement}, Tariq~\textsc{Perwez}
and Ricard~\textsc{Torres} for sending bug reports and feature requests when
the first version of the package was issued.

 \begin{center}
Numerous examples will be found there:\\
   \url{http://jf.burnol.free.fr/mathastext.html}\\
   \url{http://jf.burnol.free.fr/showcase.html}
 \end{center}

\catcode`\§=12

% ATTENTION
\clearpage


\normalsize

\section{Change log}
\label{sec:changelog}

\begingroup

\def\MacroFont{\footnotesize\normalfont}
% utilisé par verbatim en classe scrdoc
% (rappel: macrocode utilise \macro@font qui est MacroFont at begin document)

\makeatletter

\def\@verbatim{%
\parindent \z@ \parfillskip \@flushglue \parskip \tw@\p@
\let \do \@makeother \dospecials \catcode`\ =10 }

% et donc on ne fait pas \obeylines
\def\endverbatim{}
\let\@vobeyspaces\relax

\begingroup \catcode `|=0 \catcode `[= 1 \catcode`]=2 
\catcode `\{=12 \catcode `\}=12 \catcode`\\=12 
|long|gdef|@xverbatim#1\end{verbatim}[#1|end[verbatim]]
|endgroup

% \end{verbatim} Fix du font-locking de AUCTeX (11.89.6)
% 2015/09/10 -- 2015/09/12
% Dorénavant README.md (et possiblement un CHANGES.txt ou CHANGES.md)
% sont auto-extraits du .dtx.
% 
% Ici je dois faire un input approprié.

% 2019/08/12: le ChangeLog.md est directement disponible, alors qu'auparavant
% il était inclus dans le README.md.
%
% Les items sont initiés par des *
% Il faut se débarrasser des ---- et remplacer les \[, \]
% Il faut aussi gérer les `.

\catcode`*=\active
\def*{\ifvmode\smallskip
  \leavevmode\kern.5em\smash{\raisebox{-.3\height}{\char42}}\kern1em
  \else\smash{\raisebox{-.3\height}{\char42}}\fi }%

\begingroup
    \lccode`\~`1
\lowercase{\endgroup\def~}{\ifvmode\medskip\expandafter\@DTXLOGhelper\fi 1}

\begingroup
    \catcode`\| 0
    \catcode`\\ 12
|long|gdef|@DTXLOGhelper #1 ----#2|par{|@@DTXLOGhelper #1\[\]|par}
|long|gdef|@@DTXLOGhelper #1\[#2\]#3|par%
    {|textbf{#1}% le #1 ici contient un espace
     |ifx|relax #2|relax|else [#2]|fi
     |par|nopagebreak}
|endgroup

\catcode`-=\active
\def-{%
  \catcode`M\active
  \begingroup
  \lccode`\-`M % MATHASTEXT CHANGE LOG est la première ligne...
  \lowercase{\endgroup\long\def-}##1\par{\catcode`\M=12 \catcode`\-=12 }%
  \catcode`1=\active
  \catcode`\` 9 % légèrement ennuyeux mais bon, c'est le plus simple.
  \input ChangeLog.md
}

\makeatother

\begin{multicols}{2}
\begin{verbatim}
-
\end{verbatim}
\end{multicols}
\endgroup


\ifnum\NoSourceCode=1 
\bigskip
\begin{framed}
\def\givesomestretch{%
\fontdimen2\font=0.33333\fontdimen6\font
\fontdimen3\font=0.16666\fontdimen6\font
\fontdimen4\font=0.11111\fontdimen6\font
}%
  \ttfamily\small\givesomestretch\hyphenchar\font45 This documentation
  has been compiled without the source code. To produce the
  documentation with the source code included, run "tex mathastext.dtx" to
  generate mathastext.tex (if not already available), then thrice latex on
  mathastext.tex and finally dvipdfmx on mathastext.dvi.
\end{framed}
\fi


\makeatletter
\StopEventually{\end{document}\endinput}
\makeatother

\cleardoublepage
\newgeometry{hmarginratio=3:2}
\small

\section{Implementation}
% The catcode hackery next is to avoid to have <*package> to be listed
% in the commented source code...
% (c) 2012/11/19 jf burnol ;-)
\MakePercentIgnore
%
% \catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
% \let</dtx>\relax
% \def<*package>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12}
%
%</dtx>
%<*package>
% The usual catcode regime for letters and digits is assumed and some characters
% such as |*|, |`|, |"|, |=| are supposed to be of catcode other at the time of loading
% of \mst. The source of \mst takes precautions for some other characters such
% as the right quote |'|, which may thus be active with no harm at the time of
% loading. By the way, I think \LaTeX2e should have provided to authors a
% standard macro to be used at the beginning of a style file to make sure the
% catcodes are standard. Shorthands created by Babel should be mostly no problem
% as Babel does the activation only at the |\begin{document}|.
%
% The comments have been accumulating through successive versions with only
% partial efforts to achieve some sort of coherence; as a result some are a
% bit strange or obsolete to various degrees. And the similar remark
% applies to some ancient parts of the code itself!
%
% Should I require |2005/12/01| \LaTeX? (not sure about the month).
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage {mathastext}
  [2019/11/16 v1.3w Use the text font in math mode (JFB)]
%    \end{macrocode}
% \LaTeX{} |2019-10-01| release has made robust math macros such as the math
% accents and \cs{hbar}. 
%    \begin{macrocode}
\newif\ifmst@robust@obsessed@LaTeX@era
\@ifl@t@r\fmtversion{2019/10/01}{\mst@robust@obsessed@LaTeX@eratrue}{}
\edef\mst@robustifyingspace{\ifmst@robust@obsessed@LaTeX@era\space\fi}
%    \end{macrocode}
% Testing for \XeTeX\ and \LuaLaTeX.
%
% |1.3g 2015/10/15|: update for the naming of primitives, the situation has
% evolved both on \XeTeX\ side and on the \LuaLaTeX\ side (LaTeX base
% |2015/10/01|): I was told "U" named math primitives were always available
% for \LuaLaTeX. For \XeTeX, the XeTeX prefix got replaced by U prefix with
% 0.99.. a certain number of 9. I opted for rather simple approach of just
% trying the "modern" names and if they don't exist fall back on earlier (and
% in danger of being deprecated) names.
%    \begin{macrocode}
  \let\mst@Umathcharnumdef\Umathcharnumdef
  \let\mst@Umathcodenum   \Umathcodenum
  \let\mst@Umathcode      \Umathcode
  \let\mst@Umathchardef   \Umathchardef
  \let\mst@Umathaccent    \Umathaccent
\newif\ifmst@XeTeX
\ifx\XeTeXinterchartoks\@undefined
  \mst@XeTeXfalse
\else
  \mst@XeTeXtrue
  \ifx\mst@Umathcharnumdef\@undefined
    \let\mst@Umathcharnumdef\XeTeXmathcharnumdef
    \let\mst@Umathcodenum   \XeTeXmathcodenum
    \let\mst@Umathcode      \XeTeXmathcode
    \let\mst@Umathchardef   \XeTeXmathchardef
    \let\mst@Umathaccent    \XeTeXmathaccent
  \fi
\fi
\newif\ifmst@LuaTeX
\ifx\directlua\@undefined
  \mst@LuaTeXfalse
\else
  \mst@LuaTeXtrue
  \ifx\mst@Umathcharnumdef\@undefined
    \let\mst@Umathcharnumdef\luatexUmathcharnumdef
    \let\mst@Umathcodenum   \luatexUmathcodenum
    \let\mst@Umathcode      \luatexUmathcode
    \let\mst@Umathchardef   \luatexUmathchardef
    \let\mst@Umathaccent    \luatexUmathaccent
  \fi
\fi
\newif\ifmst@XeOrLua
\ifmst@LuaTeX\mst@XeOrLuatrue\fi
\ifmst@XeTeX \mst@XeOrLuatrue\fi
%    \end{macrocode}
% |1.2|: all inner macros of \mst now starts with |\mst@| for a cleaner
% name-space. 
%
% |1.3l 2016/01/29|: hmmm... at this late stage where nobody would expect me
% to still look at the code, I have found at least two macros which still
% didn't: \cs{do@the@endashstuff} and \cs{do@the@emdashstuff}.
%
% Ok, doing something more serious: compatibility with upcoming TL2016
% fontspec and its switch to |`TU'| NFSS font encoding in replacement of
% |`EU1/EU2'| Anyhow, the code in \mst has been common to the two Unicode
% engines for a while, hence it is not hard to adapt to the replacement of
% |EU1/EU2| by |TU|, maintaining compatibility with legacy installations.
%
% \begin{macro}{\mst@OneifUniEnc}
% The \cs{mst@OneifUniEnc} is expandable but must be used after
% having set \cs{mst@tmp@enc}... 
%    \begin{macrocode}
\def\mst@oti{OT1}
\def\mst@eui{EU1}\def\mst@euii{EU2}\def\mst@tu{TU}
\def\mst@OneifUniEnc {%
    \ifx \mst@tmp@enc\mst@tu   1\else
    \ifx \mst@tmp@enc\mst@eui  1\else
    \ifx \mst@tmp@enc\mst@euii 1\else 0\fi\fi\fi }
\newif\ifmst@goahead
\newif\ifmst@abort
%    \end{macrocode}
% \end{macro}
%  \begin{macro}{\mst@enc}
%  \begin{macro}{\mst@fam}
%  \begin{macro}{\mst@ser}
%  \begin{macro}{\mst@opsh}
%  \begin{macro}{\mst@bold}
%  \begin{macro}{\mst@ltsh}
%    Macros to store the font settings, each math version will store its
%    own records. 
%    \begin{macrocode}
  \def\mst@enc{\encodingdefault}
  \def\mst@fam{\familydefault}
  \def\mst@ser{\seriesdefault}
  \def\mst@opsh{\shapedefault}  %% will be default shape for operator names
  \def\mst@bold{\bfdefault}
  \def\mst@ltsh{\shapedefault}  %% will be default shape for letters
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%  \begin{macro}{\mst@greekfont}
%    |1.15c|: for use by the LGRgreek and selfGreek options. Defined as
%    an \cs{edef} in order to be able to set-up once and for all the
%    Greek at the time of \cs{usepackage}. Modifiable in the preamble
%    via \cs{MTgreekfont}\marg{font\_name}\cs{Mathastext}.
%    \begin{macrocode}
  \edef\mst@greekfont{\familydefault} %% v 1.15c 
%    \end{macrocode}
%  \end{macro}
% \begin{macro}{Package options}
%   |2011/03/09|: |1.13| introduces the option LGRgreek and systematic use
%   of \cs{if...} conditionals, for better readability (by myself) of
%   the code. 
%    \begin{macrocode}
\newif\ifmst@italic
\newif\ifmst@frenchmath
    \DeclareOption{italic}{\mst@italictrue
        \def\mst@ltsh{\itdefault}}
    \DeclareOption{frenchmath}{\mst@frenchmathtrue\mst@italictrue
      \def\mst@ltsh{\itdefault}}
\newif\ifmst@endash\mst@endashtrue  
    \DeclareOption{endash}{\mst@endashtrue}
    \DeclareOption{noendash}{\mst@endashfalse}
\newif\ifmst@emdash
    \DeclareOption{emdash}{\mst@emdashtrue\mst@endashfalse}
\newif\ifmst@alldelims
\edef\mst@tmp{\encodingdefault}\ifx\mst@oti\mst@tmp\else\mst@alldelimstrue\fi 
    \DeclareOption{alldelims}{\mst@alldelimstrue}
    \DeclareOption{nolessnomore}{\mst@alldelimsfalse}
\newif\ifmst@nosmalldelims
    \DeclareOption{nosmalldelims}{\mst@nosmalldelimstrue}
\newif\ifmst@noplus
    \DeclareOption{noplus}{\mst@noplustrue}
\newif\ifmst@nominus
    \DeclareOption{nominus}{\mst@nominustrue}
\DeclareOption{noplusnominus}{\ExecuteOptions{noplus,nominus}}
\newif\ifmst@noparen
    \DeclareOption{noparenthesis}{\mst@noparentrue}
\newif\ifmst@nopunct
    \DeclareOption{nopunctuation}{\mst@nopuncttrue}
\newif\ifmst@noequal
    \DeclareOption{noequal}{\mst@noequaltrue}
\newif\ifmst@noexclam
    \DeclareOption{noexclam}{\mst@noexclamtrue}
\newif\ifmst@asterisk
    \DeclareOption{noasterisk}{\PackageWarningNoLine{mathastext}
        {option `noasterisk\string' is deprecated.^^J\space\space\space 
         Check the documentation}}
    \DeclareOption{asterisk}{\mst@asterisktrue}
\newif\ifmst@nospecials
    \DeclareOption{nospecials}{\mst@nospecialstrue}
\newif\ifmst@basic % 1.3 to avoid unnecessary patch of amsmath \newmcodes@
    \DeclareOption{basic}{\mst@basictrue
    \ExecuteOptions{noparenthesis,nopunctuation,%
                    noplusnominus,noequal,noexclam,nospecials,nolessnomore}}
\newif\ifmst@nohbar
    \DeclareOption{nohbar}{\mst@nohbartrue}
\newif\ifmst@nodigits
    \DeclareOption{nodigits}{\mst@nodigitstrue}
\newif\ifmst@defaultimath
    \DeclareOption{defaultimath}{\mst@defaultimathtrue}
\newif\ifmst@mathaccents
    \DeclareOption{mathaccents}{\mst@mathaccentstrue}
\newif\ifmst@unimathaccents % 1.3u
    \DeclareOption{unimathaccents}{\mst@mathaccentstrue\mst@unimathaccentstrue}
\newif\ifmst@needsymbol
\newif\ifmst@symboldelimiters
    \DeclareOption{symboldelimiters}{\mst@needsymboltrue\mst@symboldelimiterstrue}
\newif\ifmst@symboldigits
    \DeclareOption{symboldigits}{\mst@needsymboltrue\mst@symboldigitstrue}
\newif\ifmst@symbolgreek
\newif\ifmst@customgreek %% new with 1.3d
    \DeclareOption{symbolgreek}{\mst@needsymboltrue\mst@symbolgreektrue
                                \mst@customgreektrue }
\newif\ifmst@symbolre
    \DeclareOption{symbolre}{\mst@needsymboltrue\mst@symbolretrue}
\newif\ifmst@symbolmisc
    \DeclareOption{symbolmisc}{\mst@needsymboltrue\mst@symbolmisctrue}
    \DeclareOption{symbol}{\ExecuteOptions{symbolgreek,symbolmisc,symbolre}}
    \DeclareOption{symbolmax}{\ExecuteOptions{symbol,symboldelimiters}}
\newif\ifmst@needeuler
\newif\ifmst@eulerdigits
    \DeclareOption{eulerdigits}{\mst@needeulertrue\mst@eulerdigitstrue}
\newif\ifmst@eulergreek
    \DeclareOption{eulergreek}{\mst@needeulertrue\mst@eulergreektrue
                               \mst@customgreektrue }
\newif\ifmst@selfGreek
    \DeclareOption{selfGreek}{\mst@selfGreektrue\mst@customgreektrue}
\newif\ifmst@selfGreeks
    \DeclareOption{selfGreeks}{\mst@selfGreekstrue\mst@selfGreektrue
                               \mst@customgreektrue }
\newif\ifmst@LGRgreek
    \DeclareOption{LGRgreek}{\mst@LGRgreektrue\mst@customgreektrue}
\newif\ifmst@LGRgreeks
    \DeclareOption{LGRgreeks}{\mst@LGRgreekstrue\mst@LGRgreektrue
                              \mst@customgreektrue}
\def\mst@greek@select{0}
\newif\ifmst@itgreek
\newif\ifmst@upgreek
    \DeclareOption{itgreek}{\mst@itgreektrue}
    \DeclareOption{upgreek}{\mst@upgreektrue}
    \DeclareOption{itGreek}{\def\mst@greek@select{1}}
    \DeclareOption{upGreek}{\def\mst@greek@select{2}}
%    \end{macrocode}
% Starting with |1.15f| the meaning of the `defaultxx' options has changed. They
% now prevent |mathastext| from defining additional alphabets rather than
% prevent it from identifying the `mathxx' with the new `Mathxx'. The
% `Mathnormal' and `Mathrm' alphabet commands are always created as they are
% SymbolFontAlphabets.
%    \begin{macrocode}
\newif\ifmst@defaultnormal
    \DeclareOption{defaultnormal}{\mst@defaultnormaltrue}
\newif\ifmst@defaultrm
    \DeclareOption{defaultrm}{\mst@defaultrmtrue}
\newif\ifmst@defaultbf
    \DeclareOption{defaultbf}{\mst@defaultbftrue}
\newif\ifmst@defaultit
    \DeclareOption{defaultit}{\mst@defaultittrue}
\newif\ifmst@defaultsf
    \DeclareOption{defaultsf}{\mst@defaultsftrue}
\newif\ifmst@defaulttt
    \DeclareOption{defaulttt}{\mst@defaulttttrue}
\newif\ifmst@nonormalbold
\DeclareOption{defaultalphabets}{\ExecuteOptions{defaultnormal,defaultrm,%
defaultbf,defaultit,defaultsf,defaulttt}\mst@nonormalboldtrue}
%    \end{macrocode}
% |mathastext| considers the default script and especially scriptscript sizes to
% be far too small, and it will modify them. An option maintains the default. 
%    \begin{macrocode}
\newif\ifmst@defaultsizes
    \DeclareOption{defaultmathsizes}{\mst@defaultsizestrue}
\newif\ifmst@twelve
    \DeclareOption{12pt}{\mst@twelvetrue}
\newif\ifmst@fouriervec
    \DeclareOption{fouriervec}{\mst@fouriervectrue}
%    \end{macrocode}
% |1.15|: the subdued option. 
%    \begin{macrocode}
\newif\ifmst@subdued
    \DeclareOption{subdued}{\mst@subduedtrue}
%    \end{macrocode}
% |1.3q|: the unicode option. Thanks to \textsc{Tobias~Brink} for suggesting its
% incorporation. The parsing of |\CurrentOption| does not seek any robustness,
% it just does its job if the option is used correctly.
%    \begin{macrocode}
\def\mst@unicodeminus {2013}
\def\mst@checkoption #1unicodeminus#2\mst@#3\mst@@
   {\ifx\\#3\\\PackageWarningNoLine{mathastext}
               {Unknown option `\CurrentOption\string'}\else
    \ifx\\#2\\\def\mst@unicodeminus {2212}\else
    \expandafter\def\expandafter\mst@unicodeminus\expandafter{\@secondoftwo#2}%
    \fi\fi}
\DeclareOption*%
  {\expandafter\mst@checkoption\CurrentOption\mst@ unicodeminus\mst@\mst@@}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
% \begin{macro}{\mst@DeclareMathAccent}
%
%   I somehow missed realizing \LaTeX{} |2019-10-01| if used together
%   with |amsmath| made repeated usage of \cs{DeclareMathAccent} trigger
%   an error: \url{https://github.com/latex3/latex2e/issues/216}.
%
%   This broke usage of \cs{Mathastext} macro in preamble.
%
%   |1.3w| works around this via \cs{mst@DeclareMathAccent}. And other
%   changes were made in \mst code to cope with these complications around
%   robustness.
%    \begin{macrocode}
\def\mst@DeclareMathAccent#1{\let#1\mst@undefined
  \expandafter
  \let\csname\expandafter\@gobble\string#1\space\endcsname\mst@undefined
  \DeclareMathAccent{#1}}
%    \end{macrocode}
% \end{macro}
% Helper macros to test math version names. User is not allowed to redefine
% via \cs{Mathastext} with optional argument or via \cs{MTDeclareVersion} the
% |normal| and |bold| math versions! Added at |1.3w|, about 7 years late.
%    \begin{macrocode}
\def\mst@normalversionname{normal}%
\def\mst@boldversionname{bold}%
%    \end{macrocode}
%  \begin{macro}{\exists} \begin{macro}{\mst@exists@skip}
%  \begin{macro}{\forall} \begin{macro}{\mst@forall@skip} 
%  \begin{macro}{\MTnormalexists}
%  \begin{macro}{\MTexistsdoesskip }
%  \begin{macro}{\MTnormalforall}
%  \begin{macro}{\MTforalldoesskip }
%  
%      |1.15e| |2012/10/21|: math skip/glue \emph{after} \cs{exists} and
%      \cs{forall}, this is useful with upright letters in math mode.
%      Each math version has its own user defined values for the skips,
%      stored as macros. The redefinitions of $\exists$ and $\forall$ are
%      done only at the end of the package as the |symbol| option will
%      also want to redefine these math symbols.
%
%      The subdued option (later and only for the normal and bold math
%      version) and the italic option (here) set to zero the package
%      default skips. With |1.2| the skips can be modified on the fly in
%      the document, they are not necessarily set in the preamble once
%      and for all for each math version.
%
%      |1.3j| adds \cs{MTnormalexists}, \cs{MTexistsdoesskip},
%      \cs{MTnormalforall}, \cs{MTforalldoesskip}.
%
%      Earlier to |1.3j|, |\let\mst@exists@original\exists| was done at End of
%      Package, now it is done at Begin Document, and same for |\forall|. We
%      pay attention that use of \cs{MTnormalexists} etc... inside the
%      preamble does not create self-let's.
%
%      Also |subdued| mode will do \cs{MTnormalexists}, \cs{MTnormalforall}
%      (earlier than |1.3j|, it only set the muskips to |0mu|.) Same when
%      using |\MTversion{normal}|, if |subdued|.
%
%      For some (random, legacy) reason, the handling of $\exists$ and
%      $\forall$ is part of the things
%      not included inside |\everymath/\everydisplay|.
%
%      |1.3v| The \mst-defined \cs{exists} and \cs{forall} are created
%      \cs{protected}. We feel this matches better with their default
%      definition as \cs{mathchardef} tokens than dealing with \LaTeX2e robust
%      macros. Besides, the coding is simpler.
%    \begin{macrocode}
\newmuskip\mst@exists@muskip  %% v 1.15e
\newmuskip\mst@forall@muskip
\def\mst@exists@skip{1mu}
\def\mst@forall@skip{.6667mu}
\ifmst@italic\ifmst@frenchmath\else
    \def\mst@exists@skip{0mu}
    \def\mst@forall@skip{0mu}
    \def\mst@prime@skip {0mu}
\fi\fi
\protected\def\mst@exists{\mst@exists@original\mskip\mst@exists@muskip}
\protected\def\mst@forall{\mst@forall@original\mskip\mst@forall@muskip}
\AtBeginDocument{%
   \let\mst@exists@original\exists
   \let\mst@forall@original\forall
   \def\MTnormalexists   {\let\exists\mst@exists@original }%
   \def\MTexistsdoesskip {\let\exists\mst@exists }%
   \def\MTnormalforall   {\let\forall\mst@forall@original }%
   \def\MTforalldoesskip {\let\forall\mst@forall }%
%    \end{macrocode}
% The document body starts in the normal math version, whether or not
% \cs{Mathastext} command as been used in the preamble (which either re-defines
% the normal/bold math version or defines another one in case of optional
% argument), and in case of |subdued| option should use the standard $\forall$
% and $\exists$.
%    \begin{macrocode}
   \ifmst@subdued
   \else
     \MTexistsdoesskip
     \MTforalldoesskip
   \fi
}%
\newcommand*\MTnormalexists   {\AtBeginDocument {\MTnormalexists   }}
\newcommand*\MTexistsdoesskip {\AtBeginDocument {\MTexistsdoesskip }}
\newcommand*\MTnormalforall   {\AtBeginDocument {\MTnormalforall   }}
\newcommand*\MTforalldoesskip {\AtBeginDocument {\MTforalldoesskip }}
%    \end{macrocode}
%  \end{macro}\end{macro}\end{macro}\end{macro}
%  \end{macro}\end{macro}\end{macro}\end{macro}
%  \begin{macro}{\prime}
%  \begin{macro}{\mst@prime@skip}
%  \begin{macro}{\active@math@prime}
%  \begin{macro}{\MTnormalprime}
%  \begin{macro}{\MTprimedoesskip}
%
%    |1.2| |2012/12/17|: math skip/glue \emph{before} the \cs{prime}
%    glyph. This is useful with the default CM glyph and upright letters
%    (in contrast the prime from |txfonts| works fine with upright
%    letters). For this we replace the \LaTeX{} kernel \cs{active@math@prime}
%    with our own skip-enhanced version \cs{mst@active@math@prime}.
%
%    |1.2b| |2012/12/31|: doing\\
%    \null\hspace{1cm}|{\catcode`\'=\active \global\let'\mst@active@math@prime}|\\
%    is awfully wrong when the right quote is made active at begin document by
%    some other package (as happens with |babel| for some languages). So \mst
%    treats now the right quote with the same method as applied to the other
%    characters it makes mathematically active. This uses the macro
%    \cs{mst@mathactivate} which is defined later in the package.
%
%    Babel does |\let\prim@s\bbl@prim@s| when |'| is made active via its
%    services (the czech and slovak languages also store the initial
%    version of \cs{prim@s}, else the quote would not work correctly
%    when being again of |catcode 12|), and it doesn't matter if \mst is
%    loaded before or after this happens, as the \cs{mst@mathactivate}
%    does its job only as part of the \cs{everymath} and
%    \cs{everydisplay} token lists.
%
%    |1.2e| being paranoid, we take precautions against a possibly
%    catcode active right quote at
%    the time of loading mathastext.
%
% |1.3i| adds \cs{MTactiveprime}.
% 
% |1.3j| renames it to \cs{MTprimedoesskip}. Besides, it makes use in the
% preamble of \cs{MTnormalprime} or \cs{MTprimedoesskip}. 
%    \begin{macrocode}
\newmuskip\mst@prime@muskip   %% v 1.2
\def\mst@prime@skip{.5mu}
\ifmst@italic\ifmst@frenchmath\else\def\mst@prime@skip{0mu}\fi\fi
\def\mst@active@math@prime{\sp\bgroup\mskip\mst@prime@muskip\prim@s}
{\catcode`\'=12 
\gdef\mst@@modifyprime{\mst@mathactivate'{}\mst@active@math@prime}}
\newcommand*\MTnormalprime   {\let\mst@modifyprime\@empty }
\newcommand*\MTprimedoesskip {\let\mst@modifyprime\mst@@modifyprime}
\ifmst@subdued
    \MTnormalprime
\else
    \MTprimedoesskip
\fi
\AtBeginDocument{%
  \everymath\expandafter
           {\the\everymath    \mst@modifyprime \MTnormalprime}%
  \everydisplay\expandafter
           {\the\everydisplay \mst@modifyprime \MTnormalprime}%
}
%    \end{macrocode}
%  \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{\MTexistsskip}
% \begin{macro}{\MTforallskip}
% \begin{macro}{\MTprimeskip}
%   |1.15e|: These user macros set up the amount of muglue after
%   \cs{exists} or \cs{forall}. The normal and
%   bold math versions inherit the same skips; these skips are set to
%   zero in case of the subdued, or the italic option. Each command
%   \cs{Mathastext}\oarg{version\_name} stores the current values in
%   the definition of the math version.
%
%   |1.2|: \cs{MTprimeskip} added, the silly \cs{@onlypreamble} are removed
%   and the macros are modified to have immediate effect in the document,
%   independently of their possible use in the preamble for the math
%   versions to store values.
%
%   Note (september 2013): the names were badly chosen; \cs{MTsetprimeskipto}
%   for example would have been a better choice.
%    \begin{macrocode}
\newcommand*\MTexistsskip[1]{\edef\mst@exists@skip{#1}%
    \mst@exists@muskip\mst@exists@skip\relax}
\newcommand*\MTforallskip[1]{\edef\mst@forall@skip{#1}%
    \mst@forall@muskip\mst@forall@skip\relax}
\newcommand*\MTprimeskip[1]{\edef\mst@prime@skip{#1}%
    \mst@prime@muskip\mst@prime@skip\relax}
\let\Mathastextexistsskip\MTexistsskip
\let\Mathastextforallskip\MTforallskip
\let\Mathastextprimeskip\MTprimeskip
\let\mathastextexistsskip\MTexistsskip
\let\mathastextforallskip\MTforallskip
\let\mathastextprimeskip\MTprimeskip
%    \end{macrocode}
%  \end{macro}\end{macro}
%  \end{macro}
%  \begin{macro}{\resetMathstrut@}
%        |2012/12/31|: The |amsmath| macro \cs{resetMathstrut@} is not compatible
%        with a
%        mathematically active opening parenthesis: it does \\
%        \null\hspace{1cm}|\mathchardef\@tempa\mathcode`\(\relax|\\
%        and is made a part of the hook \cs{every@math@size} inside
%        \cs{glb@settings}. 
%        This is called from \cs{check@mathfonts} which is done in
%        particular in \cs{frozen@everymath}, hence \emph{before} (but wait)
%        what \mst puts in \cs{everymath}. Also, \cs{glb@settings} is triggered
%        by \cs{mathversion} which must be done outside of math mode.
%
%        Alas, with things such as |$...\hbox{...$..$..}...$| \mst will have
%        already made the parenthesis (mathematically) active. And
%        \cs{boldsymbol} from |amsbsy| disables the \cs{@nomath} switch and
%        executes \cs{mathversion\{bold\}} directly in math mode. So we have a
%        problem with \cs{resetMathstrut@}. 
%
%        |lualatex-math| replaces \cs{resetMathstrut@} with its own version
%        (which also looks at |)|) and no error is signaled when \mst has done
%        |\mathcode`(="8000|, but the \cs{Mathstrutbox@} created by \mst is then
%        wrong.
%
%        The replacement macro avoids a potentially math active |(|. It
%        assumes that there is still some appropriate glyph in slot |40| of
%        |operators| and it sets the height and depth of \cs{Mathstrutbox@}
%        to be large enough to accomodate both this glyph and the one from the
%        mathastext font (both in the current math version). If option
%        |noparenthesis| was used, we leave everything untouched.
%
%    In |1.3a|, |2013/09/04|, the modification is done only at the time of
%    \cs{MTnonlettersobeymathxx}. It is canceled by
%    \cs{MTnonlettersdonotobeymathxx}. So the code has been moved to these
%    macros and here we just store at the begin document the then meaning of
%    \cs{resetMathstrut@}, and check also if \cs{MTnonlettersobeymathxx} has
%    been invoked in the preamble.
%
%    |1.3f| |2015/09/12| issues only an Info message not a Warning, as I am
%    becoming aware from another context (etoc) that Warnings are stressful to
%    users, in some integrated environments for editing and compiling \LaTeX{}
%    source files.
%    \begin{macrocode}
\ifmst@noparen\else
\AtBeginDocument{%
    \@ifundefined{resetMathstrut@}{% nothing to do, no amsmath
    }{% amsmath loaded, and possibly patched by things such as lualatex-math
    \let\mst@savedresetMathstrut@\resetMathstrut@
    \PackageInfo{mathastext}{current meaning of amsmath
      \string\resetMathstrut@\space saved}%
    \ifx\mst@the\the % means that \MTnonlettersobeymathxx was used in preamble
      \let\mst@the\@gobble\MTnonlettersobeymathxx
   \fi}}
\fi
%    \end{macrocode}
%  \end{macro} 
%
%      |1.2| |2012/12/20| does some rather daring \emph{math} activation of
%      \verb$; , : ! ? + - = < > ( ) [ ]$  in
%      math mode to achieve something I wanted to do since a long time: overcome
%      the mutually excluding relation between the variable-family concept and
%      the automatic spacing concept. After loading \mst, these characters now
%      obey the math alphabets commands but still have the automatic spacing.
%      The use as delimiters for those concerned is also ok.
%
%    The activation is done via setting the \cs{mathcode} to |"8000| through the
%    macro \cs{mst@mathactivate} which in turn is put into the \cs{everymath}
%    and \cs{everydisplay} token lists. No character is made active in the sense
%    of the \cs{catcode} (the issues with catcode active characters at
%    the entrance of the math mode are discussed later),\\
%    \null\hspace{1cm}\fbox{but the concerned characters will now expand in math
%    mode to \emph{two} tokens.}\\
%      |1.2c| |2012/12/31|: hence, this current
%      implementation puts constraints on the input: |$x^?$| or |$x\mathrel?y$|
%      now create errors. They must be input
%      |$x^{?}$|, respectively |$x\mathrel{?}y$|.\\
%   \null\hspace{1cm} \fbox{The disactivating
%        macro \cs{MTnonlettersdonotobeymathxx} is made the default.}
%
%        The mechanism is (even more) off by default for |\{| and |\}| as this
%        is not compatible with their use as delimiters (|\lbrace| and |\rbrace|
%        should be used instead) but it can be activated for them too.
%      
%
%  \begin{macro}{\mst@mathactivate}
%    |1.2b| |2012/12/30|: there were bad oversights in the |1.2| code
%    for \cs{mst@mathactivate} related to the possibility for some
%    characters to have been made active (in the sense of the catcode)
%    elsewhere (something which often is done by language definition
%    files of the |babel| system). The code from |v1.2b| tried to
%    provide correct behavior using a prefix called \cs{mst@fork} (its
%    definition and its use has since been modified) which let the
%    active character expand to the \mst re-definition \emph{only} in
%    math mode and \emph{only} if \cs{protect} was
%    \cs{@typeset@protect}. This indeed took care of situations such as
%    |$\hbox{?}$| with an active |?| or |$\label{eq:1}$| with an active
%    |:| (assuming for the latter that things would have worked ok before
%    the twiddling by \mst).
%
%    |1.2e| |2013/01/09|: alas |$\ref{eq:1}$| still was a problem.
%    Indeed in that case the \mst prefix had no means to know it was
%    inside a \cs{ref} so it made the character expand to its \mst
%    redefinition, which is not acceptable inside a
%    |\csname...\endcsname|. What happens with Babel is that it patches
%    things such as \cs{ref}, \cs{newlabel},... we can test the
%    \cs{if@safe@actives} flag to detect it in that case, but this is
%    Babel specific. After having thought hard about this I see no
%    general solution except patching all macros such as \cs{ref}...(in
%    an imitation of what Babel does). So the final decision is to not
%    do anything when the character is catcode active \emph{except} it
%    it seems that Babel is behind the scenes.
% 
%    Incidently, Babel and TikZ are buggy with characters which are
%    mathcode actives. For example the combination of |[french]{babel}|
%    and |mathtools| with its |centercolon| turns |$:$| into an
%    \emph{infinite loop} !! 
%
%    In the case of Babel the reason is that, generally (but not always,
%    the right quote |'| is an exception), the
%    \cs{normal@char}\meta{char} fall-back is \cs{string}\meta{char}.
%    But this is wrong if the mathcode is |32768|! The fall-back becomes
%    the default if the user switches to a language where \meta{char} is
%    `normal' and then an infinite loop arises.
%
%    As a further example (I am not familiar with other languages from
%    the Babel system) with |frenchb| the active |!?;:| expand in math
%    mode to \cs{string}|! or ? or ; or :|. This creates an infinite
%    loop if the mathcode is |32768|.
%
%    For the special case of the right quote |'| when it is made active
%    by Babel, its fall-back does not invoke |\string'| so being still
%    of mathcode |32768| is not a problem.
%  
%    I have posted online ^^A on TeX StackExchange 
%    how Babel should possibly modify
%    its definitions and I use this here. I simplify a bit my proposed
%    replacement of \cs{normal@char}\meta{char} as the check for
%    \cs{protect} is superfluous, I think, having been
%    done already at the level of the Babel prefix.
%
%    Replacing \cs{user@active}\meta{char} is indeed not enough, and
%    \cs{normal@char}\meta{char} also must be changed, because when the
%    user switches back to a language where the character is `normal' it
%    remains catcode active. The crucial thing is the test of
%    \cs{if@safe@actives} in the replacement of the
%    \cs{normal@char}\meta{char}, besides of course the test for math
%    mode in both replacements.
%
%    When the character is not catcode active, then \mst uses the math
%    activation method. As the mathcode is not looked at in \cs{edef},
%    \cs{write} or inside |\csname...\endcsname| nothing special needs
%    to be done, I think, in terms of protection against premature
%    expansion. (I did not know that initially). 
%
%    So, to recapitulate, \mst will use the mechanism of the active
%    |mathcode| if the character is not |catcode| active, and in the
%    opposite case will do something only in the context of Babel,
%    modifying directly its \cs{user@active}\meta{char} and its
%    \cs{normal@char}\meta{char} macros and \fbox{it does NOT then set
%    the mathcode to 32768!!}, rather it makes \emph{sure} the character
%    is not mathematically active.
%
%    As |1.2e| is a bit paranoid it takes precautions against
%    the possibility of characters it treats being active at
%    the time of its loading. Excepted from the scope of the
%    paranoia are the latin letters (that would be crazy!) and
%    also |*|, |"| and the left quote |`|.
%
%    |1.2f| |2013/01/21| with earlier versions (*) it was important not
%    to do twice the business of \cs{mst@mathactivate} (think
%    |$\hbox{$?$}$|), so I used (this was a bit wasteful) some sort of
%    boolean macro for each character. But now that there are the
%    |\mst@the..| prefixes, let's just use them! (don't know why I did
%    not think of that earlier; perhaps I had in mind some more general
%    character per character customization initially, which I just dropped.)
%
%    (*) it is still important to not do twice the thing when the
%    character is active, in which case the |babel| macros are patched.
%
%    As an aside, |$\hbox{\catcode`?=\active $?$}$| for an |?| which was
%    unactive at the first |$| will just make \mst overwrite the
%    definition (assumed here to have been done earlier) of an active
%    |?|, but the result is that the inner |?| can not be used in
%    |\label| or |\ref|. So testing for active characters should be done
%    always... many things should be done always... I leave as is.
%
%    |1.3i| |2016/01/06| removes a spurious end of line space in
%    \cs{mst@mathactivate} (did not show as anyhow done in math mode).
%
%  \begin{macro}{\mst@do@az}
%  \begin{macro}{\mst@do@AZ}
%  \begin{macro}{\mst@addtodo@az}
%  \begin{macro}{\mst@addtodo@AZ}
%  \begin{macro}{\mst@the}
%    |1.2b| |2012/12/28| now that we understand the great advantages of |"8000|
%    we do it also for all letters a-z and A-Z to insert automatically the
%    italic corrections. See the \hyperref[sec:ic]{discussion} in the user
%    manual. Ironically I wrote the code initially for the |italic| option only
%    to realize later it was more suitable to using an \emph{upright} text font
%    in math mode! So this mathematical activation of the letters is not done if
%    the font shape is detected to be |it| or |sl|; to bypass this the command
%    \cs{MTicinmath} is provided.
%
%    |1.2e| |2013/01/10| corrects a bad oversight of |1.2b| in
%    \cs{mst@mathactivate} which made the reproduction of the user manual
%    illustrations with |$f_i^i$| impossible. As \cs{mst@mathactivate} was
%    originally used also to get the non-letters obey math alphabet while
%    maintaining the \TeX{} spacings, it added no extra braces. The braces
%    should however be added for expansion of math active letters, in order of
%    things like |x^y| to work as expected. (the group braces do not prevent
%    ligatures when the letters are arguments to the math alphabet commands,
%    the added macros \cs{mst@itcorr} and \cs{mst@before<letter>} expanding to
%    nothing).
%
%    Added note |2016/01/06|: it should be explicitly said that the extra
%    |{..}| in |\mst@mathactivate| for letters end up creating |\hbox|'es
%    around each letter with its extra skips and explicit italic correction,
%    when present. These skips are thus set at natural width and do not add
%    any break point.
%
%  \begin{macro}{\MTmath-}\begin{macro}{activeletters}
%  \begin{macro}{\MTmath-}\begin{macro}{standardletters}
%    |1.3| |2013/09/02| extends the use of mathematically active letters to
%    allow the user to specify muglue before and after the letter itself (see
%    \cs{MTsetmathskips}, below).
%    Mathematically active letters were previously used only to add the italic
%    correction; the math activation has now been separated and put in
%    \cs{MTmathactiveletters}. There is also \cs{MTmathactiveLetters} to allow
%    math activation only for the uppercase letters. To cancel the (now default,
%    even with option |italic|) math
%    activation of letters, there is \cs{MTmathstandardletters}. Version |1.3a|
%    removes some silly |\string|'s from the code, which prevented to pass
%    macros as first argument to the command.
%  \begin{macro}{\MTnonletters-}\begin{macro}{obeymathxx}
%  \begin{macro}{\MTnonletters-}\begin{macro}{donotobeymathxx}
%  \begin{macro}{\resetMathstrut@}
%    These macros are modified in version |1.3a| |2013/09/04| in order to
%    cleverly adjust, or not, the |amsmath| \cs{resetMathstrut@}. When used in
%    the preamble, they just modify \cs{mst@the}. And there is code at begin
%    document to check the status there of \cs{mst@the} and if its meaning is
%    \cs{the}, then \cs{MTnonlettersobeymathxx} is activated again to do the
%    patch. When used in the body they adjust \cs{resetMathstrut@}.
%
%    Notice that the saved meaning is the one at begin document (thus,
%    possibly patched by |lualatex-math| --- not anymore since 1.5 of March
%    2016, as |amsmath.sty| now maintained by LaTeX team has modified
%    \cs{resetMathStrut@} to make it compatible to Unicode engines) but
%    modifications done after that would not be seen in
%    |\mst@savedresetMathstrut@|.
%
%    The new version of \cs{resetMathStrut@} from LaTeX team release
%    |2016/03/03 v2.15a| of |amsmath.sty| is still not compatible with a math
%    active opening parenthesis. Hence my patch here is still needed.
%
%    At |1.3u| \cs{MTnonlettersobeymathxx} and \cs{MTeasynonlettersobeymathxx}
%    are made no-ops under subdued mode. This fixes some bug if for example
%    the former was used in preamble or immediately after |\begin{document}|
%    making the minus sign math active although the \mst action was
%    supposedly subdued. Similarly \cs{MTmathactiveletters} is now a no-op
%    if issued under subdued mode in the \emph{normal} or \emph{bold} math
%    versions.
%    \begin{macrocode}
\newtoks\mst@do@nonletters
\newtoks\mst@do@easynonletters
\newtoks\mst@do@az
\newtoks\mst@do@AZ
\let\mst@the\@gobble
\newcommand*\MTnonlettersdonotobeymathxx{%
    \ifx\mst@the\@gobble
    \else
      \@ifundefined{mst@savedresetMathstrut@}{}{%
        \PackageInfo{mathastext}{restoring (for this group or environment) amsmath \string\resetMathstrut@}%
      \let\resetMathstrut@\mst@savedresetMathstrut@}%
    \fi
    \let\mst@the\@gobble
}%
%    \end{macrocode}
% |1.3u| adds this check that we are not in a subdued normal or bold math
% version. No need for expandable coding.
%    \begin{macrocode}
\def\mst@OnlyIfNotSubdued#1{%
    \ifmst@subdued
      \ifx\math@version\mst@normalversionname
      \else
        \ifx\math@version\mst@boldversionname
        \else
          #1%
        \fi
      \fi
    \else
      #1%
    \fi
}%
\def\mst@nonlettersobeymathxx{%
    \ifx\mst@the\the
    \else
      \@ifundefined{mst@savedresetMathstrut@}{}{%
        \ifmst@symboldelimiters
          \def\resetMathstrut@{%
           \setbox\z@\hbox{\the\textfont\symmtpsymbol\char40
                        \the\textfont\symmtoperatorfont\char40
                        \the\textfont\symoperators\char40}%
           \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@}%
        \else
          \def\resetMathstrut@{%
           \setbox\z@\hbox{\the\textfont\symmtoperatorfont\char40
                        \the\textfont\symoperators\char40}%
           \ht\Mathstrutbox@\ht\z@ \dp\Mathstrutbox@\dp\z@}%
        \fi
      \PackageInfo{mathastext}{\string\resetMathstrut@\space 
      from amsmath replaced (for this group or environment)}}%
    \fi
    \let\mst@the\the
}%
\newcommand*\MTnonlettersobeymathxx
   {\mst@OnlyIfNotSubdued\mst@nonlettersobeymathxx}%
\newcommand*\MTeasynonlettersdonotobeymathxx{\let\mst@theeasy\@gobble}%
\def\mst@easynonlettersobeymathxx{\let\mst@theeasy\the}%
\newcommand*\MTeasynonlettersobeymathxx
   {\mst@OnlyIfNotSubdued\mst@easynonlettersobeymathxx}%
\MTeasynonlettersobeymathxx % no-op here if subdued mode
\def\mst@mathactiveletters{\let\mst@thef\the \let\mst@theF\the}%
\newcommand*\MTmathactiveletters
   {\mst@OnlyIfNotSubdued\mst@mathactiveletters}%
\MTmathactiveletters % no-op here if subdued mode
\def\mst@mathactiveLetters{\let\mst@theF\the}%
\newcommand*\MTmathactiveLetters
   {\mst@OnlyIfNotSubdued\mst@mathactiveLetters}%
\newcommand*\MTmathstandardletters{\let\mst@thef\@gobble \let\mst@theF\@gobble}%
%    \end{macrocode}
%  \begin{macro}{\MTicinmath}
%  \begin{macro}{\MTICinmath}
%  \begin{macro}{\MTnoicinmath}
%  \begin{macro}{\MTicalsoinmathxx}
%      \cs{MTnoicinmath} can also be used from inside math mode. 
%
%      \cs{MTicalsoinmathxx} is destined to be used inside
%      \cs{mathnormalbold} as I didn't want to add the complication of
%      extracting the family number used inside \cs{mathnormalbold} (will
%      perhaps come back if I have time to spend on
%      |source2e|). Added note |2016/01/06|: this number is a priori simply
%      |symmtletterfont+1|.
%
%      \cs{MTicinmath} can also be used inside math mode, to revert an
%      earlier \cs{MTnoicinmath} from inside the same math group: the math mode
%      had to be entered with the math activation of letters allowed.
%
%      |1.3i| |2016/01/06|: For some reason which I have now forgotten I did
%      until now:
% \begin{verbatim}
% \def\mst@itcorr{\ifnum\fam=\m@ne\/\else\ifnum\fam=\symmtletterfont\/\fi\fi}%
% \end{verbatim}
%      hence italic corrections were also applied inside \cs{mathnormal} (for
%      upright fonts; \cs{mathnormalbold} math alphabet was not treated like
%      \cs{mathnormal}). I now drop this to be more in sync with the handling
%      of the extra skips around letters. Everything gets suppressed inside
%      all math alphabets, allowing ligatures, even for \cs{mathnormal}.
%
%    \begin{macrocode}
\newcommand*\MTicinmath{% 
    \MTmathactiveletters
    \def\mst@itcorr{\ifnum\fam=\m@ne\/\fi}%
    \let\mst@ITcorr\mst@itcorr}
\newcommand*\MTICinmath{%
    \MTmathactiveLetters 
    \def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}}
\newcommand*\MTnoicinmath{\let\mst@itcorr\@empty\let\mst@ITcorr\@empty}
\newcommand*\MTnoICinmath{\let\mst@ITcorr\@empty}
\newcommand*\MTicalsoinmathxx{%
    \ifx\mst@itcorr\@empty\else\def\mst@itcorr{\/}\fi
    \ifx\mst@ITcorr\@empty\else\def\mst@ITcorr{\/}\fi}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{\MTsetmathskips}
% \begin{macro}{\MTunsetmathskips}
%   |1.3| |2013/09/02|: user level command to specify extra spaces in math mode
%   around the letters (only the 7bit a,b,..,z and A,B,..,Z). First parameter is
%   the letter, second is the math skip to be inserted before, and third the
%   skip to be inserted after; for example \cs{thickmuskip} or explicitly
%   |0.1mu|.
%
%   For this, letters are made mathematically active. This is now the package
%   default (version |1.2| did this only in the absence of option |italic|, or
%   more precisely when the font used was not of shape |it| or |sl|). But if
%   \cs{MTsetmathskips} has not been used for that letter, the only effect of
%   the math activation is, as in |1.2|, to add the italic correction
%   automatically, except when the font shape is detected to be |it| or |sl|; in
%   these latter cases, although mathematically active, the letter acts in the
%   standard way.
%
%   The command \cs{MTmathstandardletters} turns off math activation and its
%   effects for all letters.
%
%   Ligatures within the argument of a math alphabet command are impeached by
%   skips; so \cs{MTunsetmathskips} is provided to cancel the skips for one
%   specific letter (|f| for example).
%
%   |1.3a| |2013/09/04|: I strangely had |\string#1| inside \cs{MTsetmathskips}.
%   Phobic of catcode active letters... but with |\string| one needs some
%   |\expandafter| to use \cs{MTsetmathskips} in an |\@for| loop for example. It
%   is better to allow the first argument to be a macro or anything expanding to
%   a letter, and to not be paranoid about improbable catcode active letters
%   (the user just has to tame them at the time of the \cs{MTsetmathskip}) so I
%   take out these |\string|'s.
%
%   |1.3i| |2016/01/06|: the extra skips are suppressed for the arguments of
%   math alphabet commands. This applies in particular for amsmath's
%   \cs{DeclareMathOperator}.
%
%    \begin{macrocode}
\newcommand*\MTsetmathskips[3]{%
    \@namedef{mst@before#1}{\ifnum\fam=\m@ne\mskip#2\relax\fi }%
    \@namedef{mst@after#1}{\ifnum\fam=\m@ne\mskip#3\relax\fi }%
}
\newcommand*\MTunsetmathskips[1]{%
    \@namedef{mst@before#1}{}%
    \@namedef{mst@after#1}{}%
}
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{\mst@mathactivate}
% \begin{macro}{\mst@addtodo@nonletters}
% \begin{macro}{\mst@addtodo@easynonletters}
% \begin{macro}{\mst@addtodo@az}
% \begin{macro}{\mst@addtodo@AZ}
% Added note |2016/01/06|:
%   Notice that the initially |\relax| tokens \verb+\mst@[before|after]@<letter>+
%   formed with |\csname...\endcsname| do not modify TeX's math layout:
%   |{\relax f\relax}| is like |f| (also for ligatures inside |\mathrm| for
%   example).
%    \begin{macrocode}
\def\mst@magic@v #1#2#3#4#5{#1#3#4}
\def\mst@magic@vi #1#2#3#4#5#6{#1#2#4#5}
\def\mst@fork{\ifmmode\mst@magic@v\fi\@thirdofthree}
\def\mst@safefork{\ifmmode\if@safe@actives\else\mst@magic@vi\fi\fi\@thirdofthree}
\def\mst@do@activecase#1#2#3{% #1 is a category 11 or 12 character token
    \@ifundefined{active@char#1}{}{%
         \ifcat #1a\mathcode`#1=#2\else
         \ifx\relax #2\relax\mathcode`#1=`#1 \else\mathcode`#1=#3\fi\fi
    \expandafter\expandafter\expandafter\let\expandafter\expandafter
                   \csname mst@orig@user@active#1\endcsname
                   \csname user@active#1\endcsname
    \expandafter\expandafter\expandafter\let\expandafter\expandafter
                   \csname mst@orig@normal@char#1\endcsname
                   \csname normal@char#1\endcsname
    \ifcat #1a%
      \expandafter\edef\csname user@active#1\endcsname
                   {\noexpand\mst@fork {{#2\noexpand#3}}{}\expandafter
                    \noexpand\csname mst@orig@user@active#1\endcsname
                   }%
      \expandafter\edef\csname normal@char#1\endcsname
                   {\noexpand\mst@safefork {{#2\noexpand#3}}{}\expandafter
                    \noexpand\csname mst@orig@normal@char#1\endcsname
                   }%
    \else
      \expandafter\edef\csname user@active#1\endcsname
                   {\noexpand\mst@fork {#2}\noexpand#3\expandafter
                    \noexpand\csname mst@orig@user@active#1\endcsname
                   }%
      \expandafter\edef\csname normal@char#1\endcsname
                   {\noexpand\mst@safefork {#2}\noexpand#3\expandafter
                    \noexpand\csname mst@orig@normal@char#1\endcsname
                   }%
    \fi}}
\begingroup
  \catcode`\~=\active
  \def\x{\endgroup
    \def\mst@mathactivate##1##2##3{% ##1 guaranteed of cat 11 or 12
      \begingroup
      \lccode`~=`##1
      \lccode`##1=`##1
      \lowercase{\endgroup
          \ifnum\catcode`##1=\active
            \mst@do@activecase ##1{##2}##3%
            % careful as ##2 is empty in the asterisk and
            % prime case! 
          \else
            \mathcode`##1="8000 
            % version 1.3 adds the possibility of extra skips around letters,
            % (only if non catcode active at the time of use).
            \ifcat##1a\edef~{% extra braces for a^b for example
               {\expandafter\noexpand\csname mst@before##1\endcsname
                ##2\noexpand##3%
                \expandafter\noexpand\csname mst@after##1\endcsname}}%
            \else\def~{##2##3}\fi
          \fi}}}
\x
\def\mst@addtodo@nonletters#1#2#3{% 
  % #1 will be of cat 11 or 12. 
  % #2 is empty for asterisk and right quote
  \mst@do@nonletters\expandafter
      {\the\mst@do@nonletters \mst@mathactivate#1{#2}#3}%
}
\def\mst@addtodo@easynonletters#1#2{% #1 is a one char control sequence
  \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters\mathcode`#1=#2}%
}
\def\mst@addtodo@az#1#2{%
  \mst@do@az\expandafter{\the\mst@do@az\mst@mathactivate#1#2\mst@itcorr}
}
\def\mst@addtodo@AZ#1#2{%
  \mst@do@AZ\expandafter{\the\mst@do@AZ\mst@mathactivate#1#2\mst@ITcorr}%
}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{\newmcodes@}
% \begin{macro}{\mst@newmcodes@}
% \begin{macro}{\MTresetnewmcodes}
% \begin{macro}{\MTcustomizenewmcodes}
%   |1.15d|: the \cs{newmcodes@} amsmath macro causes an error in Unicode engines as soon
%   someone assigns a Unicode mathcode to the minus sign, and then makes a
%   \cs{DeclareMathOperator} declaration. Furthermore it hard-codes the font
%   family 0 as being the one to be used. Moreover just putting the concerned
%   signs |-|, |:|, |.|, |\| ,|'|, |*| inside braces emulates enough the
%   behavior (although the tick will give a prime).
%   
%   |1.3|: now tests if `basic' option was used.
%
%   |1.3d|: I should re-examine the situation with |\newmcodes@|. In the
%   meantime its relaxification will not be done if lualatex-math is
%   loaded. And the whole thing is put at begin document.
%
%   |1.3m|: |lualatex-math 1.5| n'a pas modifié son traitement de |\newmcodes@|
%   mais par contre a supprimé le patch de \cs{resetMathstrut@}. Mais la date
%   de release est restée à |2015/09/22| (date de |1.4a|) au lieu de quelque
%   chose comme |2016/03/13| (date pour l'annonce sur CTAN). Il faudra suivre
%   l'évolution future de |amsmath.sty| maintenant assurée par D.C.
%
%   |1.3n 2016/04/22|: there is no more a patch of |\newmcodes@| by
%   |lualatex-math 1.6| |(2016/04/16)|, as |amsmath 2016/03/10 v2.15b| has now
%   a version compatible with \LuaLaTeX.
%
%   My very radical |\let\newmcodes@\relax| was only a temporary measure I
%   adopted for lack of time on October 13, 2012, and apart from avoiding to
%   do that in case |lualatex-math| was detected, I never came back... finally
%   I handle it myself for |1.3n|. The remaining problem of this macro (now
%   that it does not anymore crash |lualatex| or vice versa) is that (also
%   with |amsmath| version |2016/03/10 v2.15b|) it hardcodes the font used.
%   The aim of the macro is to modify the type of spacing affected to symbols
%   |'|, |*|, |.|, |-|, |/|, |:|, in case they are used in operator names.
%
%   \begin{itemize}
%   \item As I don't want to monopolize a count register only for
%     computations, let's just be mean if \eTeX\ not there.
%   \item \mst makes (or not, depending on commands issued by the user) these
%     characters math active (the right tick already is), which complicates
%     recovery of former mathcode. We have mathchar type \emph{macros}, but
%     then the complication is in diverging behaviours of the engines:
%     |\numexpr\mst@varfam@minus\relax| works with \LuaTeX, not with \XeTeX.
%   \item the |*| must presumably really be the non-lowered text glyph.
%   \item for the |-| I hesitated but do use the hyphen in the end.
%   \item seems I simply don't understand what the amsmath code does with
%     \cs{std@minus}. It is used in \cs{relbar} and it escapes me why
%     \cs{newmcodes@} would ever want to redefine it, and more importantly why
%     on earth it tests the mathcode of |-| for that ? yes, \cs{std@minus} is
%     defined (at begin document) using the mathcode of |-|, but what's the
%     connexion to \cs{newmcodes@} ?? Any way \mst defines \cs{relbar} with
%     \cs{mst@minus@sign}. Thus I just drop this conditional.
%   \item things are complicated by the options such as |nominus|,
%     |noparenthesis|.
%   \item the \cs{newmcodes@} macro is anyhow assuming that if a new math font
%     is used it occupies math groups |0| and |1| !! very bad; fixing it in
%     passing if the character has not been handled by \mst could be
%     envisioned, but that's not \mst's job.
%     \item years go by, and I remain as baffled as ever about the story of
%     ``more than 16 math families''. I will not test again, but I am pretty
%     sure that \cs{DeclareMathSymbol} does not work with more than 16
%     families, thus when I try to be a good boy and use \cs{Umathcode} syntax
%     with |symmtoperatorfont| I am perhaps doing unnecessary efforts.
%   \item I noticed that \LuaLaTeX\ does not apply the ``TeX Ligature'' (bad
%     name) regarding the right tick APOSTROPHE being transformed into RIGHT
%     SINGLE QUOTATION MARK in math mode, but \XeLaTeX\ does. From the point
%     of view of \mst, the behaviour of \XeLaTeX\ is the coherent one. It
%     appears that \LuaLaTeX\ use in math mode of a text font does not obey
%     the set features.^^A like this
%^^A     \url{http://tex.stackexchange.com/questions/208688/oldstylefigure-issue-with-lualatex-and-mathastext}
%^^A     perhaps illustrates.
%     I opened a ticket at
%     \url{https://github.com/wspr/fontspec/issues/238}, but as usual it is
%     hard to figure out the best place where to report font matters.
%     \emph{This item might be obsolete -- not checked (1.3q).}
%     \item Some hesitation about what to do under option |symboldelimiters|. I
%     temporarily used |\symmtpsymbol|, except for the right quote and for the
%     hyphen, but finally  I drop that and use |\symmtoperatorfont| always.
%     (after testing how it looked like).
%   \end{itemize}
% All in all this is a great deal of trouble and I understand I postponed back
% in 2012! I spent some hours on this small thing, with consequent testing and
% for example this TeX Ligature issue with Unicode engines.
%
% Since |1.3v| we require e-\TeX{} extensions, so a test for
% \cs{numexpr} has been dropped here.
%    \begin{macrocode}
\ifmst@basic
\else
 \ifmst@XeOrLua
  \AtBeginDocument {%
  \ifx\newmcodes@\@undefined\else
  \edef\mst@newmcodes@{%
   \mst@Umathcode `\noexpand\' 0 \symmtoperatorfont 39\relax
   \ifmst@asterisk
    \mst@Umathcode `\noexpand\* 0 \symmtoperatorfont 42\relax 
   \else\mathcode`\noexpand\* 42 
   \fi
   \ifmst@nopunct\mathcode `\noexpand\."613A \mathcode `\noexpand\: "603A
   \else
    \mst@Umathcode `\noexpand\. 6 \symmtoperatorfont 46\relax 
    \mst@Umathcode `\noexpand\: 6 \symmtoperatorfont 58\relax 
   \fi
   \ifmst@nominus\mathcode`\noexpand\- 45 
   \else
      \mst@Umathcode `\noexpand\- 0 \symmtoperatorfont 45\relax
   \fi
   \ifmst@noparen\mathcode `\noexpand\/  47 
   \else
      \mst@Umathcode `\noexpand\/ 0 \symmtoperatorfont 47\relax
   \fi
  }%
  \let\mst@originalnewmcodes@\newmcodes@
  \fi
  }% end of AtBeginDocument
 \else
  \AtBeginDocument {%
  \ifx\newmcodes@\@undefined\else
  \edef\mst@newmcodes@{%
    \mathcode`\noexpand\' \the\numexpr\symmtoperatorfont*\@cclvi+39\relax
    \mathcode`\noexpand\* 
      \the\numexpr\ifmst@asterisk\symmtoperatorfont*\@cclvi\fi+42\relax
    \ifmst@nopunct\mathcode `\noexpand\."613A \mathcode `\noexpand\: "603A
    \else
      \mathcode`\noexpand\. \the\numexpr\mst@varfam@dot-"1000\relax
      \mathcode`\noexpand\: \the\numexpr\mst@varfam@colon-"1000\relax
    \fi
    \mathcode`\noexpand\- 
     \the\numexpr\unless\ifmst@nominus\symmtoperatorfont*\@cclvi\fi+45\relax
    \mathcode`\noexpand\/ 
     \the\numexpr\unless\ifmst@noparen\symmtoperatorfont*\@cclvi\fi+47\relax\relax
    }%
  \let\mst@originalnewmcodes@\newmcodes@
  \fi
  }% end of second AtBeginDocument
 \fi % mst@XeOrLua
\fi % mst@basic
\newcommand*\MTresetnewmcodes{\ifx\mst@originalnewmcodes@\undefined\else
                               \let\newmcodes@\mst@originalnewmcodes@\fi}
\newcommand*\MTcustomizenewmcodes{\ifx\mst@originalnewmcodes@\undefined\else
                               \let\newmcodes@\mst@newmcodes@\fi}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{mtoperatorfont}
%   Declaration of the current default font as our math
%   font. The characteristics of the used font can be
%   changed by a user call to the macros \cs{Mathastext} or
%   \cs{Mathastextwilluse}, which will be defined next. We
%   will also make one internal call to \cs{Mathastext} to
%   set up the normal and bold math versions, so we will
%   also employ \cs{SetSymbolFont} later. 
%    \begin{macrocode}
\DeclareSymbolFont{mtoperatorfont}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@opsh}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\operator@font}
%   We modify this \LaTeX{} internal variable in order for the
%   predefined \cs{cos}, \cs{sin}, etc\dots to be typeset with the
%   |mathastext| font.  This will also work for things declared
%   through the |amsmath| package command
%   \cs{DeclareMathOperator}. The alternative would have been to
%   redefine the `operators' Math Symbol Font. Obviously people
%   who expect that \cs{operator@font} will always refer to the
%   `operators' math font might be in for a surprise\dots{} well,
%   we'll see.
% \begin{macro}{\MTmathoperators-}\begin{macro}{obeymathxx}
% \begin{macro}{\MTmathoperators-}\begin{macro}{donot-}\begin{macro}{obeymathxx}
%       |1.2|: rather than just replacing \cs{symoperators} by
%       \cs{symmtoperatorfont} I add a modification which makes the
%       declared operator names sensitive to the math alphabets... ouh le
%       vilain!
%    \begin{macrocode}
\newcommand*{\MTmathoperatorsobeymathxx}
{\def\operator@font{\mathgroup\ifnum\fam=\m@ne\symmtoperatorfont\else\fam\fi}}
\newcommand*{\MTmathoperatorsdonotobeymathxx}
{\def\operator@font{\mathgroup\symmtoperatorfont}}
\MTmathoperatorsobeymathxx
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{mtletterfont}
%   At version |1.1|, we add the possibility to mimick the standard
%   behavior, that is to have italic letters and upright
%   digits. Thanks to Tariq~\textsc{Perwez} and
%   Kevin~\textsc{Klement} who asked for such a feature.
%    \begin{macrocode}
\DeclareSymbolFont{mtletterfont}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@ltsh}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTfixmathfonts}
%   There is a long-standing issue
%   \url{https://github.com/lualatex/luaotfload/issues/204} on \LuaLaTeX{} not
%   applying OpenType features in math mode (this impacts |\url| macro too, as
%   it uses math mode.) Lua\TeX{} has two modes for handling of OpenType
%   fonts, the default in text being to use the |node| mode, and this mode is
%   non-working in math, thus \mst needs to force use of |base| mode. Else one
%   sees old style figures where one does not expect them, or the opposite,
%   depending on the default font feature.
%^^A see for example \url{http://tex.stackexchange.com/questions/208688/oldstylefigure-issue-with-lualatex-and-mathastext/277628}.
%
%   Once we know the cause, the fix is relatively easy. I will go for the
%   |\everymath| way, because I don't want to dwelve at all with the details
%   of \LaTeX's handling of math fonts, of size changes, of math versions
%   etc... perhaps in the future \LaTeX{} will fix the issue upstream by modifying
%   \cs{DeclareSymbolFont} under \LuaLaTeX{} + |luaotfload| regime, then the
%   present patch by \mst will be unneeded. Naturally, here we care only about
%   the two maths fonts used by \mst: |mtoperatorfont| and |mtletterfont|.
%
%   For the |\url| situation, I have posted online a patch.
%^^A   \url{http://tex.stackexchange.com/questions/264206/cant-get-oldstyle-figures-in-url-with-lualatex}.
%
%   Not all is resolved, as I comment online
%^^A   \url{http://tex.stackexchange.com/a/307585/4686} and at
%   at \url{https://github.com/lualatex/luaotfload/issues/204#issuecomment-216465680}
%   that with |TeX Gyre Termes| for example I can not get simultaneously Old
%   Style and Tabular Figures to work in math mode, although the font name as
%   constructed by my patch (which is like the code below, only simpler as we
%   only have to consider |\textfont0|) is the correct one. Similarly with
%   |Vollkorn|: I can then not get the two features |lnum| and |tnum| to work
%   simultaneously when specified with |mode=base|. It does work with
%   |mode=node| but this mode ``does not work in math mode.''
%
% Done for |1.3o| of |2016/05/03|.
%
% |1.3p| renames the macro to \cs{MTfixmathfonts} for public access.
%    \begin{macrocode}
\begingroup
\catcode`N 12
\catcode`O 12
\catcode`D 12
\catcode`E 12
\lowercase{\gdef\mst@fixmathfonts@ #1=NODE;#2#3\relax #4\@empty #5}%
  {\ifx#2\empty\else\font\mst@mathfont=#1=base;#2#3\relax#5=\mst@mathfont\fi}
\lowercase{\gdef\MTfixmathfonts
{\expandafter\mst@fixmathfonts@
  \fontname\textfont\symmtoperatorfont\relax\relax=NODE;\empty\relax\@empty
   {\textfont\symmtoperatorfont}%
 \expandafter\mst@fixmathfonts@
  \fontname\scriptfont\symmtoperatorfont\relax\relax=NODE;\empty\relax\@empty
   {\scriptfont\symmtoperatorfont}%
 \expandafter\mst@fixmathfonts@
  \fontname\scriptscriptfont\symmtoperatorfont\relax\relax=NODE;\empty\relax\@empty
   {\scriptscriptfont\symmtoperatorfont}%
 \expandafter\mst@fixmathfonts@
  \fontname\textfont\symmtletterfont\relax\relax=NODE;\empty\relax\@empty
   {\textfont\symmtletterfont}%
 \expandafter\mst@fixmathfonts@
  \fontname\scriptfont\symmtletterfont\relax\relax=NODE;\empty\relax\@empty
   {\scriptfont\symmtletterfont}%
 \expandafter\mst@fixmathfonts@
  \fontname\scriptscriptfont\symmtletterfont\relax\relax=NODE;\empty\relax\@empty
   {\scriptscriptfont\symmtletterfont}%
  }%
}%
\endgroup
\ifmst@LuaTeX
  \everymath\expandafter{\the\everymath\mst@fixmathfonts}%
  \everydisplay\expandafter{\the\everydisplay\mst@fixmathfonts}%
\fi
\newcommand*\MTfixfonts{\let\mst@fixmathfonts\MTfixmathfonts}%
\newcommand*\MTdonotfixfonts{\let\mst@fixmathfonts\empty}%
\MTfixfonts
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Mathnormal}
% \begin{macro}{\Mathrm}
% \begin{macro}{\Mathbf}
% \begin{macro}{\Mathit}
% \begin{macro}{\Mathsf}
% \begin{macro}{\Mathtt}
% \begin{macro}{\mathnormalbold}
%   We redefine the default normal, rm, bf, it, sf, and tt alphabets,
%   but this will be done via |\renewcommand*{\mathrm}{\Mathrm}| etc\dots
%   (not anymore, see comment below).
%
%   We follow the standard \LaTeX{} behavior for \cs{mathbf}, which is
%   to pick up the bold series of the roman font (digits and operator
%   names).
%
%   We will access (if no option is passed for Greek) the \cs{omicron}
%   via \cs{mathnormal}. But unfortunately the |fourier| package with the
%   upright option does not have an upright omicron obtainable by simply
%   typing \cs{mathnormal}|{o}|. So if |fourier| is loaded we use
%   \cs{mathrm} and not \cs{mathnormal}.
%
%   Actually math alphabet macros are created robust since \LaTeX{} from 2005,
%   so at |1.3v 2019/09/19| I decided to modify the old \mst approach a bit.
%   Indeed with the old approach a \cs{mathtt} in a moving argument translates
%   ultimately into \cs{Mathtt} but if for example the new context where it
%   gets expanded is a subdued normal math version, this does not give the same
%   as \cs{mathtt} would have given there. This was a bug: imagine
%   |\section{$\mathtt{X}$}| issued in a math version, but the TOC is done in
%   subdued normal version; the output in TOC will often differ (fontsize being
%   put aside) both from out it looked at the section title and from what
%   direct usage of \cs{mathtt} in the TOC would have given. I have no strong
%   preference between the two possibilities (to be as in section title, or to
%   be as if \cs{mathtt} gets executed in TOC and obeys its local regime), but
%   it is a bug if the result is still a third one. Thus I decided to follow
%   \LaTeX2e and that \cs{mathtt} had to remain \cs{mathtt} when moving.
%
%   But a math alphabet command such as \cs{Mathtt} redefines its unprotected
%   meaning on first use as well as the one of the math version macro, hence a
%   |\letrobustmacro\mathtt\Mathtt| of sorts is no good at all. I thus opted to
%   not hack into the math \LaTeX{} font support across math versions and to
%   simply use |\protected\def| in place of obeying strictly \LaTeX2e
%   robustness (except of course in the subdued math versions as there the math
%   alphabets acquire back their original robust meanings.)
%    \begin{macrocode}
\let\mst@alph@omicron\mathnormal 
\@ifpackageloaded{fourier}{\ifsloped\else\let\mst@alph@omicron\mathrm\fi}{}
\DeclareSymbolFontAlphabet{\Mathnormal}{mtletterfont}
\DeclareSymbolFontAlphabet{\Mathrm}{mtoperatorfont}
\ifmst@nonormalbold\else
   \DeclareMathAlphabet{\mathnormalbold}{\mst@enc}{\mst@fam}{\mst@bold}{\mst@ltsh}
\fi
\ifmst@defaultbf\else
   \DeclareMathAlphabet{\Mathbf}{\mst@enc}{\mst@fam}{\mst@bold}{\mst@opsh}
\fi
\ifmst@defaultit\else
   \DeclareMathAlphabet{\Mathit}{\mst@enc}{\mst@fam}{\mst@ser}{\itdefault}
\fi
\ifmst@defaultsf\else
   \DeclareMathAlphabet{\Mathsf}{\mst@enc}{\sfdefault}{\mst@ser}{\mst@opsh}
\fi
\ifmst@defaulttt\else
   \DeclareMathAlphabet{\Mathtt}{\mst@enc}{\ttdefault}{\mst@ser}{\mst@opsh}
\fi
%    \end{macrocode}
% The \cs{mathxx} macros being \LaTeX2e robust, or course the meanings here
% are known, and «original» macros are sort of superfluous but well it works.
%    \begin{macrocode}
\let\mst@original@normal\mathnormal
\let\mst@original@rm\mathrm
\let\mst@original@bf\mathbf
\let\mst@original@it\mathit
\let\mst@original@sf\mathsf
\let\mst@original@tt\mathtt
\def\mst@restorealphabets{% for subdued
    \let\mathnormal\mst@original@normal
    \let\mathrm\mst@original@rm
    \let\mathbf\mst@original@bf
    \let\mathit\mst@original@it
    \let\mathsf\mst@original@sf
    \let\mathtt\mst@original@tt}
\def\mst@setalphabets{%
    \ifmst@defaultnormal\else\protected\def\mathnormal{\Mathnormal}\fi
    \ifmst@defaultrm\else\protected\def\mathrm{\Mathrm}\fi
    \ifmst@defaultbf\else\protected\def\mathbf{\Mathbf}\fi
    \ifmst@defaultit\else\protected\def\mathit{\Mathit}\fi
    \ifmst@defaultsf\else\protected\def\mathsf{\Mathsf}\fi
    \ifmst@defaulttt\else\protected\def\mathtt{\Mathtt}\fi}
\ifmst@subdued\else\mst@setalphabets\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{LGRgreek}
% \begin{macro}{selfGreek}
% \begin{macro}{mtlgrfontupper}
% \begin{macro}{mtlgrfontlower}
% \begin{macro}{mtselfGreekfont}
%   |1.14b|: We can not move the \cs{DeclareSymbolFont} to the
%   \cs{Mathastext} macro because it resets the font family in *all*
%   math versions, and some could have been defined by the user with
%   previous calls to \cs{Mathastext}. So we have to have them here.
%   The problem is that at this stage it is impossible to know if we
%   really need (in the case of LGRgreek) two separate shapes for
%   upper and lowercase, and (in the case of selfGreek) a shape
%   distinct from the one used in |mtoperatorfont|. So I opted in the
%   end for declaring possibly one too many font. To achieve more
%   economy the only way would be to keep cumulative track of all
%   previously declared math versions and to redeclare appropriately
%   the LGR or self greek fonts at each call to \cs{Mathastext} (with
%   no optional argument): a bit painful, and as I am possibly the
%   sole user in the world of this possibility of multiple math
%   versions with this package. Also the advantage to systematically
%   allocate a font for the selfGreek option is that we can force the
%   use of the OT1 encoding.
%
%   First we establish the cumulative effect of the greek related options.
%
%   |1.15c| introduces some possibilities to change the shapes of Greek letters
%   in each math versions, and even the Greek font (in LGR encoding). The
%   commands \cs{MTitgreek} etc... will be used in-between calls to
%   \cs{Mathastext} and re-adjust the shapes. And the command \cs{MTgreekfont}
%   changes the Greek font family.
%    \begin{macrocode}
\def\mst@update@greeksh{
  \def\mst@greek@lsh{\mst@ltsh} %% default behavior
  \def\mst@greek@ush{\mst@opsh}
    \ifmst@itgreek\def\mst@greek@lsh{\itdefault}
                     \def\mst@greek@ush{\itdefault}\fi
    \ifmst@upgreek\def\mst@greek@lsh{\updefault}
                     \def\mst@greek@ush{\updefault}\fi
    \ifmst@frenchmath
      \ifmst@itgreek\else
      \ifmst@upgreek\else
        \def\mst@greek@lsh{\mst@opsh}
        \def\mst@greek@ush{\mst@opsh}
      \fi\fi
    \fi
    \ifcase\mst@greek@select
        \or\def\mst@greek@ush{\itdefault}
        \or\def\mst@greek@ush{\updefault}
    \fi}
\mst@update@greeksh
\ifmst@LGRgreek
    \DeclareFontEncoding{LGR}{}{}
    \DeclareSymbolFont{mtlgrfontlower}{LGR}{\mst@fam}{\mst@ser}{\mst@greek@lsh}
    \DeclareSymbolFont{mtlgrfontupper}{LGR}{\mst@fam}{\mst@ser}{\mst@greek@ush}
\else
\ifmst@selfGreek
    \DeclareSymbolFont{mtselfGreekfont}{OT1}{\mst@fam}{\mst@ser}{\mst@greek@ush}
\fi\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{mteulervm}
% \begin{macro}{\MathEuler}
% \begin{macro}{\MathEulerBold}
% In case we need the Euler font, we declare it here. It will use
% |uzeur.fd| from the |eulervm| package of Walter~\textsc{Schmidt}
%    \begin{macrocode}
\ifmst@needeuler\typeout{** will use Euler font; command \string\MTEulerScale}
\DeclareSymbolFont{mteulervm}{U}{zeur}{m}{n}
\DeclareSymbolFontAlphabet{\MathEuler}{mteulervm}
\DeclareMathAlphabet{\MathEulerBold}{U}{zeur}{\mst@bold}{n}
\fi
\newcommand*\MTEulerScale[1]{\edef\zeu@Scale{#1}}
\let\MathastextEulerScale\MTEulerScale
%    \end{macrocode}
% \LaTeXe{} has a strange initial configuration where the
% capital Greek letters are of type |mathalpha|, but the
% lower Greek letters of type |mathord|, so that \cs{mathbf}
% does not act on them, although lowercase Greek letters and
% Latin letters are from the same font. This is because
% \cs{mathbf} is set up to be like a bold version of
% \cs{mathrm}, and \cs{mathrm} uses the `operators' font, by
% default |cmr|, where there are NO lowercase greek
% letters. This set-up is ok for the Capital Greek letters
% which are together with the Latin letters in both |cmmi|
% and |cmr|.
%
% The package eulervm sets the lowercase Greek letters to be
% of type |mathalpha|, the default \cs{mathbf} and
% \cs{mathrm} will act wierdly on them, but a \cs{mathbold}
% is defined which will use the bold series of the Euler
% roman font, it gives something coherent for Latin and
% Greek \emph{lowercase} letters, and this is possible
% because the same font contains upright forms for them all.
%
% Here in |mathastext|, Latin letters and Greek letters (lower and upper case)
% must be (generally) assumed to come from two different fonts, as a result the
% standard \cs{mathbf} (and \cs{mathrm}) will give weird results when used for
% Greek letters. We could coerce \cs{mathbf} to do something reasonable (cf
% |http://tug.org/pipermail/texhax/2011-January/016605.html|) but at this time
% |30-01-2011 09:42:27 CET| I decided I would not try to implement it here. I
% prefer to respect the default things.
%
% I followed the simpler idea of the |eulervm| package and
% defineed \cs{MathEuler} and \cs{MathEulerBold} alphabet
% commands (the |eulervm| package does this only for the
% bold font).
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{mtpsymbol}
% \begin{macro}{\MathPSymbol}
% In case we need the Symbol font, we declare it here. The macro
% \cs{psy@scale} will be used to scale the font (see at the
% very end of this file).
%    \begin{macrocode}
\ifmst@needsymbol\typeout{** will use Symbol font; command \string\MTSymbolScale}
 \def\psy@scale{1}
 \DeclareSymbolFont{mtpsymbol}{U}{psy}{m}{n}
 \DeclareSymbolFontAlphabet{\MathPSymbol}{mtpsymbol}
\AtBeginDocument{%
  \DeclareFontFamily{U}{psy}{}%
  \DeclareFontShape{U}{psy}{m}{n}{<->s*[\psy@scale] psyr}{}%
}
\fi
\newcommand*\MTSymbolScale[1]{\edef\psy@scale{#1}}
\let\MathastextSymbolScale\MTSymbolScale
%    \end{macrocode}
% I did not choose for name \cs{MathSymbol} as this may
% be defined somewhere for another thing.  There is no bold
% for the postscript Symbol font distributed with the
% \LaTeXe{} |psnffs| core package.
% \end{macro}
% \end{macro}
% \begin{macro}{\pmvec}
% Definition of a poor man version of the \cs{vec} accent
%    \begin{macrocode}
\DeclareRobustCommand*\pmvec[1]{\mathord{\stackrel{\raisebox{-.5ex}%
{\tiny\boldmath$\mathord{\rightarrow}$}}{{}#1}}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\fouriervec}
%   The glyph is taken from the Fourier font of
%   Michel~\textsc{Bovani}. Note: (oct 2012) I should not allocate an
%   entire symbol font just for one glyph! But I have not given any
%   serious thought to what one can do to simulate a math accent
%   without doing such a wasteful thing.
%    \begin{macrocode}
\ifmst@fouriervec
  \DeclareFontEncoding{FML}{}{}
  \DeclareFontSubstitution{FML}{futm}{m}{it}
  \DeclareSymbolFont{mathastextfourier}{FML}{futm}{m}{it}
  \SetSymbolFont{mathastextfourier}{bold}{FML}{futm}{b}{it}
  \mst@DeclareMathAccent{\fouriervec}{\mathord}{mathastextfourier}{"7E}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTencoding}
% \begin{macro}{\MTfamily}
% \begin{macro}{\MTseries}
% \begin{macro}{\MTshape}
% \begin{macro}{\MTboldvariant}
% \begin{macro}{\MTlettershape}
%   Some public macros to modify our private internals, and
%   we will use them also ourself.
%
%   In version |1.1| we add the possibility to have two
%   distinct font shapes for letters and digits. So in fact
%   we could as well have two really unrelated fonts but
%   this is really not the spirit of the package.
%
%   Note that using these macros in the preamble allows \cs{Mathastext}
%   to set up math versions with a given font for math mode, and at the
%   same time not modifying the \cs{familydefault} or \cs{romandefault}
%   etc\dots
%    \begin{macrocode}
\newcommand*\MTencoding[1]{\def\mst@enc{#1}}
\newcommand*\MTfamily[1]{\def\mst@fam{#1}}
\newcommand*\MTseries[1]{\def\mst@ser{#1}}
\newcommand*\MTshape[1]{\def\mst@opsh{#1}
  \ifmst@italic\else\def\mst@ltsh{#1}\fi}
\newcommand*\MTboldvariant[1]{\def\mst@bold{#1}}
\newcommand*\MTlettershape[1]{\def\mst@ltsh{#1}}
\let\Mathastextencoding\MTencoding
\let\Mathastextfamily\MTfamily
\let\Mathastextseries\MTseries
\let\Mathastextshape\MTshape
\let\Mathastextboldvariant\MTboldvariant
\let\Mathastextlettershape\MTlettershape
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\MTitgreek}
% \begin{macro}{\MTupgreek}
% \begin{macro}{\MTitGreek}
% \begin{macro}{\MTupGreek}
% \begin{macro}{\MTgreekfont}
%   |1.15c|: These new macros can be used in-between calls to \cs{Mathastext}.
%   They reset the shapes for Greek letters (applies to LGRgreek(s) and
%   selfGreek(s) options). The \cs{MTgreekfont} presupposes either LGRgreek or
%   selfGreek. |\MTgreekfont{\familydefault}| acts like turning on LGRgreeks or
%   selfGreeks.
%    \begin{macrocode}
    \newcommand*\MTitgreek{%
\mst@itgreektrue\mst@upgreekfalse\def\mst@greek@select{0}}
    \newcommand*\MTupgreek{%
\mst@upgreektrue\mst@itgreekfalse\def\mst@greek@select{0}}
    \newcommand*\MTitGreek{\def\mst@greek@select{1}}
    \newcommand*\MTupGreek{\def\mst@greek@select{2}}
\let\Mathastextitgreek\MTitgreek
\let\Mathastextupgreek\MTupgreek
\let\MathastextitGreek\MTitGreek
\let\MathastextupGreek\MTupGreek
    \newcommand*\MTgreekfont[1]{\def\mst@greekfont{#1}}
\let\Mathastextgreekfont\MTgreekfont
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% At (long...) last we now change the font for the letters of the
% latin alphabet. In version |1.1|, Latin letters have their own font
% (shape).
%
% |1.2b| initiated the use of mathematically active letters to insert the italic
% corrections. With version |1.3| the use of math active letters is also for
% extra muglue added before and after the letters. Use of |\@for| to shorten the
% code initiated with release |1.3|.
%    \begin{macrocode}
\def\mst@DeclareMathLetter #1{%
    \DeclareMathSymbol {#1}{\mathalpha}{mtletterfont}{`#1}%
    \expandafter
    \DeclareMathSymbol \csname mst@#1\endcsname{\mathalpha}{mtletterfont}{`#1}%
    \expandafter\mst@addtodo@az\expandafter #1\csname mst@#1\endcsname
}%
\@tfor\mst@tmp:=abcdefghijklmnopqrstuvwxyz\do
     {\expandafter\mst@DeclareMathLetter\mst@tmp}%
\ifmst@frenchmath \def\mst@font@tbu{mtoperatorfont}%
   \else          \def\mst@font@tbu{mtletterfont}%
\fi
\def\mst@DeclareMathLetter #1{%
    \DeclareMathSymbol {#1}{\mathalpha}{\mst@font@tbu}{`#1}%
    \expandafter
    \DeclareMathSymbol \csname mst@#1\endcsname{\mathalpha}{\mst@font@tbu}{`#1}%
    \expandafter\mst@addtodo@AZ\expandafter #1\csname mst@#1\endcsname 
}%
\@tfor\mst@tmp:=ABCDEFGHIJKLMNOPQRSTUVWXYZ\do
     {\expandafter\mst@DeclareMathLetter\mst@tmp}%
\let\mst@DeclareMathLetter\relax
\ifmst@nodigits\else
\def\mst@font@tbu{mtoperatorfont}%
%    \end{macrocode}
% In version |1.1|, we have now separated digits from letters, so paradoxically
% it is less problematic to give them the |mathalpha| type. 
%    \begin{macrocode}
\ifmst@symboldigits \def\mst@font@tbu{mtpsymbol} \fi
\ifmst@eulerdigits \def\mst@font@tbu{mteulervm} \fi
\DeclareMathSymbol{0}{\mathalpha}{\mst@font@tbu}{`0}%
\DeclareMathSymbol{1}{\mathalpha}{\mst@font@tbu}{`1}%
\DeclareMathSymbol{2}{\mathalpha}{\mst@font@tbu}{`2}%
\DeclareMathSymbol{3}{\mathalpha}{\mst@font@tbu}{`3}%
\DeclareMathSymbol{4}{\mathalpha}{\mst@font@tbu}{`4}%
\DeclareMathSymbol{5}{\mathalpha}{\mst@font@tbu}{`5}%
\DeclareMathSymbol{6}{\mathalpha}{\mst@font@tbu}{`6}%
\DeclareMathSymbol{7}{\mathalpha}{\mst@font@tbu}{`7}%
\DeclareMathSymbol{8}{\mathalpha}{\mst@font@tbu}{`8}%
\DeclareMathSymbol{9}{\mathalpha}{\mst@font@tbu}{`9}%
\fi
%    \end{macrocode}
% When |symboldelimiters| is passed as an option, we use the
% Symbol font for the printable characters other than
% letters and digits. 
%    \begin{macrocode}
\ifmst@symboldelimiters 
\def\mst@font@tbu{mtpsymbol}%
\mst@endashfalse
\mst@emdashfalse
\else
\def\mst@font@tbu{mtoperatorfont}%
\fi
%    \end{macrocode}
% |1.2| adds the tricks to let non letters/digits obey math alphabets. We have
% to double the definitions for easy switch on-off of the mechanism, via a token
% list which is put into \cs{everymath} and \cs{everydisplay}.
%    \begin{macrocode}
\ifmst@noexclam\else\typeout{** \string! and \string?}%
\DeclareMathSymbol{!}{\mathclose}{\mst@font@tbu}{"21}%
\DeclareMathSymbol{\mst@varfam@exclam}{\mathalpha}{\mst@font@tbu}{"21}%
\expandafter\mst@addtodo@nonletters\string!\mathclose\mst@varfam@exclam
\DeclareMathSymbol{?}{\mathclose}{\mst@font@tbu}{"3F}%
\DeclareMathSymbol{\mst@varfam@question}{\mathalpha}{\mst@font@tbu}{"3F}%
\expandafter\mst@addtodo@nonletters\string?\mathclose\mst@varfam@question
\fi
%    \end{macrocode}
% \begin{macro}{\MTlowerast}
% \begin{macro}{\mst@doasterisk}
% \begin{macro}{\mst@@doasterisk}
% \begin{macro}{\MTnormalasterisk}
% \begin{macro}{\MTactiveasterisk}
%   |1.12d| The \cs{ast} or |*| is defined in |fontmath.ltx| as a binary
%   operator from the |symbols| font. Usually the asterisk from the text
%   font is in a raised position. Previous versions of \mst did nothing
%   with \cs{ast} but strangely defined |*| to be the one from the text
%   font, with type \cs{mathalpha}. The package now leaves by default
%   both |*| and |\ast| untouched, and if passed option |asterisk|
%   replaces both of them with a lowered text asterisk (or the one from
%   the Symbol font), and of type \cs{mathbin}. A trick is used to
%   optionally get both |*| and \cs{ast} obey the math alphabets.
%
% The user macro \cs{MTlowerast} sets the amount
% of lowering to be applied to the text asterisk.
%
%   |1.12e| Somehow there was a big omission in |1.12d|, the
%   command \cs{MTlowerast} as described in the manual was missing!
%
% nota bene: it is assumed that |*| is of type |other| when \mst
% is loaded... it should neither be active, nor of type |letter|!
%
% |1.3i| adds \cs{MTnormalasterisk} and \cs{MTactiveasterisk}. They do nothing
% without option |asterisk|.
%    \begin{macrocode}
\def\mst@@doasterisk{\let\ast\mst@ast\mst@mathactivate*{}\mst@ast}%
\newcommand*\MTnormalasterisk {\let\mst@doasterisk\relax}
\newcommand*\MTactiveasterisk {\let\mst@doasterisk\mst@@doasterisk}
\ifmst@asterisk\typeout{** asterisk: \string\ast\space and *}
    \AtBeginDocument{%
     \everymath\expandafter
              {\the\everymath   \mst@doasterisk \MTnormalasterisk }%
     \everydisplay\expandafter
              {\the\everydisplay\mst@doasterisk \MTnormalasterisk }}
  \ifmst@symbolmisc
    \def\mst@bin@ast{%
    \mathbin{\mathchoice{\raisebox{-.1\height}%
                        {\the\textfont\symmtpsymbol\char42}}%
                      {\raisebox{-.1\height}%
                        {\the\textfont\symmtpsymbol\char42}}%
                      {\raisebox{-.1\height}%
                        {\the\scriptfont\symmtpsymbol\char42}}%
                      {\raisebox{-.1\height}%
                        {\the\scriptscriptfont\symmtpsymbol\char42}}}}%
  \else
    \def\mst@bin@ast{%
    \mathbin{\mathchoice{\raisebox{-\mst@lowerast}%
                        {\the\textfont\symmtoperatorfont\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\textfont\symmtoperatorfont\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\scriptfont\symmtoperatorfont\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\scriptscriptfont\symmtoperatorfont\char42}}}}%
  \fi
  \def\mst@varfam@ast{\ifnum\fam=\m@ne\mst@bin@ast\else
    \mathbin{\mathchoice{\raisebox{-\mst@lowerast}%
                        {\the\textfont\fam\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\textfont\fam\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\scriptfont\fam\char42}}%
                      {\raisebox{-\mst@lowerast}%
                        {\the\scriptscriptfont\fam\char42}}}\fi}%
  \MTactiveasterisk
  \DeclareRobustCommand*{\mst@ast}{\mst@bin@ast}
  \newcommand*\MTlowerast[1]{\def\mst@lowerast{#1}}
  \MTlowerast{.3\height}
  \mst@do@easynonletters\expandafter\expandafter\expandafter
    {\expandafter\the\expandafter\mst@do@easynonletters
     \expandafter\def\csname mst@ast \endcsname{\mst@varfam@ast}}
\fi
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}\end{macro}
% (2011) I renounced to try to do things with all the various dots, they are
% defined in many different ways, and there is the amsmath also. Dealing with
% this issue would mean a lot a time for a minuscule result. Better to leave the
% user use the |mathdots| package and accept that we can not avoid the default
% fonts in that case. So here I just treat |.| (in the hope to really lessen by
% 1 the number of fonts embedded at the end in the PDF). 
%
% [(Dec. 2012) should I reexamine these definitive sounding remarks?]
%    \begin{macrocode}
\ifmst@nopunct\else\typeout{** punctuation\string: \string, \string. \string: \string; and \string\colon}
\DeclareMathSymbol{,}{\mathpunct}{\mst@font@tbu}{"2C}
\DeclareMathSymbol{\mst@varfam@comma}{\mathalpha}{\mst@font@tbu}{"2C}
\expandafter\mst@addtodo@nonletters\string,\mathpunct\mst@varfam@comma
\DeclareMathSymbol{.}{\mathord}{\mst@font@tbu}{"2E}
\DeclareMathSymbol{\mst@varfam@dot}{\mathalpha}{\mst@font@tbu}{"2E}
\mst@addtodo@easynonletters\.\mst@varfam@dot
\DeclareMathSymbol{:}{\mathrel}{\mst@font@tbu}{"3A} % relation spacing
\DeclareMathSymbol{\mst@varfam@colon}{\mathalpha}{\mst@font@tbu}{"3A}
\expandafter\mst@addtodo@nonletters\string:\mathrel\mst@varfam@colon
\@ifpackageloaded{amsmath}
{} % \colon defined in amsmath.sty in terms of : with some enlarged explicit
   % spacing. No need to intervene. 
{% no amsmath, use standard punctuation spacing
\let\colon\undefined 
  % the reason is if some package has redefined \colon which then
  % can not be used in \cs{DeclareMathSymbol} anymore (we
  % shamelessly overwrite...)
    \DeclareMathSymbol{\colon}{\mathpunct}{\mst@font@tbu}{"3A}
    \mst@do@nonletters\expandafter{\the\mst@do@nonletters
%    \end{macrocode}
% |1.3v| uses \cs{protected} for the (optional) \cs{colon} redefinition.
%    \begin{macrocode}
        \protected\def\colon{\mathpunct{\mst@varfam@colon}}}} 
\DeclareMathSymbol{;}{\mathpunct}{\mst@font@tbu}{"3B}
\DeclareMathSymbol{\mst@varfam@pointvirgule}{\mathalpha}{\mst@font@tbu}{"3B}
\expandafter\mst@addtodo@nonletters\string;\mathpunct\mst@varfam@pointvirgule
\fi
%    \end{macrocode}
% \begin{macro}{\relbar}
% Due to the way = and - are used by \LaTeX{} in arrows, we will
% have to redefine \cs{Relbar} and \cs{relbar} in order for 
% them to preserve their original meanings.
%
% |1.15d|: Oct 13, 2012. Belated amendment of the code to be compatible
% with Unicode engines in case someone changed the mathcode of -.
% However, for the time being I can do it in an easy way only for
% \XeTeX, not for \LuaLaTeX. Also I do my modifications to \cs{relbar}
% in a manner testing for the presence of amsmath.
%
% |1.3v 2019/09/19|: \LaTeX{} of |2019-10-01| defines \cs{leftarrowfill}
% and \cs{rightarrowfill} as robust macros, so we do the same.
%
% I need to put amsmath under surveillance to check if it decides to
% robustify \cs{relbar} at some point, now that the \LaTeX\ team has
% taken over maintenance.
%
% |2019/09/16| Use \cs{protected} for \cs{right\textbar{}leftarrowfill} in the non
% \cs{DeclareRobustCommand} branch?
%    \begin{macrocode}
\ifmst@nominus
\else
  \ifmst@XeOrLua
    \mst@Umathcharnumdef\mst@minus@sign=\mst@Umathcodenum`\-\relax
%^^A I used this prior to the new \luatexUmathcodenum, as available since TL2013:
%^^A \mathchardef\mst@minus@sign=8704\relax % "2200
  \else
    \mathchardef\mst@minus@sign=\mathcode`\-\relax
  \fi
  \@ifpackageloaded{amsmath}
    {\def\relbar{\mathrel{\mathpalette\mathsm@sh\mst@minus@sign}}}
    {\DeclareRobustCommand\relbar{\mathrel{\smash\mst@minus@sign}}}
  \ifmst@robust@obsessed@LaTeX@era\expandafter\DeclareRobustCommand
   \else\expandafter\def\fi
  \rightarrowfill{$\m@th\mathord{\relbar}\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
  \mkern-7mu\mathord\rightarrow$}
  \ifmst@robust@obsessed@LaTeX@era\expandafter\DeclareRobustCommand
   \else\expandafter\def\fi
  \leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
  \mkern-7mu\mathord{\relbar}$}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{endash}
%  |1.1| |2011/01/29|: Producing this next piece of code was not a piece
%   of cake for a novice like myself!\newline
%  |1.11| |2011/02/05|: Compatibility with Unicode (via use of fontspec
%   encodings EU1 and EU2)\newline
%  |1.12| |2011/02/07|: Improved dealing of Unicode possibility.\newline
%  |1.14b| |2011/04/02|: Corrected some very irresponsible bug in the
%   Unicode part which caused a problem when 10 or more math families have
%   been allocated.\newline
%  |1.15| |2012/09/24|: Added AtBeginDocument to circumvent some amsmath
%   problem with unicode engines.
%
% |1.3l| |2016/01/29|: anticipating TL2016 fontspec's switch to |TU|.
%
% |1.3t| |2018/08/22|: fix to very ancient (|2012/12/20|) bug with
% |\DeclareMathSymbol| lacking last argument if encoding not T1, OT1 or
% LY1 when setting up math mode to use the en-dash character as minus
% sign (PDF\TeX\ engine).
%
% \begin{macro}{\mst@subduedminus}
% \begin{macro}{\mst@nonsubduedminus}
% |1.3t| Further, new macros |\mst@subduedminus| and |\mst@nonsubduedminus|,
% for the good functioning of the subdued option also in case of
% presence of fontspec. This is the only character for which subdued
% option works (now) by setting the mathcode on each math version
% change. Indeed, a typical issue is when the Unicode EN DASH or MINUS
% is used, but the actual font in subdued normal math version is
% originally in OT1 or T1 encoding. The only reasonable way to address
% this is by actually modifying the assigned mathcode at each version
% change. This means also that |\MTversion| and not |\mathversion|
% must be used for good functioning.
%
% |1.3u| improves the handling of the minus sign by letting it be compatible
% with math versions (and not only with the with subdued mechanism but all
% math versions) having varying font encodings, even possibly classic 8bit
% font encoding mixed with TU encoding for Unicode engines. For this it is
% needed to work around a feature of XeTeX/LuaLaTeX, here is original comment:
%
% \begin{quotation}
%     afaict it is
%     impossible to use straightforwardly in extended mathcode assignments
%     a control sequence as created by \cs{Umathchardef}.
%     This is counter-intuitive and breaks expectations.
% \end{quotation}
%
% But the |1.3u| mechanism with \cs{mst@UmathchardefWorkAround@i} introduced a
% bug which showed under option |noendash| (hence also |symboldelimiters|) with
% Unicode engines. Fixed at |1.3w|.
%    \begin{macrocode}
\let\mst@subduedminus\empty
\let\mst@nonsubduedminus\empty
\def\mst@dothe@endashstuff#1#2#3{%
  \edef\mst@tmp@enc{#3}%
  \if1\mst@OneifUniEnc
    \mst@Umathchardef#1=2 \symmtoperatorfont "\mst@unicodeminus\relax
    \mst@Umathchardef#2=7 \symmtoperatorfont "\mst@unicodeminus\relax
  \else
    \DeclareMathSymbol{#1}{\mathbin}{mtoperatorfont}
                      {\csname\mst@tmp@enc\string\textendash\endcsname}
    \DeclareMathSymbol{#2}{\mathalpha}{mtoperatorfont}
                      {\csname\mst@tmp@enc\string\textendash\endcsname}
  \fi}% mst@dothe@endashstuff
\def\mst@dothe@emdashstuff#1#2#3{%
  \edef\mst@tmp@enc{#3}%
  \if1\mst@OneifUniEnc
    \mst@Umathchardef#1=2 \symmtoperatorfont "2014\relax
    \mst@Umathchardef#2=7 \symmtoperatorfont "2014\relax
  \else
    \DeclareMathSymbol{#1}{\mathbin}{mtoperatorfont}
                      {\csname\mst@tmp@enc\string\textemdash\endcsname}
    \DeclareMathSymbol{#2}{\mathalpha}{mtoperatorfont}
                      {\csname\mst@tmp@enc\string\textemdash\endcsname}
  \fi}% mst@dothe@emdashstuff
\def\mst@dothe@hyphenstuff#1#2{%
  \DeclareMathSymbol{#1}{\mathbin}{\mst@font@tbu}{"2D}%
  \DeclareMathSymbol{#2}{\mathalpha}{\mst@font@tbu}{"2D}%
}%
\def\mst@varfam@minus{\@nameuse{mst@varfam@minus@mv\math@version}}%
\ifmst@nominus\else
  \expandafter\mst@addtodo@nonletters\string-\mathbin\mst@varfam@minus
  \def\mst@nonsubduedminus{%
    \edef\mst@tmp@enc{\csname mst@encoding@\math@version\endcsname}%
    \if1\mst@OneifUniEnc
     \mst@Umathcode`\-=\expandafter
                       \mst@UmathchardefWorkAround@i
                       \csname mst@minus@mv\math@version\endcsname
                       \relax
    \else
     \mathcode`\-=\@nameuse{mst@minus@mv\math@version}% self-delimiting
    \fi
   }% \mst@nonsubduedminus
%    \end{macrocode}
% The above works only if the \cs{mst@minus@mv<name>} was really
% defined via \cs{Umathchardef}. If it was defined via \cs{DeclareMathSymbol}
% then it is a \cs{mathchar}, not a \cs{Umathchar}. At least currently (2019).
% So we need to correct the definition of \cs{mst@nonsubduedminus}.
%    \begin{macrocode}
  \ifmst@endash\else\ifmst@emdash\else
    \def\mst@nonsubduedminus{%
      \mathcode`\-=\@nameuse{mst@minus@mv\math@version}% self-delimiting
      }% non Umathchardef \mst@minus@mv<mathversion> macros
  \fi\fi
\fi
\def\mst@UmathchardefWorkAround@i
    {\expandafter\mst@UmathchardefWorkAround@ii\meaning}%
\def\mst@UmathchardefWorkAround@ii#1"{"}%
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% \begin{macro}{\mst@hbar@mvnormal}
% \begin{macro}{\mst@ltbar@mvnormal}
%   |2011/01/31|, |1.1| I decide to settle the question of the |\hbar|. The
%   \LaTeX{} definition is |\def\hbar{{\mathchar'26\mkern-9muh}}|
%   and its advantage is that |h| is in the correct font. But of course not
%   the macron character (|\=|, |\bar|). And anyway |amsfonts| uses a
%   \cs{DeclareMathSymbol}. Also there is the kern whose length depends on
%   |cmsy| (18mu=1em and em taken from info in |cmsy|).
%
%   I will need an |rlap| adapted to math
%   mode, and this is provided by code from Alexander~R.~\textsc{Perlis} in
%   his TugBoat article 22 (2001), 350--352, which I found by googling |rlap|.
%   (as an aside, I am only now (April 2, 2011) aware that the package
%   |mathtools| provides the |mathrlap| etc... )
%
%   |1.3l 2016/01/29|: anticipating TL2016 fontspec's switch to |TU|.
%
%   |1.3u 2019/08/20|: encoding (8bits) agnostic construct for hbar, using same
%   method as for |mathaccents| option. I should add some way to adjust the
%   vertical positioning.
%
%   On this occasion I replace |h| by |\mst@h| because the mechanism for
%   before and after skips does not interact well with the rlap construct.
%
%   |1.3v 2019/09/19| adapts to maintain the robustness of \cs{hbar} which now
%   applies with \LaTeX{} |2019-10-01|.
%
%   |1.3w| works around \url{https://github.com/latex3/latex2e/issues/216} via
%   \cs{mst@DeclareMathAccent}. The upstream bug affected the definition of
%   \cs{mst@ltbar@mvnormal} and broke usage of \cs{Mathastext} in preamble.
%
%   |1.3w| also fixes oversight that \cs{hbar} may have been redefined via
%   \cs{DeclareMathSymbol} by some package (e.g. |amsfonts|) and with \LaTeX{}
%   |2019-10-01| this means \cs{hbar<space>} is now undefined. Modifying it
%   changed nothing to \cs{hbar} behaviour in such circumstances. Finally we
%   opt for a \cs{protected} \cs{hbar} and choose to ignore completely if
%   there is a \cs{hbar<space>} or not. To avoid extra steps we do not
%   undefine it if it exists, because we would need to restore it in
%   subdued math versions.
%    \begin{macrocode}
\let\mst@subduedhbar\@empty
\let\mst@nonsubduedhbar\@empty
\ifmst@nohbar\else
  \def\mst@subduedhbar{\let\hbar\mst@original@hbar}%
  \def\mst@nonsubduedhbar{\expandafter
       \let\expandafter\hbar\csname mst@hbar@mv\math@version\endcsname}%
\fi
\def\mst@mathrlap{\mathpalette\mst@mathrlapinternal}
\def\mst@mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
\def\mst@dothe@hbarstuff#1#2#3{%
  \edef\mst@tmp@enc{#3}%
  \if1\mst@OneifUniEnc % Unicode engine and font
    \mst@Umathchardef#1="7 \symmtletterfont "0127 \relax %% or 210F?
  \else
    \begingroup
    \def\@text@composite##1\@text@composite##2{##2}%
    \let\add@accent\@firstoftwo
    \mst@DeclareMathAccent{#2}{\mathalpha}{mtletterfont}%
                      {\csname\mst@tmp@enc\string\=\endcsname{}}%
    \endgroup
    \protected\def#1{\mst@mathrlap{#2{\ }}\mst@h}%
  \fi
}% end of \mst@dothe@hbarstuff
%    \end{macrocode}
% \end{macro}
% \end{macro}
% |1.15d|: Oct 13, 2012. The \cs{mathcode} thing with = is (belatedly,
% sorry!) made Unicode compatible.
% \begin{macro}{+,=,\Relbar}
%    \begin{macrocode}
\ifmst@noplus\else\typeout{** \string+ and \string=}
\DeclareMathSymbol{+}{\mathbin}{\mst@font@tbu}{"2B}
\DeclareMathSymbol{\mst@varfam@plus}{\mathalpha}{\mst@font@tbu}{"2B}
\expandafter\mst@addtodo@nonletters\string+\mathbin\mst@varfam@plus
\fi
\ifmst@noequal\else
\ifmst@XeOrLua
    \mst@Umathcharnumdef\mst@equal@sign=\mst@Umathcodenum`\=\relax
\else
    \mathchardef\mst@equal@sign=\mathcode`\=\relax
\fi
\@ifpackageloaded{amsmath}
{\def\Relbar{\mathrel\mst@equal@sign}}
{\DeclareRobustCommand\Relbar{\mathrel{\mst@equal@sign}}}
\DeclareMathSymbol{=}{\mathrel}{\mst@font@tbu}{"3D}
\DeclareMathSymbol{\mst@varfam@equal}{\mathalpha}{\mst@font@tbu}{"3D}
%    \end{macrocode}
% \begin{macro}{\nfss@catcodes}
% |2012/12/18|: Activating = (only in math mode actually) seems very bad but
% surprisingly works well. However I had a problem with |eu2lmtt.fd| which
% should not be loaded with an active =.
% |2012/12/25|: Since then I had switched to only math activation. And in fact
% the problematic = from |eu2lmtt.fd| end up in \cs{csname}...\cs{endcsname}
% and I have
% learnt since that \TeX{} does not look at the |mathcode| inside a
% \cs{csname}...\cs{endcsname}. Example:
% \begin{verbatim}
% \mathcode`x="8000
% \begingroup
% \catcode`x=\active
% \global\everymath{\defx{Hello}}
% \endgroup
% \def\foox{World!}
% $x \csname foox\endcsname$ 
% \end{verbatim}
% We need nevertheless to inactivate the =, for the following reason. Imagine
% someone did |\catcode`==\active\def={\string=}|, or another definition which
% would not lead to a tragedy in a \cs{csname}...\cs{endcsname}. Then the = is
% active and the re-definition done by |mathastext| will not be compatible with
% loading |eu2lmtt.fd| (for the first time) from math mode, as this
% re-definition can not be expanded inside a
% \cs{csname}...\cs{endcsname}.
%
% |2012/12/28|: to be on the safe side, I add also |;| and |+| and do it
% without discriminating between engines
%    \begin{macrocode}
\typeout{** adding \string= \string; and \string+ to \string\nfss@catcodes}
\g@addto@macro\nfss@catcodes{%
  \@makeother\=%
  \@makeother\;%
  \@makeother\+%
}
\expandafter\mst@addtodo@nonletters\string=\mathrel\mst@varfam@equal
\fi
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{noparenthesis}
% \begin{macro}{(,),[,],/}
%   \cs{lbrack} and \cs{rbrack} are defined in |latex.ltx| by
%   |\def\lbrack{[}\def\rbrack{]}| so this fits well with what we do here.
%   \cs{lparen} and \cs{rparen} are similarly defined in |mathtools|. On the
%   other hand in |latex.ltx| with |\{| and |\}| are defined (in math mode) in
%   terms of the control sequences \cs{lbrace} and \cs{rbrace}. Such control
%   sequences can not be simultaneously math symbols and math delimiters,
%   thus, this complicates things for the mathastextification.
%    \begin{macrocode}
\ifmst@noparen\else\typeout{** parentheses \string( \string) \string[ \string] and slash \string/}
\ifmst@nosmalldelims
    \DeclareMathSymbol{(}{\mathopen}{\mst@font@tbu}{"28}
    \DeclareMathSymbol{)}{\mathclose}{\mst@font@tbu}{"29}
    \DeclareMathSymbol{[}{\mathopen} {\mst@font@tbu}{"5B}
    \DeclareMathSymbol{]}{\mathclose}{\mst@font@tbu}{"5D}
    \DeclareMathSymbol{/}{\mathord}{\mst@font@tbu}{"2F}
\else
    \DeclareMathDelimiter{(}{\mathopen}{\mst@font@tbu}{"28}{largesymbols}{"00}
    \DeclareMathDelimiter{)}{\mathclose}{\mst@font@tbu}{"29}{largesymbols}{"01}
    \DeclareMathDelimiter{[}{\mathopen} {\mst@font@tbu}{"5B}{largesymbols}{"02}
    \DeclareMathDelimiter{]}{\mathclose}{\mst@font@tbu}{"5D}{largesymbols}{"03}
    \DeclareMathDelimiter{/}{\mathord}{\mst@font@tbu}{"2F}{largesymbols}{"0E}
\fi
\DeclareMathSymbol{\mst@varfam@lparen}{\mathalpha}{\mst@font@tbu}{40}
\DeclareMathSymbol{\mst@varfam@rparen}{\mathalpha}{\mst@font@tbu}{41}
\DeclareMathSymbol{\mst@varfam@lbrack}{\mathalpha}{\mst@font@tbu}{"5B}
\DeclareMathSymbol{\mst@varfam@rbrack}{\mathalpha}{\mst@font@tbu}{"5D}
\DeclareMathSymbol{\mst@varfam@slash}{\mathalpha}{\mst@font@tbu}{"2F}
\expandafter\mst@addtodo@nonletters\string(\mathopen\mst@varfam@lparen
\expandafter\mst@addtodo@nonletters\string)\mathclose\mst@varfam@rparen
\expandafter\mst@addtodo@nonletters\string[\mathopen\mst@varfam@lbrack
\expandafter\mst@addtodo@nonletters\string]\mathclose\mst@varfam@rbrack
\mst@addtodo@easynonletters\/\mst@varfam@slash
\fi
%    \end{macrocode}
% \end{macro}\end{macro}
% \begin{macro}{alldelims}
% \begin{macro}{<,>,\}\begin{macro}{\setminus}\begin{macro}{\backslash}
%    \begin{macrocode}
\ifmst@alldelims\typeout{** alldelims: \string< \string>
  \string\backslash\space\string\setminus\space\string|
  \string\vert\space\string\mid\space\string\{\space and \string\}}
\ifmst@nosmalldelims
%    \end{macrocode}
% Dec 18, 2012. We then want |\let\backslash\mst@varfam@backslash| to do nothing
% when the \cs{backslash} is used as a delimiter. So here the original
% definition from |latex.ltx| is copied, generally speaking when people use
% other math symbol fonts they do respect the encoding of the CM symbols and
% largesymbols, so this is 90\% safe. But in truth I should extract from the
% meaning of \cs{backslash} the |delcode|.
%    \begin{macrocode}
    \DeclareMathDelimiter{\mst@varfam@backslash}
        {\mathalpha}{symbols}{"6E}{largesymbols}{"0F}
\else
    \DeclareMathDelimiter{<}{\mathopen}{\mst@font@tbu}{"3C}{largesymbols}{"0A}
    \DeclareMathDelimiter{>}{\mathclose}{\mst@font@tbu}{"3E}{largesymbols}{"0B}
%    \end{macrocode}
% There is no backslash in the Symbol font hence |mtoperatorfont| here.
%    \begin{macrocode}
    \DeclareMathDelimiter{\backslash}
        {\mathord}{mtoperatorfont}{"5C}{largesymbols}{"0F}
    \DeclareMathDelimiter{\mst@varfam@backslash}
        {\mathalpha}{mtoperatorfont}{"5C}{largesymbols}{"0F}
\fi    
\DeclareMathSymbol{<}{\mathrel}{\mst@font@tbu}{"3C}
\DeclareMathSymbol{>}{\mathrel}{\mst@font@tbu}{"3E}
\DeclareMathSymbol{\mst@varfam@less}{\mathalpha}{\mst@font@tbu}{"3C}
\DeclareMathSymbol{\mst@varfam@more}{\mathalpha}{\mst@font@tbu}{"3E}
\expandafter\mst@addtodo@nonletters\string<\mathrel\mst@varfam@less
\expandafter\mst@addtodo@nonletters\string>\mathrel\mst@varfam@more
\mst@do@easynonletters\expandafter{\the\mst@do@easynonletters
            \let\backslash\mst@varfam@backslash}
\DeclareMathSymbol{\setminus}{\mathbin}{mtoperatorfont}{"5C}
\DeclareMathSymbol{\mst@varfam@setminus}{\mathalpha}{mtoperatorfont}{"5C}
%    \end{macrocode}
% |1.3v| adds a \cs{protected} here for \cs{setminus}.
%    \begin{macrocode}
\mst@do@nonletters\expandafter{\the\mst@do@nonletters
            \protected\def\setminus{\mathbin{\mst@varfam@setminus}}}
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% \begin{macro}{\models}
% |1.15d|: 13 oct 2012. Before modifying \string| we must preserve \cs{models}. 
%    \begin{macrocode}
\ifmst@XeOrLua
  \mst@Umathcharnumdef\mst@vert@bar=\mst@Umathcodenum`\|\relax
\else
  \mathchardef\mst@vert@bar=\mathcode`\|\relax
\fi
\DeclareRobustCommand\models{\mathrel{\mst@vert@bar}\joinrel\Relbar}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{|,\mid,\vert}
%   (2011) I did not do anything then to try to emulate \cs{Vert} with the
%   vertical bar from the text font... and now (2012) \mst is not as radical as
%   it used to be anyhow, so it is too late. Or not (2019)? maybe I
%   \emph{should} do something here...
%
%   |1.3v 2019/09/19|: I discover this rather radical legacy
%   \verb+\def\vert{|}+, which is done here once in the preamble, but I leave
%   it unmodified apart from prefixing it with \cs{protected}. I also add a
%   \cs{protected} for the definition of \cs{mid} (which applies only under
%   \cs{MTnonlettersobeymathxx} regime).
%    \begin{macrocode}
\ifmst@nosmalldelims
    \DeclareMathSymbol{|}{\mathord}{\mst@font@tbu}{124}
\else
    \DeclareMathDelimiter{|}{\mathord}{\mst@font@tbu}{124}{largesymbols}{"0C}
\fi    
\protected\def\vert{|}
\DeclareMathSymbol{\mst@varfam@vbar}{\mathalpha}{\mst@font@tbu}{124}
\mst@addtodo@easynonletters\|\mst@varfam@vbar
\let\mid\undefined % 1.3: to avoid problems with some packages
\DeclareMathSymbol{\mid}{\mathrel}{\mst@font@tbu}{124}
\mst@do@nonletters\expandafter{\the\mst@do@nonletters
    \protected\def\mid{\mathrel\mst@varfam@vbar}}
%    \end{macrocode}
% \begin{macro}{\MTexplicitbraces-}\begin{macro}{obeymathxx}
% \begin{macro}{\MTexplicitbraces-}\begin{macro}{donotobeymathxx}
%       Braces. With version |1.2|, |\{| and |\}| will not be acceptable as
%       delimiters anymore if the redefinitions below in \cs{mst@dobraces} are
%       enacted. But they will obey math alphabets. Improvements in |1.2a|, to
%       preserve robustness.
%
%       For |1.3| I make |\lbrace| and |\rbrace| undefined first, else problems
%       may arise with some packages.
%
%       |1.3e| suppresses under option
%       |nosmalldelims| the definitions of |\lbrace| and |\rbrace| as math
%       symbols as this made |\left\lbrace| cause an error, it was a bug.
%
%       LaTeX2e defines |\{| and |\}| as robust commands for a long time
%       (I don't know since when). The \mst redefinition is done only if user
%       has executed \cs{MTexplicitbracesobeymathxx}, and it is done only when
%       entering math mode, but there could be some |\hbox| inside math, hence
%       it has to be careful to be valid in text too.
%
%       |1.3v| maintains strict \LaTeX2e robustness for |\{| and |\}|.
%       This assumes no one fiddled with |\{| and |\}| proper (without space
%       in the name).
%    \begin{macrocode}
  \ifmst@nosmalldelims
  \else
     \let\lbrace\undefined \let\rbrace\undefined
     \DeclareMathDelimiter{\lbrace}
        {\mathopen}{\mst@font@tbu}{123}{largesymbols}{"08}
     \DeclareMathDelimiter{\rbrace}
        {\mathclose}{\mst@font@tbu}{125}{largesymbols}{"09}
  \fi
\DeclareMathSymbol{\mst@varfam@lbrace}{\mathalpha}{\mst@font@tbu}{123} 
\DeclareMathSymbol{\mst@varfam@rbrace}{\mathalpha}{\mst@font@tbu}{125}
\DeclareRobustCommand*{\mst@lbrace}
        {\ifmmode\mathopen\mst@varfam@lbrace\else\textbraceleft\fi}
\DeclareRobustCommand*{\mst@rbrace}
        {\ifmmode\mathclose\mst@varfam@rbrace\else\textbraceright\fi}
\mst@do@nonletters\expandafter{\the\mst@do@nonletters
    \mst@dobraces{\expandafter\let\csname\string{ \expandafter\endcsname
                                  \csname mst@lbrace \endcsname
                  \expandafter\let\csname\string} \expandafter\endcsname
                                  \csname mst@rbrace \endcsname}}
\fi % end of \ifmst@alldelims
\newcommand*{\MTexplicitbracesobeymathxx}{\let\mst@dobraces\@firstofone}
\newcommand*{\MTexplicitbracesdonotobeymathxx}{\let\mst@dobraces\@gobble}
\MTexplicitbracesdonotobeymathxx
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% \end{macro}\end{macro}
% \begin{macro}{specials}
%   \leavevmode\kern\parindent |1.14b| |2011/04/02|: the redefinitions of
%   \#, \$, \% and \& were buggy (this showed up when 10 or more math
%   families had been created).
%
%   |1.15f| |2012/10/23|: the code, although working, was perhaps a bit insane
%   and
%   had definitions which could surprise other packages. For example, it did:\\
%   \null\hspace{1cm}|\renewcommand{\%}{\ifmmode\mt@mmode@percent\else\char37\relax\fi}|\\
%   But it seems this provokes a problem with |microtype|. Perhaps the problem
%   was that the command was not declared robust? For the dollar \LaTeX{} itself does\\
%   \null\hspace{1cm}|\DeclareRobustCommand{\$}{\ifmmode\mathdollar\else\textdollar\fi}|\\
%   So here I just modify \cs{mathdollar}. Then we have in
%   |latex.ltx| the same definitions as in |plain.tex|:
%  |\chardef\%=`\%|, 
%  |\chardef\&=`\&|, and 
%  |\chardef\#=`\#|. It turns out that we can just adjust the mathcodes of these
%  characters and achieve exactly what is wanted for the corresponding one char
%  control sequences. In math mode the control sequence will use the specified
%  mathcode. So here it is \emph{not} a redefinition of  the control sequences,
%  purely an adjustment of mathcodes.
%
%  |1.2d| |2013/01/01|: previous versions imposed the variable family type. I
%  hereby make it possible to de-activate this feature with the macro
%  \cs{MTeasynonlettersdonotobeymathxx}. Besides, I have absolutely no idea
%  why I had different looking code depending on the engine \XeTeX, \LuaTeX\ or
%  default. Removed.
%
%  |1.3c| |2013/12/14|: I have absolutely no idea why I removed the \XeTeX\
%  and \LuaTeX\ code at the time of |1.2d|! the code for tex/pdftex engine
%  could not accomodate more than 16 math families. Code for \XeTeX\ and
%  \LuaTeX\ again added. (and since TL2013 no more problems with
%  |\luatexUmathcode|.)
%    \begin{macrocode}
\ifmst@nospecials
\else
   \typeout{** \string\#\space\string\mathdollar\space
               \string\%\space\string\&\space}
  \ifmst@XeOrLua
  \mst@Umathcode`\#=0 \symmtoperatorfont "23 \relax
  \mst@Umathchardef\mathdollar=0 \symmtoperatorfont "24 \relax
  \mst@Umathcode`\%=0 \symmtoperatorfont "25 \relax
  \mst@Umathcode`\&=0 \symmtoperatorfont "26 \relax
  \mst@do@easynonletters\expandafter{%
    \the\mst@do@easynonletters
    \mst@Umathcode`\#=7 \symmtoperatorfont "23 \relax
    \mst@Umathchardef\mathdollar=7 \symmtoperatorfont "24 \relax
    \mst@Umathcode`\%=7 \symmtoperatorfont "25 \relax
    \mst@Umathcode`\&=7 \symmtoperatorfont "26 \relax
    }
  \else
  \count@=\symmtoperatorfont
  \multiply\count@ by \@cclvi
  \advance\count@ by 35
      \mathcode`\#\count@
  \advance\count@ by \@ne
      \mathchardef\mathdollar\count@
  \advance\count@ by \@ne
      \mathcode`\%\count@
  \advance\count@ by \@ne
      \mathcode`\&\count@
  \count@=\symmtoperatorfont
  \multiply\count@ by \@cclvi
  \advance\count@ by 28707 % = "7023
      \mathchardef\mst@varfam@mathhash\count@
  \advance\count@ by \@ne
      \mathchardef\mst@varfam@mathdollar\count@
  \advance\count@ by \@ne
      \mathchardef\mst@varfam@mathpercent\count@
  \advance\count@ by \@ne
      \mathchardef\mst@varfam@mathampersand\count@
  \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters
    \mathcode`\#=\mst@varfam@mathhash
    \let\mathdollar\mst@varfam@mathdollar
    \mathcode`\%=\mst@varfam@mathpercent
    \mathcode`\&=\mst@varfam@mathampersand}
  \fi
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{symbolmisc}
% We construct (with some effort) some long arrows from the Symbol glyphs, of
% almost the same lengths as the standard ones. By the way, I always found the
% \cs{iff} to be too wide, but I follow here the default. Also, although
% there is a \cs{longmapsto} in standard \LaTeX{}, if I am not mistaken, there
% is no \cs{longto}. So I define one here. I could not construct in the same
% manner \cs{Longrightarrow} etc\dots{} as the = sign from Symbol does not
% combine easily with the logical arrows, well, I could have done some box
% manipulations, but well, life is finite.
% \begin{macro}{\prod}
% \begin{macro}{\sum}
%   |1.13b|: I correct the brutal re-definitions of \cs{prod} and \cs{sum} from
%   the earlier versions of the package; most of the time the Symbol glyphs do
%   appear to be too small in display mode. The new redefinitions do have some
%   defects: |$\displaystyle\prod_1^2$| changes the position of limits but not
%   the glyph itself, and |$$\textstyle\prod_1^2$$| change the limits but
%   switches to the CM inline math glyph. So I tried\\
%   |\renewcommand{\prod}{\mathchoice{\mst@prod}{\prodpsy}{\prodpsy}{\prodpsy}}|\\
%   but this did not go well with subscripts and exponents. 
%    
% October 2012: maybe I should re-examine what I did?
%
% |1.3c| (|2013/12/14|) renames |\defaultprod| to |\MToriginalprod| and
% |\defaultsum| to 
% |\MToriginalsum|.
%
% |1.3v| hesitates about making robust here \cs{prod} and \cs{sum}. Finally I
% use \cs{protected} for them.
%    \begin{macrocode}
\ifmst@symbolmisc\typeout{** symbolmisc: miscellaneous math symbols from Symbol font}
\let\mst@prod\prod
\let\MToriginalprod\prod
\DeclareMathSymbol{\prodpsy}{\mathop}{mtpsymbol}{213}
\protected\def\prod{\ifinner\prodpsy\else\mst@prod\fi}
\let\mst@sum\sum
\let\MToriginalsum\sum
\DeclareMathSymbol{\sumpsy}{\mathop}{mtpsymbol}{229}
\protected\def\sum{\ifinner\sumpsy\else\mst@sum\fi}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\DeclareMathSymbol{\mst@implies}{\mathrel}{mtpsymbol}{222}
\DeclareRobustCommand*{\implies}{\;\mst@implies\;}
\DeclareMathSymbol{\mst@impliedby}{\mathrel}{mtpsymbol}{220}
\DeclareRobustCommand*{\impliedby}{\;\mst@impliedby\;}
\DeclareRobustCommand*{\iff}{\;\mst@impliedby\mathrel{\mkern-3mu}\mst@implies\;}
\DeclareMathSymbol{\mst@iff}{\mathrel}{mtpsymbol}{219}
\DeclareRobustCommand*{\shortiff}{\;\mst@iff\;}
\DeclareMathSymbol{\mst@to}{\mathrel}{mtpsymbol}{174}
\DeclareMathSymbol{\mst@trait}{\mathrel}{mtpsymbol}{190}
\DeclareRobustCommand*\to{\mst@to}
\DeclareRobustCommand*\longto{\mkern2mu\mst@trait\mathrel{\mkern-10mu}\mst@to}
\DeclareRobustCommand*\mapsto{\mapstochar\mathrel{\mkern0.2mu}\mst@to}
\DeclareRobustCommand*\longmapsto{%
\mapstochar\mathrel{\mkern2mu}\mst@trait\mathrel{\mkern-10mu}\mst@to}
\DeclareMathSymbol{\aleph}{\mathord}{mtpsymbol}{192}
\DeclareMathSymbol{\inftypsy}{\mathord}{mtpsymbol}{165} 
\DeclareMathSymbol{\emptyset}{\mathord}{mtpsymbol}{198}
\let\varnothing\emptyset
\DeclareMathSymbol{\nabla}{\mathord}{mtpsymbol}{209}
\DeclareMathSymbol{\surd}{\mathop}{mtpsymbol}{214}
\let\angle\undefined
\DeclareMathSymbol{\angle}{\mathord}{mtpsymbol}{208}
\DeclareMathSymbol{\forall}{\mathord}{mtpsymbol}{34}
\DeclareMathSymbol{\exists}{\mathord}{mtpsymbol}{36}
\DeclareMathSymbol{\neg}{\mathord}{mtpsymbol}{216}
\DeclareMathSymbol{\clubsuit}{\mathord}{mtpsymbol}{167}
\DeclareMathSymbol{\diamondsuit}{\mathord}{mtpsymbol}{168}
\DeclareMathSymbol{\heartsuit}{\mathord}{mtpsymbol}{169}
\DeclareMathSymbol{\spadesuit}{\mathord}{mtpsymbol}{170}
\DeclareMathSymbol{\smallint}{\mathop}{mtpsymbol}{242}
\DeclareMathSymbol{\wedge}{\mathbin}{mtpsymbol}{217}
\DeclareMathSymbol{\vee}{\mathbin}{mtpsymbol}{218}
\DeclareMathSymbol{\cap}{\mathbin}{mtpsymbol}{199}
\DeclareMathSymbol{\cup}{\mathbin}{mtpsymbol}{200}
\DeclareMathSymbol{\bullet}{\mathbin}{mtpsymbol}{183}
\DeclareMathSymbol{\div}{\mathbin}{mtpsymbol}{184}
\DeclareMathSymbol{\otimes}{\mathbin}{mtpsymbol}{196}
\DeclareMathSymbol{\oplus}{\mathbin}{mtpsymbol}{197}
\DeclareMathSymbol{\pm}{\mathbin}{mtpsymbol}{177}
\DeclareMathSymbol{\times}{\mathbin}{mtpsymbol}{180}
\DeclareMathSymbol{\proptopsy}{\mathrel}{mtpsymbol}{181}
\DeclareMathSymbol{\mid}{\mathrel}{mtpsymbol}{124} 
\DeclareMathSymbol{\leq}{\mathrel}{mtpsymbol}{163}
\DeclareMathSymbol{\geq}{\mathrel}{mtpsymbol}{179}
\DeclareMathSymbol{\approx}{\mathrel}{mtpsymbol}{187}
\DeclareMathSymbol{\supset}{\mathrel}{mtpsymbol}{201}
\DeclareMathSymbol{\subset}{\mathrel}{mtpsymbol}{204}
\DeclareMathSymbol{\supseteq}{\mathrel}{mtpsymbol}{202}
\DeclareMathSymbol{\subseteq}{\mathrel}{mtpsymbol}{205}
\DeclareMathSymbol{\in}{\mathrel}{mtpsymbol}{206}
\DeclareMathSymbol{\sim}{\mathrel}{mtpsymbol}{126}
\let\cong\undefined
\DeclareMathSymbol{\cong}{\mathrel}{mtpsymbol}{64} 
\DeclareMathSymbol{\perp}{\mathrel}{mtpsymbol}{94}
\DeclareMathSymbol{\equiv}{\mathrel}{mtpsymbol}{186}
\let\notin\undefined
\DeclareMathSymbol{\notin}{\mathrel}{mtpsymbol}{207}
\DeclareMathDelimiter{\rangle}
   {\mathclose}{mtpsymbol}{241}{largesymbols}{"0B}
\DeclareMathDelimiter{\langle}
   {\mathopen}{mtpsymbol}{225}{largesymbols}{"0A}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{symbolre}
% I like the \cs{Re} and \cs{Im} from Symbol, so I overwrite the CM ones.
%    \begin{macrocode}
\ifmst@symbolre\typeout{** symbolre: \string\Re\space and \string\Im\space from Symbol font}
\DeclareMathSymbol{\Re}{\mathord}{mtpsymbol}{"C2}
\DeclareMathSymbol{\Im}{\mathord}{mtpsymbol}{"C1}
\DeclareMathSymbol{\DotTriangle}{\mathord}{mtpsymbol}{92}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{Greek letters}
% LGRgreek $>$ selfGreek $>$ eulergreek $>$ symbolgreek 
% 
% |1.11| I correct some bugs on how eulergreek and
% symbolgreek interacted.
%
% |1.12b| more bug fixes.
%
% |1.13| 
%
%       * Option LGRgreek. 
%
%       * Also, a behavior has been changed: it regards the selfGreek case,
%       the default shape is now the one for letters, not for operator-names
%       and digits. This complies to the ISO standard.  
%
%       * bugfix: version |1.12b| did not define the \cs{omicron} in the
%       case when no Greek-related option was passed to the package. 
%
% |1.13d| has new macros |\MTstandardgreek| and |\MTcustomgreek|.
%       And in the subdued case |\MTstandardgreek| is done when switching to
%       the normal or bold math versions (previously something like this
%       was only done in case of |LGRgreek| option. )
%    \begin{macrocode}
\let\mst@mathord\mathalpha
\mst@goaheadtrue
\ifmst@selfGreek 
    \def\mst@font@tbu{mtselfGreekfont}
\else
    \ifmst@eulergreek 
        \def\mst@font@tbu{mteulervm} 
    \else
      \ifmst@symbolgreek 
        \def\mst@font@tbu{mtpsymbol}
        \let\mst@mathord\mathord
      \else
         \ifmst@LGRgreek
            \mst@goaheadfalse
         \else
%    \end{macrocode}
% The \cs{omicron} requires special treatment. By default we use the o from the
% (original) normal alphabet, if eulergreek or symbolgreek we adapt.  There is
% also a special adjustment  if the package |fourier| was loaded in its
% |upright| variant: we then take \cs{omicron} from the (original) rm alphabet.
%    \begin{macrocode}
           \mst@goaheadfalse
           \def\mst@omicron {\mst@alph@omicron{o}}
         \fi
      \fi
   \fi
\fi
\ifmst@goahead
  \DeclareMathSymbol{\mst@Alpha}{\mst@mathord}{\mst@font@tbu}{"41}
  \DeclareMathSymbol{\mst@Beta}{\mst@mathord}{\mst@font@tbu}{"42}
  \DeclareMathSymbol{\mst@Epsilon}{\mst@mathord}{\mst@font@tbu}{"45}
  \DeclareMathSymbol{\mst@Zeta}{\mst@mathord}{\mst@font@tbu}{"5A}
  \DeclareMathSymbol{\mst@Eta}{\mst@mathord}{\mst@font@tbu}{"48}
  \DeclareMathSymbol{\mst@Iota}{\mst@mathord}{\mst@font@tbu}{"49}
  \DeclareMathSymbol{\mst@Kappa}{\mst@mathord}{\mst@font@tbu}{"4B}
  \DeclareMathSymbol{\mst@Mu}{\mst@mathord}{\mst@font@tbu}{"4D}
  \DeclareMathSymbol{\mst@Nu}{\mst@mathord}{\mst@font@tbu}{"4E}
  \DeclareMathSymbol{\mst@Omicron}{\mst@mathord}{\mst@font@tbu}{"4F}
  \DeclareMathSymbol{\mst@Rho}{\mst@mathord}{\mst@font@tbu}{"50}
  \DeclareMathSymbol{\mst@Tau}{\mst@mathord}{\mst@font@tbu}{"54}
  \DeclareMathSymbol{\mst@Chi}{\mst@mathord}{\mst@font@tbu}{"58}
%    \end{macrocode}
%  When we in fact use Symbol, we  have to correct \cs{Rho} and
%  \cs{Chi}. And \cs{Digamma} is non-existent in fact (no F
%  in Symbol, F codes a \cs{Phi}).
%    \begin{macrocode}
  \ifx\mst@mathord\mathord
%    \end{macrocode}
%  symbolgreek but neither eulergreek nor selfGreek
%    \begin{macrocode}
%% attention le P de Symbol est un \Pi pas un \Rho
    \DeclareMathSymbol{\mst@Rho}{\mathord}{mtpsymbol}{"52}
%% attention le X de Symbol est un \Xi pas un \Chi
    \DeclareMathSymbol{\mst@Chi}{\mathord}{mtpsymbol}{"43}
%% attention le F de Symbol est un \Phi. Il n'y a pas de \Digamma
    \DeclareMathSymbol{\mst@Gamma}{\mathord}{mtpsymbol}{"47}
    \DeclareMathSymbol{\mst@Delta}{\mathord}{mtpsymbol}{"44}
    \DeclareMathSymbol{\mst@Theta}{\mathord}{mtpsymbol}{"51}
    \DeclareMathSymbol{\mst@Lambda}{\mathord}{mtpsymbol}{"4C}
    \DeclareMathSymbol{\mst@Xi}{\mathord}{mtpsymbol}{"58}
    \DeclareMathSymbol{\mst@Pi}{\mathord}{mtpsymbol}{"50}
    \DeclareMathSymbol{\mst@Sigma}{\mathord}{mtpsymbol}{"53}
    \DeclareMathSymbol{\mst@Upsilon}{\mathord}{mtpsymbol}{"A1}
    \DeclareMathSymbol{\mst@Phi}{\mathord}{mtpsymbol}{"46}
    \DeclareMathSymbol{\mst@Psi}{\mathord}{mtpsymbol}{"59}
    \DeclareMathSymbol{\mst@Omega}{\mathord}{mtpsymbol}{"57}
  \else % de \mst@mathord=\mathord
%    \end{macrocode}
% not symbolgreek but eulergreek or selfGreek. Note |2015/10/31| : apparemment à
% un moment dans le passé je considérais eulergreek et selfGreek comme pouvant
% être utilisés simultanément car j'avais ici "or both". Mais je laisse tomber
% tout effort réel de m'en préoccuper.
%    \begin{macrocode}
    \DeclareMathSymbol\mst@Digamma  {\mathalpha}{\mst@font@tbu}{"46}
    \DeclareMathSymbol\mst@Gamma    {\mathalpha}{\mst@font@tbu}{"00}
    \DeclareMathSymbol\mst@Delta    {\mathalpha}{\mst@font@tbu}{"01}
    \DeclareMathSymbol\mst@Theta    {\mathalpha}{\mst@font@tbu}{"02}
    \DeclareMathSymbol\mst@Lambda   {\mathalpha}{\mst@font@tbu}{"03}
    \DeclareMathSymbol\mst@Xi       {\mathalpha}{\mst@font@tbu}{"04}
    \DeclareMathSymbol\mst@Pi       {\mathalpha}{\mst@font@tbu}{"05}
    \DeclareMathSymbol\mst@Sigma    {\mathalpha}{\mst@font@tbu}{"06}
    \DeclareMathSymbol\mst@Upsilon  {\mathalpha}{\mst@font@tbu}{"07}
    \DeclareMathSymbol\mst@Phi      {\mathalpha}{\mst@font@tbu}{"08}
    \DeclareMathSymbol\mst@Psi      {\mathalpha}{\mst@font@tbu}{"09}
    \DeclareMathSymbol\mst@Omega    {\mathalpha}{\mst@font@tbu}{"0A}
  \fi % de \mst@mathord=\mathord
\fi % fin de goahead
%    \end{macrocode}
% There are differences regarding Euler and Symbol with respect to the
% available var-letters. We include one or two things like the |wp| and the
% |partial|.
%
% The lower case Greek letters in default \LaTeX{} are of type |mathord|. If
% we use the Euler font it is perhaps better to have them be of type
% |mathalpha|
%    \begin{macrocode}
\ifmst@goahead
 \ifmst@eulergreek
  \DeclareMathSymbol{\mst@alpha}  {\mathalpha}{mteulervm}{"0B}
  \DeclareMathSymbol{\mst@beta}   {\mathalpha}{mteulervm}{"0C}
  \DeclareMathSymbol{\mst@gamma}  {\mathalpha}{mteulervm}{"0D}
  \DeclareMathSymbol{\mst@delta}  {\mathalpha}{mteulervm}{"0E}
  \DeclareMathSymbol{\mst@epsilon}{\mathalpha}{mteulervm}{"0F}
  \DeclareMathSymbol{\mst@zeta}   {\mathalpha}{mteulervm}{"10}
  \DeclareMathSymbol{\mst@eta}    {\mathalpha}{mteulervm}{"11}
  \DeclareMathSymbol{\mst@theta}  {\mathalpha}{mteulervm}{"12}
  \DeclareMathSymbol{\mst@iota}   {\mathalpha}{mteulervm}{"13}
  \DeclareMathSymbol{\mst@kappa}  {\mathalpha}{mteulervm}{"14}
  \DeclareMathSymbol{\mst@lambda} {\mathalpha}{mteulervm}{"15}
  \DeclareMathSymbol{\mst@mu}     {\mathalpha}{mteulervm}{"16}
  \DeclareMathSymbol{\mst@nu}     {\mathalpha}{mteulervm}{"17}
  \DeclareMathSymbol{\mst@xi}     {\mathalpha}{mteulervm}{"18}
  \DeclareMathSymbol{\mst@omicron}{\mathalpha}{mteulervm}{"6F}
  \DeclareMathSymbol{\mst@pi}     {\mathalpha}{mteulervm}{"19}
  \DeclareMathSymbol{\mst@rho}    {\mathalpha}{mteulervm}{"1A}
  \DeclareMathSymbol{\mst@sigma}  {\mathalpha}{mteulervm}{"1B}
  \DeclareMathSymbol{\mst@tau}    {\mathalpha}{mteulervm}{"1C}
  \DeclareMathSymbol{\mst@upsilon}{\mathalpha}{mteulervm}{"1D}
  \DeclareMathSymbol{\mst@phi}    {\mathalpha}{mteulervm}{"1E}
  \DeclareMathSymbol{\mst@chi}    {\mathalpha}{mteulervm}{"1F}
  \DeclareMathSymbol{\mst@psi}    {\mathalpha}{mteulervm}{"20}
  \DeclareMathSymbol{\mst@omega}  {\mathalpha}{mteulervm}{"21}
%
  \DeclareMathSymbol{\mst@varepsilon}{\mathalpha}{mteulervm}{"22}
  \DeclareMathSymbol{\mst@vartheta}{\mathalpha}{mteulervm}{"23}
  \DeclareMathSymbol{\mst@varpi}  {\mathalpha}{mteulervm}{"24}
  \let\mst@varrho=\mst@rho
  \let\mst@varsigma=\mst@sigma
  \DeclareMathSymbol{\mst@varphi} {\mathalpha}{mteulervm}{"27}
%
  \DeclareMathSymbol{\mst@partial}{\mathalpha}{mteulervm}{"40}
  \DeclareMathSymbol{\mst@wp}{\mathalpha}{mteulervm}{"7D}
  \DeclareMathSymbol{\mst@ell}{\mathalpha}{mteulervm}{"60}
 \else
  \ifmst@symbolgreek
  \DeclareMathSymbol{\mst@alpha}{\mathord}{mtpsymbol}{"61}
  \DeclareMathSymbol{\mst@beta}{\mathord}{mtpsymbol}{"62}
  \DeclareMathSymbol{\mst@gamma}{\mathord}{mtpsymbol}{"67}
  \DeclareMathSymbol{\mst@delta}{\mathord}{mtpsymbol}{"64}
  \DeclareMathSymbol{\mst@epsilon}{\mathord}{mtpsymbol}{"65}
  \DeclareMathSymbol{\mst@zeta}{\mathord}{mtpsymbol}{"7A}
  \DeclareMathSymbol{\mst@eta}{\mathord}{mtpsymbol}{"68}
  \DeclareMathSymbol{\mst@theta}{\mathord}{mtpsymbol}{"71}
  \DeclareMathSymbol{\mst@iota}{\mathord}{mtpsymbol}{"69}
  \DeclareMathSymbol{\mst@kappa}{\mathord}{mtpsymbol}{"6B}
  \DeclareMathSymbol{\mst@lambda}{\mathord}{mtpsymbol}{"6C}
  \DeclareMathSymbol{\mst@mu}{\mathord}{mtpsymbol}{"6D}
  \DeclareMathSymbol{\mst@nu}{\mathord}{mtpsymbol}{"6E}
  \DeclareMathSymbol{\mst@xi}{\mathord}{mtpsymbol}{"78}
  \DeclareMathSymbol{\mst@omicron}{\mathord}{mtpsymbol}{"6F}
  \DeclareMathSymbol{\mst@pi}{\mathord}{mtpsymbol}{"70}
  \DeclareMathSymbol{\mst@rho}{\mathord}{mtpsymbol}{"72}
  \DeclareMathSymbol{\mst@sigma}{\mathord}{mtpsymbol}{"73}
  \DeclareMathSymbol{\mst@tau}{\mathord}{mtpsymbol}{"74}
  \DeclareMathSymbol{\mst@upsilon}{\mathord}{mtpsymbol}{"75}
  \DeclareMathSymbol{\mst@phi}{\mathord}{mtpsymbol}{"66}
  \DeclareMathSymbol{\mst@chi}{\mathord}{mtpsymbol}{"63}
  \DeclareMathSymbol{\mst@psi}{\mathord}{mtpsymbol}{"79}
  \DeclareMathSymbol{\mst@omega}{\mathord}{mtpsymbol}{"77}
  \let\mst@varepsilon=\mst@epsilon 
  \DeclareMathSymbol{\mst@vartheta}{\mathord}{mtpsymbol}{"4A}
  \DeclareMathSymbol{\mst@varpi}{\mathord}{mtpsymbol}{"76}
  \let\mst@varrho=\mst@rho 
  \DeclareMathSymbol{\mst@varsigma}{\mathord}{mtpsymbol}{"56}
  \DeclareMathSymbol{\mst@varphi}{\mathord}{mtpsymbol}{"6A}
  \DeclareMathSymbol{\mst@partial}{\mathord}{mtpsymbol}{"B6}
  \DeclareMathSymbol{\mst@wp}{\mathord}{mtpsymbol}{"C3}
  \fi
 \fi
\fi
\ifmst@LGRgreek
% cf http://milde.users.sourceforge.net/LGR/lgrxenc.def.html
% et greek.ldf du package babel
\DeclareMathSymbol{\mst@Alpha}{\mathalpha}{mtlgrfontupper}{65}
\DeclareMathSymbol{\mst@Beta}{\mathalpha}{mtlgrfontupper}{66}
\DeclareMathSymbol{\mst@Epsilon}{\mathalpha}{mtlgrfontupper}{69}
\DeclareMathSymbol{\mst@Zeta}{\mathalpha}{mtlgrfontupper}{90}
\DeclareMathSymbol{\mst@Eta}{\mathalpha}{mtlgrfontupper}{72}
\DeclareMathSymbol{\mst@Iota}{\mathalpha}{mtlgrfontupper}{73}
\DeclareMathSymbol{\mst@Kappa}{\mathalpha}{mtlgrfontupper}{75}
\DeclareMathSymbol{\mst@Mu}{\mathalpha}{mtlgrfontupper}{77}
\DeclareMathSymbol{\mst@Nu}{\mathalpha}{mtlgrfontupper}{78}
\DeclareMathSymbol{\mst@Omicron}{\mathalpha}{mtlgrfontupper}{79}
\DeclareMathSymbol{\mst@Rho}{\mathalpha}{mtlgrfontupper}{82}
\DeclareMathSymbol{\mst@Tau}{\mathalpha}{mtlgrfontupper}{84}
\DeclareMathSymbol{\mst@Chi}{\mathalpha}{mtlgrfontupper}{81}
%
\DeclareMathSymbol{\mst@Digamma}{\mathalpha}{mtlgrfontlower}{195}    
%
\DeclareMathSymbol{\mst@Gamma}{\mathalpha}{mtlgrfontupper}{71}
\DeclareMathSymbol{\mst@Delta}{\mathalpha}{mtlgrfontupper}{68}
\DeclareMathSymbol{\mst@Theta}{\mathalpha}{mtlgrfontupper}{74}
\DeclareMathSymbol{\mst@Lambda}{\mathalpha}{mtlgrfontupper}{76}
\DeclareMathSymbol{\mst@Xi}{\mathalpha}{mtlgrfontupper}{88}
\DeclareMathSymbol{\mst@Pi}{\mathalpha}{mtlgrfontupper}{80}
\DeclareMathSymbol{\mst@Sigma}{\mathalpha}{mtlgrfontupper}{83}
\DeclareMathSymbol{\mst@Upsilon}{\mathalpha}{mtlgrfontupper}{85}
\DeclareMathSymbol{\mst@Phi}{\mathalpha}{mtlgrfontupper}{70}
\DeclareMathSymbol{\mst@Psi}{\mathalpha}{mtlgrfontupper}{89}
\DeclareMathSymbol{\mst@Omega}{\mathalpha}{mtlgrfontupper}{87}
%
\DeclareMathSymbol{\mst@alpha}{\mathalpha}{mtlgrfontlower}{97}
\DeclareMathSymbol{\mst@beta}{\mathalpha}{mtlgrfontlower}{98}
\DeclareMathSymbol{\mst@gamma}{\mathalpha}{mtlgrfontlower}{103}
\DeclareMathSymbol{\mst@delta}{\mathalpha}{mtlgrfontlower}{100}
\DeclareMathSymbol{\mst@epsilon}{\mathalpha}{mtlgrfontlower}{101}
\DeclareMathSymbol{\mst@zeta}{\mathalpha}{mtlgrfontlower}{122}
\DeclareMathSymbol{\mst@eta}{\mathalpha}{mtlgrfontlower}{104}
\DeclareMathSymbol{\mst@theta}{\mathalpha}{mtlgrfontlower}{106}
\DeclareMathSymbol{\mst@iota}{\mathalpha}{mtlgrfontlower}{105}
\DeclareMathSymbol{\mst@kappa}{\mathalpha}{mtlgrfontlower}{107}
\DeclareMathSymbol{\mst@lambda}{\mathalpha}{mtlgrfontlower}{108}
\DeclareMathSymbol{\mst@mu}{\mathalpha}{mtlgrfontlower}{109}
\DeclareMathSymbol{\mst@nu}{\mathalpha}{mtlgrfontlower}{110}
\DeclareMathSymbol{\mst@xi}{\mathalpha}{mtlgrfontlower}{120}
\DeclareMathSymbol{\mst@omicron}{\mathalpha}{mtlgrfontlower}{111}
\DeclareMathSymbol{\mst@pi}{\mathalpha}{mtlgrfontlower}{112}
\DeclareMathSymbol{\mst@rho}{\mathalpha}{mtlgrfontlower}{114}
\DeclareMathSymbol{\mst@sigma}{\mathalpha}{mtlgrfontlower}{115}       
\DeclareMathSymbol{\mst@tau}{\mathalpha}{mtlgrfontlower}{116}
\DeclareMathSymbol{\mst@upsilon}{\mathalpha}{mtlgrfontlower}{117}
\DeclareMathSymbol{\mst@phi}{\mathalpha}{mtlgrfontlower}{102}
\DeclareMathSymbol{\mst@chi}{\mathalpha}{mtlgrfontlower}{113}
\DeclareMathSymbol{\mst@psi}{\mathalpha}{mtlgrfontlower}{121}
\DeclareMathSymbol{\mst@omega}{\mathalpha}{mtlgrfontlower}{119}
%
\DeclareMathSymbol{\mst@digamma}{\mathalpha}{mtlgrfontlower}{147}   
% only varsigma defined (I should check this again)
\DeclareMathSymbol{\mst@varsigma}{\mathalpha}{mtlgrfontlower}{99}  
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTstandardgreek}
% \begin{macro}{\MTcustomgreek}
% \begin{macro}{\MTrecordstandardgreek}
%   |1.3d 2014/05/23| defines the commands |\MTstandardgreek| and
%   |\MTcustomgreek| for package and user. I leave |\MTrecordstandardgreek|
%   undocumented as I don't want to encourage people to load math packages
%   after \mst.
%
% |1.3h 2015/10/31|: corrected |\MTcustomgreek| as it caused |\ell| to
% become undefined under option |symbolgreek| and, much more catastrophic,
% caused |\alpha|, etc.. to become undefined under option |selfGreek| !
%    \begin{macrocode}
\newcommand*{\MTstandardgreek}{}
\newcommand*{\MTcustomgreek}{}
\newcommand*{\MTrecordstandardgreek}{}
\ifmst@customgreek
 \renewcommand*{\MTrecordstandardgreek}{%
    \let\mst@origAlpha\Alpha
    \let\mst@origBeta\Beta
    \let\mst@origGamma\Gamma
    \let\mst@origDelta\Delta
    \let\mst@origEpsilon\Epsilon
    \let\mst@origZeta\Zeta
    \let\mst@origEta\Eta
    \let\mst@origTheta\Theta
    \let\mst@origIota\Iota
    \let\mst@origKappa\Kappa
    \let\mst@origLambda\Lambda
    \let\mst@origMu\Mu
    \let\mst@origNu\Nu
    \let\mst@origXi\Xi
    \let\mst@origOmicron\Omicron
    \let\mst@origPi\Pi
    \let\mst@origRho\Rho
    \let\mst@origSigma\Sigma
    \let\mst@origTau\Tau
    \let\mst@origUpsilon\Upsilon
    \let\mst@origPhi\Phi
    \let\mst@origChi\Chi
    \let\mst@origPsi\Psi
    \let\mst@origOmega\Omega
%
    \let\mst@origalpha\alpha
    \let\mst@origbeta\beta
    \let\mst@origgamma\gamma
    \let\mst@origdelta\delta
    \let\mst@origepsilon\epsilon
    \let\mst@origvarepsilon\varepsilon
    \let\mst@origzeta\zeta
    \let\mst@origeta\eta
    \let\mst@origtheta\theta
    \let\mst@origvartheta\vartheta
    \let\mst@origiota\iota
    \let\mst@origkappa\kappa
    \let\mst@origlambda\lambda
    \let\mst@origmu\mu
    \let\mst@orignu\nu
    \let\mst@origxi\xi
    \let\mst@origomicron\omicron
    \let\mst@origpi\pi
    \let\mst@origvarpi\varpi
    \let\mst@origrho\rho
    \let\mst@origvarrho\varrho
    \let\mst@origsigma\sigma
    \let\mst@origvarsigma\varsigma
    \let\mst@origtau\tau
    \let\mst@origupsilon\upsilon
    \let\mst@origphi\phi
    \let\mst@origvarphi\varphi
    \let\mst@origchi\chi
    \let\mst@origpsi\psi
    \let\mst@origomega\omega
    \let\mst@origDigamma\Digamma
    \let\mst@origdigamma\digamma
%
    \let\mst@origpartial\partial
    \let\mst@origwp\wp
    \let\mst@origell\ell }% \MTrecordstandardgreek
\MTrecordstandardgreek 
\renewcommand*{\MTstandardgreek}{%
    \let\Alpha\mst@origAlpha
    \let\Beta\mst@origBeta
    \let\Gamma\mst@origGamma
    \let\Delta\mst@origDelta
    \let\Epsilon\mst@origEpsilon
    \let\Zeta\mst@origZeta
    \let\Eta\mst@origEta
    \let\Theta\mst@origTheta
    \let\Iota\mst@origIota
    \let\Kappa\mst@origKappa
    \let\Lambda\mst@origLambda
    \let\Mu\mst@origMu
    \let\Nu\mst@origNu
    \let\Xi\mst@origXi
    \let\Omicron\mst@origOmicron
    \let\Pi\mst@origPi
    \let\Rho\mst@origRho
    \let\Sigma\mst@origSigma
    \let\Tau\mst@origTau
    \let\Upsilon\mst@origUpsilon
    \let\Phi\mst@origPhi
    \let\Chi\mst@origChi
    \let\Psi\mst@origPsi
    \let\Omega\mst@origOmega
%
    \let\alpha\mst@origalpha
    \let\beta\mst@origbeta
    \let\gamma\mst@origgamma
    \let\delta\mst@origdelta
    \let\epsilon\mst@origepsilon
    \let\varepsilon\mst@origvarepsilon
    \let\zeta\mst@origzeta
    \let\eta\mst@origeta
    \let\theta\mst@origtheta
    \let\vartheta\mst@origvartheta
    \let\iota\mst@origiota
    \let\kappa\mst@origkappa
    \let\lambda\mst@origlambda
    \let\mu\mst@origmu
    \let\nu\mst@orignu
    \let\xi\mst@origxi
    \let\omicron\mst@origomicron
    \let\pi\mst@origpi
    \let\varpi\mst@origvarpi
    \let\rho\mst@origrho
    \let\varrho\mst@origvarrho
    \let\sigma\mst@origsigma
    \let\varsigma\mst@origvarsigma
    \let\tau\mst@origtau
    \let\upsilon\mst@origupsilon
    \let\phi\mst@origphi
    \let\varphi\mst@origvarphi
    \let\chi\mst@origchi
    \let\psi\mst@origpsi
    \let\omega\mst@origomega
    \let\Digamma\mst@origDigamma
    \let\digamma\mst@origdigamma
%
    \let\partial\mst@origpartial
    \let\wp\mst@origwp
    \let\ell\mst@origell
}% \MTstandardgreek
\renewcommand*{\MTcustomgreek}{%
    \let\Alpha\mst@Alpha
    \let\Beta\mst@Beta
    \let\Epsilon\mst@Epsilon
    \let\Zeta\mst@Zeta
    \let\Eta\mst@Eta
    \let\Iota\mst@Iota
    \let\Kappa\mst@Kappa
    \let\Mu\mst@Mu
    \let\Nu\mst@Nu
    \let\Omicron\mst@Omicron
    \let\Rho\mst@Rho
    \let\Tau\mst@Tau
    \let\Chi\mst@Chi
% 1.3h: \mst@Digamma not defined if symbolgreek option
    \ifmst@symbolgreek\else\let\Digamma\mst@Digamma\fi
%
    \let\Gamma\mst@Gamma
    \let\Delta\mst@Delta
    \let\Theta\mst@Theta
    \let\Lambda\mst@Lambda
    \let\Xi\mst@Xi
    \let\Pi\mst@Pi
    \let\Sigma\mst@Sigma
    \let\Upsilon\mst@Upsilon
    \let\Phi\mst@Phi
    \let\Psi\mst@Psi
    \let\Omega\mst@Omega
%    \end{macrocode}
% |1.3h 2015/10/31| adds this conditional to correct the bad bug in 
% |1.3d 2014/05/23| which caused |\alpha| etc... to become undefined 
% under option |selfGreek|.
%    \begin{macrocode}
 \ifmst@selfGreek\else
    \let\alpha\mst@alpha
    \let\beta\mst@beta
    \let\gamma\mst@gamma
    \let\delta\mst@delta
    \let\epsilon\mst@epsilon
    \let\zeta\mst@zeta
    \let\eta\mst@eta
    \let\theta\mst@theta
    \let\iota\mst@iota
    \let\kappa\mst@kappa
    \let\lambda\mst@lambda
    \let\mu\mst@mu
    \let\nu\mst@nu
    \let\xi\mst@xi
    \let\omicron\mst@omicron
    \let\pi\mst@pi
    \let\rho\mst@rho
    \let\sigma\mst@sigma
    \let\tau\mst@tau
    \let\upsilon\mst@upsilon
    \let\phi\mst@phi
    \let\chi\mst@chi
    \let\psi\mst@psi
    \let\omega\mst@omega
% 1.3h: digamma only defined with option LGRgreek:
    \ifmst@LGRgreek\let\digamma\mst@digamma\fi
%
    \let\varsigma\mst@varsigma
% conditional added 1.3h 2015/10/31
    \ifmst@LGRgreek\else
      \let\varepsilon\mst@varepsilon
      \let\vartheta\mst@vartheta
      \let\varpi\mst@varpi
      \let\varrho\mst@varrho
      \let\varphi\mst@varphi
%
      \let\partial\mst@partial
      \let\wp\mst@wp
% 1.3h: no \mst@ell if symbolgreek (bugfix 1.3h 2015/10/31)
      \ifmst@symbolgreek\else\let\ell\mst@ell\fi
    \fi
 \fi
}% \MTcustomgreek
\fi
\let\Mathastextstandardgreek\MTstandardgreek
\let\Mathastextcustomgreek\MTcustomgreek
\ifmst@subdued\else\MTcustomgreek\fi
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}
% \begin{macro}{\inodot}
% \begin{macro}{\jnodot}
%   In |1.0|, I had them of type |mathord|, here I choose |mathalpha|. If I
%   used \cs{i} and \cs{j} from the text font the problem would be with the
%   fontsize, if in scriptstyle. The amsmath \cs{text} would do the trick.
%
% |1.14b| |2011/04/02|: again this bug in the EU1/EU2 encoding part, as in the
% code redefining \$ etc in math mode (see above). Fixed.
%
% |1.3l| |2016/01/29|: anticipating TL2016 fontspec's switch to |TU|.
%
% |1.3t| |2018/08/22| removes the definitions done of |\i| and |\j|
% since |1.12| (as robust commands usable both in text and math mode).
%
% |1.3u| lets the \cs{imath} and \cs{jmath} react to the font encoding at each
% math version.
%
% |1.3v| lets the redefined \cs{imath} and \cs{jmath} be \cs{protected}.
%    \begin{macrocode}
\def\mst@subduedinodot{%
   \let\inodot\mst@original@imath
   \let\jnodot\mst@original@jmath
}%
\def\mst@nonsubduedinodot{%
   \expandafter\let\expandafter\inodot
               \csname mst@inodot@mv\math@version\endcsname
   \expandafter\let\expandafter\jnodot
               \csname mst@jnodot@mv\math@version\endcsname
}%
\def\mst@dothe@inodotstuff#1#2#3{%
  \edef\mst@tmp@enc{#3}%
  \if1\mst@OneifUniEnc
    % Unicode engine and font
    \mst@Umathchardef#1="7 \symmtletterfont "0131 \relax
    \mst@Umathchardef#2="7 \symmtletterfont "0237 \relax
  \else 
   \DeclareMathSymbol{#1}{\mathalpha}{mtletterfont}
                     {\csname\mst@tmp@enc\string\i\endcsname}
   \DeclareMathSymbol{#2}{\mathalpha}{mtletterfont}
                     {\csname\mst@tmp@enc\string\j\endcsname}
  \fi}% \mst@dothe@inodotstuff
\ifmst@defaultimath\else\typeout{** \string\imath\space and \string\jmath\space}
    \AtEndOfPackage{\AtBeginDocument{%
        \protected\def\imath{\inodot}%
        \protected\def\jmath{\jnodot}%
    }}%
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{math accents}
%   \emph{Obsolete comments relative to the 2011 code:}
%   \begin{quote}
%   I don't know how to get from the encoding to the slot
%   positions of the accents (apart from going to look at
%   all possible encodings definition files and putting this
%   info here).  In standard \LaTeX{}, the math accents are
%   taken from the `operators' font. So we do the same
%   here. Of course there is the problem that the user can
%   define math versions with different encodings. Here I
%   take T1 if it was the default at the time of loading the
%   package, else OT1.
%   |1.12b|: I add LY1 which is quasi like OT1.
%   \end{quote}
%
%   At |1.3u 2019/08/20| I decide to remove the hard-coded slot positions
%   for OT1, T1 and LY1, and replace them with some hack which assumes
%   LaTeX2e way of handling text accents got executed by the encoding
%   definition file. If not, some breakage on package loading could occur, but
%   this whole thing is conditional on the |mathaccents| option anyway, which
%   per default is not executed.
%
%   The |\vec| accent is not considered here because it has no suitable
%   available glyph in a standard 8bits text font encodings.
%
%   Also at |1.3u| the math accents adapt to the font encoding at each math
%   version.
%
%   |1.3v| adapts to \LaTeX{} |2019-10-01| which now comes with robust math
%   accent macros. The «original»-named macros are without the robustifying
%   space (NOT true anymore, see |1.3w| next), as they only serve as meaning
%   holders.
%
%   On the other hand the macros
%   indexed by math version names are (in the pdflatex branch) always defined
%   via \cs{DeclareMathAccent} hence they will be robust with |2019-10-01| or
%   later and we must use the \cs{mst@robustifyingspace} with them to access
%   their real meaning (this thus differs from the situation with \cs{hbar}).
%
%   |1.3w| The above was a bit optimistic as |amsmath| for example modifies
%   \LaTeX{} internals and handles math accents differently.
%
%   We thus needed to double our
%   |\let|'s as, if |amsmath| is loaded, the cs with space will exist but not
%   be paired in expected way with the original cs. This breaks things by the
%   way if some math accent is written to an external file under a certain
%   context and executed in another context. The new context will be probably
%   ignored if |amsmath| is loaded, as the external file will have an already
%   expanded-once meaning.
%
%   Some macros with space in name might thus be created as |\relax|. Should I
%   rather create \cs{protected} macros for the math accents with Unicode
%   engines? Anyway, the construct does give good result with the few OpenType
%   text fonts I tested.
%    \begin{macrocode}
\let\mst@subduedmathaccents\@empty
\let\mst@nonsubduedmathaccents\@empty
\ifmst@mathaccents
\def\mst@subduedmathaccents{%
  \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                 {dot}{ddot}{mathring}{hat}{tilde}%
  \do
  {\expandafter\let\csname\@tempa\expandafter\endcsname
                   \csname mst@original@\@tempa\endcsname
   \expandafter\let\csname\@tempa\space\expandafter\endcsname
                   \csname mst@original@\@tempa\space\endcsname
   }%
}%
\def\mst@nonsubduedmathaccents{%
  \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                 {dot}{ddot}{mathring}{hat}{tilde}%
  \do
  {\expandafter\let\csname\@tempa\expandafter\endcsname
                   \csname mst@\@tempa @mv\math@version\endcsname
   \expandafter\let\csname\@tempa\space\expandafter\endcsname
                   \csname mst@\@tempa @mv\math@version\space\endcsname
}%
}%
\def\mst@dothe@mathaccentsstuff#1#2{%
  \begingroup
  \edef\mst@tmp@enc{#2}%
  \def\@text@composite##1\@text@composite##2{##2}%
  \let\add@accent\@firstoftwo
  \let\add@unicode@accent\@firstoftwo
  \if1\mst@OneifUniEnc
    \ifmst@unimathaccents
      % \` -> \grave
      \expandafter\xdef\csname mst@grave@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\`\endcsname{}\relax}%
      % \' -> \acute
      \expandafter\xdef\csname mst@acute@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\'\endcsname{}\relax}%
      % \v -> \check
      \expandafter\xdef\csname mst@check@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\v\endcsname{}\relax}%
      % \u -> \breve
      \expandafter\xdef\csname mst@breve@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\u\endcsname{}\relax}%
      % \= -> \bar
      \expandafter\xdef\csname mst@bar@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\=\endcsname{}\relax}%
      % \. -> \dot
      \expandafter\xdef\csname mst@dot@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\.\endcsname{}\relax}%
      % \" -> \ddot
      \expandafter\xdef\csname mst@ddot@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\"\endcsname{}\relax}%
      % \r -> \mathring
      \expandafter\xdef\csname mst@mathring@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\r\endcsname{}\relax}%
      % \^ -> \hat
      \expandafter\xdef\csname mst@hat@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\^\endcsname{}\relax}%
      % \~ -> \tilde
      \expandafter\xdef\csname mst@tilde@mv#1\mst@robustifyingspace\endcsname
       {\mst@Umathaccent
        7
        \number\symmtoperatorfont\space
        \csname#2\string\~\endcsname{}\relax}%
    \else % false branch of ifmst@unimathaccents
%    \end{macrocode}
% |1.3u| used some \cs{def} but this made the accent macro meanings look
% slightly different depending on whether the math version being set-up was
% with an 8bit encoding or TU encoding.
%
% For the sake of uniform treatment we modify this at |1.3v|, but this is a
% bit complicated regarding timing: we need, in absence of |unimathaccents|
% option, in math versions with an OpenType font, to let the \cs{acute} etc...
% acquire back some prior non-\mst meanings. To allow maximal flexibility,
% these original meaning get stored at begin document only. But
% \cs{mst@nonsubduedmathaccents} assigns to \cs{acute} etc... (in the robust
% sense with \LaTeX{} |2019-10-01| or later) the meaning stored in the macros
% with the math version in their names. Such \cs{mst@acute@mvnormal} etc...
% must thus be ready before \cs{mst@nonsubduedmathaccents} (or at least before
% the last such) execution: the code here must get executed after the
% definition of the «original»-named macros but prior to the (last one, if
% multiple) \cs{mst@nonsubduedmathaccents}.
%
% Hence |1.3v| delayed a bit the initial execution of this macro (see further
% down in the code) compared to what happened in |1.3u|.
%
% We are in a group but \cs{AtEndOfPackage} does the right thing.
%    \begin{macrocode}
      \AtEndOfPackage{\AtBeginDocument{%
      \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                     {dot}{ddot}{mathring}{hat}{tilde}%
      \do
      {\expandafter\let
          \csname mst@\@tempa @mv#1\expandafter\endcsname
          \csname mst@original@\@tempa\endcsname
       \expandafter\let
          \csname mst@\@tempa @mv#1\space\expandafter\endcsname
          \csname mst@original@\@tempa\space\endcsname}%
      }}%
    \fi
%    \end{macrocode}
% This is needed because the pdflatex engine branch will use
% \cs{DeclareMathAccent} and it creates robust macros with \LaTeX{}
% |2019-10-01| or later. As we want elsewhere in the package code not to have
% to check if under Unicode engine or not, we need to handle here also some
% definition of robust macros.
%
% But wouldn't it be simpler to manage \cs{protected} macros?
%    \begin{macrocode}
    \ifmst@robust@obsessed@LaTeX@era
      \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                     {dot}{ddot}{mathring}{hat}{tilde}%
      \do
      {\expandafter\xdef\csname mst@\@tempa @mv#1\endcsname
         {\noexpand\protect
          \expandafter\noexpand\csname mst@\@tempa @mv#1 \endcsname}%
      }%
    \fi
  \else % false branch of ifUniEnc
%    \end{macrocode}
% \cs{DeclareMathAccent} works \cs{global}ly. And with \LaTeX{} |2019-10-01|
% or later it creates robust macros.
%
% \cs{mst@DeclareMathAccent} to work around \url{https://github.com/latex3/latex2e/issues/216}
%    \begin{macrocode}
    % \` -> \grave
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@grave@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\`\endcsname{}}
    % \' -> \acute
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@acute@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\'\endcsname{}}
    % \v -> \check
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@check@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\v\endcsname{}}
    % \u -> \breve
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@breve@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\u\endcsname{}}
    % \= -> \bar
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@bar@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\=\endcsname{}}
    % \. -> \dot
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@dot@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\.\endcsname{}}
    % \" -> \ddot
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@ddot@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\"\endcsname{}}
    % \r -> \mathring
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@mathring@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\r\endcsname{}}
    % \^ -> \hat
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@hat@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\^\endcsname{}}
    % \~ -> \tilde
    \expandafter\mst@DeclareMathAccent\expandafter
               {\csname mst@tilde@mv#1\endcsname}{\mathalpha}{mtoperatorfont}%
               {\csname#2\string\~\endcsname{}}
  \fi
  \endgroup
}%
\fi % \ifmst@mathaccents
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTDeclareVersion}
%   The \cs{MTDeclareVersion} command is to be used in the preamble
%   to declare a math version. A more complicated variant would also
%   specify a choice of series for the Euler and Symbol font: anyhow
%   Symbol only has the medium series, and Euler has medium and bold,
%   so what is lacking is the possibility to create a version with a
%   bold Euler. There is already one such version: the default |bold|
%   one. And there is always the possibility to add to the preamble
%   \cs{SetSymbolFont}|{mteulervm}||{versionname}||{U}{zeur}{bx}{n}| if
%   one wants to have a math version with bold Euler characters.
%
%   For version |1.1| we add an optional parameter specifying the shape
%   to be used for letters.
%
%   Note: (|2012/10/24|) I really should check whether the user attempts to
%   redefine the `normal' and `bold' versions and issue a warning in
%   that case! Finally done at  |1.3w| |2019/11/16|! Better late than never...
%
%   |1.3c| (|2013/12/14|) adds an extra optional parameter after all
%   previous ones, to inherit the settings from another version. Typically
%   to be used with [bold]. I take this opportunity to sanitize a bit some
%   line endings to avoid generating (in the preamble, document macros were
%   already careful of course) too many space
%   tokens, at least inside macros. And I modifiy (correct? perhaps it was on
%   purpose) the strange way I used |\@onlypreamble| in earlier
%   version.
%
%   |1.3u| adds storage of macros holding the needed meanings for
%   \cs{imath}, \cs{hbar}, math accents, and the minus symbol,
%   version wise.
%
%   |1.3w| adds the check to forbid |normal| and |bold| as version names.
%    \begin{macrocode}
\newcommand*\MTDeclareVersion[6][]{%
  \edef\mst@declareversionargs{{#1}{#2}{#3}{#4}{#5}{#6}}%
  \edef\mst@version{#2}%
  \if0\ifx\mst@version\mst@normalversionname0\else
      \ifx\mst@version\mst@boldversionname0\else
      1\fi\fi
   \expandafter\expandafter\expandafter
   \MTDoNotDeclareVersion@\expandafter\@gobblefour
  \fi
  \relax\DeclareMathVersion{\mst@version}\MTDeclareVersion@
}% \MTDeclareVersion
\newcommand*\MTDoNotDeclareVersion@[1][]{%
   \PackageWarningNoLine{mathastext}{You asked to declare a version with name
   `\mst@version'.^^J%
   \@spaces Sorry but you are not allowed to do that.^^J%
   \@spaces \ifmst@subdued Anyway the `subdued' option is in force\else
         Use rather \string\Mathastext\space macro (with no optional argument)\fi
}}%\MTDoNotDeclareVersion@
\newcommand*\MTDeclareVersion@[1][]{%
    \edef\mst@tmp{#1}%
    \ifx\mst@tmp\empty\else
      \global\expandafter\let\csname mv@\mst@version\expandafter\endcsname
                             \csname mv@#1\endcsname
      \typeout{** Math version `\mst@version\string' inherits from `#1\string'.}%
    \fi
    \expandafter\MTDeclareVersion@@\mst@declareversionargs
}% \MTDeclareVersion@
\newcommand*\MTDeclareVersion@@[6]{%
  \expandafter\edef\csname mst@encoding@\mst@version\endcsname{#3}%
  \expandafter\edef\csname mst@family@\mst@version\endcsname{#4}%
  \expandafter\edef\csname mst@series@\mst@version\endcsname{#5}%
  \expandafter\edef\csname mst@shape@\mst@version\endcsname{#6}%
  \expandafter\edef\csname mst@boldvariant@\mst@version\endcsname{\mst@bold}%
  \expandafter\edef\csname mst@itdefault@\mst@version\endcsname{\itdefault}%
  \expandafter\edef\csname mst@rmdefault@\mst@version\endcsname{\rmdefault}%
  \expandafter\edef\csname mst@sfdefault@\mst@version\endcsname{\sfdefault}%
  \expandafter\edef\csname mst@ttdefault@\mst@version\endcsname{\ttdefault}%
  \expandafter\edef\csname mst@exists@skip@\mst@version\endcsname
        {\mst@exists@skip}%
  \expandafter\edef\csname mst@forall@skip@\mst@version\endcsname
        {\mst@forall@skip}%
  \expandafter\edef\csname mst@prime@skip@\mst@version\endcsname
        {\mst@prime@skip}%
  \def\mst@tmp{#1}%
  \ifx\mst@tmp\empty
    \ifmst@italic
      \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{\mst@ltsh}%
      \typeout{** Latin letters in math version `#2\string' will use the font
                  #3/#4/#5/\mst@ltsh^^J%    
               ** Other characters (digits, ...) and \protect\log-like names 
                    will be in #6 shape.}%
      \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{\mst@ltsh}%
    \else
      \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#6}%
       \typeout{** Latin letters in math version `#2\string' will use the fonts
                   #3/#4/#5(\mst@bold)/#6}%
      \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{#6}%
    \fi
  \else
    \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#1}%
    \typeout{** Latin letters in math version `#2\string' will use the font
                #3/#4/#5/#1^^J%
             ** Other characters (digits, ...) and \protect\log-like
                names will be in #6 shape.}%
      \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{#1}%
  \fi
  \ifmst@nonormalbold\else
       \SetMathAlphabet{\mathnormalbold}{#2}{#3}{#4}{\mst@bold}%
                   {\csname mst@ltshape@\mst@version\endcsname}%
  \fi
  \SetSymbolFont{mtoperatorfont}{#2}{#3}{#4}{#5}{#6}%
  \ifmst@defaultbf\else\SetMathAlphabet{\Mathbf}{#2}{#3}{#4}{\mst@bold}{#6}\fi
  \ifmst@defaultit\else\SetMathAlphabet{\Mathit}{#2}{#3}{#4}{#5}{\itdefault}\fi
  \ifmst@defaultsf\else\SetMathAlphabet{\Mathsf}{#2}{#3}{\sfdefault}{#5}{#6}\fi
  \ifmst@defaulttt\else\SetMathAlphabet{\Mathtt}{#2}{#3}{\ttdefault}{#5}{#6}\fi
  \ifmst@needeuler
      \SetMathAlphabet{\MathEulerBold}{#2}{U}{zeur}{\mst@bold}{n}%
  \fi
%    \end{macrocode}
% \begin{macro}{LGRgreeks}
% \begin{macro}{selfGreeks}
%   In the case of option LGRgreeks (selfGreeks), it is expected that
%   the fonts used in each math versions exist in LGR (OT1) encoding. We
%   first recalculate the shapes to be used for lowercase and uppercase
%   Greek letters depending on the frenchmath and [it/up][g/G]reek
%   options as well as on the (local to this version) shapes for letters
%   and digits.
%    \begin{macrocode}
  \def\mst@greek@lsh@loc{\csname mst@ltshape@\mst@version\endcsname}%
  \def\mst@greek@ush@loc{\csname mst@shape@\mst@version\endcsname}%
  \ifmst@itgreek\def\mst@greek@lsh@loc{\itdefault}%
                     \def\mst@greek@ush@loc{\itdefault}%
  \fi
  \ifmst@upgreek\def\mst@greek@lsh@loc{\updefault}%
                     \def\mst@greek@ush@loc{\updefault}%
  \fi
  \ifmst@frenchmath
      \ifmst@itgreek\else
      \ifmst@upgreek\else
        \def\mst@greek@lsh@loc{\csname mst@shape@\mst@version\endcsname}%
        \def\mst@greek@ush@loc{\csname mst@shape@\mst@version\endcsname}%
      \fi\fi
  \fi
  \ifcase\mst@greek@select
        \or\def\mst@greek@ush@loc{\itdefault}%
        \or\def\mst@greek@ush@loc{\updefault}%
  \fi
  \ifmst@LGRgreeks
      \SetSymbolFont{mtlgrfontlower}{#2}{LGR}{#4}{#5}{\mst@greek@lsh@loc}%
      \SetSymbolFont{mtlgrfontupper}{#2}{LGR}{#4}{#5}{\mst@greek@ush@loc}%
    \typeout{** Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use
                LGR font #4\ifmst@subdued ^^J** (in non subdued versions)\fi}%
  \else
   \ifmst@selfGreeks
      \SetSymbolFont{mtselfGreekfont}{#2}{OT1}{#4}{#5}{\mst@greek@ush@loc}%
     \typeout{** Capital Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc)
                 will use OT1 font #4\ifmst@subdued ^^J** (in non subdued versions)\fi}%
   \else
    \ifmst@LGRgreek 
      \SetSymbolFont{mtlgrfontlower}{#2}{LGR}{\mst@greekfont}{#5}{\mst@greek@lsh@loc}%
      \SetSymbolFont{mtlgrfontupper}{#2}{LGR}{\mst@greekfont}{#5}{\mst@greek@ush@loc}%
    \typeout{** Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc) will use
                LGR font \mst@greekfont\ifmst@subdued ^^J** (in non subdued versions)\fi}%
    \else
     \ifmst@selfGreek
       \SetSymbolFont{mtselfGreekfont}{#2}{OT1}{\mst@greekfont}{#5}{\mst@greek@ush@loc}%
       \typeout{** Capital Greek letters (\mst@greek@lsh@loc/\mst@greek@ush@loc)
                   will use OT1 font \mst@greekfont\ifmst@subdued ^^J** (in non subdued versions)\fi}%
     \fi
    \fi
   \fi
  \fi
  \edef\mst@tmp{\expandafter\noexpand\csname mst@hbar@mv#2\endcsname
                \expandafter\noexpand\csname mst@ltbar@mv#2\endcsname}%
  \expandafter\mst@dothe@hbarstuff\mst@tmp{#3}%
  \edef\mst@tmp{\expandafter\noexpand\csname mst@inodot@mv#2\endcsname
                \expandafter\noexpand\csname mst@jnodot@mv#2\endcsname}%
  \expandafter\mst@dothe@inodotstuff\mst@tmp{#3}%
  \ifmst@mathaccents
    \mst@dothe@mathaccentsstuff{#2}{#3}%
  \fi
  \edef\mst@tmp{\expandafter\noexpand\csname mst@minus@mv#2\endcsname
                \expandafter\noexpand\csname mst@varfam@minus@mv#2\endcsname}%
  \ifmst@endash
    \expandafter\mst@dothe@endashstuff\mst@tmp{#3}%
  \else
    \ifmst@emdash
      \expandafter\mst@dothe@emdashstuff\mst@tmp{#3}%
    \else
      \expandafter\mst@dothe@hyphenstuff\mst@tmp
    \fi
  \fi
}% \MTDeclareVersion@@
\let\MathastextDeclareVersion\MTDeclareVersion
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \begin{macro}{\MTversion}
% \begin{macro}{\MTversion@}
% \begin{macro}{\MTversion@s}
% \begin{macro}{\MTversion@@}
%   This is a wrapper around \LaTeX{}'s \cs{mathversion}: here we have an
%   optional argument allowing a quick and easy change of the text fonts
%   additionally to the math fonts. Present already in the initial
%   version of the package (January 2011.)
%  
%   |1.15|: some modifications for the subdued option vs LGRgreek and
%   for the math muskips after \cs{exists} and \cs{forall}.
%
%   |1.2|: with the subdued option sets the math alphabets in the
%   normal and bold math versions do not apply to operator
%   names and non-alphabetical symbols. The switch for braces
%   is left as it is.
%
%   |1.2b|: with the subdued option, the italic corrections are not added.
%   Else, we check the shape of letters in this version. Also, there was a bug
%   since |1.15|: the values of the math skips were taken not from the
%   settings for the math version (\#2) but from those of the optional argument
%   (\#1), if present...
%
%   |1.3|: activation of italic corrections is now separated from actual math
%   activation of letters.
%
%   |1.3c|: a starred variant is added which does not modify the text fonts,
%   only the math set-tup.
%
%   |1.3d|: replaced in |\MTversion@| things like |\edef\mst@encoding{...}| and
%   |\renewcommand{\encodingdefault}{\mst@@encoding}| by
%   |\edef\encodingdefault{...}| etc\dots All those |\mst@@...| things were
%   useless. I also redefine |\seriesdefault| rather than |\mddefault|.
%
%   |1.3d|: mechanism of restoration of Greek in subdued normal and bold
%   versions has been to all cases, and not only for the
%   |LGRgreek| option.
%
%   |1.3u|: version savvy (i.e. font-encoding savvy) minus sign,
%   \cs{hbar}, \cs{imath}, math accents.
%    \begin{macrocode}
\newcommand*\MTversion {\@ifstar\MTversion@s\MTversion@ }
\newcommand*\MTversion@s [1]{\mathversion{#1}\MTversion@@ }
\newcommand*\MTversion@ [2][]{%
    \mathversion{#2}% defines \math@version as expanded #2
    \edef\mst@tmpa{#1}%
    \ifx\mst@tmpa\empty
        \let\mst@tmp\math@version
    \else
        \let\mst@tmp\mst@tmpa
    \fi
    \edef\encodingdefault {\csname mst@encoding@\mst@tmp\endcsname}%
    \edef\familydefault   {\csname mst@family@\mst@tmp\endcsname}%
    \edef\seriesdefault   {\csname mst@series@\mst@tmp\endcsname}%        
    \edef\shapedefault    {\csname mst@shape@\mst@tmp\endcsname}%
    \edef\bfdefault {\csname mst@boldvariant@\mst@tmp\endcsname}%
    \edef\itdefault {\csname mst@itdefault@\mst@tmp\endcsname}%
    \edef\rmdefault {\csname mst@rmdefault@\mst@tmp\endcsname}%
    \edef\sfdefault {\csname mst@sfdefault@\mst@tmp\endcsname}%
    \edef\ttdefault {\csname mst@ttdefault@\mst@tmp\endcsname}%
    \usefont{\encodingdefault}{\familydefault}{\seriesdefault}{\shapedefault}%
    \MTversion@@
}% \MTversion@
%    \end{macrocode}
%   |1.3j| has a stronger subdued which does \cs{MTnormalprime},
%   \cs{MTnormalexists}, \cs{MTnormalforall} rather than setting the skips to
%   |0mu|. Hence \cs{MTversion} by default should do \cs{MTprimedoesskip},
%   \cs{MTexistsdoesskip}, \cs{MTforalldoesskip}.
%
%   |1.3u| drops the argument, as the info is in \cs{math@version} from
%   \LaTeX2e code.
%    \begin{macrocode}
\newcommand*\MTversion@@ {%
    \MTexistsdoesskip
    \MTforalldoesskip
    \MTprimedoesskip
%    \end{macrocode}
% |v1.15e|: muskips.
%    \begin{macrocode}
     \mst@exists@muskip\csname mst@exists@skip@\math@version\endcsname\relax
     \mst@forall@muskip\csname mst@forall@skip@\math@version\endcsname\relax
%    \end{macrocode}
% |v1.2|: muskip for \cs{prime}.
%    \begin{macrocode}
     \mst@prime@muskip\csname mst@prime@skip@\math@version\endcsname\relax
%    \end{macrocode}
% |v1.2b|: italic corrections except for italic/slanted (sic) letters, and of
% course except in the subdued normal and bold math versions.
%
% |v1.3|: by default, letters are made mathematically active, even if italic
% corrections are not used, to allow the action of \cs{MTsetmathskips}.
%    \begin{macrocode}
    \edef\mst@tmpa{\csname mst@ltshape@\math@version\endcsname}%
    \edef\mst@tmpb{\csname mst@shape@\math@version\endcsname}%
%    \end{macrocode}
% |v1.15c|: extending subdued to LGRgreek.
%
% |v1.15f|: subdueing math alphabets in a simpler way than in |1.15e|.
%
% |v1.2b|: subdueing the activation of characters in math mode.
%
% |v1.2d|: special treatment of the asterisk.
%
% |v1.3d|: extended LGRgreek mechanism of activation/restoration of Greek to all
% cases.
%
% |v1.3j|: use of \cs{MTeverymathdefault}, which includes \cs{MTicinmath}, but
% must be corrected then according to shape of letters and presence or absence
% of option |frenchmath|. We do only |\def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}|
% and not \cs{MTICinmath} to not overwrite some user-defined
% \cs{MTeverymathdefault}. Code for italic corrections or not according to
% letter shape is executed after \cs{MTeverymathdefault} which limits a bit
% user customizing possibilities, but if I moved it later, I would possibly
% have to put inside the \cs{MTicinmath} the check for |it| ot |sl|. Similary
% the \cs{MTcustomgreek} always executed (if not |subdued|).
%    \begin{macrocode}
    \MTmathoperatorsobeymathxx
    \MTeverymathdefault
    \MTcustomizenewmcodes       
    \@for\mst@tmpc:=it,sl\do{\ifx\mst@tmpc\mst@tmpa\MTnoicinmath\fi}%
    \ifmst@frenchmath
      \def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}%
      \@for\mst@tmpc:=it,sl\do{\ifx\mst@tmpc\mst@tmpb\MTnoICinmath\fi}%
    \fi
%    \end{macrocode}
% |1.3j| has a stronger subdued which does \cs{MTnormalprime},
% \cs{MTnormalexists}, \cs{MTnormalforall} rather than simply setting the
% skips to |0mu|. Note: \cs{MTnormalprime} is done as part of
% \cs{MTeverymathoff}. 
%    \begin{macrocode}
    \ifmst@subdued
      \ifx\math@version\mst@normalversionname
        \mst@restorealphabets
        \MTstandardgreek
        \MTmathoperatorsdonotobeymathxx
        \MTnormalexists
        \MTnormalforall
        \MTeverymathoff
        \MTresetnewmcodes
%    \end{macrocode}
% |1.3t| adds better compatibility with |subdued| mode for
% |\imath/\jmath| and perfect compatibility for the minus sign.
%
% |1.3u| extends this further to allow per-math-version meanings
% for them.
%    \begin{macrocode}
        \mst@subduedhbar
        \mst@subduedinodot
        \mst@subduedmathaccents
        \mst@subduedminus
      \else
        \ifx\math@version\mst@boldversionname
          \mst@restorealphabets
          \MTstandardgreek
          \MTmathoperatorsdonotobeymathxx
          \MTnormalexists
          \MTnormalforall
          \MTeverymathoff
          \MTresetnewmcodes
          \mst@subduedhbar
          \mst@subduedinodot
          \mst@subduedmathaccents
          \mst@subduedminus
        \else
          \mst@setalphabets
          \MTcustomgreek
          \mst@nonsubduedhbar
          \mst@nonsubduedinodot
          \mst@nonsubduedmathaccents
          \mst@nonsubduedminus
        \fi
      \fi
    \else
      \MTcustomgreek % new with 1.3d
      \mst@nonsubduedhbar
      \mst@nonsubduedinodot
      \mst@nonsubduedmathaccents
      \mst@nonsubduedminus
    \fi
}% \MTversion@@
\let\MathastextVersion\MTversion
\let\Mathastextversion\MTversion
\let\MTVersion\MTversion
\let\mathastextversion\MTversion
%    \end{macrocode}
% \end{macro}\end{macro}\end{macro}\end{macro}
% \begin{macro}{\MTWillUse}
% This is a preamble-only command, which can be used more than once, only the
% latest one counts. Sets up the math fonts in the normal and bold
% versions, as does \cs{Mathastext}.
%    \begin{macrocode}
\newcommand*\MTWillUse[5][]{
  \MTencoding{#2}
  \MTfamily{#3}
  \MTseries{#4}
  \MTshape{#5}
    \ifmst@italic\MTlettershape{\itdefault}\fi % was missing in v 1.14 and prior
  \edef\mst@tmp{#1}
  \ifx\mst@tmp\empty\else\MTlettershape{#1}\fi
  \Mathastext}
\let\MathastextWillUse\MTWillUse
\let\Mathastextwilluse\MTWillUse
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Mathastext}
%    The command \cs{Mathastext} can be used anywhere in the
%    preamble and any number of time, the last one is the
%    one that counts.
%
%    In version |1.1| we have two fonts: they only differ in
%    shape. The |mtletterfont| is for letters, and the
%    |mtoperatorfont| for digits and log-like operator
%    names. The default is that both are upright.
%
%    Starting with version |1.12|, an optional argument makes
%    \cs{Mathastext} act as the declaration of a math
%    version, to be later used in the document.
%
%    Versions |1.15x| brought some adaptations related to the subdued
%    option.
%
%    |1.3c| adds a second optional parameter to inherit previous settings
%    from another version; mostly done to inherit the bold version fonts for
%    symbols and large symbols. This is done in |\MTDeclareVersion|.
%
%    |1.3j| moves the code related to \cs{MTicinmath} from \cs{Mathastext@} to
%    \cs{AtBeginDocument} (code depending on whether |subdued| option in use).
%    But we omit for this from \cs{MTicinmath} the \cs{MTmathactiveletters}
%    and issue the latter during loading of package, hence allowing
%    \cs{MTmathstandardletters} to be effective in the preamble.
%
%    I forgot to document that under |subdued| option the \cs{Mathastext}
%    command without optional parameter does not any |\SetSymbolFont| etc...
%    but it has a few other tasks to complete nevertheless.
%
% |1.3u| fixes some long-standing bug that \cs{Mathastext} did not repeat some
% font-encoding dependent things: they got done only once during package
% loading (things regarding the \cs{hbar}, \cs{imath}, the math accents and
% the minus sign). They are now part of the contents of \cs{Mathastext} macro
% itself (which is executed during package loading).
%    \begin{macrocode}
\def\Mathastext {\@ifnextchar [\Mathastext@declare\Mathastext@ }
\def\Mathastext@declare [#1]{%
  \edef\mst@tmp{#1}%
  \ifx\mst@tmp\empty
       \expandafter\@firstoftwo
  \else\expandafter\@secondoftwo
  \fi
  \Mathastext@
  {\MTDeclareVersion[\mst@ltsh]{#1}{\mst@enc}{\mst@fam}{\mst@ser}{\mst@opsh}}%
}% \Mathastext@declare
\def\Mathastext@ {%
  \mst@update@greeksh 
  \edef\mst@encoding@normal{\mst@enc}%
  \edef\mst@family@normal{\mst@fam}%
  \edef\mst@series@normal{\mst@ser}%
  \edef\mst@shape@normal{\mst@opsh}%
  \edef\mst@ltshape@normal{\mst@ltsh}%
  \edef\mst@itdefault@normal{\itdefault}%
  \edef\mst@rmdefault@normal{\rmdefault}%
  \edef\mst@sfdefault@normal{\sfdefault}%
  \edef\mst@ttdefault@normal{\ttdefault}%
  \edef\mst@boldvariant@normal{\mst@bold}%
  \edef\mst@exists@skip@normal{\mst@exists@skip}%
  \edef\mst@forall@skip@normal{\mst@forall@skip}%
  \edef\mst@prime@skip@normal{\mst@prime@skip}%
  \edef\mst@encoding@bold{\mst@enc}%
  \edef\mst@family@bold{\mst@fam}%
  \edef\mst@series@bold{\mst@bold}%
  \edef\mst@shape@bold{\mst@opsh}%
  \edef\mst@ltshape@bold{\mst@ltsh}%
  \edef\mst@boldvariant@bold{\mst@bold}%
  \edef\mst@itdefault@bold{\itdefault}%
  \edef\mst@rmdefault@bold{\rmdefault}%
  \edef\mst@sfdefault@bold{\sfdefault}%
  \edef\mst@ttdefault@bold{\ttdefault}%
  \edef\mst@exists@skip@bold{\mst@exists@skip}%
  \edef\mst@forall@skip@bold{\mst@forall@skip}%
  \edef\mst@prime@skip@bold{\mst@prime@skip}%
  \ifmst@subdued
%    \end{macrocode}
% Since |1.3j| this branch is actually almost superfluous, as entering
% |normal| or |bold| with \cs{MTversion} does \cs{MTnormalexists},
% \cs{MTnormalforall}, and \cs{MTnormalprime}. But some default values are
% needed if the user insists on issuing \cs{MTexistsdoesskip}, etc...
% nevertheless.
%    \begin{macrocode}
    \def\mst@exists@skip@normal{0mu}%
    \def\mst@forall@skip@normal{0mu}%
    \def\mst@prime@skip@normal{0mu}%
    \def\mst@exists@skip@bold{0mu}%
    \def\mst@forall@skip@bold{0mu}%
    \def\mst@prime@skip@bold{0mu}%
  \else % not subdued
    \ifmst@italic
      \ifmst@frenchmath
        \mst@exists@muskip\mst@exists@skip\relax
        \mst@forall@muskip\mst@forall@skip\relax
        \mst@prime@muskip\mst@prime@skip\relax
      \else
       \def\mst@exists@skip@normal{0mu}%
       \def\mst@forall@skip@normal{0mu}%
       \def\mst@prime@skip@normal{0mu}%
       \def\mst@exists@skip@bold{0mu}%
       \def\mst@forall@skip@bold{0mu}%
       \def\mst@prime@skip@bold{0mu}%
      \fi
    \else
        \mst@exists@muskip\mst@exists@skip\relax
        \mst@forall@muskip\mst@forall@skip\relax
        \mst@prime@muskip\mst@prime@skip\relax
    \fi
  \fi
%% v1.15f 
  \ifmst@nonormalbold\else
   \SetMathAlphabet{\mathnormalbold}{normal}{\mst@encoding@normal}%
                                 {\mst@family@normal}%
                                 {\mst@boldvariant@normal}%
                                 {\mst@ltshape@normal}%
   \SetMathAlphabet{\mathnormalbold}{bold}{\mst@encoding@bold}%
                                 {\mst@family@bold}%
                                 {\mst@boldvariant@bold}%
                                 {\mst@ltshape@bold}%
  \fi
%% v1.15f adds \ifmst@default.. checks
  \ifmst@subdued\else
   \SetSymbolFont{mtletterfont}{normal}{\mst@encoding@normal}%
                                       {\mst@family@normal}%
                                       {\mst@series@normal}%
                                       {\mst@ltshape@normal}%
   \SetSymbolFont{mtletterfont}{bold}  {\mst@encoding@bold}%
                                       {\mst@family@bold}%
                                       {\mst@series@bold}%
                                       {\mst@ltshape@bold}%
   \SetSymbolFont{mtoperatorfont}{normal}{\mst@encoding@normal}%
                                       {\mst@family@normal}%
                                       {\mst@series@normal}%
                                       {\mst@shape@normal}%
   \SetSymbolFont{mtoperatorfont}{bold} {\mst@encoding@bold}%
                                       {\mst@family@bold}%
                                       {\mst@series@bold}%
                                       {\mst@shape@bold}%
   \ifmst@defaultbf\else
    \SetMathAlphabet{\Mathbf}{normal}{\mst@encoding@normal}%
                                 {\mst@family@normal}%
                                 {\mst@series@bold}%
                                 {\mst@shape@normal}%
    \SetMathAlphabet{\Mathbf}{bold}{\mst@encoding@bold}%
                                 {\mst@family@bold}%
                                 {\mst@series@bold}%
                                 {\mst@shape@bold}%
   \fi
   \ifmst@defaultit\else
    \SetMathAlphabet{\Mathit}{normal}{\mst@encoding@normal}%
                                 {\mst@family@normal}%
                                 {\mst@series@normal}%
                                 {\mst@itdefault@normal}%
    \SetMathAlphabet{\Mathit}{bold}{\mst@encoding@bold}%
                                 {\mst@family@bold}%
                                 {\mst@series@bold}%
                                 {\mst@itdefault@bold}%
   \fi
   \ifmst@defaultsf\else
    \SetMathAlphabet{\Mathsf}{normal}{\mst@encoding@normal}%
                                 {\mst@sfdefault@normal}%
                                 {\mst@series@normal}%
                                 {\mst@shape@normal}%
    \SetMathAlphabet{\Mathsf}{bold}{\mst@encoding@bold}%
                                 {\mst@sfdefault@bold}%
                                 {\mst@series@bold}%
                                 {\mst@shape@bold}%
   \fi
   \ifmst@defaulttt\else
    \SetMathAlphabet{\Mathtt}{normal}{\mst@encoding@normal}%
                                 {\mst@ttdefault@normal}%
                                 {\mst@series@normal}%
                                 {\mst@shape@normal}%
    \SetMathAlphabet{\Mathtt}{bold}{\mst@encoding@bold}%
                                 {\mst@ttdefault@bold}%
                                 {\mst@series@bold}%
                                 {\mst@shape@bold}%
   \fi
  \fi % de \ifmst@subdued
%    \end{macrocode}
% \begin{macro}{\MathEulerBold}
%   |1.14c|: We reset |mteulervm| and \cs{MathEulerBold} here as the
%   variant for bold may have been changed by the user via
%   \cs{Mathastextboldvariant}|{m}|; and we should keep this local to
%   math versions.
%    \begin{macrocode}
  \ifmst@needeuler
    \SetSymbolFont{mteulervm}{bold}{U}{zeur}{\mst@boldvariant@normal}{n}%
    \SetMathAlphabet{\MathEulerBold}{normal}%
               {U}{zeur}{\mst@boldvariant@normal}{n}%
    \SetMathAlphabet{\MathEulerBold}{bold}%
               {U}{zeur}{\mst@boldvariant@normal}{n}%
  \fi
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
  \ifmst@needsymbol\SetSymbolFont{mtpsymbol}{bold}%
                     {U}{psy}{\mst@boldvariant@normal}{n}%
  \fi
%    \end{macrocode}
% \begin{macro}{LGRgreek*}
% \begin{macro}{selfGreek*}
% LGRgreek, LGRgreeks, selfGreek, and selfGreeks options.
%    \begin{macrocode}
  \ifmst@subdued\else 
   \ifmst@LGRgreek
    \SetSymbolFont{mtlgrfontlower}{normal}{LGR}%
            {\mst@greekfont}{\mst@series@normal}{\mst@greek@lsh}%
    \SetSymbolFont{mtlgrfontlower}{bold}{LGR}%
            {\mst@greekfont}{\mst@boldvariant@normal}{\mst@greek@lsh}%
    \SetSymbolFont{mtlgrfontupper}{normal}{LGR}%
            {\mst@greekfont}{\mst@series@normal}{\mst@greek@ush}%
    \SetSymbolFont{mtlgrfontupper}{bold}{LGR}%
            {\mst@greekfont}{\mst@boldvariant@bold}{\mst@greek@ush}%
   \else
    \ifmst@selfGreek
     \SetSymbolFont{mtselfGreekfont}{normal}{OT1}%
            {\mst@greekfont}{\mst@series@normal}{\mst@greek@ush}%
     \SetSymbolFont{mtselfGreekfont}{bold}{OT1}%
            {\mst@greekfont}{\mst@boldvariant@bold}{\mst@greek@ush}%
    \fi
   \fi
  \fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
  \ifmst@subdued
   \typeout{** subdued mode will be activated for the normal and bold math versions}%
  \else 
   \typeout{** Latin letters in the normal (resp. bold) math versions are now^^J%
            ** set up to use the fonts 
   \mst@encoding@normal/\mst@family@normal/\mst@series@normal%
               (\mst@boldvariant@normal)/\mst@ltshape@normal}%
   \ifmst@LGRgreek\typeout{** Greek letters (\mst@greek@lsh/\mst@greek@ush) 
                              will use LGR/\mst@greekfont}%
   \fi
   \ifmst@nodigits\else
     \typeout{** Other characters (digits, ...) and \protect\log-like names will be^^J%
              ** typeset with the \mst@shape@normal\space shape.}%
   \fi
  \fi
  \ifmst@nohbar\else
     \typeout{** \string\hbar}%
     \mst@dothe@hbarstuff
         \mst@hbar@mvnormal\mst@ltbar@mvnormal\mst@encoding@normal
     \let\mst@hbar@mvbold\mst@hbar@mvnormal
  \fi
  \mst@dothe@inodotstuff\inodot\jnodot\mst@encoding@normal
  \let\mst@inodot@mvnormal\inodot
  \let\mst@inodot@mvbold\inodot
  \let\mst@jnodot@mvnormal\jnodot
  \let\mst@jnodot@mvbold\jnodot
  \ifmst@mathaccents
    \typeout{** math accents}%
    \mst@dothe@mathaccentsstuff{normal}\mst@encoding@normal
  \fi
  \ifmst@nominus\else
   \typeout{** minus as endash}%
   \ifmst@endash
    \mst@dothe@endashstuff\mst@minus@mvnormal\mst@varfam@minus@mvnormal
                          \mst@encoding@normal
    \mst@dothe@endashstuff\mst@minus@mvbold\mst@varfam@minus@mvbold
                          \mst@encoding@normal
   \else
    \ifmst@emdash
      \mst@dothe@emdashstuff\mst@minus@mvnormal\mst@varfam@minus@mvnormal
                            \mst@encoding@normal
      \mst@dothe@emdashstuff\mst@minus@mvbold\mst@varfam@minus@mvbold
                            \mst@encoding@normal
    \else
      \mst@dothe@hyphenstuff\mst@minus@mvnormal\mst@varfam@minus@mvnormal
      \let\mst@minus@mvbold\mst@minus@mvnormal
      \let\mst@varfam@minus@mvbold\mst@varfam@minus@mvnormal
    \fi
   \fi
  \fi
}% \Mathastext@
\let\mathastext\Mathastext
\Mathastext
%    \end{macrocode}
% \end{macro}
% Additional appropriate messages to the terminal and the log.
%    \begin{macrocode}
\ifmst@eulergreek
      \typeout{** Greek letters will use the Euler font. Use \protect\MathastextEulerScale{<factor>} to scale the
               font.}%
      \ifmst@subdued{\typeout{** (subdued mode: normal and bold math
          version with default Greek letters.)}}\fi
\else
\ifmst@symbolgreek
       \typeout{** Greek letters will use the PostScript Symbol font. Use^^J%
                ** \protect\MathastextSymbolScale{<factor>} to scale the font.}%
      \ifmst@subdued{\typeout{** (subdued mode: normal and bold math
          version with default Greek letters.)}}\fi
\fi\fi
%    \end{macrocode}
% \begin{macro}{Math sizes}
% I took the code for \cs{Huge} and \cs{HUGE} from the |moresize| package of
% Christian~\textsc{Cornelssen}
%    \begin{macrocode}
\ifmst@defaultsizes\else
\providecommand\@xxxpt{29.86}
\providecommand\@xxxvipt{35.83}
\ifmst@twelve  
  \def\Huge{\@setfontsize\Huge\@xxxpt{36}}
  \def\HUGE{\@setfontsize\HUGE\@xxxvipt{43}}
\typeout{** \protect\Huge\space and \protect\HUGE\space have been (re)-defined.}
\else 
  \def\HUGE{\@setfontsize\HUGE\@xxxpt{36}}
\typeout{** \protect\HUGE\space has been (re)-defined.} 
\fi
%    \end{macrocode}
% I choose rather big subscripts.
%    \begin{macrocode}
\def\defaultscriptratio{.8333}
\def\defaultscriptscriptratio{.7}
\DeclareMathSizes{9}{9}{7}{5}
\DeclareMathSizes{\@xpt}{\@xpt}{8}{6}
\DeclareMathSizes{\@xipt}{\@xipt}{9}{7}
\DeclareMathSizes{\@xiipt}{\@xiipt}{10}{8}
\DeclareMathSizes{\@xivpt}{\@xivpt}{\@xiipt}{10}
\DeclareMathSizes{\@xviipt}{\@xviipt}{\@xivpt}{\@xiipt}
\DeclareMathSizes{\@xxpt}{\@xxpt}{\@xviipt}{\@xivpt}
\DeclareMathSizes{\@xxvpt}{\@xxvpt}{\@xxpt}{\@xviipt}
\DeclareMathSizes{\@xxxpt}{\@xxxpt}{\@xxvpt}{\@xxpt}
\DeclareMathSizes{\@xxxvipt}{\@xxxvipt}{\@xxxpt}{\@xxvpt}
\typeout{** mathastext has declared larger sizes for subscripts.^^J%
** To keep LaTeX defaults, use option `defaultmathsizes\string'.}
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTeverymathoff}
%   |1.3i 2016/01/06| Compatibility patch with |\url| from |url.sty| and
%   |\url/\nolinkurl| from |hyperref.sty|.
%
%   |1.3j 2016/01/15| renamed the macro from |\MTactivemathoff| to
%   |\MTeverymathoff|, as it is not exclusively a matter of math active
%   characters due to |\MTeasynonlettersdonotobeymathxx|.
%
%   |1.3o 2016/05/03| adds \cs{MTdonotfixfonts}. Operant with \LuaLaTeX\ only.
%    \begin{macrocode}
\newcommand*\MTeverymathoff {%
    \MTnormalasterisk
    \MTnormalprime
    \MTnonlettersdonotobeymathxx
    \MTeasynonlettersdonotobeymathxx
    \MTmathstandardletters
    \MTdonotfixfonts
}%
\AtBeginDocument {%
   \@ifpackageloaded{hyperref}
   {\def\Hurl{\begingroup\MTeverymathoff\Url}}
   {\@ifpackageloaded{url}{\DeclareUrlCommand\url{\MTeverymathoff}}{}}%
}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\MTeverymathdefault}
%   |1.3j 2016/01/15| Customizable command which gets executed by
%   \cs{MTversion} except when switching to |normal/bold| if option |subdued|.
%   The included \cs{MTicinmath} does \cs{MTmathactiveletters} which will also
%   activate the math skips around letters.
%
%   The \cs{MTeverymathdefault} does not include
%   \cs{MTmathoperatorsobeymathxx} as the latter does not correspond to
%   something done during execution of |\the\everymath|.
%
%   Should I put  |\let\newmcodes@\mst@newmcodes@| here too ? No, it is not
%   done at everymath.
%
%   During the loading, the (non subdued) package does \cs{MTactiveasterisk}
%   (if option asterisk), \cs{MTprimedoesskip}, \cs{MTeasynonlettersobeymathxx}
%   and \cs{MTmathactiveletters}. There is some code at begin document for
%   decisions about italic corrections, this code does not emit again
%   \cs{MTmathactiveletters}, hence a \cs{MTmathstandardletters} in the
%   preamble is not overruled. Furthermore the at begin document code will not
%   overrule user emitted \cs{MTnoicinmath} etc... commands in the preamble.
%
%   And user can employ \cs{MTnormalexists}, etc..., from inside the preamble,
%   it will not be overruled (as it is delayed at begin document to after \mst
%   dealings).
%
%   |1.3o 2016/05/03| adds \cs{MTfixfonts}. Operant with \LuaLaTeX\ only.
%    \begin{macrocode}
\newcommand*\MTeverymathdefault {%
    \MTactiveasterisk
    \MTprimedoesskip
    \MTeasynonlettersobeymathxx
    \MTicinmath
    \MTfixfonts
}%
%    \end{macrocode}
% \end{macro}
% \let\temp~
% \def~{\rlap}
% \begin{macro}{Things to do last ~{``at begin document''}}
% \let~\temp
%    \begin{macrocode}
\AtBeginDocument{%
  \everymath\expandafter{\the\everymath 
    \mst@the\mst@do@nonletters \let\mst@the\@gobble
    \mst@theeasy\mst@do@easynonletters  \let\mst@theeasy\@gobble
    \mst@thef\mst@do@az \let\mst@thef\@gobble
    \mst@theF\mst@do@AZ \let\mst@theF\@gobble}%
  \everydisplay\expandafter{\the\everydisplay 
    \mst@the\mst@do@nonletters \let\mst@the\@gobble
    \mst@theeasy\mst@do@easynonletters  \let\mst@theeasy\@gobble
    \mst@thef\mst@do@az \let\mst@thef\@gobble
    \mst@theF\mst@do@AZ \let\mst@theF\@gobble}%
%    \end{macrocode}
% |1.3j|: moved here to be executed at begin document (and not from inside
% \cs{Mathastext@}.) The \cs{MTeverymathoff} does: \cs{MTnormalasterisk},
% \cs{MTnormalprime}, \cs{MTnonlettersdonotobeymathxx},
% \cs{MTeasynonlettersdonotobeymathxx}, \cs{MTmathstandardletters}.
%
% |1.3m|: doing \cs{MTmathactiveletters} in subdued mode immediately after
% |\begin{document}| resulted in errors because \cs{mst@itcorr} had been left
% undefined. We thus add \cs{MTnoicinmath} to the subdued initialization.
%
% Since |1.3n| there is \cs{MTresetnewmcodes} which needs
% \cs{mst@originalnewmcodes@}, itself defined at begin document. Thus we have
% wrapped the whole thing in \cs{AtEndOfPackage} (at |1.3u| whole code
% directly moved at end of package).
%
% And |1.3p| adds here \cs{MTcustomizenewmcodes} which had been regrettably
% forgotten by |1.3n|.
%
% |1.3t| adds some extras to handle correctly the minus sign and
% dotless i and j in subdued mode, even in case of usage with fontspec.
%
% |1.3u| similarly lets math accents be correctly subdued.
%
% |1.3v| adapts to \cs{hbar} and math accents now being robust with \LaTeX{}
% |2019-10-01| or later.
%
% |1.3w| pays attention to the fact that \cs{hbar} may well be
% a |\mathchar| and not a robust macro! And no need to worry about
% \cs{hbar<space>} finally in revised code.
%    \begin{macrocode}
  \MTcustomizenewmcodes
  \let\mst@original@hbar\hbar
  \let\mst@original@imath\imath
  \let\mst@original@jmath\jmath
  \@tfor\@tempa:={grave}{acute}{check}{breve}{bar}%
                 {dot}{ddot}{mathring}{hat}{tilde}%
  \do
  {\expandafter\let\csname mst@original@\@tempa\expandafter\endcsname
                   \csname \@tempa\endcsname
   \expandafter\let\csname mst@original@\@tempa\space\expandafter\endcsname
                   \csname \@tempa\space\endcsname
  }%
  \ifmst@XeOrLua
     \edef\mst@subduedminus
         {\mst@Umathcodenum`\noexpand\-=\the\mst@Umathcodenum`\-\relax}%
  \else
     \edef\mst@subduedminus{\mathcode`\noexpand\-=\the\mathcode`\-\relax}%
  \fi
  \ifmst@subdued
    \MTeverymathoff
    \MTresetnewmcodes
    \MTnoicinmath
    \MTmathoperatorsdonotobeymathxx
    %\mst@subduedhbar
    \let\inodot\imath
    \let\jnodot\jmath
    %\mst@subduedmathaccents
    \mst@subduedminus
  \else
     \mst@nonsubduedhbar
%    \end{macrocode}
% |1.3v| needs this \cs{mst@nonsubduedmathaccents} to get executed later (see
% code comments for \cs{mst@dothe@mathaccentsstuff}).
%    \begin{macrocode}
     % \mst@nonsubduedmathaccents % will get executed later
     \mst@nonsubduedminus
%    \end{macrocode}
% |1.3j|: an earlier version of this code was earlier part of \cs{Mathastext@}.
% As we are now in \cs{AtBeginDocument} we try to be careful not to overwrite
% \cs{MTicinmath}, \cs{MTnoicinmath}, \cs{MTicalsoinmathxx}, ... if issued by
% the user in the preamble, though. And we do not execute
% \cs{MTmathactiveletters}, it is issued by the package at loading time in
% order to allow user to cancel it if desired from inside the preamble.
%    \begin{macrocode}
     \ifx\mst@itcorr\@undefined
         \def\mst@itcorr{\ifnum\fam=\m@ne\/\fi}%
         \@for\mst@tmp:=it,sl\do 
           {\ifx\mst@tmp\mst@ltshape@normal\let\mst@itcorr\@empty\fi }%
     \fi
     \ifx\mst@ITcorr\@undefined
         \let\mst@ITcorr\mst@itcorr
         \ifmst@frenchmath
           \def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}%
           \@for\mst@tmp:=it,sl\do
                {\ifx\mst@tmp\mst@shape@normal\let\mst@ITcorr\@empty\fi }%
         \fi
     \fi
  \fi
}% \AtBeginDocument
\AtEndOfPackage{\AtBeginDocument{\ifmst@subdued\else\mst@nonsubduedmathaccents\fi}}%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{subdued}
%   |1.15|: The subdued code was initiated in May 2011. I returned to
%   |mathastext| on Sep 24, 2012, and decided to complete what I had started
%   then, but in the mean time I had forgotten almost all of the little I knew
%   about \LaTeX{} macro programming.
%
%   The point was to extract the data about how are `letters' and
%   `operators' in the normal and bold versions, through obtaining the
%   math families of `a' and `1', respectively$^1$. Due to the
%   reassignements done for characters by |mathastext| I also had
%   decided in 2011 that the OT1 encoding, if detected, should be
%   replaced by T1\newline
%   $^1$but the \emph{euler} package for example
%   assigns the digits to the \emph{letters} symbol font...
%
%   |1.15d|: Oct 13, 2012. The \cs{mathcode} thing has to be used with care
%   under Unicode engines. Unfortunately the \cs{luatexUmathcode} macro is
%   helpless as it is not possible to know if it will return a legacy mathcode
%   or a Unicode mathcode. On the other hand the much saner
%   \cs{XeTeXmathcodenum} always return a Unicode mathcode. 
%
%   {UPDATE for \mst\ 1.3 (|2013/09/02|): since the release of lualatex as
%   included in 
%   TL2013, \cs{luatexUmathcodenum} behaves as \cs{XeTeXmathcodenum} so \mst 1.3
%   treats identically under both unicode engines the equal and minus signs (and
%   the vertical bar).}
%
%   |1.15e|: Oct 22, 2012. I add the necessary things to also subdue the
%   \cs{mathbf}, \cs{mathit}, \cs{mathsf} and \cs{mathtt} macros (previous
%   version only took care of the symbol alphabets \cs{mathnormal} and
%   \cs{mathrm}.) [update: |1.15f| does that in a completely different and much
%   simpler way] Notice that the package defines a \cs{mathnormalbold} macro,
%   but it will not be subdued in the normal and bold math versions.
%
%   |1.15f|: Oct 23, 2012. The previous version of the code queried the math
%   family of a, respectively 1, to guess and then extract the fonts to be
%   reassigned to mtletterfont and mtoperatorfont (which is done at the end of
%   this .sty file). The present code simply directly uses letters and operators
%   (so mathastext could not subdue itself... if it was somehow cloned), but
%   obtains indeed the corresponding font specifications in normal and bold in a
%   cleaner manner. But it is so much shorter (and avoids the \LuaLaTeX{}
%   problem with \cs{luatexUmathcode}). Anyhow, for example the euler package
%   puts the digits in the letters math family! so the previous method was also
%   error prone. In fact there is no way to do this subdued mechanism on the
%   basis of the legacy code of mathastext. The only way is to rewrite entirely
%   the package to query all mathcodes of things it changes in order to be able
%   to revert these changes (and one would have to do even more hacking for
%   |\mathversion{normal}| and not only |\MTversion{normal}| to work).
%
%   |1.15f|: and also I take this opportunity to do the subdued math
%   alphabets things in a much much easier way, see below.
%
%   |1.3s 2018/08/21|: I have half-forgotten the reasons for modifiying the
%   font encoding to current |\encodingdefault|, but at any rate this should
%   not be done in a |fontspec| context, encoding default being (now) |TU| it
%   is very unlikely modifying from |TU| or to |TU| from something else will
%   do any good.^^A See
%^^A   \centeredline{\url{https://tex.stackexchange.com/questions/444565/mathastext-wrong-digits-in-math-mode/}}
%^^A   for original report.
%   I add workaround here for case of |fontspec| being
%   detected via the |\encodingdefault| setting.
%
%   |1.3t 2018/08/22|: the |1.3s| fix erroneously removed the
%   |OT1->T1| replacement in |TU| context.
%
%   |1.3u|: the whole thing will only get executed At Begin Document.
%    \begin{macrocode}
\ifmst@subdued
\AtBeginDocument{%
  \def\mst@reserved#1\getanddefine@fonts\symletters#2#3\@nil{%
        \def\mst@normalmv@letter{#2}}%
  \expandafter\mst@reserved\mv@normal\@nil
  \def\mst@reserved#1\getanddefine@fonts\symletters#2#3\@nil{%
        \def\mst@boldmv@letter{#2}}%
  \expandafter\mst@reserved\mv@bold\@nil
  \def\mst@reserved#1\getanddefine@fonts\symoperators#2#3\@nil{%
        \def\mst@normalmv@operator{#2}}%
  \expandafter\mst@reserved\mv@normal\@nil
  \def\mst@reserved#1\getanddefine@fonts\symoperators#2#3\@nil{%
        \def\mst@boldmv@operator{#2}}%
  \expandafter\mst@reserved\mv@bold\@nil
  \edef\mst@tmp@enc{\mst@encoding@normal}%
  \def\mst@reserved#1/#2/#3/#4/{\gdef\mst@debut{#1}\gdef\mst@reste{#2/#3/#4}}%
  \begingroup\escapechar\m@ne
      \xdef\mst@funnyoti{\expandafter\string\csname OT1\endcsname}%
      \expandafter\expandafter\expandafter
          \mst@reserved\expandafter\string\mst@normalmv@operator/%
  \endgroup
  \ifx\mst@debut\mst@funnyoti\ifx\mst@tmp@enc\mst@oti\def\mst@tmp@enc{T1}\fi\fi
  \edef\mst@normalmv@operator{\expandafter\noexpand\csname 
       \if1\mst@OneifUniEnc
         \ifx\mst@debut\mst@funnyoti T1\else\mst@debut\fi
       \else
         \mst@tmp@enc
       \fi/\mst@reste\endcsname}%
  \edef\mst@tmp@enc{\mst@encoding@bold}%
  \begingroup\escapechar\m@ne
      \expandafter\expandafter\expandafter
          \mst@reserved\expandafter\string\mst@boldmv@operator/%
  \endgroup
  \ifx\mst@debut\mst@funnyoti\ifx\mst@tmp@enc\mst@oti\def\mst@tmp@enc{T1}\fi\fi
  \edef\mst@boldmv@operator{\expandafter\noexpand\csname 
       \if1\mst@OneifUniEnc
         \ifx\mst@debut\mst@funnyoti T1\else\mst@debut\fi
       \else
         \mst@tmp@enc
       \fi/\mst@reste\endcsname}%
  \typeout{** ...entering subdued mode...}%
  \expandafter\SetSymbolFont@ \expandafter\mv@normal\mst@normalmv@letter\symmtletterfont
  \expandafter\SetSymbolFont@ \expandafter\mv@bold\mst@boldmv@letter\symmtletterfont
  \expandafter\SetSymbolFont@ \expandafter\mv@normal\mst@normalmv@operator\symmtoperatorfont
  \expandafter\SetSymbolFont@ \expandafter\mv@bold\mst@boldmv@operator\symmtoperatorfont
  \typeout{** ...done.}%
}% \AtBeginDocument
\fi % \ifmst@subdued
%    \end{macrocode}
%^^A  In the short-lived |1.15e| I was doing the following for alphabets:\\
%^^A  |\def\mst@reservedc#1#2#3#4{\def\mst@normalmv@mathbf{#4#3}}|\\
%^^A  |\def\mst@reserveda#1{%|\\
%^^A  |\def\mst@reservedb##1\install@mathalphabet#1##2##3\@nil{\mst@reservedc##2}%|\\
%^^A  |\expandafter\mst@reservedb\mv@normal\@nil}|\\
%^^A  |\expandafter\mst@reserveda\csname mathbf\space\endcsname|\\
%^^A  and later in the code:\\
%^^A  |\expandafter\expandafter\expandafter\SetMathAlphabet@|\\
%^^A  |\expandafter\expandafter\expandafter\mv@normal|\\
%^^A  |\expandafter\mst@normalmv@mathbf\csname Mathbf\space \endcsname\Mathbf|\\
%^^A  It does work! but |\let\mst@original@bf\mathbf| is so
%^^A  much simpler. And also safer, because \cs{mathbf} could have been
%^^A  redefined using \cs{DeclareSymbolFontAlphabet}... (I could have
%^^A  provided the necessary check to the already bloated code...)
% \end{macro}
% \begin{macro}{Preamble-only...}
% ``Only preamble'' restrictions. I was way too much obedient back in 2011,
% particularly taking into account how much of a pain it has been and still is
% that things such as \cs{DeclareMathSymbol} or \cs{DeclareMathAccent} are
% preamble-only. But keeping this for time being, however not using
% \cs{@onlypreamble} which breaks one's heart when tracing to see how much
% place it takes, so we do it in one go.
%    \begin{macrocode}
\expandafter \gdef \expandafter \@preamblecmds \expandafter {\@preamblecmds
\do\MTitgreek
\do\MTupgreek
\do\MTitGreek
\do\MTitGreek
\do\Mathastextitgreek
\do\Mathastextupgreek
\do\MathastextitGreek
\do\MathastextitGreek
\do\MTgreekfont
\do\Mathastextgreekfont
\do\MTDeclareVersion
\do\MathastextDeclareVersion
\do\MTWillUse
\do\MathastextWillUse
\do\Mathastextwilluse
\do\Mathastext
\do\mathastext
}
\endinput
%    \end{macrocode}
% \end{macro}
% \DeleteShortVerb{\|}
% \MakePercentComment
%</package>
%<*dtx>
\CharacterTable
 {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
  Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
  Digits        \0\1\2\3\4\5\6\7\8\9
  Exclamation   \!     Double quote  \"     Hash (number) \#
  Dollar        \$     Percent       \%     Ampersand     \&
  Acute accent  \'     Left paren    \(     Right paren   \)
  Asterisk      \*     Plus          \+     Comma         \,
  Minus         \-     Point         \.     Solidus       \/
  Colon         \:     Semicolon     \;     Less than     \<
  Equals        \=     Greater than  \>     Question mark \?
  Commercial at \@     Left bracket  \[     Backslash     \\
  Right bracket \]     Circumflex    \^     Underscore    \_
  Grave accent  \`     Left brace    \{     Vertical bar  \|
  Right brace   \}     Tilde         \~}

\CheckSum{6187}
\makeatletter\check@checksum\makeatother
\Finale
%%
%% End of file `mathastext.dtx'.