summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/mathastext/mathastext.dtx
blob: 3c6b074da22cc4368b8fe4fcbc083abdc4737a69 (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
% -*- coding: iso-latin-1; -*-
%<*ins>
\def\pkgname{mathastext}
\def\pkgdate{2013/01/01}
\def\pkgversion{v1.2d}
\def\pkgdescription{Use the text font in math mode (jfB)}
%</ins>
%%
%% Package `mathastext' by Jean-Francois Burnol
%% Copyright (C) 2011, 2012 by Jean-Francois Burnol
%%
%<*none>
\def\lasttimestamp{Time-stamp: <02-01-2013 19:06:35 CET jfb>}
\def\docdate{2013/01/01}
\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4}
\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp}
\ProvidesFile{\pkgname.dtx}
  [`\pkgname' source and documentation (\dtxtimestamp)]
%         
% The copyright statement applies to `mathastext.dtx' and to its derived files.
% 
%    This file may be distributed and/or modified under the
%    conditions of the LaTeX Project Public License,
%    either version 1.3 of this license or (at your
%    option) any later version.  The latest version of
%    this license is in
%    http://www.latex-project.org/lppl.txt 
%    and version 1.3 or later is part of all distributions of
%    LaTeX version 2003/12/01 or later.  
%
%    Please report errors to jfbu (at) free.fr
%    For examples of use of mathastext:
%        http://jf.burnol.free.fr/mathastext.html
%        http://jf.burnol.free.fr/showcase.html
%    
%  Installation:
%  ============
%
% `latex mathastext.dtx' or `pdflatex mathastext.dtx'
%  Run thrice to get the table of contents, labels and bookmarks right.
%
%  `mathastext.sty', `mathastext.ins' and `mathastexttest.tex' are generated on
%  the first latex run.
%
%  Put `mathastext.sty' at a suitable location within the TeX installation:
%          mathastext.sty -> ..path..to../tex/latex/mathastext/
%
%  `mathastext.ins' is for TeX distributions expecting it.
%
%  `mathastexttest.tex' is an example of use of the package.
% 
\begingroup
\input docstrip.tex
\askforoverwritefalse
\def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
\string\ProvidesPackage{\pkgname}^^J%
\space[\pkgdate\space\pkgversion\space\pkgdescription]}
\generate{\nopreamble
\file{\pkgname.ins}{\from{\pkgname.dtx}{ins}}
\file{test\pkgname mathversions.tex}{\from{\pkgname.dtx}{mathversions}}
\file{test\pkgname macos.tex}{\from{\pkgname.dtx}{macos}}
\file{test\pkgname linux.tex}{\from{\pkgname.dtx}{linux}}
\file{test\pkgname alphabets.tex}{\from{\pkgname.dtx}{alphabets}}
\usepreamble\pkgpreamble
\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
\endgroup
\iffalse
%</none>
%<*ins>
%-------------------------------------------------------------------------------
%% This file `mathastext.ins' is provided for compatibility with TeX
%% distributions expecting to find it for installation of `mathastext.sty'.
%%
%% As usual `latex mathastext.ins' produces `mathastext.sty' from the source
%% `mathastext.dtx'
%%
%% (an already existing `mathastext.sty' in the same repertory will be
%% overwritten)
%% 
%% Put `mathastext.sty' in a suitable location within the TeX installation:
%% mathastext.sty -> ................/tex/latex/mathastext/
%%
%% Some test files are also generated, processing them through latex, pdflatex,
%% lualatex or xetex checks if some of the package commands work as advertised.
%%
%% See `mathastext.dtx' for the copyright and conditions of distribution or
%% modification.
%%
\input docstrip.tex
\askforoverwritefalse
\def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
\string\ProvidesPackage{\pkgname}^^J%
\space[\pkgdate\space\pkgversion\space\pkgdescription]}
\generate{\usepreamble\pkgpreamble
\file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
\endbatchfile
%-------------------------------------------------------------------------------
%</ins>
%<*mathversions>
%-------------------------------------------------------------------------------
%% This file `testmathastextversions.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} 
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 `testmathastextmacos.tex' is for testing the use of the package
%% `mathastext' with the unicode engines XeTeX or LuaLaTeX.
%%
%% Mac OS X specific fonts are used (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[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]
\begin{document}
\MTversion{normal} 
This test uses \verb|mathastext| with its
\emph{italic}, \emph{asterisk}, and \emph{subdued} options. Furthermore we test
if the non-letter characters obey the math alphabet \verb|\mathbf| (this is
disabled in the normal and bold math versions, as option \emph{subdued} was
used; and if activated there we should use the package defined \verb|\Mathbf|
rather than the original \verb|\mathbf| as the latter would use encoding
\verb|OT1| in the normal and bold versions). The base document fonts are the
Latin Modern ones. The other fonts used were chosen from those of a Mac OS
machine. Some of the used fonts have no italic variant.
\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}
\end{document}
%-------------------------------------------------------------------------------
%</macos>
%<*linux>
%-------------------------------------------------------------------------------
%% This file `testmathastextlinux.tex' is for testing the use of the package
%% `mathastext' with the unicode engines XeTeX or LuaLaTeX.
%%
%% Fonts available on a Linux machine are used.
%%
%% 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[subdued,italic,asterisk]{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}
\MTlettershape{n}
\setmainfont[Color=FF0000]{Andale Mono}  \Mathastext[Andale]
\begin{document}
\MTversion{normal}
This test uses
\verb|mathastext| with its \emph{italic}, \emph{asterisk}, and \emph{subdued}
options. Furthermore we test if the non-letter characters obey the math alphabet
\verb|\mathbf| (this is disabled in the normal and bold math versions, as option
\emph{subdued} was used; and if activated there we should use the package
defined \verb|\Mathbf| rather than the original \verb|\mathbf| as the latter
would use encoding \verb|OT1| in the normal and bold versions). The base
document fonts are the Latin Modern ones. The other fonts used were chosen from
those of a Linux machine. We also used the Times font in T1 encoding, but as
explained in the user manual of mathastext it is not recommended to use
different encodings in the various math versions.
\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$ }
\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}
%-------------------------------------------------------------------------------
%</linux>
%<*none>
\fi
\catcode`\~0\catcode`\\12
~iffalse
%</none>
%<*alphabets>
%-------------------------------------------------------------------------------
%% This file `testmathastextalphabets.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.7]{geometry}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{iftex}
\ifXeTeX
\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
\usepackage[no-math]{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Termes}
\setmonofont[Ligatures=TeX]{TeX Gyre Cursor}
\setsansfont[Ligatures=TeX]{TeX Gyre Heros}
\else
\usepackage[latin1]{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]{mathastext}\MTnonlettersobeymathxx
\MTexplicitbracesobeymathxx
\delimitershortfall-1pt
\begin{document}
\def\testformula{\Biggl\lbrace\biggl(\left(\left[[\sin(a) + \cos(b) - \log(c) = 
\sec(d)]\right]\right)\biggr)\Biggr\rbrace}
\noindent $\displaystyle\testformula$
$\displaystyle\mathnormalbold{\testformula}$\\
$\displaystyle\mathrm{\testformula}$
$\displaystyle\mathbf{\testformula}$\\
$\displaystyle\mathit{\testformula}$
$\displaystyle\mathtt{\testformula}$\\
$\displaystyle\mathsf{\testformula}$

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

\begin{tabular}{ccccccc}
\testline{a!b}\\
\testline{a?b}\\
\testline{a,b}\\
\testline{a;b}\\
\testline{a: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}

\bigskip

When using \verb|\MTnonlettersobeymathxx| (as is done in this test file),
this preempts in math mode even active characters (among
those treated by \texttt{mathastext} of course) and replaces
their definitions with the \texttt{mathastext} definitions. 

For example if \texttt{?} is already active in the document, in
\verb|$?\hbox{?}$| the first \texttt{?} will use the \texttt{mathastext}
definition, whereas the second one will use its original definition as
active character. Let's try:
\begin{verbatim}
\catcode`\?=\active \def?{X} $?\mathtt{?}\hbox{?$\mathbf{?}$}$
\end{verbatim}

The result is: \catcode`\?\active\def?{X}$?\mathtt{?}\hbox{?$\mathbf{?}$}$.

However, after
\verb|\MTnonlettersdonotobeymathxx|,\MTnonlettersdonotobeymathxx{} we get:
$?\mathtt{?}\hbox{?$\mathbf{?}$}$. The original definition of the active
character has been used everywhere, as expected. Note that \verb|1.2c| issues
\texttt{\string\MTnonlettersdonot\-obeymathxx} by default.
\end{document}
%-------------------------------------------------------------------------------
%</alphabets>
%<*none>
~fi
~catcode`~\0
\catcode`\~\active
\documentclass[a4paper,fontsize=11pt,abstract]{scrdoc}
%\OnlyDescription
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\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{amsmath}\allowdisplaybreaks

\usepackage[hscale=0.66]{geometry}

\usepackage[%dvipdfmx,% in contrast, pdftex creates a 3 to 4 times bigger file!
pdfencoding=pdfdoc,%
bookmarks=true,%
bookmarksopen=true,%dvipdfmx-outline-open,%
]{hyperref}

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

\DeclareRobustCommand\cs[1]{{\ttfamily\hyphenchar\font45\char`\\#1}}
\DeclareRobustCommand\csb[1]{{%
\color{blue}\ttfamily\hyphenchar\font45\char`\\#1}}

\newcommand\cshyp[1]{\texorpdfstring{\cs{#1}}{\textbackslash #1}}
\newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}}
\newcommand\blueit[1]{\texorpdfstring{{\color{blue}\ttfamily #1}}{#1}}
\newcommand\lowast{\raisebox{-.25\height}{*}}
\newcommand\starit[1]{\cs{#1\lowast}}
\newcommand\staritb[1]{\csb{#1\lowast}}

\newif\iftoggled
\catcode`\§=13
\def§{\iftoggled\endgroup\toggledfalse\xspace\else
      \toggledtrue\begingroup\color{blue}\ttfamily\expandafter\string\fi}

\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]

\MTitgreek\MTupGreek\MTgreekfont{txr}
\usepackage{times}
\Mathastext[times]

\usepackage[scaled]{helvet}
\renewcommand\familydefault\sfdefault
\MTgreekfont{cmss}
\Mathastext[helvet]

\usepackage{etoc}

\begin{document}
\MTversion{normal}
\renewcommand\familydefault\sfdefault

\frenchspacing

\begin{center}
  {\normalfont\Large The \mst  package}\\
\textsc{Jean-François Burnol}\par
  \footnotesize \ttfamily 
  jfbu (at) free (dot) fr\\
  Package version: \pkgversion\ (\pkgdate)\\
  Documentation generated from the source file\\
  with timestamp ``\dtxtimestamp''
\end{center}


 \begin{abstract}
   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.
 \end{abstract}

\etoctoclines
\tableofcontents

\section{What \mst does}

\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.

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 explicitely 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
  |txfonstb| 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}

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
    \begingroup\color{joli}\bfseries
      {abcdefghijklmnopqrstuvwxyz}\\
      {ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\
      {0123456789}\\
      \DeleteShortVerb{\|}%
      {!\,?\,\raisebox{-.3\height}{*}\,,\,.\,:\,;\,+\,\textendash\,=\,(\,)\,[\,]\,/\,\#\,%
        \$\,\%\,\&\,<\,>\,|\,\{\,\} {\color{black}\mdseries and
        }\char92}\endgroup\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 -,
\item the option §asterisk§ is necessary 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 for making it optional is that after this |$R^*$|
  or |$R^\ast$| do not work and have to be written |$R^{*}$| or |$R^{\ast}$|.
\end{itemize}

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


\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{always load \mst last}

  As said already none of the ``large'' math symbols is 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. The more common symbols can be taken
  from the Symbol font (option §symbolmisc§, or §symbolmax§ to get
  also the Greek letters from Symbol).

\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{a more detailed discussion comes next. Note
  that 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.} Of course it is always possible to leave the
  responsability to set up Greek letters in math mode to packages
  loaded previously to \mst.

  % \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
Tariq~\textsc{Perwez} and Kevin~\textsc{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§ 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}

This option was introduced in |v1.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. 

The previous description is in fact a bit optimistic: \mst was not
written initially in order to allow its action to be completely
cancelled, and achieving this would require a complete rewrite of
large portions of the code. In order to really have the displayed math
(almost) as if \mst had not been loaded, one must at a minimum also
use the option §defaultmathsizes§. This does not quite suffice,
because, 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, and although it will make a reasonable choice of this font,
this is not a return to the previously prevailing situation. And
then arbitrary packages could have done arbitrary things... so to
be on the safe side one needs the §basic§ option which limits the
mathastextification to letters and digits (and should also be
accompanied by §defaultimath§ which prevents redefinition of the
\cs{imath} macro, and §nohbar§ which prevents redefinition of the
\cs{hbar} macro\dots). And even then, in some circumstances, this
will still 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 in
operator names, and in the case of the \emph{euler} package, this
is the main document font. So, even subdued, \mst still kicks. But,
as I think is illustrated by the examples given at the start of
this document, the §subdued§ option has its utility, and works
reasonably well. 

Furthermore, the §subdued§ action does \emph{not} extinguish
package options §eulergreek§, §symbolgreek§ or §symbol§. But
§LGRgreek§ is receptive to it.


\subsection{Math versions}

\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, so no spaces in the names). 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,
§\Mathastextversion\{name\_of\_version\}§, or equivalently 
§\MTversion\{name\_of\_version\}§ in the body of the document
enacts the font switches. 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}

In the body of the document the \LaTeX{} command
\cs{mathversion}\marg{version\_name} will change only the fonts used in math
mode. It is recommended to use instead the package command
\csb{mathastextversion} (or its synonyms \csb{MTversion},
\cs{Mathastextversion}, \cs{MTVersion}), with a mandatory argument
\marg{version\_name}. It
\begin{itemize}
\item checks in case the §subdued§ option was specified whether the asked-for
  math version is \meta{normal} or \meta{bold}, and adapts the following
  to that case, 
\item sets the font which will be used in math mode for letters (including math
  operator names), digits, punctuations and other ascii symbols,
\item sets the font of the document text (if another version name is
  additionally passed as optional argument, it uses instead the corresponding
  font for text),
\item resets the |\(family,rm,sf,tt)default|s to their values as
  registered at the time  of definition of the version,
\item (see section \ref{sec:extraskips}) resets the user-defined extra spaces after the symbols $\exists$,
  $\forall$ and before the derivative ${}'$ to the values as decided in the
  preamble on a \emph{per version} basis,
\item (see section \ref{sec:ic}) checks if the used font is upright and then
  activates the automatic insertion of italic corrections after each letter in
  math mode,
\item (see section \ref{sec:mathxx}) makes the math operator names as well as
  the `easy' non letter characters (and the asterisk) obey the math alphabets,
\item does some additional set up for Greek letters  when the
  §LGRgreek§ option was used.
\end{itemize}
The scope is limited to the current \LaTeX{}
environment or group.


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{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 ;-) 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 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 `hard' 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 explicitely 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 `hard'
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.} \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 \cs{MTnonlettersdonotobeymathxx} by
  default. The reason is that activating the mechanism adds some constraints to
  the way things must be input, adding
  |\usepackage{mathastext}|{}\cs{MTnon\-letters\-obey\-mathxx} 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 `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 brace control sequences |\{| and |\}| have their own (supplementary) switch,
which is (even) less activated by default. The reason is that after
\csb{MTexplicitbracesobeymathxx}, they regrettably can not be used anymore as
delimiters: |\big\{| or |\big\}| cease to function and must be replaced by
|\big\lbrace| and |\big\rbrace|. But
\MTmathoperatorsobeymathxx\MTnonlettersobeymathxx\MTexplicitbracesobeymathxx we
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.}

There is no such restriction with $($, $)$ or the brackets $[$, $]$. When used
as delimiters though, they will become again unreactive to the math alphabets:
the same applies to $<$ and $>$ or to any of the other characters such as the
slashes $/$, $\backslash$, when they are used as delimiters. This is a rather
obvious restriction except possibly for the smallest size delimiters (the
so-called `small variants'), as all other sizes will be anyway absent from the
text fonts. Even the small variants may not be really available in the text
fonts: for example the standard $<$ used as a delimiter is in \LaTeX{} a
\cs{langle}: $\langle$. With standard \LaTeX{} |$\left< x\right>$| gives
$\langle x\rangle$.


Actually, \mst does try to pick up most of the `small variants' in the text
font: |$\left<x\right>$| gives $\left<x\right>$ (but |$\left<b\right>$| gives $\left<b\right>$.) If you don't like that use the
option §nosmalldelims§ (it is indeed perhaps a bit strange to have $\left<
  x\right>$ next to $\left< X\right>$, again before blaming me, consider using
§nosmalldelims§.) At any rate, whether `small' or not, delimiters are not under
the extended law of math alphabets, this is a general rule of the way \mst
manages these things.

Examples: |\mathbf{<a,b>}| gives $\mathbf{<a,b>}$. 
|\mathbf{\left<a,b\right>}| gives $\mathbf{\left<a,b\right>}$. 
|\mathbf{\mathopen{<}a,b \mathclose{>}}| gives $\mathbf{\mathopen{<} a,b
  \mathclose{>}}$.
The \LaTeX{} standard behavior for 
|\mathbf{\mathopen{<}a,b\mathclose{>}}| is
\endgroup
$\mathbf{\mathopen{<} a,b \mathclose{>}}$.


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

\begingroup
% \showboxbreadth=\maxdimen
% \showboxdepth=\maxdimen
\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 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).
 
\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 These
    italic corrections are cancelled inside the arguments to the math alphabet
    commands others than \cs{mathnormal}, to allow the formation of ligatures as
    is expected in the standard default \TeX{} font set-up in math.
  \end{framed}\vskip-.75\baselineskip
\end{framed}
\footnotetext{the situation is rather ironical! by the way, the warnings in
  section \ref{sec:mathxx} related to \cs{MTnonletters\-obeymathxx} are less of
  an issue here, because the additional italic correction is added \emph{after}
  the original character. Nevertheless it is still true that (in math mode
  only)
  the letter characters |a-z|, |A-Z|, are now composite objects, something which
  could surprise other packages. The macro §\MTnoicinmath§ cancels the
  mechanism.}

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 create fake 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} % problème de syntax highlighting dans emacs
\kern-.75\baselineskip}\\
\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.}

\subsection{Additional whitespaces}
\label{sec:extraskips}

\begingroup\MTversion{upright}\renewcommand\familydefault\sfdefault
\makeatletter % c'est parce que sinon ils sont pris dans Symbol
\let\mst@stdexists\oldexists
\let\mst@stdforall\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.\footnote{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.}
\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 that 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. Or, the commands may be used directly in the document.

Also, when the §subdued§ option has been used, the normal and bold math versions
have by default zero length skips (no preamble setting will change that).
Nevertheless it is possible to use also then the commands in the body of the
document.
\endgroup


\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. 

The §subdued§ option interacts with the options for Greek letters in the
following way:
\begin{enumerate}
\item in its presence, the §LGRgreek§ and §LGRgreeks§ options cease
  to have any effect in the normal and bold math versions,
\item §selfGreek(s)§, §eulergreek§ and §symbolgreek§ act normally,
  they are not affected by the presence or absence of §subdued§.
\end{enumerate}


\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 has been made minimally unicode-aware and can be used with \XeTeX{} or
\LuaLaTeX{}, but the user is strongly advised to look first at the |mathspec|
package, which is a far more powerful package designed for
unicode (only for \XeTeX{}), and to |unicode-math| (to use
OpenType math fonts).

Of course \mst 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|.
 
When using \mst with either \XeTeX{} or \LuaLaTeX{} it is recommended to use
the |fontspec| package. Else, some of the encoding dependent things done by
\mst like using the en-dash character to get a minus sign in math mode will
not be put in place. Furthermore, it is \emph{necessary} to load |fontspec|
with its |no-math| option, and this \emph{must} happen before loading \mst.

\begin{framed}
  Use |fontspec| with its
  \emph{no-math} option, and load it \emph{prior} to \mst.
\end{framed}

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

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 |pdfetex| engine (the
OpenType fonts not being usable with the latter engine, this is
not a criterion of choice anyhow).

To specify math versions using unicode fonts, use the
|fontspec| \cs{setmainfont} command (with arbitrary optional
features). This command can be issued before loading \mst,
or after and then will be followed by a \cs{Mathastext}
command with the name of the version in square brackets. 

It is possible to mix unicode fonts and classical \TeX{}
fonts. But this is definitely \emph{not} recommended as \mst
decides once and for all what is the font slot of things such
as the text endash (used for the minus sign) and this is
encoding dependent. So it is best to have either only unicode
fonts, or only old-fashioned \TeX{} fonts in a fixed encoding
(T1, or LY1 for example).

The package was not extensively tested with unicode engines, but 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{running |latex| on the source of this document
  |mathastext.dtx| (in a temporary repertory) extracts the 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}
\MTlettershape{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}

\subsection{Compatibility issues}

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).

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 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 ${}'$.

Version |1.2b| does this in
a careful manner with the hope to not create conflict with packages (typically,
language definition files from the |babel| system) making characters `globally
active' in the document.\footnote{it is better if these characters are not
  `catcode active' at the time of loading \mst, and fortunately |babel| does the
  activation of characters only at the \texttt{\string\begin\{document\}}.} All
  the action done by \mst is done anew at each math environment and has no
  effect elsewhere (even in hboxes included in a math mode group).

  Still, it is to be expected that all these `math active' characters will
  create incompatibilities (at least, surprises) with other packages. One such
  radical incompatibility arose 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}, with
      the ``non letters obey math alphabets'' mechanism, 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$| \emph{must} be input now as |$0^{+}$| and, respectively,
      |$x\mathrel{?}y$|. This is why the package does
      \cs{MTnonletters\textbf{donot}\-obeymathxx} 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.

  Doing (after the |\begin{document}|) |\everymath={}| and |\everydisplay={}|
    (preemptively) annihilates all of the \mst (evil) doing with math active
    characters but it annihilates also everything else some other package might
    have put in there, so it is much better, in case the need arises to
    preemptively cancel the action of \mst, to use the package macros
    \cs{MTmathoperatorsdonotobeymathxx}, \cs{MTnonlettersdonotobeymathxx} (this
    is default), \cs{MTnoicinmath}, and \cs{MTnormalprime} (which cancels the
    redefinition done by \mst of the action of the right quote |'| in math
    mode).

  An exception is with the modifications to $\oldexists$ and $\oldforall$
  which are done by the package in the preamble; the old definitions can be
  saved before to be reestablished after loading the package. Just using
  |\MTexistsskip{0mu}| and |\MTforallskip{0mu}| should be sufficient, except
  if it is important that the \cs{exists} and \cs{forall} control sequences
  always expand to only one token each.


   
\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).

\item[amsmath:] the behavior of the \cs{DeclareMathOperator}
command of |amsmath| is slightly modified by \mst. This
command initially allows crazy things like 
\cs{DeclareMathOperator}\cs{crazy}\{m.ch-in'tr/u:c\}
and then the ., -, ', / and : will be typeset  in the
roman font. But the font number was hardcoded in the macro
and furthermore the code of |amsmath| would cause an error
with Unicode engine as soon as some Unicode code is assigned
to the minus character.\footnote{To the experts: the $\sin$,
$\cos$, \dots{} operator names are \emph{not} defined by |amsmath| with
the help of the \cs{DeclareMathOperator} macro, hence are
not the cause of an error in \XeTeX{}/\LuaLaTeX{}. What \mst
does is to let to relax the \cs{newmcodes@} macro, so it is
possible to save it before loading \mst and re-establish
later, if really really this is what you want.}
This specific issue will perhaps be
fixed by some hypothetic future release of |amsmath|, or by other
packages providing patches, but I decided for a preemptive
strike. As a result the declaration above will not cause an
error when \cs{crazy} is used with a Unicode engine, but there
 are now some spacings around the punctuation characters. To
avoid this use (also with \LaTeX{}):\\
\centerline{\cs{DeclareMathOperator}\cs{crazy}\{m\{.\}ch\{-\}in\{'\}tr\{/\}u\{:\}c\}}
Note though that the quote ' will be typeset as a derivative sign $'$. 

\item[hbar:] the definition of \cs{hbar} inherited from
  default \LaTeX{} will 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 the bar
  accross the §h§ will come from the original default
  math font for letters (usually |cmmi|), and
  furthermore its placement on the §h§ can be
  odd-looking. So we redefine \cs{hbar} to use only the
  text font (and this will be aware of the §italic§
  option). Our construction does not always give an
  optimal result (and its scope is limited to the |OT1|,
  |LY1| and |T1| encodings), so an option §nohbar§
  deactivates it. There is no \cs{hslash} provided by
  the package, though. The version |1.12| of the
  package when dealing with a Unicode font tries to get
  the \cs{hbar} directly as a glyph from the font.


\item[dotless i and j:] by default the package redefines
  \cs{i} and \cs{j} to give the dotless i and j (if it
  exists at all), \emph{also in math mode,} in the text
  font. Will overwrite the default commands \cs{imath}
  and \cs{jmath}. In version |1.12| of the package this
  should work in all encodings, including Unicode (it
  is then assumed that |fontspec| has been loaded, and
  of course that the glyphs are indeed in the font).

\item[asterisk:] previous versions of \mst 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
  is decided by the argument to the macro \csb{MTlowerast}\marg{dimen} whose
  default value is |0.3\height|.\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}.} The symbol 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{}:] for the en-dash
and the dotless i and j, the package expects to detect
either the EU1 encoding for XeTeX{} or the EU2 encoding
for \LuaLaTeX{} (this will be true if |fontspec| was
loaded), or one of |OT1|, |LY1| or |T1|, else it
will renounce and not attempt to access the en-dash or the
dotless i and j glyphs. With \LaTeX{} and Pdf\LaTeX{},
there is no such limitation and all 8bit-encodings
(containing these glyphs) should be ok.

 \item[fontspec:] one more note to users of
\XeTeX{}/\LuaLaTeX{} with |fontspec|: it has to be
loaded {with the option} §no-math§, 
{and 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.


\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.
  \end{itemize}

\item[math accents:] an option §mathaccents§ is
  provided to pick up the accents in math mode from the
  text font, but the package knows only |T1|, |LY1| or
  |OT1|-compatible encodings.
 
\end{description}

Regarding the encoding-dependent glyphs: the en-dash, the
dotless i and j, the math accents, the hbar, are encoding
dependent and the relevant decisions are made once by \mst at
the time it is loaded and are applied to all declared math
versions. So you can use math versions with different
encodings but, regarding these characters only those with the
same encoding as the normal math version will display them
correctly.

\begin{framed}
  It is thus recommended that all declared mathastext math
  versions use the same font encoding.
\end{framed}

 \subsection{Commands}    

\subsubsection{Preamble-only commands}
These commands mainly facilitate the definition of math versions, in a \mst
extended sense. It is thus not necessary to use them to activate the package
basic functionalities, loading \mst is enough.
\begin{itemize}
\item §\Mathastext§ (or §\mathastext§): reinitializes \mst according to the
  current defaults of encoding, family, series and shape.\footnote{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.}}
  \begin{itemize}
  \item It can also 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, new with version
    |1.1|, §\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 \textbf{math versions:} starting with version |1.12| \cs{Mathastext}
    accepts an optional argument \oarg{version\_name}, which will serve as a
    name to designate the corresponding math version (without optional argument
    \cs{Mathastext} redefines the default normal and bold versions.) This
    argument, being optional, must be enclosed within square
    brackets.\footnote{The allowed version names are as for the \LaTeX{}
      \cs{DeclareMathVersion} macro. Do not use ``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.}
  \end{itemize}

  \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}:
  declares that the document will have access to the font
  with the specified characteristics, under the math version name
  \meta{name}. For
  example:\\
  \hbox
  to\hsize{\hss§\MTDeclareVersion[sc]\{palatino\}\{T1\}\{ppl\}\{b\}\{sl\}§\hss}
  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
  optional argument is absent, and \mst was loaded
  with the §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.
\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 §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 §LGRgreek§ option.
\end{itemize}

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

\begin{itemize}

\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 \cs{Mathastext} command (or
  \cs{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 skips are set to zero for the normal
  and bold math versions. In the case of the option §italic§,
  the default skip is set to zero.

\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 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 skips are set to be zero by default in
  the normal and bold math versions. In the case of the option
  §italic§, the default skip is zero for all math versions.
  One may use the command also at any time in the document.

\item §\MTprimeskip§\marg{math glue}: the default is to add a |0.5mu| skip
  before the derivative glyph, except for the §italic§ option, and except in
  the normal and bold math versions with option §subdued§. The same
  observations apply.

\item §\MTlowerast§\marg{dimen}: a \cs{raisebox} command is used to lower the
  text asterisk to produce a reasonable math asterisk. The package uses the
  command with the 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. Not that the
  dimension argument will be used also in sub-scripts and sub-sub-scripts, so it
  is best not to use an absolute measure.

\item §\MTmathoperatorsobeymathxx§, §\MTmathoperatorsdonotobeymathxx§,
  §\MTnonlettersobeymathxx§, §\MTnonlettersdonotobeymathxx§,
  §\MTexplicitbra\-cesobeymathxx§, §\MTexplicitbracesdonotobeymathxx§,
  §\MTeasynonlettersobeymathxx§, §\MTeasynonlettersdonotobeymathxx§: these
  commands without argument must be used \emph{outside} of math mode. \mst
  issues automatically §\MTmathoperatorsobeymathxx§,
  §\MTeasynonlettersobeymathxx§ and  and
  §\MTnonletters\textbf{donot}obeymathxx§ at the time of
  \cs{usepackage\{math\-as\-text\}}. See the discussion in section \ref{sec:mathxx}.
  The `explicit braces' activation works only
  when \cs{MTnonletters\-obeymathxx} has already been used.

\item §\MTicinmath§: this command tells \mst to add italic corrections after all
  letters in math mode. Its effect is cancelled inside math alphabets (except
  \cs{mathnormal}). The command is issued by default in the preamble when the
  shape of the letters used in math mode is neither italic nor slanted. It is
  reissued each time a math version is entered, under the same conditions (and
  except of course for the normal and bold subdued math versions). Its effect is
  local to the group or environment in which it has been issued. From inside
  math mode, it will only revert an earlier \cs{MTnoicinmath} from the same math
  group, and the math mode itself must have been entered with the italic
  corrections on. 

\item §\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). Its effect
  remains local to the group or environment where it was
  issued.

\item §\MTICinmath§, §\MTnoICinmath§: these commands set up the italic
  corrections only for the uppercase letters. Using §\MTICinmath§ de-activates
  the added italic corrections for uppercase letters in the arguments of
  \emph{all} the math alphabet commands.

\item §\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 in as well as
  outside of math mode.\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 \cs{MTicinmath} after it.

\end{itemize}

\subsubsection{Body-only commands}

\begin{itemize}
\item §\MTversion§\oarg{nametext}\marg{namemath}:\footnote{\cs{MTversion}
  is also available as \cs{MTVersion}, \cs{Mathastextversion} and
  \cs{mathastextversion}.} in the absence 
  of the optional argument changes simultaneously the
  text and the math fonts to be the fonts corresponding
  to the version \meta{namemath}. If there is an
  optional argument then the text fonts will use
  \meta{nametext} and the math mode will use
  \meta{namemath}. To change only the math fonts, one may use
  the \LaTeX{} command \cs{mathversion}. However this is not
  recommended as \mst does quite a lot of additional configuration
  when invoked with \cs{MTversion}. 

  Each invocation of §\MTversion§ checks the chosen shape of letters in math
  mode and if it is not \emph{italic} or \emph{slanted} it activates the
  automatic insertion of italic corrections in math mode, for better positioning
  of subscripts. See the discussion in the section \ref{sec:ic}. With the
  §frenchmath§ option the package checks separately whether to insert the italic
  corrections after lowercase and/or uppercase letters.

  With the §subdued§ option, \cs{MTversion\{normal\}} and \cs{MTversion\{bold\}}
  do \cs{MTmathoperatorsdonotobeymathxx} (and \cs{MTnonlettersdonotobeymathxx}).
\end{itemize}

All further commands are for math mode only.
\begin{itemize}
\item §\hbar§: this is constructed
  (in a way compatible with the §italic§ option) from
  the §h§ letter and the \={ } accent from the
  \mst font. Note that \cs{mathrm}|{\hbar}| and
  \cs{mathbf}|{\hbar}| should work and that \cs{hbar}
  does scale in subscripts and exponents. Only for |T1|
  and |OT1| (or |LY1|) encodings.
\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 chosen font for math mode. By default, will
  overwrite |\imath| and |\jmath|. With version |1.12|
  by default §\i§ and §\j§ work also in math mode and
  give then §\inodot§, resp. §\jnodot§. This should work for
  all 8bit-encodings having these glyphs, and 
  also in Unicode. 
\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 §symbolgreek§,
  §eulergreek§, or §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 §asterisk§ is also required to treat the $*$.
    Recall from section \ref{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) : \[\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{defaultprod} and \cs{defaultsum}
  will refer to the \cs{prod} and \cs{sum} before redefinition by the
  package: this is to allow constructs such as
  |$\displaystyle\defaultprod$| or
  |\[\textstyle\defaultprod\]|, because they would not work
  with the \cs{prod} and \cs{sum} as re-defined by the package.
\end{itemize}

 \subsection{Complete list of options}

 \begin{itemize}
 \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 \cs{MTversion} (or \cs{mathastextversion}) command
   activating an additional math version as declared in the preamble. With
   option §subdued§ each \cs{MTversion\{normal\}} or \cs{MTversion\{bold\}} does
   \cs{MTmathoperatorsdonotobeymathxx} (and \cs{MTnonlettersdonotobeymathxx}).
 \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 §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 §asterisk§: use the text font (or the Symbol font) asterisk in math mode. 
\item §noendash§: the minus sign will be the - from the
text font, not the en-dash \textendash.
\item §nohbar§: prevents \mst from defining its own
  \cs{hbar}.
\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 \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.
 \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. Will work only for |T1|, |LY1|, or |OT1|-compatible encodings.
 \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}, do not extend \cs{i} and \cs{j} to math mode use.
 \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{itemize}

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


\makeatletter
\StopEventually{\check@checksum\end{document}}
\makeatother

\newgeometry{hmarginratio=3:2}
\small
\section{Implementation}

\makeatletter
\begingroup
\topsep\MacrocodeTopsep
\trivlist\parskip\z@\item[]
\macro@font
\leftskip\@totalleftmargin  \advance\leftskip\MacroIndent
\rightskip\z@  \parindent\z@  \parfillskip\@flushglue
\global\@newlistfalse \global\@minipagefalse
\ifcodeline@index
  \everypar{\global\advance\c@CodelineNo\@ne
  \llap{\theCodelineNo\ \hskip\@totalleftmargin}}%
\fi
\string\ProvidesPackage\string{\pkgname\string}\par
\noindent\space [\pkgdate\space\pkgversion\space\pkgdescription]\par
\nointerlineskip
\global\@inlabelfalse
\endtrivlist
\endgroup
\makeatother
% 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</none>\relax
% \def<*package>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12}
%
%</none>
%<*package>
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
%    \end{macrocode}
% Testing for XeTeX and LuaLaTeX. I should load some package for this
% code which I copied somewhere. 2013/01/01: at least the code now does not
% overwrite previous \cs{ifXeTeX} or \cs{ifLuaTeX}...
%    \begin{macrocode}
\newif\ifmst@XeTeX
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax
  \mst@XeTeXfalse
\else
  \mst@XeTeXtrue
\fi
\newif\ifmst@LuaTeX
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname directlua\endcsname\relax
  \mst@LuaTeXfalse
\else
  \mst@LuaTeXtrue
\fi
%    \end{macrocode}
% |1.2|: all inner macros of \mst now starts with |\mst@| for a cleaner
% name-space. 
%    \begin{macrocode}
\def\mst@oti{OT1}\def\mst@ti{T1}\def\mst@lyi{LY1}
\def\mst@eui{EU1}\def\mst@euii{EU2}
\newif\ifmst@goahead
\newif\ifmst@abort
\newif\ifmst@optionalparam
%    \end{macrocode}
%  \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}
%% new with 1.2
\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' is deprecated.^^J\space\space\space 
         Check the documentation}}
    \DeclareOption{asterisk}{\mst@asterisktrue
      \AtBeginDocument{
        \everymath\expandafter{\the\everymath \mst@doasterisk}
        \everydisplay\expandafter{\the\everydisplay \mst@doasterisk}}}
\newif\ifmst@nospecials
    \DeclareOption{nospecials}{\mst@nospecialstrue}
\DeclareOption{basic}{\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@needsymbol
\newif\ifmst@symboldelimiters
    \DeclareOption{symboldelimiters}{\mst@needsymboltrue\mst@symboldelimiterstrue}
\newif\ifmst@symboldigits
    \DeclareOption{symboldigits}{\mst@needsymboltrue\mst@symboldigitstrue}
\newif\ifmst@symbolgreek
    \DeclareOption{symbolgreek}{\mst@needsymboltrue\mst@symbolgreektrue}
\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}
%%
\newif\ifmst@selfGreek
    \DeclareOption{selfGreek}{\mst@selfGreektrue}
\newif\ifmst@selfGreeks
    \DeclareOption{selfGreeks}{\mst@selfGreekstrue\mst@selfGreektrue}
\newif\ifmst@LGRgreek
    \DeclareOption{LGRgreek}{\mst@LGRgreektrue}
\newif\ifmst@LGRgreeks
    \DeclareOption{LGRgreeks}{\mst@LGRgreekstrue\mst@LGRgreektrue}
%%
\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}
\DeclareOption*{\PackageWarningNoLine{mathastext}{Unknown option `\CurrentOption'}}
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\ProcessOptions\relax
%    \end{macrocode}
%  \begin{macro}{\exists} \begin{macro}{\mst@exists@skip}
%  \begin{macro}{\forall} \begin{macro}{\mst@forall@skip} 
%  
%      |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.
%
%    \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
\AtEndOfPackage{% must be at end of code
\let\mst@stdexists\exists
\let\mst@stdforall\forall
\renewcommand\exists{\mst@stdexists\mskip\mst@exists@muskip}
\renewcommand\forall{\mst@stdforall\mskip\mst@forall@muskip}
}
%    \end{macrocode}
%  \end{macro}\end{macro}\end{macro}\end{macro}
%  \begin{macro}{\prime}
%  \begin{macro}{\mst@prime@skip}
%  \begin{macro}{\active@math@prime}
%  \begin{macro}{\MTnormalprime}
%
%    |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, 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.
%
%    The macro \cs{mst@modifyprime} is defined here and not At Begin Document as
%    this could be a time when the right quote has been made active. The safe
%    fall-back definition (for use in an \cs{hbox} or a \cs{label} inside math
%    for example), which is made anew each time by \cs{mst@mathactivate} at each
%    math mode entrance, invokes, in case |'| is \emph{not} active then, the |'|
%    with its catcode as seen by \TeX{} when it first reads
%    |\mst@mathactivate'...|, so here when it stores the definition of
%    \cs{mst@modifyprime}. Henve there would be a problem if the |'| were
%    active \emph{here} and then the |'| is \emph{not} active anymore
%    when entering a math mode list. To be extra safe, I should perhaps issue a
%    local |\@makeother'| here, but is it really worth the trouble? (and if I
%    did it for |'| I would have for consistency to apply the same safeguard to
%    all the other characters treated later by \mst).
%
%    The \cs{string'} below seems to contradict this belief in a non-active
%    |'| here but this is just to be extra sure loading the package is
%    safe. A user command \cs{MTnormalprime} is provided in case there is
%    a problem later.
%
%    \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}
\def\mst@modifyprime{\mst@mathactivate'\mst@active@math@prime{}}
\expandafter\let\csname mst@ifdone\string'\endcsname\iffalse
\AtBeginDocument{
\everymath\expandafter{\the\everymath \mst@modifyprime}
\everydisplay\expandafter{\the\everydisplay \mst@modifyprime}
}
\newcommand\MTnormalprime{\let\mst@modifyprime\relax}
%    \end{macrocode}
%  \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 mu skip or glue after
%   \cs{exists} or \cs{forall}, on a math version basis (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), as each
%   \cs{Mathastext}\oarg{version\_name} stores the then 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.
%    \begin{macrocode}
\newcommand*\MTexistsskip[1]{\edef\mst@exists@skip{#1}%
    \expandafter\mst@exists@muskip\mst@exists@skip\relax}
\newcommand*\MTforallskip[1]{\edef\mst@forall@skip{#1}%
    \expandafter\mst@forall@muskip\mst@forall@skip\relax}
\newcommand*\MTprimeskip[1]{\edef\mst@prime@skip{#1}%
    \expandafter\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}{\MTnonletters-}\begin{macro}{obeymathxx}
%  \begin{macro}{\MTnonletters-}\begin{macro}{donotobeymathxx}
%      |1.2| [2012/12/20] does some rather daring \emph{math} activation of
%      \DeleteShortVerb{\|}\verb$!,?,+,-,=,<,>,(,),[,],|$ \MakeShortVerb{\|} 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.
%
%  \begin{macro}{\mst@mathactivate}
%    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},\\
%    \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}{\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 |)|).
%        With |lualatex| no error is signaled when \mst has done
%        |\mathcode`(="8000|, but the \cs{Mathstrutbox@} 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
%        |noparen| was used, we leave everything untouched.
%    \begin{macrocode}
\ifmst@noparen\else
\AtBeginDocument{
\@ifundefined{resetMathstrut@}{}{%
    \PackageWarningNoLine{mathastext}{a custom version of the amsmath macro^^J%
      \space\space\space\string\resetMathstrut@\space will replace the original}
    \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}}
\fi
%    \end{macrocode}
%  \end{macro} 
%
%  \begin{macro}{\mst@fork}
%      |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 new code provides (let's hope)
%      correct behavior: the \cs{mst@fork} macro will expand the active
%      character to its \mst re-definition \emph{only} in math mode and
%      \emph{only} if \cs{protect} is \cs{@typeset@protect}. This covers
%      situations such as |$\hbox{?}$| with an active |?| or
%      |$\label{eq:1}$| with an active |:| (an iteration of math modes
%      and restricted horizontal modes is no problem).
%
%      In the case the character is not active at the entrance of the
%      math mode, the fall-back macro \cs{mst@original}\meta{char}
%      expands to the character with its catcode at the time of the
%      loading of the package, so, \emph{it is assumed}, 11 for the
%      letters a-z, A-Z, and 12 for the other concerned characters.
%      Perhaps this is not the catcode of the character at the time the
%      current math mode is now entered. As the fall-back macro will be
%      activated presumably when writing to a display or file, or
%      building a \cs{csname}...\cs{endcsname}, being of catcode 11 or 12
%      should not be an issue. If the character has been assigned a
%      catcode neither 11 nor 12, then \TeX{} does not look at its
%      \cs{mathcode}, so what mathastext does in \cs{mst@mathactivate} is
%      of no consequence. And in the case of a character which has
%      catcode 13 when entering math mode, the precautions taken have
%      been explained in the previous paragraph.
%
%  \begin{macro}{\mst@do@az}
%  \begin{macro}{\mst@do@AZ}
%  \begin{macro}{\mst@addtodo@az}
%  \begin{macro}{\mst@addtodo@AZ}
%  \begin{macro}{\MTicinmath}
%  \begin{macro}{\MTICinmath}
%  \begin{macro}{\MTnoicinmath}
%  \begin{macro}{\MTicalsoinmathxx}
%  \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:it]{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!
%
%    Note: the italic correction is added of course \emph{after} the letters
%    and |$x^y$| or |$x\mathrel yz$| at least do not create errors. But of
%    course as nobody expects the letters to have their |mathcodes| set to
%    |32768| there will certainly be some incompatibilities. This is less
%    severe though that the problem with the `non-letters'.
%
%    One may question the fact of doing this at every math/display, as it
%    seems costly. Why not do it once and for all? well, processor chips
%    are fast these days. True, for the case of the characters such as
%    |?|, |!|, |>|, |<|, ... which could reasonably be expected to be
%    made active elsewhere in the document, it is certainly a great
%    simplification for me to do my business at every math/display which are
%    groups. For the letters, which are not really in danger of being
%    made active in the document, I could possibly have moved the
%    |\mathcode`x="8000| thing to the document preamble, but to cancel it
%    (in the document body) would mean to have to reset all mathcodes,
%    rather than let simply as is done here a \cs{the} to be a
%    \cs{@gobble}.
%     
%      \cs{MTnoicinmath} can be used inside math mode (and has
%      its scope limited by the group of course). 
%
%      \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|).
%
%      \cs{MTicinmath} can also be used inside math mode,
%      but it can then only revert an earlier
%      \cs{MTnoicinmath} inside the same math group. So the
%      math mode had to be entered with italic corrections on.
%    \begin{macrocode}
\newtoks\mst@do@nonletters
\newtoks\mst@do@easynonletters
\newtoks\mst@do@az
\newtoks\mst@do@AZ
\newcommand\MTnonlettersdonotobeymathxx{\let\mst@the\@gobble}
\newcommand\MTnonlettersobeymathxx{\let\mst@the\the}
\newcommand\MTeasynonlettersdonotobeymathxx{\let\mst@theeasy\@gobble}
\newcommand\MTeasynonlettersobeymathxx{\let\mst@theeasy\the}
\MTnonlettersdonotobeymathxx % 1.2c !!!
\MTeasynonlettersobeymathxx
\newcommand\MTicinmath{% 
    \let\mst@thef\the
    \let\mst@theF\the
    \def\mst@itcorr{\ifnum\fam=\m@ne\/\else\ifnum\fam=\symmtletterfont\/\fi\fi}%
    \let\mst@ITcorr\mst@itcorr}
\newcommand\MTnoicinmath{% also usable in math mode
    \def\mst@itcorr{}\def\mst@ITcorr{}%
    \let\mst@thef\@gobble\let\mst@theF\@gobble}
\newcommand\MTICinmath{% 
    \let\mst@theF\the
    \def\mst@ITcorr{\ifnum\fam=\m@ne\/\fi}}
\newcommand\MTnoICinmath{% also usable in math mode
    \def\mst@ITcorr{}%
    \let\mst@theF\@gobble}
\newcommand\MTicalsoinmathxx{%
    \ifx\mst@itcorr\@empty\else\def\mst@itcorr{\/}\fi
    \ifx\mst@ITcorr\@empty\else\def\mst@ITcorr{\/}\fi}
\AtBeginDocument{
\everymath\expandafter{\the\everymath \mst@the\mst@do@nonletters
    \mst@theeasy\mst@do@easynonletters
    \mst@thef\mst@do@az \mst@theF\mst@do@AZ}
\everydisplay\expandafter{\the\everydisplay \mst@the\mst@do@nonletters
    \mst@theeasy\mst@do@easynonletters
    \mst@thef\mst@do@az \mst@theF\mst@do@AZ}
}
\def\mst@fork{%
    \ifx\protect\@typeset@protect\ifmmode
      \expandafter\expandafter\expandafter\@thirdofthree
    \fi\fi
    \@firstoftwo}
\begingroup % make sure ~ is active
  \catcode`~=\active
  \def\x{\endgroup
\def\mst@mathactivate##1##2##3{%
    \begingroup
    \lccode`~=`##1
    \lccode`##1=`##1
    \lowercase{\endgroup
      \csname mst@ifdone\string##1\endcsname
      \else
        \expandafter\expandafter\expandafter
        \let\expandafter\expandafter\csname mst@original\string##1\endcsname
            \expandafter=\ifnum\catcode`##1=\active~\else##1\fi
        \expandafter\def\csname mst@mathactive\string##1\endcsname{##2##3}%
        \mathcode`##1="8000
        \edef~{\noexpand\mst@fork
            \expandafter\noexpand\csname mst@original\string##1\endcsname
            \expandafter\noexpand\csname mst@mathactive\string##1\endcsname}%
      \fi}%
      \expandafter\let\csname mst@ifdone\string##1\endcsname=\iftrue}
}\x
\def\mst@addtodo@nonletters#1#2#3{
  \expandafter\let\csname mst@ifdone\string#1\endcsname\iffalse
  \mst@do@nonletters\expandafter{\the\mst@do@nonletters\mst@mathactivate#1#2#3}
}
\def\mst@addtodo@easynonletters#1#2{
  \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters\mathcode`#1=#2}
}
\def\mst@addtodo@az#1#2#3{
  \expandafter\let\csname mst@ifdone\string#1\endcsname\iffalse
  \mst@do@az\expandafter{\the\mst@do@az\mst@mathactivate#1#2#3}
}
\def\mst@addtodo@AZ#1#2#3{
  \expandafter\let\csname mst@ifdone\string#1\endcsname\iffalse
  \mst@do@AZ\expandafter{\the\mst@do@AZ\mst@mathactivate#1#2#3}
}
%    \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}
% \begin{macro}{\newmcodes@}
%   |1.15d|: this 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).
%    \begin{macrocode}
\@ifpackageloaded{amsmath}
{\let\newmcodes@\relax} % brutal, but bye bye and don't come back.
{}
%    \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 ($(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 [update: I have since been told by TH that the
%   next LuaLaTeX release will change this] 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. 
%
%   |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.
%    \begin{macrocode}
\ifmst@subdued
  \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{\encodingdefault}
  \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\mst@oti\def\mst@tmp{T1}\fi\fi
  \edef\mst@normalmv@operator{\expandafter\noexpand\csname 
                               \mst@tmp/\mst@reste\endcsname}
  \begingroup\escapechar\m@ne
      \expandafter\expandafter\expandafter
          \mst@reserved\expandafter\string\mst@boldmv@operator/
  \endgroup
  \ifx\mst@debut\mst@funnyoti\ifx\mst@tmp\mst@oti\def\mst@tmp{T1}\fi\fi
  \edef\mst@boldmv@operator{\expandafter\noexpand\csname 
                             \mst@tmp/\mst@reste\endcsname}
  \AtEndOfPackage{
  \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.}
  }
\fi % fin de ce \ifmst@subdued
%    \end{macrocode}
%  In the short-lived |1.15e| I was doing the following for alphabets:\\
%  |\def\mst@reservedc#1#2#3#4{\def\mst@normalmv@mathbf{#4#3}}|\\
%  |\def\mst@reserveda#1{%|\\
%  |\def\mst@reservedb##1\install@mathalphabet#1##2##3\@nil{\mst@reservedc##2}%|\\
%  |\expandafter\mst@reservedb\mv@normal\@nil}|\\
%  |\expandafter\mst@reserveda\csname mathbf\space\endcsname|\\
%  and later in the code:\\
%  |\expandafter\expandafter\expandafter\SetMathAlphabet@|\\
%  |\expandafter\expandafter\expandafter\mv@normal|\\
%  |\expandafter\mst@normalmv@mathbf\csname Mathbf\space \endcsname\Mathbf|\\
%  It does work! but |\let\mst@original@bf\mathbf| is so
%  much simpler. And also safer, because \cs{mathbf} could have been
%  redefined using \cs{DeclareSymbolFontAlphabet}... (I could have
%  provided the necessary check to the already bloated code...)
% \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}
%   In 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}{\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
%   and (|1.15f|) the previous status of the math alphabets is recorded for the
%   sake of the |subdued| option. 
%
%   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}.
%    \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
\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\renewcommand{\mathnormal}{\Mathnormal}\fi
    \ifmst@defaultrm\else\renewcommand{\mathrm}{\Mathrm}\fi
    \ifmst@defaultbf\else\renewcommand{\mathbf}{\Mathbf}\fi
    \ifmst@defaultit\else\renewcommand{\mathit}{\Mathit}\fi
    \ifmst@defaultsf\else\renewcommand{\mathsf}{\Mathsf}\fi
    \ifmst@defaulttt\else\renewcommand{\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{mtfourierpourvec}{FML}{futm}{m}{it}
  \SetSymbolFont{mtfourierpourvec}{bold}{FML}{futm}{b}{it}
  \DeclareMathAccent{\fouriervec}{\mathord}{mtfourierpourvec}{"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}}
\@onlypreamble\MTencoding
\@onlypreamble\MTfamily
\@onlypreamble\MTseries
\@onlypreamble\MTshape
\@onlypreamble\MTboldvariant
\@onlypreamble\MTlettershape
\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}}
\@onlypreamble\MTitgreek
\@onlypreamble\MTupgreek
\@onlypreamble\MTitGreek
\@onlypreamble\MTitGreek
\let\Mathastextitgreek\MTitgreek
\let\Mathastextupgreek\MTupgreek
\let\MathastextitGreek\MTitGreek
\let\MathastextupGreek\MTupGreek
    \newcommand*\MTgreekfont[1]{\def\mst@greekfont{#1}}
\@onlypreamble\MTgreekfont
\let\Mathastextgreekfont\MTgreekfont
%    \end{macrocode}
% \end{macro}
% \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][\@empty]{
  \MTencoding{#2}
  \MTfamily{#3}
  \MTseries{#4}
  \MTshape{#5}
    \ifmst@italic\MTlettershape{\itdefault}\fi % was missing in v 1.14 and prior
  \ifx\@empty#1 
  \else 
%% we check if optional argument was [],  this does not detect [ ]
  \def\mst@tmp{#1}
   \ifx\@empty\mst@tmp\else\MTlettershape{#1}\fi
  \fi
  \Mathastext}
\@onlypreamble\MTWillUse
\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.
%    \begin{macrocode}
\newcommand*\Mathastext[1][\@empty]{
\ifx\@empty#1 % no optional argument
  \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}
  \MTicinmath
  \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@ltshape@normal\MTnoicinmath\fi}%
  \ifmst@frenchmath
      \MTICinmath
      \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@shape@normal\MTnoICinmath\fi}%
  \fi
  \ifmst@subdued
    \MTeasynonlettersdonotobeymathxx
    \MTnonlettersdonotobeymathxx
    \MTmathoperatorsdonotobeymathxx
    \MTnoicinmath
    \ifmst@asterisk\let\mst@doasterisk\relax\fi
    \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
        \expandafter\mst@exists@muskip\mst@exists@skip\relax
        \expandafter\mst@forall@muskip\mst@forall@skip\relax
        \expandafter\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
        \expandafter\mst@exists@muskip\mst@exists@skip\relax
        \expandafter\mst@forall@muskip\mst@forall@skip\relax
        \expandafter\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
\else % optional argument, then we rather do DeclareVersion
 \edef\mst@tmp{#1}
 \ifx\mst@tmp\@empty
    \Mathastext  % no infinite loop!
  \else
    \MTDeclareVersion[\mst@ltsh]{#1}
         {\mst@enc}{\mst@fam}{\mst@ser}{\mst@opsh}
 \fi
\fi
}
\@onlypreamble\Mathastext
\let\mathastext\Mathastext
%    \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!
%    \begin{macrocode}
\newcommand*\MTDeclareVersion[6][\@empty]{
  \edef\mst@version{#2}
  \DeclareMathVersion{\mst@version}
  \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}
  \mst@optionalparamfalse
    \ifx\@empty#1
    \else % we check nevertheless for [] situation, will not work with [ ]
       \def\mst@tmp{#1}
       \ifx\mst@tmp\@empty\else\mst@optionalparamtrue\fi
    \fi
  \ifmst@optionalparam
      \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{#1}
    \typeout{** Latin letters in math version `#2' 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}
  \else
    \ifmst@italic
      \SetSymbolFont{mtletterfont}{#2}{#3}{#4}{#5}{\mst@ltsh}
    \typeout{** Latin letters in math version `#2' 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' will use the fonts
    #3/#4/#5(\mst@bold)/#6}
      \expandafter\edef\csname mst@ltshape@\mst@version\endcsname{#6}
    \fi
  \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}
 \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}
 \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}
 \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}
 \fi\fi\fi\fi
%\mst@font@info@on
}
\@onlypreamble\MTDeclareVersion
%    \end{macrocode}
% \end{macro}
% \end{macro}
%    \begin{macrocode}
\let\MathastextDeclareVersion\MTDeclareVersion
%    \end{macrocode}
% \end{macro}
% \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...
%    \begin{macrocode}
\newcommand*\MTVersion[2][\@empty]{%
    \mathversion{#2}%
    \ifx\@empty#1% no optional argument
        \def\mst@tmp{#2}% 
    \else% we check nevertheless for [] situation, will not work with [ ]
       \def\mst@tmpa{#1}%
       \ifx\mst@tmpa\@empty\def\mst@tmp{#2}%
       \else\def\mst@tmp{#1}%
       \fi%
    \fi%
    \usefont{\csname mst@encoding@\mst@tmp\endcsname}%
        {\csname mst@family@\mst@tmp\endcsname}%
        {\csname mst@series@\mst@tmp\endcsname}%
        {\csname mst@shape@\mst@tmp\endcsname}%
    \edef\mst@@encoding{\csname mst@encoding@\mst@tmp\endcsname}%
        \renewcommand{\encodingdefault}{\mst@@encoding}%
%% some modifications for v1.15b 
    \edef\mst@@famdefault{\csname mst@family@\mst@tmp\endcsname}%
        \renewcommand{\familydefault}{\mst@@famdefault}%
    \edef\mst@@series{\csname mst@series@\mst@tmp\endcsname}%        
        \renewcommand{\mddefault}{\mst@@series}%
    \edef\mst@@shape{\csname mst@shape@\mst@tmp\endcsname}%
        \renewcommand{\shapedefault}{\mst@@shape}%
    \edef\mst@@boldvariant{\csname mst@boldvariant@\mst@tmp\endcsname}%
        \renewcommand{\bfdefault}{\mst@@boldvariant}%
    \edef\mst@@itdefault{\csname mst@itdefault@\mst@tmp\endcsname}%
        \renewcommand{\itdefault}{\mst@@itdefault}%
    \edef\mst@@rmdefault{\csname mst@rmdefault@\mst@tmp\endcsname}%
        \renewcommand{\rmdefault}{\mst@@rmdefault}%
    \edef\mst@@sfdefault{\csname mst@sfdefault@\mst@tmp\endcsname}%
        \renewcommand{\sfdefault}{\mst@@sfdefault}%
    \edef\mst@@ttdefault{\csname mst@ttdefault@\mst@tmp\endcsname}%
        \renewcommand{\ttdefault}{\mst@@ttdefault}%
    \edef\mst@tmp{#2}%
%% v1.15e: muskips
    \expandafter
     \mst@exists@muskip\csname mst@exists@skip@\mst@tmp\endcsname\relax
    \expandafter
     \mst@forall@muskip\csname mst@forall@skip@\mst@tmp\endcsname\relax
%% v1.2: muskip for \cs{prime}
    \expandafter
     \mst@prime@muskip\csname mst@prime@skip@\mst@tmp\endcsname\relax
%% v1.2b: italic corrections except for italic/slanted (sic) letters, and of
%% course except in the subdued normal and bold math versions
    \edef\mst@tmpa{\csname mst@ltshape@\mst@tmp\endcsname}%
    \edef\mst@tmpb{\csname mst@shape@\mst@tmp\endcsname}%
    \MTicinmath
    \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@tmpa\MTnoicinmath\fi}%
    \ifmst@frenchmath
      \MTICinmath
      \@for\mst@tmp:=it,sl\do{\ifx\mst@tmp\mst@tmpb\MTnoICinmath\fi}%
    \fi
%% 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
    \MTmathoperatorsobeymathxx
    \MTeasynonlettersobeymathxx
    \ifmst@asterisk
        \let\mst@doasterisk\mst@@doasterisk
    \fi
    \ifmst@subdued
      \edef\mst@tmp{#2}\def\mst@tmpa{normal}%
      \ifx\mst@tmp\mst@tmpa
        \mst@restorealphabets
        \MTmathoperatorsdonotobeymathxx
        \MTnonlettersdonotobeymathxx
        \MTeasynonlettersdonotobeymathxx
        \MTnoicinmath
        \ifmst@asterisk\let\mst@doasterisk\relax\fi
        \ifmst@LGRgreek\mst@restoregreek\fi
      \else
      \def\mst@tmpa{bold}%
      \ifx\mst@tmp\mst@tmpa
          \mst@restorealphabets
          \MTmathoperatorsdonotobeymathxx
          \MTnonlettersdonotobeymathxx
          \MTeasynonlettersdonotobeymathxx
          \MTnoicinmath
          \ifmst@asterisk\let\mst@doasterisk\relax\fi
          \ifmst@LGRgreek\mst@restoregreek\fi
      \else
      \mst@setalphabets
      \ifmst@LGRgreek\mst@setuplgrgreek\fi
    \fi\fi\fi
}
\let\MathastextVersion\MTVersion
\let\Mathastextversion\MTVersion
\let\MTversion\MTVersion
\let\mathastextversion\MTVersion
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\Mathastext}
% Initialization call:
%    \begin{macrocode}
\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^^J%
** \protect\MathastextEulerScale{<factor>} to scale the font.}
\else
\ifmst@symbolgreek
       \typeout{** Greek letters will use the PostScript Symbol font. Use^^J%
** \protect\MathastextSymbolScale{<factor>} to scale the font.}
\fi\fi
%    \end{macrocode}
% 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| uses |\mathcode`x="8000| to insert the italic corrections
% after letters.
%    \begin{macrocode}
\def\mst@DeclareMathSymbol#1#2#3#4{%
    \DeclareMathSymbol{#1}{#2}{#3}{#4}
    \expandafter\DeclareMathSymbol\csname mst@#1\endcsname{#2}{#3}{#4}
    \expandafter\mst@addtodo@az
        \expandafter#1\csname mst@#1\endcsname\mst@itcorr}
\mst@DeclareMathSymbol{a}{\mathalpha}{mtletterfont}{`a}
\mst@DeclareMathSymbol{b}{\mathalpha}{mtletterfont}{`b}
\mst@DeclareMathSymbol{c}{\mathalpha}{mtletterfont}{`c}
\mst@DeclareMathSymbol{d}{\mathalpha}{mtletterfont}{`d}
\mst@DeclareMathSymbol{e}{\mathalpha}{mtletterfont}{`e}
\mst@DeclareMathSymbol{f}{\mathalpha}{mtletterfont}{`f}
\mst@DeclareMathSymbol{g}{\mathalpha}{mtletterfont}{`g}
\mst@DeclareMathSymbol{h}{\mathalpha}{mtletterfont}{`h}
\mst@DeclareMathSymbol{i}{\mathalpha}{mtletterfont}{`i}
\mst@DeclareMathSymbol{j}{\mathalpha}{mtletterfont}{`j}
\mst@DeclareMathSymbol{k}{\mathalpha}{mtletterfont}{`k}
\mst@DeclareMathSymbol{l}{\mathalpha}{mtletterfont}{`l}
\mst@DeclareMathSymbol{m}{\mathalpha}{mtletterfont}{`m}
\mst@DeclareMathSymbol{n}{\mathalpha}{mtletterfont}{`n}
\mst@DeclareMathSymbol{o}{\mathalpha}{mtletterfont}{`o}
\mst@DeclareMathSymbol{p}{\mathalpha}{mtletterfont}{`p}
\mst@DeclareMathSymbol{q}{\mathalpha}{mtletterfont}{`q}
\mst@DeclareMathSymbol{r}{\mathalpha}{mtletterfont}{`r}
\mst@DeclareMathSymbol{s}{\mathalpha}{mtletterfont}{`s}
\mst@DeclareMathSymbol{t}{\mathalpha}{mtletterfont}{`t}
\mst@DeclareMathSymbol{u}{\mathalpha}{mtletterfont}{`u}
\mst@DeclareMathSymbol{v}{\mathalpha}{mtletterfont}{`v}
\mst@DeclareMathSymbol{w}{\mathalpha}{mtletterfont}{`w}
\mst@DeclareMathSymbol{x}{\mathalpha}{mtletterfont}{`x}
\mst@DeclareMathSymbol{y}{\mathalpha}{mtletterfont}{`y}
\mst@DeclareMathSymbol{z}{\mathalpha}{mtletterfont}{`z}
\ifmst@frenchmath\def\mst@font@tbu{mtoperatorfont}
   \else\def\mst@font@tbu{mtletterfont}\fi
\def\mst@DeclareMathSymbol#1#2#3#4{%
    \DeclareMathSymbol{#1}{#2}{#3}{#4}
    \expandafter\DeclareMathSymbol\csname mst@#1\endcsname{#2}{#3}{#4}
    \expandafter\mst@addtodo@AZ
        \expandafter#1\csname mst@#1\endcsname\mst@ITcorr}
\mst@DeclareMathSymbol{A}{\mathalpha}{\mst@font@tbu}{`A}
\mst@DeclareMathSymbol{B}{\mathalpha}{\mst@font@tbu}{`B}
\mst@DeclareMathSymbol{C}{\mathalpha}{\mst@font@tbu}{`C}
\mst@DeclareMathSymbol{D}{\mathalpha}{\mst@font@tbu}{`D}
\mst@DeclareMathSymbol{E}{\mathalpha}{\mst@font@tbu}{`E}
\mst@DeclareMathSymbol{F}{\mathalpha}{\mst@font@tbu}{`F}
\mst@DeclareMathSymbol{G}{\mathalpha}{\mst@font@tbu}{`G}
\mst@DeclareMathSymbol{H}{\mathalpha}{\mst@font@tbu}{`H}
\mst@DeclareMathSymbol{I}{\mathalpha}{\mst@font@tbu}{`I}
\mst@DeclareMathSymbol{J}{\mathalpha}{\mst@font@tbu}{`J}
\mst@DeclareMathSymbol{K}{\mathalpha}{\mst@font@tbu}{`K}
\mst@DeclareMathSymbol{L}{\mathalpha}{\mst@font@tbu}{`L}
\mst@DeclareMathSymbol{M}{\mathalpha}{\mst@font@tbu}{`M}
\mst@DeclareMathSymbol{N}{\mathalpha}{\mst@font@tbu}{`N}
\mst@DeclareMathSymbol{O}{\mathalpha}{\mst@font@tbu}{`O}
\mst@DeclareMathSymbol{P}{\mathalpha}{\mst@font@tbu}{`P}
\mst@DeclareMathSymbol{Q}{\mathalpha}{\mst@font@tbu}{`Q}
\mst@DeclareMathSymbol{R}{\mathalpha}{\mst@font@tbu}{`R}
\mst@DeclareMathSymbol{S}{\mathalpha}{\mst@font@tbu}{`S}
\mst@DeclareMathSymbol{T}{\mathalpha}{\mst@font@tbu}{`T}
\mst@DeclareMathSymbol{U}{\mathalpha}{\mst@font@tbu}{`U}
\mst@DeclareMathSymbol{V}{\mathalpha}{\mst@font@tbu}{`V}
\mst@DeclareMathSymbol{W}{\mathalpha}{\mst@font@tbu}{`W}
\mst@DeclareMathSymbol{X}{\mathalpha}{\mst@font@tbu}{`X}
\mst@DeclareMathSymbol{Y}{\mathalpha}{\mst@font@tbu}{`Y}
\mst@DeclareMathSymbol{Z}{\mathalpha}{\mst@font@tbu}{`Z}
%%
\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{** ! and ?}
\DeclareMathSymbol{!}{\mathclose}{\mst@font@tbu}{"21}
\DeclareMathSymbol{\mst@varfam@exclam}{\mathalpha}{\mst@font@tbu}{"21}
\mst@addtodo@nonletters!\mathclose\mst@varfam@exclam
\DeclareMathSymbol{?}{\mathclose}{\mst@font@tbu}{"3F}
\DeclareMathSymbol{\mst@varfam@question}{\mathalpha}{\mst@font@tbu}{"3F}
\mst@addtodo@nonletters?\mathclose\mst@varfam@question
\fi
%    \end{macrocode}
% \begin{macro}{\MTast}
%   |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 have optionally |*| and \cs{ast} also obey
%   the math alphabets.
%
% The user macro \cs{MTlowerast} sets the amount
% of lowering to be applied to the text asterisk.
%    \begin{macrocode}
  \def\mst@@doasterisk{\let\ast\mst@ast
        \expandafter\let\csname mst@ifdone*\endcsname\iffalse
        \mst@mathactivate*\mst@ast{}}
\ifmst@asterisk\typeout{** asterisk: \string\ast\space and *}
  \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{-\MTlowerast}
                        {\the\textfont\symmtoperatorfont\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\textfont\symmtoperatorfont\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\scriptfont\symmtoperatorfont\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\scriptscriptfont\symmtoperatorfont\char42}}}}
  \fi
  \def\mst@varfam@ast{\ifnum\fam=\m@ne\mst@bin@ast\else
    \mathbin{\mathchoice{\raisebox{-\MTlowerast}
                        {\the\textfont\fam\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\textfont\fam\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\scriptfont\fam\char42}}
                      {\raisebox{-\MTlowerast}
                        {\the\scriptscriptfont\fam\char42}}}\fi}
  \let\mst@doasterisk\mst@@doasterisk
  \DeclareRobustCommand*{\mst@ast}{\mst@bin@ast}
  \def\MTlowerast{.3\height}
  \mst@do@easynonletters\expandafter{\the\mst@do@easynonletters
     \expandafter\def\csname mst@ast \endcsname{\mst@varfam@ast}}
\fi
%    \end{macrocode}
% \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: , . : ; and \string\colon}
\DeclareMathSymbol{,}{\mathpunct}{\mst@font@tbu}{"2C}
\DeclareMathSymbol{\mst@varfam@comma}{\mathalpha}{\mst@font@tbu}{"2C}
\mst@addtodo@nonletters,\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}
\mst@addtodo@nonletters:\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
  % could not be used in \cs{DeclareMathSymbol} anymore.
    \DeclareMathSymbol{\colon}{\mathpunct}{\mst@font@tbu}{"3A}
    \mst@do@nonletters\expandafter{\the\mst@do@nonletters
        \def\colon{\mathpunct{\mst@varfam@colon}}}} 
\DeclareMathSymbol{;}{\mathpunct}{\mst@font@tbu}{"3B}
\DeclareMathSymbol{\mst@varfam@pointvirgule}{\mathalpha}{\mst@font@tbu}{"3B}
\mst@addtodo@nonletters;\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.
%    \begin{macrocode}
\ifmst@nominus\else
\ifmst@XeTeX
\XeTeXmathcharnumdef\mst@minus@sign=\XeTeXmathcodenum`\-\relax
\else
\ifmst@LuaTeX
%% \luatexUmathcharnumdef\mst@minus@sign=\luatexUmathcodenum`\-\relax ne
%% marche pas pour le moment car \luatexUmathcodenum retourne parfois un
%% legacy mathcode, parfois un Unicode mathcode, \`a mon avis c'est un bug
%% de LuaLatex. En fait Taco H me dit que la prochaine version
%% r\'eglera ce probl\`eme. \luatexUmathchardef\mst@minus@sign="2 "2 "0\relax
\mathchardef\mst@minus@sign=8704\relax % "2200
\else
\mathchardef\mst@minus@sign=\mathcode`\-\relax
\fi\fi
\@ifpackageloaded{amsmath}
{\def\relbar{\mathrel{\mathpalette\mathsm@sh\mst@minus@sign}}}
{\DeclareRobustCommand\relbar{\mathrel{\smash\mst@minus@sign}}}
\def\rightarrowfill{$\m@th\mathord{\relbar}\mkern-7mu%
  \cleaders\hbox{$\mkern-2mu\relbar\mkern-2mu$}\hfill
  \mkern-7mu\mathord\rightarrow$}
\def\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}
%   2011/01/29, |1.1|: Producing this next piece of code was not a piece
%   of cake for a novice like myself!\\
%   2011/02/05, |1.11|: Compatibility with Unicode (via use of fontspec
%   encodings EU1 and EU2)\\
%   2011/02/07, |1.12|: Improved dealing of Unicode possibility.\\
%   2011/04/02, |1.14b|: Corrected some very irresponsible bug in the
%   Unicode part which caused a problem when 10 or more math families have
%   been allocated.\\
%   2012/09/24, |1.15|: Added AtBeginDocument to circumvent some amsmath
%   problem with unicode engines.
%    \begin{macrocode}
\def\do@the@endashstuff{\edef\mst@tmp@enc{\encodingdefault}
  \ifx\mst@tmp@enc\mst@eui % xetex+fontspec
\AtBeginDocument{\XeTeXmathcode`\-="2 \symmtoperatorfont "2013\relax}
\AtBeginDocument{\XeTeXmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2013\relax}
\else
  \ifx\mst@tmp@enc\mst@euii % luatex+fontspec
\AtBeginDocument{\luatexUmathcode`\-="2 \symmtoperatorfont "2013\relax}
\AtBeginDocument{\luatexUmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2013\relax}
\else
  \ifx\mst@tmp@enc\mst@ti % T1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{21}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{21}
\else
  \ifx\mst@tmp@enc\mst@oti % OT1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{123}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{123}
\else
  \ifx\mst@tmp@enc\mst@lyi % LY1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{150}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{150}
\else % make sure we have neither xetex nor luatex
   \ifmst@XeTeX\mst@aborttrue\else\ifmst@LuaTeX\mst@aborttrue\else
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}
{\expandafter\the\expandafter\csname\mst@tmp@enc\string\textendash\endcsname}
   \fi\fi
\fi\fi\fi\fi\fi}
\def\do@the@emdashstuff{\edef\mst@tmp@enc{\encodingdefault}
\ifx\mst@tmp@enc\mst@eui % xetex+fontspec
\AtBeginDocument{\XeTeXmathcode`\-="2 \symmtoperatorfont "2014\relax}
\AtBeginDocument{\XeTeXmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2014\relax}
\else
\ifx\mst@tmp@enc\mst@euii % luatex+fontspec
\AtBeginDocument{\luatexUmathcode`\-="2 \symmtoperatorfont "2014\relax}
\AtBeginDocument{\luatexUmathchardef\mst@varfam@minus="7 \symmtoperatorfont "2014\relax}
\else
  \ifx\mst@tmp@enc\mst@ti % T1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{22}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{22}
\else
\ifx\mst@tmp@enc\mst@oti % OT1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{124}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{124}
\else
\ifx\mst@tmp@enc\mst@lyi % LY1
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}{151}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}{151}
\else % make sure we have neither xetex nor luatex
   \ifmst@XeTeX\mst@aborttrue\else\ifmst@LuaTeX\mst@aborttrue\else
   \DeclareMathSymbol{-}{\mathbin}{mtoperatorfont}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{mtoperatorfont}
{\expandafter\the\expandafter\csname\mst@tmp@enc\string\textemdash\endcsname}
   \fi\fi
\fi\fi\fi\fi\fi}
\ifmst@nominus\else\typeout{** minus as endash}
\mst@abortfalse
\ifmst@endash\do@the@endashstuff\else
\ifmst@emdash\do@the@emdashstuff\else
   \DeclareMathSymbol{-}{\mathbin}{\mst@font@tbu}{"2D}
   \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{\mst@font@tbu}{"2D}
\fi\fi
\ifmst@abort
    \DeclareMathSymbol{-}{\mathbin}{\mst@font@tbu}{"2D}
    \DeclareMathSymbol{\mst@varfam@minus}{\mathalpha}{\mst@font@tbu}{"2D}
\fi
\mst@addtodo@nonletters-\mathbin\mst@varfam@minus
\fi
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\hbar}
% \begin{macro}{\mst@ltbar}
%   2011/01/31, |1.1| I decide to settle the question of the |\hbar|. First, the
%   \LaTeX{} definition
%    \begin{macrocode}
%%\def\hbar{{\mathchar'26\mkern-9muh}} % (original definition from latex.ltx)
%    \end{macrocode}
% Well, the fact is that there is a \cs{DeclareMathSymbol} in |amsfonts.sty|, so
% I can not always rely on the original which had the advantage that at least
% |h| would be in the correct font. But of course not the macron character
% (|\=|, |\bar|). And there is also the issue of the kern whose length is given
% in a way which depends on |cmsy| (18mu=1em and em taken from info in |cmsy|).
% The first problem is that I don't know how to get the slot position of the
% macron, given the encoding. So I found another way. 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... )
%
%    \begin{macrocode}
%
\def\mst@mathrlap{\mathpalette\mst@mathrlapinternal}
\def\mst@mathrlapinternal#1#2{\rlap{$\mathsurround=0pt#1{#2}$}}
\def\do@the@hbarstuff{\edef\mst@tmp@enc{\encodingdefault}
\ifx\mst@tmp@enc\mst@eui % xetex and unicode font
  \XeTeXmathchardef\hbar="7 \symmtletterfont "0127 \relax 
\else
\ifx\mst@tmp@enc\mst@euii % luatex and unicode font
   \luatexUmathchardef\hbar="7 \symmtletterfont "0127 \relax %% or 210F?
\else % I must leave open the T1, OT1 possibility also for XeTeX or LuaTeX 
    \ifx\mst@ti\mst@tmp@enc
    \DeclareMathAccent{\mst@ltbar}{\mathalpha}{mtletterfont}{9}
       \else  %% assume OT1. Bad idea? Should not provoke an error anyhow
    \DeclareMathAccent{\mst@ltbar}{\mathalpha}{mtletterfont}{22}
    \fi
    \def\hbar{\mst@mathrlap{\mst@ltbar{\ }}h}
\fi\fi}
\ifmst@nohbar\else\typeout{** \string\hbar}\do@the@hbarstuff\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% As |h| is from |mtletterfont|, the accent \cs{mst@ltbar} is the
% \cs{bar} accent from that same font. Of course, if the user
% defines math versions with other encodings than the default one
% when loading the package this will probably not work there (if I
% knew how to do for accents what I did for the endash I could do
% it for all encodings. Surely easy for a \TeX{}pert.)  Not to
% mention if he/she changes the letter shape... one never should
% give so much freedom to users ;-) Well this construction gives
% an acceptable result for some of the fonts I have tested,
% whether upright or in italics.
%
% |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{** + and =}
\DeclareMathSymbol{+}{\mathbin}{\mst@font@tbu}{"2B}
\DeclareMathSymbol{\mst@varfam@plus}{\mathalpha}{\mst@font@tbu}{"2B}
\mst@addtodo@nonletters+\mathbin\mst@varfam@plus
\fi
\ifmst@noequal\else
\ifmst@XeTeX
\XeTeXmathcharnumdef\mst@equal@sign=\XeTeXmathcodenum`\=\relax
\else
\ifmst@LuaTeX
%% 12 octobre 2012 \luatexUmathcodenum`\=
%% ne marche pas pour le moment \`a cause du fait que \luatexUmathcodenum
%% donne un mathcode sur 8bit ou un Unicode mathcode sans qu'on puisse
%% savoir lequel
%% \luatexUmathchardef\mst@equal@sign="3 "0 "3D\relax
\mathchardef\mst@equal@sign=12349\relax
\else
\mathchardef\mst@equal@sign=\mathcode`\=\relax
\fi\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: In fact this = ends up in \cs{csname}...\cs{endcsname}. I have
% discovered that if it is not active but only has its mathcode set to |"8000|
% it is not expanded. Try:
% \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 = ; and + to \string\nfss@catcodes}
\g@addto@macro\nfss@catcodes{%
  \@makeother\=%
  \@makeother\;%
  \@makeother\+%
}
\mst@addtodo@nonletters=\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}.
%    \begin{macrocode}
\ifmst@noparen\else\typeout{** parentheses ( ) [ ] and slash /}
\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}
\mst@addtodo@nonletters(\mathopen\mst@varfam@lparen
\mst@addtodo@nonletters)\mathclose\mst@varfam@rparen
\mst@addtodo@nonletters[\mathopen\mst@varfam@lbrack
\mst@addtodo@nonletters]\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\backslash\space\string\setminus\space|
  \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}
    \expandafter\DeclareMathDelimiter\@backslashchar
        {\mathord}{mtoperatorfont}{"5C}{largesymbols}{"0F}
    \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}
\mst@addtodo@nonletters<\mathrel\mst@varfam@less
\mst@addtodo@nonletters>\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}
\mst@do@nonletters\expandafter{\the\mst@do@nonletters
            \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@XeTeX
\XeTeXmathcharnumdef\mst@vert@bar=\XeTeXmathcodenum`\|\relax
\else
\ifmst@LuaTeX
%% \luatexUmathchardef\mst@vert@bar="0 "2 "006A\relax
\mathchardef\mst@vert@bar=618\relax
\else\mathchardef\mst@vert@bar=\mathcode`\|\relax
\fi\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.
%    \begin{macrocode}
\ifmst@nosmalldelims
    \DeclareMathSymbol{|}{\mathord}{\mst@font@tbu}{124}
\else
    \DeclareMathDelimiter{|}{\mathord}{\mst@font@tbu}{124}{largesymbols}{"0C}
\fi    
\def\vert{|}
\DeclareMathSymbol{\mst@varfam@vbar}{\mathalpha}{\mst@font@tbu}{124}
\mst@addtodo@easynonletters|\mst@varfam@vbar
\DeclareMathSymbol{\mid}{\mathrel}{\mst@font@tbu}{124}
\mst@do@nonletters\expandafter{\the\mst@do@nonletters
    \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.
%    \begin{macrocode}
\ifmst@nosmalldelims
   \DeclareMathSymbol{\lbrace}{\mathopen}{\mst@font@tbu}{123} 
   \DeclareMathSymbol{\rbrace}{\mathclose}{\mst@font@tbu}{125} 
\else
   \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{\let\{\mst@lbrace\let\}\mst@rbrace}}
\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.
%    \begin{macrocode}
\ifmst@nospecials\else\typeout{** \string\#\space\string\mathdollar\space\string\%\space\string\&\space}
\count255=\symmtoperatorfont
\multiply\count255 by 256
\advance\count255 by 35
    \mathcode`\#\count255
\advance\count255 by 1
    \mathchardef\mathdollar\count255
\advance\count255 by 1
    \mathcode`\%\count255
\advance\count255 by 1
    \mathcode`\&\count255
\count255=\symmtoperatorfont
\multiply\count255 by 256
\advance\count255 by 28707 % = "7023
    \mathchardef\mst@varfam@mathhash\count255
\advance\count255 by 1
    \mathchardef\mst@varfam@mathdollar\count255
\advance\count255 by 1
    \mathchardef\mst@varfam@mathpercent\count255
\advance\count255 by 1
    \mathchardef\mst@varfam@mathampersand\count255
\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
%    \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. 
%    
% Note oct 2012: maybe I should re-examine what I did?
%    \begin{macrocode}
\ifmst@symbolmisc\typeout{** symbolmisc: miscellaneous math symbols from Symbol font}
\let\mst@prod\prod
\let\defaultprod\prod
\DeclareMathSymbol{\prodpsy}{\mathop}{mtpsymbol}{213}
\renewcommand*{\prod}{\ifinner\prodpsy\else\mst@prod\fi}
\let\mst@sum\sum
\let\defaultsum\sum
\DeclareMathSymbol{\sumpsy}{\mathop}{mtpsymbol}{229}
\renewcommand*{\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| I introduced another very stupid bug (regarding
% uppercase Greek) in |1.1|. This is corrected here. All this
% business of checking for \cs{digamma} was truly stupid as
% some package might well have defined the font for Greek
% without having defined \cs{digamma}, I don't know what
% crossed my dumb mind when I committed this insane code and
% started redefining uppercase Greek, and it is even worse
% than that as I was redefining not only relatively benign
% things such as \cs{Alpha} but also \cs{Phi} etc\dots
%
% |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.  
%
%       * version |1.12b| did not define the \cs{omicron} in the case when no
%       Greek-related option was passed to the package. This was a bug.  
%    \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
       \ifx\omicron\undefined
       \newcommand*{\omicron}{\mst@alph@omicron{o}}
       \fi  
\fi\fi\fi\fi
\ifmst@goahead
\DeclareMathSymbol{\Alpha}{\mst@mathord}{\mst@font@tbu}{"41}
\DeclareMathSymbol{\Beta}{\mst@mathord}{\mst@font@tbu}{"42}
\DeclareMathSymbol{\Epsilon}{\mst@mathord}{\mst@font@tbu}{"45}
\DeclareMathSymbol{\Zeta}{\mst@mathord}{\mst@font@tbu}{"5A}
\DeclareMathSymbol{\Eta}{\mst@mathord}{\mst@font@tbu}{"48}
\DeclareMathSymbol{\Iota}{\mst@mathord}{\mst@font@tbu}{"49}
\DeclareMathSymbol{\Kappa}{\mst@mathord}{\mst@font@tbu}{"4B}
\DeclareMathSymbol{\Mu}{\mst@mathord}{\mst@font@tbu}{"4D}
\DeclareMathSymbol{\Nu}{\mst@mathord}{\mst@font@tbu}{"4E}
\DeclareMathSymbol{\Omicron}{\mst@mathord}{\mst@font@tbu}{"4F}
\DeclareMathSymbol{\Rho}{\mst@mathord}{\mst@font@tbu}{"50}
\DeclareMathSymbol{\Tau}{\mst@mathord}{\mst@font@tbu}{"54}
\DeclareMathSymbol{\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{\Rho}{\mathord}{mtpsymbol}{"52}
%% attention le X de Symbol est un \Xi pas un \Chi
\DeclareMathSymbol{\Chi}{\mathord}{mtpsymbol}{"43}
%% attention le F de Symbol est un \Phi. Il n'y a pas de \Digamma
\DeclareMathSymbol{\Gamma}{\mathord}{mtpsymbol}{"47}
\DeclareMathSymbol{\Delta}{\mathord}{mtpsymbol}{"44}
\DeclareMathSymbol{\Theta}{\mathord}{mtpsymbol}{"51}
\DeclareMathSymbol{\Lambda}{\mathord}{mtpsymbol}{"4C}
\DeclareMathSymbol{\Xi}{\mathord}{mtpsymbol}{"58}
\DeclareMathSymbol{\Pi}{\mathord}{mtpsymbol}{"50}
\DeclareMathSymbol{\Sigma}{\mathord}{mtpsymbol}{"53}
\DeclareMathSymbol{\Upsilon}{\mathord}{mtpsymbol}{"A1}
\DeclareMathSymbol{\Phi}{\mathord}{mtpsymbol}{"46}
\DeclareMathSymbol{\Psi}{\mathord}{mtpsymbol}{"59}
\DeclareMathSymbol{\Omega}{\mathord}{mtpsymbol}{"57}
\else
%    \end{macrocode}
%  not symbolgreek but eulergreek or selfGreek or both
%    \begin{macrocode}
\DeclareMathSymbol{\Digamma}{\mathalpha}{\mst@font@tbu}{"46}
\DeclareMathSymbol\Gamma    {\mathalpha}{\mst@font@tbu}{"00}
\DeclareMathSymbol\Delta    {\mathalpha}{\mst@font@tbu}{"01}
\DeclareMathSymbol\Theta    {\mathalpha}{\mst@font@tbu}{"02}
\DeclareMathSymbol\Lambda   {\mathalpha}{\mst@font@tbu}{"03}
\DeclareMathSymbol\Xi       {\mathalpha}{\mst@font@tbu}{"04}
\DeclareMathSymbol\Pi       {\mathalpha}{\mst@font@tbu}{"05}
\DeclareMathSymbol\Sigma    {\mathalpha}{\mst@font@tbu}{"06}
\DeclareMathSymbol\Upsilon  {\mathalpha}{\mst@font@tbu}{"07}
\DeclareMathSymbol\Phi      {\mathalpha}{\mst@font@tbu}{"08}
\DeclareMathSymbol\Psi      {\mathalpha}{\mst@font@tbu}{"09}
\DeclareMathSymbol\Omega    {\mathalpha}{\mst@font@tbu}{"0A}
\fi
\fi
%    \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{\alpha}  {\mathalpha}{mteulervm}{"0B}
\DeclareMathSymbol{\beta}   {\mathalpha}{mteulervm}{"0C}
\DeclareMathSymbol{\gamma}  {\mathalpha}{mteulervm}{"0D}
\DeclareMathSymbol{\delta}  {\mathalpha}{mteulervm}{"0E}
\DeclareMathSymbol{\epsilon}{\mathalpha}{mteulervm}{"0F}
\DeclareMathSymbol{\zeta}   {\mathalpha}{mteulervm}{"10}
\DeclareMathSymbol{\eta}    {\mathalpha}{mteulervm}{"11}
\DeclareMathSymbol{\theta}  {\mathalpha}{mteulervm}{"12}
\DeclareMathSymbol{\iota}   {\mathalpha}{mteulervm}{"13}
\DeclareMathSymbol{\kappa}  {\mathalpha}{mteulervm}{"14}
\DeclareMathSymbol{\lambda} {\mathalpha}{mteulervm}{"15}
\DeclareMathSymbol{\mu}     {\mathalpha}{mteulervm}{"16}
\DeclareMathSymbol{\nu}     {\mathalpha}{mteulervm}{"17}
\DeclareMathSymbol{\xi}     {\mathalpha}{mteulervm}{"18}
\let\omicron\undefined
\DeclareMathSymbol{\omicron}{\mathalpha}{mteulervm}{"6F}
\DeclareMathSymbol{\pi}     {\mathalpha}{mteulervm}{"19}
\DeclareMathSymbol{\rho}    {\mathalpha}{mteulervm}{"1A}
\DeclareMathSymbol{\sigma}  {\mathalpha}{mteulervm}{"1B}
\DeclareMathSymbol{\tau}    {\mathalpha}{mteulervm}{"1C}
\DeclareMathSymbol{\upsilon}{\mathalpha}{mteulervm}{"1D}
\DeclareMathSymbol{\phi}    {\mathalpha}{mteulervm}{"1E}
\DeclareMathSymbol{\chi}    {\mathalpha}{mteulervm}{"1F}
\DeclareMathSymbol{\psi}    {\mathalpha}{mteulervm}{"20}
\DeclareMathSymbol{\omega}  {\mathalpha}{mteulervm}{"21}
\DeclareMathSymbol{\varepsilon}{\mathalpha}{mteulervm}{"22}
\DeclareMathSymbol{\vartheta}{\mathalpha}{mteulervm}{"23}
\DeclareMathSymbol{\varpi}  {\mathalpha}{mteulervm}{"24}
\let\varrho=\rho
\let\varsigma=\sigma
\DeclareMathSymbol{\varphi} {\mathalpha}{mteulervm}{"27}
\DeclareMathSymbol{\partial}{\mathalpha}{mteulervm}{"40}
\DeclareMathSymbol{\wp}{\mathalpha}{mteulervm}{"7D}
\DeclareMathSymbol{\ell}{\mathalpha}{mteulervm}{"60}
\else
\ifmst@symbolgreek
\DeclareMathSymbol{\alpha}{\mathord}{mtpsymbol}{"61}
\DeclareMathSymbol{\beta}{\mathord}{mtpsymbol}{"62}
\DeclareMathSymbol{\gamma}{\mathord}{mtpsymbol}{"67}
\DeclareMathSymbol{\delta}{\mathord}{mtpsymbol}{"64}
\DeclareMathSymbol{\epsilon}{\mathord}{mtpsymbol}{"65}
\DeclareMathSymbol{\zeta}{\mathord}{mtpsymbol}{"7A}
\DeclareMathSymbol{\eta}{\mathord}{mtpsymbol}{"68}
\DeclareMathSymbol{\theta}{\mathord}{mtpsymbol}{"71}
\DeclareMathSymbol{\iota}{\mathord}{mtpsymbol}{"69}
\DeclareMathSymbol{\kappa}{\mathord}{mtpsymbol}{"6B}
\DeclareMathSymbol{\lambda}{\mathord}{mtpsymbol}{"6C}
\DeclareMathSymbol{\mu}{\mathord}{mtpsymbol}{"6D}
\DeclareMathSymbol{\nu}{\mathord}{mtpsymbol}{"6E}
\DeclareMathSymbol{\xi}{\mathord}{mtpsymbol}{"78}
\let\omicron\undefined
\DeclareMathSymbol{\omicron}{\mathord}{mtpsymbol}{"6F}
\DeclareMathSymbol{\pi}{\mathord}{mtpsymbol}{"70}
\DeclareMathSymbol{\rho}{\mathord}{mtpsymbol}{"72}
\DeclareMathSymbol{\sigma}{\mathord}{mtpsymbol}{"73}
\DeclareMathSymbol{\tau}{\mathord}{mtpsymbol}{"74}
\DeclareMathSymbol{\upsilon}{\mathord}{mtpsymbol}{"75}
\DeclareMathSymbol{\phi}{\mathord}{mtpsymbol}{"66}
\DeclareMathSymbol{\chi}{\mathord}{mtpsymbol}{"63}
\DeclareMathSymbol{\psi}{\mathord}{mtpsymbol}{"79}
\DeclareMathSymbol{\omega}{\mathord}{mtpsymbol}{"77}
\let\varepsilon=\epsilon 
\DeclareMathSymbol{\vartheta}{\mathord}{mtpsymbol}{"4A}
\DeclareMathSymbol{\varpi}{\mathord}{mtpsymbol}{"76}
\let\varrho=\rho 
\DeclareMathSymbol{\varsigma}{\mathord}{mtpsymbol}{"56}
\DeclareMathSymbol{\varphi}{\mathord}{mtpsymbol}{"6A}
\DeclareMathSymbol{\partial}{\mathord}{mtpsymbol}{"B6}
\DeclareMathSymbol{\wp}{\mathord}{mtpsymbol}{"C3}
\fi\fi\fi
%%
\ifmst@LGRgreek % internal names for subdued implementation (1.15c-1.15e)
\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@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@origvarsigma\varsigma
\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@origDigamma\Digamma
\let\mst@origdigamma\digamma
%%
\def\mst@restoregreek{%
\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\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\varsigma\mst@origvarsigma
\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\Digamma\mst@origDigamma
\let\digamma\mst@origdigamma
}
%%
\def\mst@setuplgrgreek{%
\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
%
\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\varsigma\mst@varsigma
\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
\let\Digamma\mst@Digamma
\let\digamma\mst@digamma
}
%%
\DeclareMathSymbol{\mst@Alpha}{\mathalpha}{mtlgrfontupper}{65}
\DeclareMathSymbol{\mst@Beta}{\mathalpha}{mtlgrfontupper}{66}
\DeclareMathSymbol{\mst@Gamma}{\mathalpha}{mtlgrfontupper}{71}
\DeclareMathSymbol{\mst@Delta}{\mathalpha}{mtlgrfontupper}{68}
\DeclareMathSymbol{\mst@Epsilon}{\mathalpha}{mtlgrfontupper}{69}
\DeclareMathSymbol{\mst@Zeta}{\mathalpha}{mtlgrfontupper}{90}
\DeclareMathSymbol{\mst@Eta}{\mathalpha}{mtlgrfontupper}{72}
\DeclareMathSymbol{\mst@Theta}{\mathalpha}{mtlgrfontupper}{74}
\DeclareMathSymbol{\mst@Iota}{\mathalpha}{mtlgrfontupper}{73}
\DeclareMathSymbol{\mst@Kappa}{\mathalpha}{mtlgrfontupper}{75}
\DeclareMathSymbol{\mst@Lambda}{\mathalpha}{mtlgrfontupper}{76}
\DeclareMathSymbol{\mst@Mu}{\mathalpha}{mtlgrfontupper}{77}
\DeclareMathSymbol{\mst@Nu}{\mathalpha}{mtlgrfontupper}{78}
\DeclareMathSymbol{\mst@Xi}{\mathalpha}{mtlgrfontupper}{88}
\DeclareMathSymbol{\mst@Omicron}{\mathalpha}{mtlgrfontupper}{79}
\DeclareMathSymbol{\mst@Pi}{\mathalpha}{mtlgrfontupper}{80}
\DeclareMathSymbol{\mst@Rho}{\mathalpha}{mtlgrfontupper}{82}
\DeclareMathSymbol{\mst@Sigma}{\mathalpha}{mtlgrfontupper}{83}
\DeclareMathSymbol{\mst@Tau}{\mathalpha}{mtlgrfontupper}{84}
\DeclareMathSymbol{\mst@Upsilon}{\mathalpha}{mtlgrfontupper}{85}
\DeclareMathSymbol{\mst@Phi}{\mathalpha}{mtlgrfontupper}{70}
\DeclareMathSymbol{\mst@Chi}{\mathalpha}{mtlgrfontupper}{81}
\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@varsigma}{\mathalpha}{mtlgrfontlower}{99}  
\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}   
\DeclareMathSymbol{\mst@Digamma}{\mathalpha}{mtlgrfontlower}{195}    
% cf http://milde.users.sourceforge.net/LGR/lgrxenc.def.html
% et greek.ldf du package babel
\ifmst@subdued\else\mst@setuplgrgreek\fi
\fi
%    \end{macrocode}
% \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.
%    \begin{macrocode}
\edef\mst@tmp@enc{\encodingdefault}
\mst@goaheadtrue
\ifx\mst@tmp@enc\mst@eui % xetex and unicode font
  \XeTeXmathchardef\inodot="7 \symmtletterfont "0131 \relax
  \XeTeXmathchardef\jnodot="7 \symmtletterfont "0237 \relax
\else
\ifx\mst@tmp@enc\mst@euii % luatex and unicode font
   \luatexUmathchardef\inodot="7 \symmtletterfont "0131 \relax
   \luatexUmathchardef\jnodot="7 \symmtletterfont "0237 \relax
\else 
\ifx\mst@tmp@enc\mst@ti % T1
   \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{25}
   \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{26}
\else
\ifx\mst@tmp@enc\mst@oti % OT1
   \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{16}
   \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{17}
\else
\ifx\mst@tmp@enc\mst@lyi % LY1
   \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}{16}
   \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}{17}
\else
   \ifmst@XeTeX\mst@goaheadfalse\else\ifmst@LuaTeX\mst@goaheadfalse\else
   \DeclareMathSymbol{\inodot}{\mathalpha}{mtletterfont}
{\expandafter\the\expandafter\csname\mst@tmp@enc\string\i\endcsname}
   \DeclareMathSymbol{\jnodot}{\mathalpha}{mtletterfont}
{\expandafter\the\expandafter\csname\mst@tmp@enc\string\j\endcsname}
   \fi\fi
\fi\fi\fi\fi\fi
\ifmst@defaultimath\else\typeout{** \string\i\space and \string\j\space}
  \ifmst@goahead
    \renewcommand*{\imath}{\inodot}
    \renewcommand*{\jmath}{\jnodot}
    \let\mst@oldi\i \let\mst@oldj\j
    \DeclareRobustCommand*{\i}{\ifmmode\inodot\else\mst@oldi\fi}
    \DeclareRobustCommand*{\j}{\ifmmode\jnodot\else\mst@oldj\fi}
  \fi
\fi
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{math accents}
%   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 mathaccents 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
%    \begin{macrocode}
\edef\mst@tmp@enc{\encodingdefault} %% rather one too many than sorry 
\ifmst@mathaccents\typeout{** math accents}
\ifx\mst@ti\mst@tmp@enc
\DeclareMathAccent{\acute}{\mathalpha}{mtoperatorfont}{1}
\DeclareMathAccent{\grave}{\mathalpha}{mtoperatorfont}{0}
\DeclareMathAccent{\ddot}{\mathalpha}{mtoperatorfont}{4}
\DeclareMathAccent{\tilde}{\mathalpha}{mtoperatorfont}{3}
\DeclareMathAccent{\bar}{\mathalpha}{mtoperatorfont}{9}
\DeclareMathAccent{\breve}{\mathalpha}{mtoperatorfont}{8}
\DeclareMathAccent{\check}{\mathalpha}{mtoperatorfont}{7}
\DeclareMathAccent{\hat}{\mathalpha}{mtoperatorfont}{2}
\DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{10}
\DeclareMathAccent{\mathring}{\mathalpha}{mtoperatorfont}{6}
\else 
\DeclareMathAccent{\acute}{\mathalpha}{mtoperatorfont}{19}
\DeclareMathAccent{\grave}{\mathalpha}{mtoperatorfont}{18}
\DeclareMathAccent{\ddot}{\mathalpha}{mtoperatorfont}{127}
\DeclareMathAccent{\tilde}{\mathalpha}{mtoperatorfont}{126}
\DeclareMathAccent{\bar}{\mathalpha}{mtoperatorfont}{22}
\DeclareMathAccent{\breve}{\mathalpha}{mtoperatorfont}{21}
\DeclareMathAccent{\check}{\mathalpha}{mtoperatorfont}{20}
\DeclareMathAccent{\hat}{\mathalpha}{mtoperatorfont}{94}
\DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{95}
\DeclareMathAccent{\mathring}{\mathalpha}{mtoperatorfont}{23}
  \ifx\mst@lyi\mst@tmp@enc   % LY1 encoding
    \DeclareMathAccent{\dot}{\mathalpha}{mtoperatorfont}{5}
  \else
     \ifx\mst@oti\mst@tmp@enc\else
      \typeout{** mathastext: math accents have been assumed to be^^J%
        ** as in OT1 encoding.}
      \fi
   \fi
\fi\fi
%    \end{macrocode}
% \end{macro}
% \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'.}
\fi
%    \end{macrocode}
% \end{macro}
%    \begin{macrocode}
\endinput
%    \end{macrocode}
% \MakePercentComment
\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{4948}

\Finale
%%
%% End of file `mathastext.dtx'.