File: testmath.tex

package info (click to toggle)
tralics 2.14.4-2
  • links: PTS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, sid, stretch, wheezy
  • size: 17,152 kB
  • ctags: 8,260
  • sloc: cpp: 49,403; xml: 18,145; sh: 140; makefile: 118
file content (5755 lines) | stat: -rwxr-xr-x 238,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
\documentclass[reqno]{report} % utf8-encoded

%% tralics compilation needs testmath.ult
%% tralics testmath -noentnames -nostraightquotes -nozerowidthspace -mathvariant

\newif\ifTeXone \TeXonetrue
\newif\ifTeXtwo \TeXtwotrue
\newif\ifTeXthree \TeXthreetrue
\newif\ifTeXfour \TeXfourtrue
\newif\ifLatex \Latextrue
\newif\ifMml \Mmltrue
\newif\ifOther \Othertrue





%% cp testmath.html ../www/quadrat/testmath.xml
%%NO_BAD_MINUS; 
\makeatletter \let\@@not\not \makeatother % make a copy

\usepackage{amsmath,amscd,delarray,amsxtra,braket}
\usepackage{fancyvrb}
\usepackage{RR}



\newcommand\LTC[1]{\xbox{latexcode}{#1}}
\newcommand\XC[1]{\xbox{xmlcode}{#1}}
\newcommand\cmd[1]{\LTC{\textbackslash#1}}
\newcommand\argument[1]{\LTC{\{#1\}}}
\newcommand\elt[1]{\XC{<#1>}}
\newcommand\entity[1]{\XC{\&#1;}}

\newcommand\xmlcolor[1]{\xbox{xmlcolor}{#1}}
%\newcommand\verbatim@hook{}
\renewcommand\verbatimnumberfont[1]{\xbox{vbnumber}{#1}}
\newcommand\Tralics{\textit{Tralics}} 
\newcommand\htmlprefix[1]{\addattributestodocument{htmlprefix}{#1}}

\newcommand*\attpair[2]{\trait{#1}\,=\,`#2'}
\newcommand\trait[1]{\textsf{#1}}
\newcommand\filename[1]{\textsf{#1}}
\newcommand\xmltex{\textsf{xmltex}}
\let\none\mmlnone
\newcommand\ex[1]{\par\textbf{Exercise #1:}}

\newcommand\Apply[2]{\mathbox{apply}{\mathbox{#1}{}#2}}

\RRetitle{Producing MathML with Tralics}
\RRtitle{Produire du MathML avec Tralics}
\RRdate{May 2007}
\RRdater{29 November 2007}
\RRversion{2}
\RRauthor{Jos\'e Grimm}
\RRnote{The software and the documentation is available
at \url{http://www-sop.inria.fr/apics/tralics}}
\email{Jose.Grimm[at]sophia.inria.fr}
\RRabstract{The purpose of this paper is to show that it is possible to
  translate almost every mathematical formula from \LaTeX\ syntax to XML. 
  The document you are reading contains a great number of formulas extracted
  from   the \TeX book, the \LaTeX\ companion, the MathML recommendation, and 
  translated into XML by \Tralics; it is available in Pdf or HTML version.  

The HTML version was produced using a very simple style sheet; mathematics are
left unchanged, and you need a MathML-aware browser, like Firefox, or
adequate plugins, and a set of fonts for the symbols or operators. 
The Pdf version was obtained by use of \filename{xmltex} (a
package by D. Carlisle that makes \TeX\ an XML interpreter), and a great number
of modifications to the file \filename{mathml2.xmt} (that interprets elements in
the MathML namespace). All files needed to produce this document are part of
the \Tralics\ bundle (version 2.10 or more).

This document was compiled with the experimental version 2.10.8, in which examples
in section \ref{additional} should work fine. 
}

\RRresume{Le but de ce papier est de d\'emontrer qu'il est possible de
  traduire presque toutes les formules de math\'ematiques de la syntaxe
  \LaTeX\ vers le langage XML. Le document que vous lisez contient un grand
  nombre de formules extraites du \TeX book, du \LaTeX\ companion, de la
  recommandation MathML, et traduites en XML par le logiciel \Tralics. Il est
  disponible en  HTML et en Pdf.

La version HTML est obtenue en utilisant une feuille de style assez simple,
qui laisse les formules de math\'ematiques inchang\'ees; pour la lire, il
vous faut un navigateur ou un plugin qui sache interpr\'eter le MathML et les
fontes associ\'ees pour les symboles et les op\'erateurs.
 La version Pdf a \'et\'e obtenue gr\^ace au package
\filename{xmltex} de D. Carlisle (qui fait de \TeX\  un interpr\`ete XML),
et un grand nombre de modifications  dans le fichier  \filename{mathml2.xmt},
qui contient le code d'interpr\'etation des math\'ematiques. Tous les fichiers
n\'ecessaires pour obtenir ce document sont distribu\'es avec le package
\Tralics\ \`a partir de la  version 2.10.
}
\keyword{Tralics, XML, MathML, mathematics, LaTeX, HTML, Pdf}
\motcle{Tralics, XML, MathML, math\'ematiques, LaTeX, HTML, Pdf}
\RRNo{6181}
\URSophia
\RRtheme{\THNum}
\RRprojet{Apics}


\begin{document}
\makeRR

\def\mtext#1{\mathbox{mtext}{\mathcnothing{#1}}}
\def\BMS{\mathbox{mphantom}{~~\mathbox{mpadded}[width][0pt][height][20pt]{(}}}
\def\UnimplementedOperator#1{\mathbox{mstyle}[color][red]{\string#1}}
\def\not{\UnimplementedOperator\not}


\DefineVerbatimEnvironment{verbatim}{Verbatim}
{listparameters={\topsep0pt }, pre=pre,style=latex}
\chardef\HAT`\^
\chapter{Introduction}

The technical reports \cite{Tralics1} and \cite{Tralics2} describe
some features of the \Tralics\ software, a \LaTeX\ to XML translator,
and associated tools. In particular, we explain how the XML file 
can be converted
to HTML, or to Pdf (using the excellent work of D. Carlisle 
and S. Rahtz (\cite{Passive-tex}, \cite{CGR2000}, \cite{xmltex}).
One application is RalyX (Inria's Annual Activity Report), where all math
formulas are converted to images before inclusion in the HTML document.

Recently, the cedram (Centre de diffusion de revues acad\'emiques de
math\'ematiques, \href{http://www.cedram.org/}{http://www.cedram.org/}) 
has decided to convert the metadata of some collections (including the
Annales de l'institut Fourier) from \LaTeX\ to HTML, \cite{Bouche}. The
\Tralics\ software has been adapted for this purpose, the idea being the
following: there are nowadays some browsers with a high quality math
renderer, where native MathML formulas are more readable than images;
thus the web site presents each document in two versions, neither of which 
containing an image. By default you see something like 
$L^1(\mathbb{T})$, and the alternate version contains
\LTC{\$L\char`\^1(\textbackslash mathbb\{T\})\$}. This looks like the source
code, but non-trivial operations are performed, as explained below.

There is a torture file that comes with \Tralics; the purpose is to make sure
that no error occurs while compiling expressions like \cmd{cfrac12}, but it is
hard to check that the result is correctly translated. For this reason, we
decided to create a sample file containing, not only all examples of the
\LaTeX\ companion second edition \cite{companion2}, but also those of the
\TeX book \cite{texbook}, or the MathML recommendation \cite{mathml2},
 and to convert it to HTML. 
Translation is correct if the HTML page prints correctly. This file is
available on the Web, we hope that it will convince you to use the \Tralics\
software, and put your math documents on the Web. We have inserted comments
explaining why some constructions do not work, if you have a solution or
suggestions, please send mail to the author. Additional examples are welcome.



We also wanted to make sure that the RalyX still works: more than one hundred
teams use \Tralics\ once a year, asking sometimes silly questions, like: how to
add color to the text, or a page break; the answer is generally either `not yet
implemented, wait for next year', or `incompatible with the Raweb semantics'.
This document uses colors and page breaks, as explained below; no modification
to the translator was needed, but, unless the style sheets are modified, these
additions are ignored.

For these reasons we converted the whole
document to Pdf. This was not trivial, especially because of a lack of font
families (this will be discussed later).  Note also the format of the
document: in the HTML version all metadata (author, title, abstract, etc.) are
placed at the start of the document by the XML to HTML processor. In the case
of the Pdf version, this was not so easy: something as trivial as
\cmd{newpage} \cmd{null} \cmd{vskip-2cm} is impossible to express in XSL/FO
(said otherwise, all my attempts failed), and I had to add a new element
\elt{vspace} for this purpose. 

The source file \filename{testmath.tex} is part of the \Tralics\ distribution;
translating it requires  \Tralics\ version 2.10, and some packages,
like \filename{amsmath} (do not try to include the file \filename{amsmath.sty},
this is not possible; you must use \filename{amsmath.plt} instead).
In most cases we show the \TeX\ source before the translation. There are some
exceptions, for instance we leave as an exercise to find out how we solved  
the exercises of the \TeX book. 
Examples of the \LaTeX\ companion \cite{companion2}  are available on
the CD that comes with the book.


The XML file was converted into HTML, math formulas are left unchanged.
We explain in some cases that what we see is not what we expected. Here 
\textit{FL} means Firefox on Linux (unless specified, it is Firefox 2.0, 
on Fedora Core 3) and \textit{FM} means Firefox on MacIntosh (unless
specified, it is Firefox 2.0 on a PowerBook G4, MacOS 10.4). 
We also tested Amaya, bot \textit{AM} (version 9.55 on Mac) and \textit{AL}
(version 9.99 on Linux FC5).

Installing math fonts for use with a web browser is not always easy:
they are installed as explained on the Mozilla web page, but this page
seems unclear to me: on one Linux machine, Firefox is happy with the fonts,
but uses the wrong font when printing, on another one, Firefox says that fonts
Math1, Math2 and Math4 are missing, but the printed result is correct. 

\clearpage

\section{Special features}
You are not supposed to insert page breaks in your document, but if you put
twenty tables in a row, you will get error messages of the form: to many
unprocessed floats, and then you are in trouble. In this case, the only remedy
is to insert some \cmd{clearpage} commands; in this document, we used the
\cmd{xbox} command in order to produce an empty \elt{clearpage} element in the
XML document, and we adapted the style sheets.

There is a \cmd{clearpage} before this section; you will not notice it because
there is a natural page break there. On the other hand, it is likely that you
will see the page breaks in Chapter three, but there is no easy solution:
there is no text in the current chapter to fill the gaps.
In order to improve the layout, we changed the ordering of
the figures, starting with tables \ref{Tbl-bin1} and  \ref{Tbl-rel1}, that
occupy a full page, and inserting smaller tables after that. Moreover,
table \ref{Tbl-rel1} was too big to fit on a page (the baseline in this
document is much larger than in the \LaTeX\ companion) and we split it into
two parts.  We are happy since this gives 8 full pages with floats, and a
single bad page, the last text page of the chapter.


Concerning colors, you can put any attribute you like to any object
(there is no attempt to validate the document against some DTD).
In the case of math formulas, identifiers, numbers and operators accept
some common attributes including font information and colors, these are
currently ignored when converting XSL/FO into Pdf (but this can easily be
changed, it suffices to add some lines 
of code to the \filename{raweb-cfg.sty} file. However, the color attribute is
honored for the \elt{mstyle} element (all symbols appearing in the \LaTeX\
companion for which no Unicode element has been found are replaced by a 
{\catcode`\#12\xdef\Sharp{#}}
\xbox{inline}{\XMLaddatt{color}{\Sharp F00000}\XMLaddatt{style}{color:\Sharp E00000}red}
$\mathbox{mstyle}[color][\#D00000]{X}$ using this method). 
For the text case, the 
\elt{inline} element is translated into \elt{span} element in the HTML and a
\elt{fo:inline} element in the Pdf, all attributes are copied; in the previous
sentence we have used
\begin{verbatim}[style=latex]
\xbox{inline}{\XMLaddatt{color}{#F00000}\XMLaddatt{style}{color:#E00000}red}
$\mathbox{mstyle}[color][\#D00000]{X}$
\def\UnimplementedOperator#1{\mathbox{mstyle}[color][red]{X}}
\end{verbatim}
This example shows that you can use a named color, or one defined in RGB
syntax, using six hexadecimal digits; use sharp or backslash sharp as
indicated here. 

\section{Compiling the example file}
These are the options you can use when compiling the file
\filename{testmath.tex} 
\begin{verbatim}[style=latex]
-noentnames -trivialmath=7 -leftquote=2018 -rightquote=2019 -nozerowidthspace
\end{verbatim}
The first option says that you prefer \entity{\#x21DA} to \entity{Lleftarrow}
(this is useless if you use an XSLT processor to convert the XML document).
Option `trivialmath=7' says that simple math expressions are translated as
text;  option `mathvariant' says that a command like \cmd{mathbb} should add a
mathvariant attribute;  these two options set initial values to some counters,
they are not needed, because the associated file \filename{testmath.ult}
resets them to the values needed here. Following options are
problematic. If you say `nostraightquotes', this changes the translation of
the apostrophe character to character U+B4, this option produces a nice HTML
file,  but  the Pdf is not so nice.  Here we modify left and right quotes to
U+2018 and U+2019.
If you say `zerowidthspace', \Tralics\ inserts an
invisible character in verbatim mode, that is supposed to inhibit ligatures
when converting the XML file into Pdf file, the trouble is that this character
is shown as a normal space by my browser in certain cases. In \Tralics\
version 2.10, the translation changed: the old behavior can be obtained by
saying \texttt{-nozerowidthelt}. Otherwise an element is created, this element
is transformed into a zerowidthspace character  when the document is converted
to Pdf, is omitted when the document is converted to HTML. This means that the
option is useless.

The following files are needed for the compilation: 
\begin{itemize}
\item a configuration file, that
behaves like the default one; namely one that defines the root element to be
\elt{std} and the dtd file to be \filename{classes.dtd};
\item the source file \filename{testmath.tex}, and the associated
  \filename{testmath.ult} file;
\item the class file \filename{report.clt} (and the auxiliary file
  \filename{std.clt});
\item the standard math packages \filename{amsmath.plt}, \filename{amscd.plt},
  \filename{delarray.plt}, \filename{amsxtra.plt}, \filename{amsgen.plt},
\filename{amsbsy.plt}, \filename{amsopn.plt};
\item the file \filename{fancyvrb.plt} for the special verbatim mode; and
\item the file \filename{RR.plt} for the meta data.
\end{itemize}

When converting the document to HTML, we use the `xsltproc' program. The style
sheet is \filename{testmathhtml.xsl}; this is a short style sheet; but it
needs \filename{cls.xsl} and \filename{RR.xsl}. Conversion to XSL/FO uses
\filename{RRfo.xsl} as style sheet, it needs \filename{clsfo.xsl}, that
includes \filename{raweb3-param.xsl}, \filename{rrrafo3.xsl},
\filename{clspages.xsl}, \filename{RRfosimple.xsl},
\filename{clsfotable.xsl}. Note: this list is likely to change; we have 
to separate clearly the RA (activity report), the RR (research report) and CLS
(standard classes). All these files are in the directory \filename{xml} or
\filename{styles} of the \Tralics\ distribution, but the XSLT processor wants
to see them in the current directory.  

Conversion from XSL/FO to pdf is achieved by compiling the file
\filename{wtestmath.tex} containing the following lines
\begin{verbatim}[numbers=left,style=latex]
\def\xmlfile{testmath.fo}
\def\LastDeclaredEncoding{T1}
\input{xmltex.tex}
\end{document}
\end{verbatim}
It requires \filename{xmltex.tex} and other files from the xmltex
distribution, so that you must install these files first.
There are some bugs or incompatibilities in
the fotex distribution, so that you must use the two files 
\filename{fotex.xmt}, \filename{fotex.sty} as distributed in the xml
directory. Additional required files are  \filename{fotex-add.sty},
\filename{raweb-uni.sty}, and \filename{fotex.cfg}.
Finally the file \filename{wtestmath.cfg} should be a
symbolic link to \filename{raweb-cfg.sty}.


\section{Overview of math mode}

The main change between \Tralics\ version 2.9 and 2.10 concerns handling of
math formulas. Two steps are required for processing them: first a tree is
created, after that, it is converted. This mechanism is similar to the
behavior of \TeX, but some details are not yet implemented, and some
information is lost (for instance, \cmd{mathbin} is a command that says that
the object that follows should be of type `binary'; this information is used
by the program, but the resulting XML tree does not contain this information
(we cannot simply add an attribute pair class=bin to the object). 

When \Tralics\ sees a math formula, it constructs recursively a tree, also
called a math list.
The action after a token has been read is the following:
If the token is expandable (a user defined command for instance), expansion
takes place, this can read some tokens, it can add new tokens to the stream
(to be read again).
If the token is a mode-independent command it will be executed (for instance,
you can change the meaning of some commands). Otherwise, the token is added
to the tree, but there are some exceptions. The easy case is when a whole
subtree is read, for instance when the token is a left brace, a \cmd{begin}
command, etc. In some cases, the execution level is incremented (said
otherwise, the 
behavior is the same as a group defined by braces in non-math mode). In a case
of \cmd{begin}, a token list is read, and the behavior depends on whether
this is a user defined environment (normal expansion rules apply), or a
built-in one. Most built-in environments are matrix-like, and each cell is
evaluated in a group; this has the following consequence: if the math formula
contains an unwanted ampersand character, an error will be signaled when that
character tries to finish the cell-group (because the current group is of type
math), and an error is signaled at the end of the math expression (because the
ampersand character has added a second group after the first, a cell-group,
where the end-of-math character expected a math-group). A third error will be
signaled later: when the tree is converted into a MathML object, \Tralics\ may
complain about non-math tokens in the expression. 
A font change command like \cmd{mathbb}
changes the internal state and adds two tokens to the tree, one that selects
the blackboard font (before the argument) and a token that selects the current
font (after the argument). 

In the case of \LTC{\$L\char`\^1(\textbackslash mathbb\{T\})\$}
the tree has eight nodes. One is a
subtree, containing the argument of the command. They are six
characters, and two commands (select double-struck font, or select normal
font). When the tree is converted into a MathML expression, some nodes are
converted to basic XML elements (the letters), some are ignored (the font
change commands), and others are used to construct an XML tree. 
We shall see later that parentheses, braces, and tokens like that can induce
\elt{mrow} elements; translation of the hat character is non-obvious, because
MathML provides \elt{msub} and \elt{mover} as possible translations; a command
like \cmd{nolimits} placed after a token is an indication for the translation
of the hat that follows. When the tree is converted the current style is looked
at, this quantity depends on the position in the tree (the style of the
numerator of a fraction or the style of an exponent after the hat is smaller
than the current style, while the style of the numerator of a \cmd{cfrac} is
always text style) or the presence of style change commands. Some commands
depend on the style (for instance \cmd{mathchoice}) and are conditionally
interpreted.

The characters in the formula above are of type letter (L, T), or type
non-letter (the digit, or the parentheses), or other (the hat). An interesting
question is: 
what happens if the single L (or any other character) is replaced by a double
one?  A first answer is that this just adds a new token to the tree (there is
a special case: \LTC{\HAT\HAT1} is a non-obvious way to represents the
character q). Spaces are ignored, so that doubling them has no effect. 
Two hat characters in a row signal an error (assume for instance that a space
between them inhibits the double-hat feature mentioned above). Two consecutive
new line characters are replaced by \cmd{par}, this is illegal.
Characters that are neither letters nor digits generally translate to a
\elt{mo} element. No attempt is made to convert two plus characters into a
double plus character (some people use `:=' as an operator, meaning `is equal
by definition', and expect no white space between the two
characters). In a case like \cmd{sqrt}\cmd{frac}\argument{1}\argument{2},
where we have two consecutive commands that take arguments, the argument of
the root operator is the fraction operator, not the full fraction (this
expression is accepted by \LaTeX, as an unexpected consequence of the
implemented of the fraction operator that provides that braces that delimit
the argument of the square root, it is rejected by \Tralics).

The superscript and subscript operators (generally associated to
hat and underscore characters) are hybrid commands: most commands, for
instance \cmd{frac}, are prefix commands (they come before their arguments), a
few commands, like \cmd{over}, are infix operators (the first argument is
before the operator). In the case of hat, there is one argument after the
operator, but the operator acts on the kernel that is to its left 
(in the example the kernel is L, but a kernel can have an index and an
exponent, so that the order of tokens can be: kernel, underscore, index, hat, 
exponent). 
 Translation of character L is a \elt{mi} element; \Tralics\ tries to
converts LL or TT into a single element, according to the following rule.
Assume that \cmd{T} is defined to be \cmd{mathbb}\argument{T} and \cmd{TT}
is defined to be \cmd{mathbb}\argument{TT}. Then \cmd{TT} produces a single
element with two characters, while \cmd{T}\cmd{T} produces two elements with a 
single character. On the other hand, a strange rule of MathML says that the
font used for a \elt{mi} element (that lacks font attributes) depends on the
number of characters in it; for this reason, in a formula like $xy$, the
translation is a sequence of two \elt{mi} elements, without attributes,
containing a single character (implicit product). In a case like  $17$, a
single \elt{mn} element is constructed, because this represents a number (in a
case like $x_{12}$, an implicit comma could be added in the case where the
expression refers to row 1 column 2 of the matrix $x$; however, do not expect
such a behavior in a near future). The source code of the expression above is
\LTC{\$x\_\argument{12}\$}. Without the braces, the translation is $x_12$
(if you do not see the difference, there is a bug somewhere).

If the internal counter \cmd{@nomathml} is negative, the tree is converted to
a character string in a trivial manner; in a case like 
\cmd{cfrac12}, you will see \cmd{cfrac}\argument{1}\argument{2}, because we
have a sub-tree with two nodes (the two arguments of the command). In reality,
the command takes an optional argument, and its value is printed only if it is
not empty. In a case like $L^1(\mathbb{T})$, you will see two font changes
as explained above. If you want to see the characters \cmd{mathbb} there are
two solutions: the easy one works only since version 2.10:
\Tralics\ inserts in the tree all commands that behave like
\cmd{relax}; these commands are ignored when converting the tree into a MathML
expression, but the name is used otherwise; thus \cmd{let} \cmd{mathbb}
\cmd{relax} does the job. Otherwise, it suffices to redefine \cmd{mathbb} in
order to expand to the desired string (using \cmd{string} for instance). 
Note: since version 2.10, a font change command that takes an argument defines
a semi-simple group, by inserting \cmd{begingroup} and \cmd{endgroup} commands.

\chapter{Examples from the TEXbook}


\section{Typing math formulas, TB 16}
\ifTeXone
The \TeX\ book starts slowly; first Knuth explains that math formulas are
enclosed in special math brackets, dollar signs. He also says that
spaces are ignored in math mode.
\begin{verbatim}[numbers=left,style=latex]
`$x$', `$2$', `$ x$', `$ 2 $', 
`$(x + y)/(x - y)$', `$(x+y) / (x-y)$' 
\end{verbatim}
Easy formulas: `$x$', `$2$', `$ x$', `$ 2 $',
`$(x + y)/(x - y)$', `$(x+y) / (x-y)$'.

We show here some Greek letters, and some other symbols:
\begin{verbatim}[numbers=left,style=latex,firstnumber=last]
$\Gamma, \nu,\kappa$,
$\phi,\emptyset, \epsilon,\in,\approx,\mapsto$
$(\phi,\theta,\epsilon,\rho)$, 
$(\varphi,\vartheta,\varepsilon,\varrho)$, 
$$\alpha, \beta, \gamma, \delta.$$
\end{verbatim}


Greek letters $\Gamma, \nu,\kappa$, and other symbols:
$\phi,\emptyset, \epsilon,\in,\approx,\mapsto$; 
standard Greek\footnote{AM does not show the epsilon} letters, $(\phi,\theta,\epsilon,\rho)$, 
and variants $(\varphi,\vartheta,\varepsilon,\varrho)$, 
a display math formula:
$$\alpha, \beta, \gamma, \delta.$$



\begin{verbatim}[numbers=left,style=latex,firstnumber=last]
\begingroup
\catcode`\*=3
*x^2*, \( x_2\), \begin{math}\Sigma\end{math}
**A** \[ B\] \begin{displaymath} C \end{displaymath}
\endgroup
\end{verbatim}

\begingroup
\catcode `\*=3
We show here that any character of category code 3 can be used as math
delimiter: 
*x^2*, as well as two alternative ways introduced by \LaTeX:
\( x_2\), \begin{math}\Sigma\end{math}. We show that display math can be
entered by doubling the character of category 3 (actual rules are more
complicated, see the \TeX Book), or using a \LaTeX\ environment (additional
environments will be explained in later chapters), or using brackets. 
Note that brackets are very useful, because they are so easy to type.
**A**\[ B\] \begin{displaymath} C \end{displaymath}
\endgroup


\ex{16.1} $\gamma+\nu\in\Gamma$.

\ex{16.2} \cmd{le},\cmd{ge},\cmd{ne}, 
\cmd{leq},\cmd{geq}, and \cmd{neq}:
$\le,\ge,\ne$,
$\leq,\geq,\neq$.

Complex formulas with superscripts\textsuperscript{(up high)} and subscripts
\textsubscript{(down low)}. 

\begin{verbatim}[numbers=left,firstnumber=last]
$x^2$, $x_2$, $2^x$, $x^2y^2$, $x ^ 2y ^ 2$, $x_2y_2$, $_2F_3$,
$x^{2y}$, $2^{2^x}$, $2^{2^{2^x}}$, $y_{x_2}$, $y_{x^2}$.
\end{verbatim}
Translation $x^2$, $x_2$, $2^x$, $x^2y^2$, $x ^ 2y ^ 2$, $x_2y_2$, $_2F_3$,
$x^{2y}$, $2^{2^x}$, $2^{2^{2^x}}$, $y_{x_2}$, $y_{x^2}$.

Consider now the following two formulas:
\begin{verbatim}[numbers=left,firstnumber=last]
$((x^2)^3)^4$,  ${({(x^2)}^3)}^4$.
\end{verbatim}
Translation of the first formula
\begin{verbatim}[numbers=left,firstnumber=last,style=xml]
<formula type='inline'>
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
    <mrow>
      <mo>(</mo>
      <mo>(</mo>
      <msup><mi>x</mi> <mn>2</mn> </msup>
      <msup><mo>)</mo> <mn>3</mn> </msup>
      <msup><mo>)</mo> <mn>4</mn> </msup>
    </mrow>
  </math>
</formula>
\end{verbatim}
Translation of the second formula

\begin{verbatim}[numbers=left,firstnumber=last,style=xml]
<formula type='inline'>
  <math xmlns='http://www.w3.org/1998/Math/MathML'>
    <msup>
      <mrow><mo>(</mo>
        <msup>
          <mrow> 
            <mo>(</mo> 
            <msup><mi>x</mi> <mn>2</mn> </msup>
            <mo>)</mo>
          </mrow> 
          <mn>3</mn> 
        </msup>
        <mo>)</mo>
      </mrow> 
      <mn>4</mn> 
    </msup>
  </math>
</formula>
\end{verbatim}
The current \Tralics\ uses some hacks, so that the translation is actually
different. You will get first $\mathord(\mathord(x^2\mathord)^3\mathord)^4$, second
${\mathord({\mathord(x^2\mathord)}^3\mathord)}^4$, third 
$((x^2)^3)^4$, and fourth ${({(x^2)}^3)}^4$. Here the first two formulas
correspond to the XML fragment shown above (they were produced by prefixing
each parenthesis with \cmd{mathord}, and after that we have the
actual translation. The MathML
recommendation says that some operators are \emph{stretchy}, so that the width
and height can depend on the context. This is not the case in \xmltex, so
that, in the Pdf version, all parentheses have the same size. The \cmd{mathop}
prefix tells \Tralics\ to not consider parentheses as stretchy, so no hack is
applied. We shall not explain the hack here; moreover we modified it in
version 2.10.8.  We originally wrote \textit{
All parentheses have the same  size in the pdf version, the same is true for
the HTML 
version in the first formula. Now, the \elt{mrow} elements delimit a scope, 
so that inner parentheses are smaller than outer parentheses (but only for
HTML, second formula); note that the placement of the exponent depend on the
context, so that, in the second formula, all three superscripts at placed at
different positions.
 In the case of the first formula, placement of the
exponent depends only on the the size of the parentheses (hence, in the Pdf
version, they should be aligned, in the HTML version, they are not).}
Firefox on Mac shows the following: all superscript are aligned. Big
parentheses are used but for case 2. Amaya shows only small parentheses,
scripts are not aligned, but this is hard to see.


The MathML recommendation says that the second alternative is
better; but Knuth says:
``The first alternative is preferable, because it is much easier to type, and
it is just as easy to read.'' 

\begin{verbatim}[numbers=left,firstnumber=last]
`${}_2F_3$', `${_2}F_3$', `${_2F_3}$' 
\end{verbatim}

\ex{16.3} Three ways to have an empty kernel:
`${}_2F_3$', `${_2}F_3$', `${_2F_3}$'. The translation is the same in all
cases because of the following two rules: if a math list starts with a
subscript or superscript operator, an empty math list is added before, it
serves as 
kernel (thus, braces in the first example are useless); 
a math list is packaged by putting it in a \elt{mrow} element, unless
the list has one element (in the second example, there are two tokens between
the braces, converted to a single \elt{msub} element, the math list has a
single element, braces are useless). In these two cases, the main math list
has two \elt{msub} elements, and a \elt{mrow} is added. In the last case, the
main math list has a single element, a \elt{mrow}, thus, no  \elt{mrow} is
added and braces are useless. 

\begin{verbatim}[numbers=left,firstnumber=last]
`$x+_2F_3$' and `$x+{}_2F_3$'.
\end{verbatim}
Effect of braces after plus sign:
`$x+_2F_3$' and `$x+{}_2F_3$'. The MathML recommendation says that the distance
between the plus sign and the letter F should be the same in both cases; in the
first case, index 2 is attached to the plus sign, in the second case to the
letter F (\textit{AM} shows both formulas with index attached to F).


\begin{verbatim}[numbers=left,firstnumber=last]
${x_2}_3$, $\displaystyle {\sum}'$ 
\end{verbatim}

Note that an \elt{mrow} element is added for a
math list with a single element in the case where it is followed by a
subscript or a subscript. Reason one: in a case like ${x_2}_3$, you will get
an error if braces are omitted; in the same fashion, an error is signaled 
(when converting to Pdf) if \elt{mrow} is missing. Reason two, in a case like
$\displaystyle {\sum}'$, the apostrophe is not placed above the sum if there
is a \elt{mrow} (the sum operator has type Op, but not the group, unless there
is a \cmd{mathop} before it).



\ex{16.4} Double superscript, ${x^y}^z$, $x^{y^z}$.

\begin{verbatim}[numbers=left,firstnumber=last]
$x^2_3$, $x_3^2$, $x^{31415}_{92}+\pi$, $x_{y^a_b}^{z_c^d}$.
$P_2^2$ and $P{}_2^2$.
\end{verbatim}
Simultaneous superscripts and subscripts $x^2_3$, $x_3^2$,
$x^{31415}_{92}+\pi$, $x_{y^a_b}^{z_c^d}$. 

Vertical alignment: $P_2^2$ and $P{}_2^2$. In the first case, scripts are
attached to the letter P, and alignment can depend on the slant of the letter.
(Amaya has extra space in the second formula).

\begin{verbatim}[numbers=left,firstnumber=last]
`$\prime$', $y_1^\prime$, $y_2^{\prime\prime}$, $y_3^{\prime\prime\prime}$,
$f'[g(x)]g'(x)$, $y_1'+y_2''$, $y'_1+y''_2$, $y'''_3+g'^2$
\end{verbatim}
Primes and shorthand:
{\let\prime\varprime
`$\prime$', $y_1^\prime$, $y_2^{\prime\prime}$, $y_3^{\prime\prime\prime}$,
$f'[g(x)]g'(x)$, $y_1'+y_2''$, $y'_1+y''_2$, $y'''_3+g'^2$.}
In the code shown here, the character used as delimiter for XML attributes is
character U+39, the quotes around the math formulas are U+60 and U+B4 (this
character can be changed via an option of the program, in verbatim mode it is
always U+39, straight quote).
The
prime character used in the formula is U+2032. This is not the right character.
Thus, in \Tralics\ 2.9.5, translation of prime changed, it is now
character U+39. The same formula is now:
`$\prime$', $y_1^\prime$, $y_2^{\prime\prime}$, $y_3^{\prime\prime\prime}$,
$f'[g(x)]g'(x)$, $y_1'+y_2''$, $y'_1+y''_2$, $y'''_3+g'^2$. It is unclear
whether this is the good solution. It seems that Firefox  uses the same font
metrics as \TeX, i.e., a very large prime character that has a normal size
when used at script size, while Amaya uses a normal size prime, that is small
when used as a superscript. In the case of f-prime, the slant of the letter is
not taken into account by Amaya, and the prime sign is hard to see.



\begin{verbatim}[numbers=left,firstnumber=last]
$x\varprime y^\varprime, x\Prime y^\Prime,
x\tprime y^\tprime,x\bprime y^\bprime,x\qprime y^\qprime$
\end{verbatim}
The amsmath package provides the symbols shown above; as you can see (at least
with FM), these characters are not meant
to be used as an exponent: 
$x\varprime y^\varprime, x\Prime y^\Prime,
x\tprime y^\tprime,x\bprime y^\bprime,x\qprime y^\qprime$.
Note that \cmd{qprime} is unkown to Amaya, and the prime subscript in the
following exercice is hard to see.

\ex{16.5} $F'(w,z)=\partial F(w,z)/\partial z$ and $F_\prime(w,z)=\partial F(w,z)/\partial w$.

\begin{verbatim}[numbers=left,firstnumber=last]
\let\none\mmlnone
$R_i{}^{jk}{}_l$ versus $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$
\end{verbatim}
\ex{16.6} 
$R_i{}^{jk}{}_l$ versus $\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$
(MathML example,  section 3.4.7.2, only second index raised). 

\begin{verbatim}[numbers=left,firstnumber=last]
$\sqrt 2$, $\sqrt{x+2}$, $\underline4$, $\overline{x+y}$, 
$\overline x+ \overline y$, $x^{\underline n}$, $x^{\overline{m+n}}$, 
$\sqrt{x^3+\sqrt\alpha}$
\end{verbatim}
Translation $\sqrt 2$, $\sqrt{x+2}$, $\underline4$, $\overline{x+y}$, 
$\overline x+ \overline y$, $x^{\underline n}$, $x^{\overline{m+n}}$, 
$\sqrt{x^3+\sqrt\alpha}$. 
There are problems with underline and overline on \textit{FM}. Vertical
position is not always good, and the length is sometimes incorrect. On the
fifth formula, rules are sometimes invisible in the printed version.
There is a text version in \Tralics:
$\underline{\text{Mfoo}}$, \underline{Tfoo},  
$\overline{\text{Mfoo}}$, \overline{Tfoo},
$\overline{\underline{\text{Mfoo}}}$, \overline{\underline{Tfoo}}. 


\begin{verbatim}[numbers=left,firstnumber=last]
$\root 3 \of 2$, $\root n \of {x^n + y^n}$, $\root n+1 \of a$,
$\sqrt[3]{2}$, $\sqrt[n]{x^n + y^n}$, $\sqrt[n+1]a$, `$\sqrt[3]{~~}$'.
\end{verbatim}
Translation
 $\root 3 \of 2$, $\root n \of {x^n + y^n}$, $\root n+1 \of a$,
$\sqrt[3]{2}$, $\sqrt[n]{x^n + y^n}$, $\sqrt[n+1]a$, `$\sqrt[3]{~~}$'.

\begin{verbatim}[numbers=left,firstnumber=last]
$\sqrt{\mathstrut a} + \sqrt{\mathstrut d} + \sqrt{\mathstrut y}$,
$\sqrt{a} + \sqrt{d} + \sqrt{y}$,
$\overline{a} + \overline{d} + \overline{y}$,
$\overline{\mathstrut a} + \overline{\mathstrut d} + \overline{\mathstrut y}$.
\end{verbatim}
Translation $\sqrt{\mathstrut a} + \sqrt{\mathstrut d} + \sqrt{\mathstrut y}$,
$\sqrt{a} + \sqrt{d} + \sqrt{y}$,
$\overline{a} + \overline{d} + \overline{y}$,
$\overline{\mathstrut a} + \overline{\mathstrut d} + \overline{\mathstrut y}$.


\ex{16.7} $10^{10}$, $2^{n+1}$, $(n+1)^2$, $\sqrt{1-x^2}$,
$\overline{w+\overline{z}}$, $p_1^{e_1}$, $a_{b_{c_{d_e}}}$,
$\sqrt[3]{h''_n(\alpha x)}$.

\ex{16.8} If$ x=y$,then $x$ is equal to $y.$ (this exercise says what you
should not do).

\ex{16.9} Deleting an element from an $n$-tuple leaves an $(n-1)$-tuple.

\ex{16.10} Letters with descenders are Qfgjpqy.

\begin{verbatim}[numbers=left,firstnumber=last]
$x+y-z$, $x+y*z$, $x*y/z$ 
\end{verbatim}
Basic binary operators: $x+y-z$, $x+y*z$, $x*y/z$.

\begin{verbatim}[numbers=left,firstnumber=last]
$x\times y\cdot z$, $x\circ y\bullet z$, $x\cup y\cap z$,
$x\sqcup y\sqcap z$, $x\vee y\wedge z$, $x\pm y \mp z$. 
Aliases   $x\land y\lor z$.
\end{verbatim}
Many more binary operators 
$x\times y\cdot z$, $x\circ y\bullet z$, $x\cup y\cap z$,
$x\sqcup y\sqcap z$, $x\vee y\wedge z$, $x\pm y \mp z$.
Aliases   $x\land y\lor z$.

\begin{verbatim}[numbers=left,firstnumber=last]
$x=+1$, $3.142-$, $(D*)$
$x=\mathmo[form][prefix]{+}1$
$3.142\mathmo[form][prefix]{-}$
$(D\mathmi[mathvariant][normal]{*})$
$(D\mathmo[lspace][0][rspace][0]{*})$
\end{verbatim}
Binary as ordinary symbols: $x=+1$, $3.142-$, $(D*)$. 
The HTML version is slightly different from the \TeX\ version. 
You can declare the plus sign as prefix operator, this gives
$x=\mathmo[form][prefix]{+}1$, you can define the minus sign as prefix
operator, this gives $3.142\mathmo[form][prefix]{-}$. Removing the space around
the star is more complicated, a solution consists of using an identifier in
upright variant like this $(D\mathmi[mathvariant][normal]{*})$, or by setting
the lspace and rspace attributes to zero:
 $(D\mathmo[lspace][0][rspace][0]{*})$.

\begin{verbatim}[numbers=left,firstnumber=last]
$K_n^+,K_n^-$, $z^*_{ij}$, $g^\circ\mapsto g^\bullet$, $f^*(x)\cap f_*(y)$
\end{verbatim}
Binary  operators in superscripts
$K_n^+,K_n^-$, $z^*_{ij}$, $g^\circ\mapsto g^\bullet$, $f^*(x)\cap f_*(y)$.

\ex{16.11} $z^{*2}$ and $h'_*(z)$.

\begin{verbatim}[numbers=left,firstnumber=last]
$x=y>z$, $x:=y$, $x\le y\ne z$, $x\sim y\simeq z$, $x\equiv y\not\equiv z$,
$x\subset y\subseteq z$
\end{verbatim}
 $x=y>z$, $x:=y$, $x\le y\ne z$, $x\sim y\simeq z$, 
$x\equiv y\not\equiv z$,
$x\subset y\subseteq z$. In the Pdf version there is no space between the
colon and the equals sign, but the HTML version shows some, because the rules
are not the same for \TeX\ and MathML. The best solution would be to use a
single operator instead of two consecutive ones; the user can define a command
\cmd{coloneq} that behaves like colon-eq in normal \TeX, or \Tralics\ could be
modified in order to recognise sequences like this. Translation of \cmd{not} is
problematic: in this document we consider it as an undefined operator, and you
see a red X. We should add rules like: \cmd{not=} should give \cmd{ne}.


\begin{verbatim}[numbers=left,firstnumber=last]
$f(x,y;z)$, $f:A\to B$, $f\colon A\to B$
%\def\colon{\mathmo[lspace][0]{:}} 
\end{verbatim}
Punctuation $f(x,y;z)$, $f:A\to B$, $f\colon A\to B$. Note that \cmd{colon} is
a colon with \attpair{lspace}{0pt}, but the attribute is ignored in the Pdf
version. It seems that Amaya uses a zero lspace by default.


\begin{verbatim}[numbers=left,firstnumber=last]
$12,345x$, $12{,}245x$, $\mathcn{12,345}x$, $\mathmn{12,345}x$
\end{verbatim}
$12,345x$, $12{,}245x$, $\mathcn{12,345}x$, $\mathmn{12,345}x$. The translation
of the first two expressions is the same, braces are useless here.  A silly
bug of my F browser: the second digit of the first number disappears; this does
not happen if the number is not the first word of a paragraph (this is why the
sentence starts with a number). You should use
one of the last two variants if you want the sequence of digits plus the comma
to be considered as a number.



\ex{16.12}  $3{\cdot}1416$, but \cmd{mathmn}\argument{3\HAT\HAT b71416} gives 
$\mathmn{3^^b71416}$ (less space in the HTML version).

\begin{verbatim}[numbers=left,firstnumber=last]
$\hat a$, $\check a$, $\tilde a$, $\acute a$, $\grave a$, $\dot a$,
$\ddot a$, $\breve a$, $\bar a$, $\vec a$
\def\ihat{{\hat \imath}} \def\jhat{{\hat\jmath}} $\ihat$, $\jhat$
\end{verbatim}

 $\hat a$, $\check a$, $\tilde a$, $\acute a$, $\grave a$, $\dot a$,
$\ddot a$, $\breve a$, $\bar a$, $\vec a$,
\def\ihat{{\hat \imath}} \def\jhat{{\hat\jmath}} $\ihat$, $\jhat$.
Character \cmd{jmath} is a normal j, because there is no dotless j in most
fonts. There is also a problem with the rendering of grave accents on FM.

\begin{verbatim}[numbers=left,firstnumber=last]
$\hat{I+M}$, $\bar z+ \overline z$, $\widehat x, \widetilde x$,
$\widehat{xy}, \widetilde{xy}$
$\widehat{xy}, \widetilde{xy}$
$\widehat{xyz}, \widetilde{xyz}$
% $\ghat\in{(H^{\pi_1^{-1}})}' -> Ex16.13 below
\end{verbatim}
Large accents
 $\hat{I+M}$, $\bar z+ \overline z$, $\widehat x, \widetilde x$,
$\widehat{xy}, \widetilde{xy}$,
$\widehat{xy}, \widetilde{xy}$,
$\widehat{xyz}, \widetilde{xyz}$. As you can see, there is no difference
between wide and non-wide operators. My browser (AM as well as FM) shows a small hat, and a
variable length tilde. For the Pdf version, we have decided to use the
variable size variant. 



\def\ghat{{\hat g}}
\ex{16.13} $e^{-x^2}$, $D\sim p^\alpha M+l$, $\ghat\in{(H^{\pi_1^{-1}})}'$,
(braces added), 
$\ghat\in(H^{\pi_1^{-1}})'$ (without braces). In \Tralics\ 2.11, there shuld
be no difference between the version with and without braces.
\fi


\section{More about Math, TB 17}
\ifTeXtwo
\begin{verbatim}[numbers=left,firstnumber=last]
$$ {1\over 2}\qquad {\rm and}\qquad {n+1 \over 3} \qquad {\rm and}\qquad {n+1
  \choose 3}\qquad {\rm and}\qquad \sum_{n=1}^3Z_n^2. \label{eq17.1}$$
\[ \frac{1}{2}\qquad \text{and}\qquad \frac{n+1}{3} \qquad \text{and}\qquad 
\binom{n+1}{3}\qquad \text{and}\qquad \sum_{n=1}^3Z_n^2.\label{eq17.2}\]
\end{verbatim}
Example of vertical alignment. Translation of the first three expressions is a
\elt{mfrac} element, subexpressions are in text style (normal size). In the
case of the last expression scripts are in script style (small size) and we
have a \elt{munderover} element for the sum (it is an operator with limits in
display style) and a \elt{msubsup} element for the Z (that is not an operator).
$$ {1\over 2}\qquad {\rm and}\qquad {n+1 \over 3} \qquad {\rm and}\qquad {n+1
  \choose 3}\qquad {\rm and}\qquad \sum_{n=1}^3Z_n^2. \label{eq17.1}
$$
The same, using \LaTeX\ syntax
\[ \frac{1}{2}\qquad \text{and}\qquad \frac{n+1}{3} \qquad \text{and}\qquad 
\binom{n+1}{3}\qquad \text{and}\qquad \sum_{n=1}^3Z_n^2.\label{eq17.2}\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[{x+y^2\over k+1},\qquad {x+y^2\over k}+1,\qquad
x+{y^2\over k}+1,\qquad x+{y^2\over k+1},\qquad x+y^{2\over k+1}\]
\[\frac{x+y^2}{k+1},\qquad \frac{x+y^2}{k}+1,\qquad
x+\frac{y^2}{k}+1,\qquad x+\frac{y^2}{k+1},\qquad x+y^{\frac{2}{k+1}}\]
\end{verbatim}
Single over. The only difference in these expressions is the placement of the
braces.
\[{x+y^2\over k+1},\qquad {x+y^2\over k}+1,\qquad
x+{y^2\over k}+1,\qquad x+{y^2\over k+1},\qquad x+y^{2\over k+1}.
\label{eq17.3}\]
\LaTeX\ style: this uses a command with two arguments, that behaves without
surprise. 
\[\frac{x+y^2}{k+1},\qquad \frac{x+y^2}{k}+1,\qquad
x+\frac{y^2}{k}+1,\qquad x+\frac{y^2}{k+1},\qquad x+y^{\frac{2}{k+1}}.
\label{eq17.4}\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[{ {a \over b}\over 2} \qquad \text{and}\qquad { a\over {b\over 2}} 
\qquad \text{and}\qquad { a/ b\over 2} \qquad \text{and}\qquad { a\over b/2} 
 \]
\[ \frac{\frac{a}{b}}{2} \qquad \text{and}\qquad \frac{a}{\frac{b}{2}}  
\qquad \text{and}\qquad  \frac{a/b}{2} \qquad \text{and}\qquad \frac{a}{b/2} \]
\end{verbatim}
Double over.  It is an error if you say A over B over C without adding
braces. As you can see, if a fraction is in text style, its numerator and
denominator are in script style, so that it is sometimes better to use a slash. 
\[{ {a \over b}\over 2} \qquad \text{and}\qquad { a\over {b\over 2}} 
\qquad \text{and}\qquad { a/ b\over 2} \qquad \text{and}\qquad { a\over b/2}. 
\label{eq17.5} \]
\LaTeX\ style (nothing special here).
\[ \frac{\frac{a}{b}}{2} \qquad \text{and}\qquad \frac{a}{\frac{b}{2}} 
\qquad \text{and}\qquad \frac{a/b}{2} \qquad \text{and}\qquad \frac{a}{b/2}.
\label{eq17.6}  \]



\ex{17.1} Compare $x+y^{\frac{2}{k+1}}$ with $x+y^{2/(k+1)}$. If a fraction is
in script style, its numerator and denominator are in script script style,
i.e. smaller. In \TeX, there are four styles and three sizes (display style and
text style have the same size). In MathML, the size is defined by a level,
zero, one, or two, but larger levels are possible; thus more than three sizes
are possible. There is however a minimal font size.
 
\ex{17.2} Compare $\frac{a+1}{b+1}x$ with $((a+1)/(b+1))x$.
\ex{17.3} Wrong use of \cmd{over} in $\displaystyle{ x=(y^2\over k+1)}$. 
\ex{17.4} $7\frac12\textcent$, using the \cmd{textcent} command.
\ex{17.5} Same as in the \TeX book, but not cramped.

\begin{verbatim}[numbers=left,firstnumber=last]
\[n+\scriptstyle n + \scriptscriptstyle n\]
\[n+{\scriptstyle n + {\scriptscriptstyle n}}\]
\end{verbatim}
\[n+\scriptstyle n + \scriptscriptstyle n\]
\[n+{\scriptstyle n + {\scriptscriptstyle n}}\]
Note: In the current version of \Tralics, it is unclear what happens when you
put style commands randomly in a math formula; in any case, \Tralics\ uses the
correct math style, but has difficulties in inserting \elt{mstyle}
elements: what is the scope? Currently such an element is added to the current
math list, if it contains a style change command; in the example above,
we have two such commands, thus three different styles,
and a single list (first example) or three lists (second example).
Translation of the first example is wrong, translation of the second example is
correct because the style command is the first token of the
list\footnote{Amaya seems to ignore the style attribute}.


\begin{verbatim}[numbers=left,firstnumber=last]
\[a_0+{1\over\displaystyle a_1 +
  {\strut 1\over\displaystyle a_2+
    {\strut 1\over\displaystyle a_3+
       {\strut 1\over a_4}}}}\]
\end{verbatim}
Translation
\[a_0+{1\over\displaystyle a_1 +
  {\strut 1\over\displaystyle a_2+
    {\strut 1\over\displaystyle a_3+
       {\strut 1\over a_4}}}}\]
Without \cmd{displaystyle}
{\let\displaystyle\relax
\[a_0+{1\over\displaystyle a_1 +
  {\strut 1\over\displaystyle a_2+
    {\strut 1\over\displaystyle a_3+
       {\strut 1\over a_4}}}}\]
}
Without \cmd{strut}. Since a \cmd{strut} is an invisible object of the size of
a parenthesis, more or less the size of the digit one, its effect is hard to
see.\footnote{The width of the strut should be zero; this is incorrectly
  rendered by Amaya, that shows a non-centered numerator; there is also
  additional space in the formulas before exercide 16.7}
{\let\strut\empty
\[a_0+{1\over\displaystyle a_1 +
  {\strut 1\over\displaystyle a_2+
    {\strut 1\over\displaystyle a_3+
       {\strut 1\over a_4}}}}\]
}
Without both
{\let\strut\empty\let\displaystyle\relax
\[a_0+{1\over\displaystyle a_1 +
  {\strut 1\over\displaystyle a_2+
    {\strut 1\over\displaystyle a_3+
       {\strut 1\over a_4}}}}\]
}

Until version 2.9.4, commands of the form \cmd{hfill} were illegal in math
mode. Since then, they are allowed as first or last element in arguments of 
commands like \cmd{overline}. They are ignored, unless the result is a
fraction;  we demonstrate here that \cmd{hfill} placed at the end of the list
produces a left alignment, in the case of \cmd{over}, \cmd{genfrac}, or
\cmd{frac}. Note that  the \cmd{cfrac} command can be used for continued
fractions: its optional argument says whether the numerator is centered, left
aligned or right aligned, under the assumption that the denominator is much
larger than the numerator.\footnote{As previously, the struts induce unwanted
  space in Amaya}.
\[
a_0+{1\hfill\over\displaystyle a_1 +
  {\strut 1\hfill\over\displaystyle a_2+
    {\strut 1\hfill\over\displaystyle a_3+
       {\strut 1\over a_4}}}}
\qquad \genfrac(){}{}{12345}{1\hfill}\qquad \frac{1\hfill}{12345}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[ {x\atop y+2}, {n \choose k}, \text{latex},
\genfrac{}{}{0pt}{}{x}{y+2},\binom{n}{k} \]
\end{verbatim}
The \cmd{atop} construction is like \cmd{over}, without fraction rule; you
should not use it in \LaTeX, you should use \cmd{genfrac} instead. The command
\cmd{atopwithdelims} (see below for an example) is followed by two delimiters,
say A and B, it puts A before the fraction and B after it. You can use
\cmd{genfrac} with A and B as arguments (third argument is line thickness,
fourth argument is style). The \cmd{choose}
command is nothing else than \cmd{atopwithdelims()}. You should not use it.
\[ {x\atop y+2}, {n \choose k}, \text{latex},
\genfrac{}{}{0pt}{}{x}{y+2},\binom{n}{k} \]

\begin{verbatim}[numbers=left,firstnumber=last]
\[{ {n\choose k}\over 2} \text{ or } { n\choose{k\over2} } 
\text{ or } { n\choose k/2} \text{ or } {n\choose{1\over2}k}\]
\end{verbatim}
As mentioned above, a construction like A over B over C needs braces, 
where over is a generic name for \cmd{over} and variants, including
\cmd{choose}. Nothing special is required for \cmd{frac} or \cmd{binom}, so
that \LaTeX\ variant is omitted.
\[{ {n\choose k}\over 2} \text{ or } { n\choose{k\over2} }
\text{ or } { n\choose k/2} \text{ or } {n\choose{1\over2}k}\]

\begin{verbatim}[numbers=left,firstnumber=last]
%%$${1\over2}{n\choose k}$$; $$\displaystyle{n\choose k}\over2}$$ : TeXbook
$\displaystyle \frac{1}{2}\binom{n}{k}$, 
$\displaystyle{n\choose k}\over \displaystyle 2$,
$\dfrac{\dbinom{n}{k}}2$.
{\def\P{\mathchoice{D}{T}{S}{SS}}
$\displaystyle{\P\choose \P}\P\over \displaystyle \P$,
$\dfrac{\dbinom{\P}{\P}\P}\P$.}
\end{verbatim}
\ex{17.6} $\displaystyle \frac{1}{2}\binom{n}{k}$ and 
$\displaystyle{n\choose k}\over \displaystyle2$; \LaTeX\ version
$\dfrac{\dbinom{n}{k}}2$; version with \cmd{P}:
 {\def\P{\mathchoice{D}{T}{S}{SS}}
$\displaystyle{\P\choose \P}\P\over \displaystyle \P$,
$\dfrac{\dbinom{\P}{\P}\P}\P$}. 
Note that the `d' in \cmd{dfrac} or \cmd{dbinom}
means that the expression is in display style, hence numerator and
denominator are in text style; as a consequence the \cmd{choose} is same as the
\cmd{dbinom}; on the other hand, the \cmd{over} produces a fraction in text
style, with numerator and denominator in display style, while the \cmd{dfrac}
produces a fraction in display style, with numerator and denominator in 
text style. In the dvi file, the distance between D and the fraction rule is
the same as the width of the rule, and the distance between the T and the
rule is approximatively one third of the height of the T; my HTML FM browser uses
larger values, making the difference more obvious.

\ex{17.7} $\displaystyle \binom p2\,x^2y^{p-2} - \frac 1{1-x}\,\frac1{1-x^2}$.
 Fine space added for legibility.

\begin{verbatim}[numbers=left,firstnumber=last]
\[{\displaystyle{a\over b}\above3pt\displaystyle{c\over d}}
\text{~~and~~} \genfrac{}{}{3pt}{}{\dfrac{a}{b}}{\dfrac{c}{d}}\]
\end{verbatim}
There are six operators that behave alike: \cmd{over}, \cmd{atop} and
\cmd{above}, and the same with delimiters. The `above' commands read a
dimension, the thickness of the fraction rule. In the current version of
\Tralics, this has better to be explicit (if you want the value of
\cmd{parskip}, you must use \cmd{genfrac}).
\[{\displaystyle{a\over b}\above3pt\displaystyle{c\over d}}
\text{~~and~~} \genfrac{}{}{3pt}{}{\dfrac{a}{b}}{\dfrac{c}{d}}.\]

\begin{verbatim}[numbers=left,firstnumber=last]
${\displaystyle \sum x_n}, {\textstyle \sum x_n}, 
{\scriptstyle \sum x_n}, {\scriptscriptstyle \sum x_n}$
\end{verbatim}
Different sums ${\displaystyle \sum x_n}, {\textstyle \sum x_n}, 
{\scriptstyle \sum x_n}, {\scriptscriptstyle \sum x_n}$. The position of the
index is unaffected by the style.

\begin{verbatim}[numbers=left,firstnumber=last]
\[ {\displaystyle \int_{-\infty}^{\infty} \sum_{n=1}^m},  
{\textstyle \int_{-\infty}^{\infty} \sum_{n=1}^m},
{\displaystyle\int\limits_0^{\frac{\pi}{2}} \sum\nolimits_{n=1}^m} \]
\end{verbatim}
This example demonstrates that the position of scripts depends on the style if
the kernel is a math operator, and the presence of key words like `limits',
`nolimits' or `displaylimits'. Scripts can be added to a MathML object using
m/sub/sup, and for an operator using m/under/over.  In this last case, the
attribute movablelimits corresponds to the `displaylimits' keyword. If set,
`under' means `sub' if the style is not display. \Tralics\ uses `under' or
`sub', depending on where the indices should be placed, and never sets the
attribute. On the other hand, when \TeX\ typesets a `under' or `sub', it 
sometimes uses a wrong strategy. The last expression (display style sum
without limits) uses a \cmd{msubsup} element; in this case, there is an
implicit \cmd{nolimits}, we cannot make it explicit, because such a command
has to follow an operator, and there is no easy way to check that the first
child of the element is an operator (it is easy to see that it is a \elt{mo}
element, a bit more complicated to see that it contains a Unicode character,
and quite impossible to say that its translation leaves \TeX\ in state where
\cmd{nolimits} is allowed). Note also that we could convert the argument to an
operator, but this is not always a good idea. In this example the HTML version
is correct, the Pdf version is wrong\footnote{Amaya places the   $\pi/2$ too low}.

\[ {\displaystyle \int_{-\infty}^{\infty} \sum_{n=1}^m},  
{\textstyle \int_{-\infty}^{\infty} \sum_{n=1}^m},
{\displaystyle\int\limits_0^{\frac{\pi}{2}} \sum\nolimits_{n=1}^m} \]

\begin{verbatim}[numbers=left,firstnumber=last]
\[\lim_ax+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_ax\]
\[\textstyle \lim_lx+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_lx\]
\[\sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_ax\]
\[\textstyle \sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_lx\]
\end{verbatim}
More about limits. Knuth says that \cmd{nolimits}\cmd{limits} produces limits;
so that \cmd{sin}\cmd{limits} produces limits; a special feature of amsmath
is that the token that follows the \cmd{sin} is ignored if it is a
\cmd{limits} token.
According to amsmath, an index A should be below the operator, an index L is a
normal subscript; the example here shows that \Tralics\ behaves more like \TeX.
\[\lim_ax+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_ax\]
\[\textstyle \lim_lx+\lim\nolimits_l x+\lim\limits_ax+\lim\displaylimits_lx\]
\[\sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_ax\]
\[\textstyle \sin_lx+\sin\nolimits_l x+\sin\limits_lx+\sin\displaylimits_lx\]



\begin{verbatim}[numbers=left,firstnumber=last]
\[\operatorname*{sin}_a \operatornamewithlimits{sin}_a \qopname\relax{n}{sin}_a
\operatorname{sin}_l  \qopname\relax{o}{sin}_l
\mathop{\rm sin}_a\mathop{\rm sin}\limits_a\]
\[\textstyle\operatorname*{sin}_l \operatornamewithlimits{sin}_l
 \qopname\relax{n}{sin}_l\operatorname{sin}_l  \qopname\relax{o}{sin}_l
\mathop{\rm sin}_l\mathop{\rm sin}\limits_a\]
\end{verbatim}
These are \LaTeX\ commands that can define operators like sin or lim:
\[\operatorname*{sin}_a \operatornamewithlimits{sin}_a \qopname\relax{n}{sin}_a
\operatorname{sin}_l  \qopname\relax{o}{sin}_l
\mathop{\rm sin}_a\mathop{\rm sin}\limits_a\]
\[\textstyle\operatorname*{sin}_l \operatornamewithlimits{sin}_l
 \qopname\relax{n}{sin}_l\operatorname{sin}_l  \qopname\relax{o}{sin}_l
\mathop{\rm sin}_l\mathop{\rm sin}\limits_a\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[\sum_{\scriptstyle0\le i\le m\atop\scriptstyle0<j<n}P(i,j)\qquad
\sum_{\stackrel{0\le i\le m}{0<j<n}}P(i,j)\]
\end{verbatim}
In the first expression given here, and in exercise 17.9 that follows, scripts
use an explicit `script style' command, hence should be typeset in scriptstyle
size. This is not the case in the HTML version: we have an atop in an atop,
and the style of the inner one is wrong.  The second formula uses a \LaTeX\
command, this is not the right command for stacking indices because the first
argument uses a smaller style than the second. It seems to me that the top
line of first formula, bottom line of the second formula have the right
size. Other lines are too big (in Firefox) or much too small (in Amaya).

\[\sum_{\scriptstyle0\le i\le m\atop\scriptstyle0<j<n}P(i,j), \qquad
\sum_{\stackrel{0\le i\le m}{0<j<n}}P(i,j)\]

\ex{17.8} $\displaystyle \sum_{i=1}^p\sum_{j=1}^q\sum_{k=1}^ra_{ij}b_{jk}c_{ki}$. 
\ex{17.9} 
\def\Atop#1#2{\genfrac{}{}{0pt}{1}{#1}{#2}}
 $\displaystyle \sum\limits_{{\scriptstyle1\le i\le n\atop\scriptstyle 1\le
  j\le q}\atop \scriptstyle 1\le k\le r}
a_{ij}b_{jk}c_{ki}$ or 
 $\displaystyle \sum\limits_{\scriptstyle1\le i\le n\atop{\scriptstyle 1\le
  j\le q\atop \scriptstyle 1\le k\le r}}
a_{ij}b_{jk}c_{ki}$.  

\begin{verbatim}[numbers=left,firstnumber=last]
\[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}\]
\end{verbatim}
\[\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+x}}}}}}}.\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \left(\left[\left\lbrack a\left\{\left\lbrace\left\lfloor b
\left\lceil\left\langle\left/ c\left|\left\|\left\uparrow d
\left\downarrow\left\updownarrow\frac 12 \right\Updownarrow
\right\downarrow t
\right\Uparrow\right\Vert\right\vert x\right\backslash\right\rangle
\right\rceil y \right\rfloor\right\rbrace\right\} z\right\rbrack\right]\right)\]
\end{verbatim}
\[ \left(\left[\left\lbrack a\left\{\left\lbrace\left\lfloor b
\left\lceil\left\langle\left/ c\left|\left\|\left\uparrow d
\left\downarrow\left\updownarrow\frac 12 \right\Updownarrow
\right\downarrow t
\right\Uparrow\right\Vert\right\vert x\right\backslash\right\rangle
\right\rceil y \right\rfloor\right\rbrace\right\} z\right\rbrack\right]\right)\]
We would expect all delimiters to be of the same size; but not all characters
can be indefinitely extensible. On Firefox, we see a large slash, reverse
slash and angle brackets; all other characters have maximum size. On Amaya,
slash and reverse slash have a normal size, as well as double vertical bars;
on \textit{AM} some delimiters are replaced by a question sign, namely floor,
ceiling, angle brackets, reverse slash and arrows (on following formulas,
arrows are however visible). AF uses floor instead of ceiling and vice-versa. 
On \textit{FM} the rendering of up-down-array is wrong.  



There are problems  with slash, backslash, double vertical bar on \Tralics\
2.9.4. Concerning the double vertical bar, the following expression contains
two different characters: $\csname @Vert\endcsname=\Vert$. The first
character is Unicode U+2016 (entity \entity{Vert} in the file
\filename{mmlalias.ent}), obtained by \cmd{Vert} in \Tralics\ 2.9.4, accessible
as \cmd{@Vert} in following versions, it is not shwon by Amaya; 
the second character is Unicode U+2225
(entity \entity{DoubleVerticalBar}, \entity{parallel} and \entity{shortparallel}
in the file \filename{mmlalias.ent}), obtained by \cmd{parallel} in \Tralics\
2.9.4, and also by \cmd{Vert} in following versions. We changed this because  
the first character has fixed size as the following demonstrates
 $\csname@Vert\endcsname\frac12\Vert$ (the effect is  only visible in HTML
 with FM).


Translation of backslash changed: it is now Unicode U+2216, you can use
the backslash character (Unicode U+5C) by saying \cmd{char`}\cmd{\HAT\HAT5c}.
Example: old is $X\char`\^^5c Y$, new is $X\backslash Y$, note the different
spacing. 


Example of \cmd{bigl} and \cmd{bigr}, followed by the same code without these
operations; currently there is no difference in the HTML version; in the Pdf
there is more space in the equations on the LHS between closing brace and
opening brace (same for bracket).
\[ \bigl (x-s(x)\bigr)\bigl(y-s(y)\bigr) \qquad (x-s(x))(y-s(y))\]
\[ \bigl [x-s[x]\bigr]\bigl[y-s[y]\bigr] \qquad [x-s[x]][y-s[y]]\]
\[ \bigl| |x|- |y| \bigr| \qquad | |x|- |y| |\]

Example of big
\begin{verbatim}[numbers=left,firstnumber=last]
\[ \big(\big[\big\lbrack \big\{\big\lbrace\big\lfloor 
\big\lceil\big\langle\big/ \big|\big\|\big\uparrow 
\big\downarrow\big\updownarrow\frac 12 \big\Updownarrow
\big\downarrow \big\Uparrow\big\Vert\big\vert \big\backslash\big\rangle
\big\rceil\big\rfloor\big\rbrace\big\}\big\rbrack\big]\big)\]
\end{verbatim}
\[ \big(\big[\big\lbrack \big\{\big\lbrace\big\lfloor 
\big\lceil\big\langle\big/ \big|\big\|\big\uparrow 
\big\downarrow\big\updownarrow\frac 12 \big\Updownarrow
\big\downarrow \big\Uparrow\big\Vert\big\vert \big\backslash\big\rangle
\big\rceil\big\rfloor\big\rbrace\big\}\big\rbrack\big]\big)\]
I see the following: every up to the slash,  and starting with the backslash
is big; remaining items are small in the Pdf version, big in Firefox, 
sometimes small, sometimes large in Amaya.

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \big(\bigl[\Big\lbrack \Bigl\{\bigg\lbrace\biggl\lfloor 
\Bigg\lceil\Biggl\langle /|\|\uparrow \downarrow\updownarrow\frac 12 
\Updownarrow\downarrow\Uparrow\Vert\vert\backslash
\Biggr\rangle\Bigg\rceil\biggr\rfloor\bigg\rbrace\Bigr\}\Big\rbrack\bigr]\big)\]
\end{verbatim}
A formula with all variants

\[ \big(\bigl[\Big\lbrack \Bigl\{\bigg\lbrace\biggl\lfloor 
\Bigg\lceil\Biggl\langle /|\|\uparrow \downarrow\updownarrow\frac 12 
\Updownarrow\downarrow\Uparrow\Vert\vert\backslash
\Biggr\rangle\Bigg\rceil\biggr\rfloor\bigg\rbrace\Bigr\}\Big\rbrack\bigr]\big)\]
Up to version 2.9.4, there was a bug in handling these big things.
Currently, \Tralics\ inserts \cmd{left} and \cmd{right} delimiters wherever
possible. In the Pdf version, this formula is identical to the previous one.
In firefox, operators between slash and backslash (that have no big) are small
before the fraction, large after that. This is strange. In Amaya, everything
between the slash and the backslash is small, except the \cmd{vert}. 

\ex{17.10} $\displaystyle\biggl({\partial^2\over\partial x^2}+
{\partial^2\over\partial y^2}\biggr)\bigl|\varphi(x+iy)\bigr|^2=0$.

\begin{verbatim}[numbers=left,firstnumber=last]
Phi is $\phi,^^^^03c6$, ^^^^03c6  and varphi is $\varphi,^^^^03d5$, ^^^^03d5, 
\end{verbatim}
There is a problem in the rendering of the letter phi; the straight phi
character is Unicode  U+03D5. As the example given here shows, the rendering
of phi and varphi in math mode, at least on my machine: 
Phi is $\phi,^^^^03c6$, ^^^^03c6  and varphi is $\varphi,^^^^03d5$, ^^^^03d5, 
epsilon is $\epsilon$, varepsilon is $\varepsilon$. We changed the
translation, so that the Firefox and Pdf versions show, in math mode, the
desired result. Note that AM shows the same characeter for phoi ad varphi in
math mode, and has trouble with epsilon(shown as a square).

\begin{verbatim}[numbers=left,firstnumber=last]
$\bigl (x\in A(n)\bigm|x\in B(n)\bigr)$, 
$\bigcup_n X_n\bigm\|\bigcap_n Y_n$,
$\displaystyle{ {a+1\over b}\bigg/{c+1\over d}}$
\end{verbatim}
Other big $\bigl( x\in A(n)\bigm|x\in B(n)\bigr)$ and
$\bigcup_n X_n\bigm\|\bigcap_n Y_n$ and
$\displaystyle{ {a+1\over b}\bigg/{c+1\over d}}$.
\ex{17.12} $\bigl(x+ f(x)\bigr)\big/\bigl(x- f(x)\bigr)$.
\begin{verbatim}[numbers=left,firstnumber=last]
\[1+\left(\frac{1}{1-x^2}\right)^3,\qquad \pi(n)=\sum_{k=2}^n 
\left\lfloor\frac{\phi(k)}{k-1}\right\rfloor, \qquad
\left|\left|x\right|-|\left|y\right|\right|, \qquad
\left(\sum_{k=1}^n A_k\right),\qquad  \biggl(\sum_{k=1}^n A_k\biggr)\]
\end{verbatim}
\ex{17.13}
Comparison between \cmd{left} and \cmd{bigl}; translation is the same in
\Tralics. 
\[1+\left(\frac{1}{1-x^2}\right)^3,\qquad \pi(n)=\sum_{k=2}^n 
\left\lfloor\frac{\phi(k)}{k-1}\right\rfloor, \qquad
\left|\left|x\right|-\left|y\right|\right|, \qquad
\left(\sum_{k=1}^n A_k\right),\qquad  \biggl(\sum_{k=1}^n A_k\biggr).\]

\ex{17.14} was wrong in \Tralics\ 2.9.4.
\[\pi(n) = \sum_{m=2}^n\left\lfloor\biggl(\sum_{k=1}^{m-1}\bigl\lfloor
(m/k)\big/\lceil m/k\rceil\bigr\rfloor\biggr) ^{-1}
\right\rfloor
\]

\[
|x|= \begin{cases}x,&\text{if } x\ge 0\\-x,&\text{if }x<0
\end{cases}
\]
\TeX\ sets \cmd{nulldelimiterspace}, unused by \Tralics.
\[\bigl<\frac 12\bigr> = \left<\frac 12\right> =
 \bigl\langle\frac 12\bigr\rangle = \left\langle\frac 12\right\rangle 
\]

The \cmd{vcenter} command is not implemented. 
Any box can be put into a formula by simply saying 
\cmd{hbox} or \cmd{vbox} or \cmd{vtop} or \cmd{box} or \cmd{copy}; this is not
implemented in \Tralics, you can insert text in math mode via \cmd{text} or
\cmd{hbox}. 

\ex{17.15} This shows the use of \cmd{mathchoice}.
\begin{verbatim}[numbers=left,firstnumber=last]
\def\puzzle{\mathchoice{D}{T}{S}{SS}}
\[\puzzle{\puzzle \over\puzzle^{\puzzle^\puzzle}} \qquad
\frac{\puzzle}{\puzzle^{\puzzle^\puzzle}} \]
\end{verbatim}
\def\puzzle{\mathchoice{D}{T}{S}{SS}}
\[\puzzle{\puzzle \over\puzzle^{\puzzle^\puzzle}} \qquad 
\frac{\puzzle}{\puzzle^{\puzzle^\puzzle}}\]
\ex{17.16} The \cmd{square} command is built-in: $\square$.

The \cmd{mathpalette} command is introduced in \Tralics\ 2.9.5, not tested
yet.
\begin{verbatim}[numbers=left,firstnumber=last]
\def\legendre{\overwithdelims()}\def\Legendre{\genfrac(){}{}}
\def\euler{\atopwithdelims<>}\def\Euler{\genfrac<>{0pt}{}}
\def\grimm{\abovewithdelims][4pt}\def\Grimm{\genfrac][{4pt}{}}
\[{a\legendre b}, \Legendre{a}{b}, {n \euler k}, \Euler{n}{k}, 
{\dfrac ab \grimm \dfrac cd}\Grimm{x}{y} \]
\end{verbatim}
\ex{17.17} Knuth says: the size of the surrounding delimiters depends only on
the  size, not on the size of the fractions, this is false for \Tralics:
\def\legendre{\overwithdelims()}\def\Legendre{\genfrac(){}{}}
\def\euler{\atopwithdelims<>}\def\Euler{\genfrac<>{0pt}{}}
\def\grimm{\abovewithdelims][4pt}\def\Grimm{\genfrac][{4pt}{}}
\[{a\legendre b}, \Legendre{a}{b}, {n \euler k}, \Euler{n}{k}, 
{\dfrac ab \grimm \dfrac cd}\Grimm{x}{y} \]

If $f$ is the value of \cmd{delimiterfactor} and $\delta$ the value of  
\cmd{delimitershortfall}, and we have a formula that extents $y_1$ units
above the axis, and $y_2$ units below, if $y=2\max(y_1,y_2)$, then the
delimiter size is at least $y\cdot f/1000$, and at least $y-\delta$.
This does not apply to \Tralics.

The remainder of the chapter discusses some low-level commands that are not 
fully implemented in \Tralics. The commands \cmd{textfont}, \cmd{scriptfont}
and \cmd{scriptscriptfont} take a small number as argument, and provide a
reference to a font. The following code
\begin{verbatim}[numbers=left,firstnumber=last]
\font\tenrm=somefont at 12pt
\font\Helvetica=someotherfont scaled 1013
\textfont0=\tenrm
\scriptscriptfont2=\scriptfont3
\the\fontdimen3\scriptscriptfont15
$\textfont0=\tenrm 9\hbox{$9\textfont0=\Helvetica$}$%
${\textfont0=\Helvetica 9}$ % exercise 17.18
\end{verbatim}
gives:
\font\tenrm=somefont at 12pt
\font\Helvetica=someotherfont scaled 1013
\textfont0=\tenrm
\scriptscriptfont2=\scriptfont3
\the\fontdimen3\scriptscriptfont15
$\textfont0=\tenrm 9\hbox{$9\textfont0=\Helvetica$}$%
${\textfont0=\Helvetica 9}$. % exercise 17.18. 
The dimension should be
zero, and the math formula contains three identical digits. Exercise 17.18
says that the fonts used by \TeX\ in the last case is not Helvetica.

You cannot use more than 16 different math fonts in a formula. Assume that you
need symbol A from font a; you can say that \cmd{textfont6} is your font a,
and your symbol is character 137 in that font. What if you want 
symbol B from font b? you can use font number 7, but this is obviously not the
solution. We explain here the amsmath strategy by telling what happens if you
use \cmd{tt} in a math formula. First of all, in a formula, this evaluates to
\cmd{mathtt}, and the real command is \cmd{@mathtt}. This is a self-modifying
command; after first use it is equivalent to \cmd{fam9} (this means that
normal characters in text size use the \cmd{textfont9}). The first use
allocates the number 9, and defines the font, moreover the font information is
remembered (the font \cmd{textfont9} will be defined for all subsequent math
formulas). Note that the value of \cmd{textfont9} can be cmtt12, but this is
recomputed if the current font size changes. For most other commands, the
number is allocated when the font is declared, this means that a slot is
allocated even when the font is never used.

Four slots are preallocated, with the names operators, letters, symbols and
largesymbols. If you load packages  amsmath, amscd, amssymb, and bm, four
other slots are used, and there are only 8 slots remaining. In the case of
this document, we test all 14 MathML fonts. How is this possible?
In fact some characters are typeset outside math mode (sans-serif characters
for instance) and in some cases poor-man-bold is used. Moreover, we had to
remove some font families (these are commented out in the file
\filename{raweb-uni.sty}). 

\ex{17.19} Math code are not implemented in \Tralics, \cmd{oplus} is character
U+2295 and \cmd{bullet} is character U+2022.

\begin{verbatim}[numbers=left,firstnumber=last]
\mathcode`<="2203 \mathcode`*="313C
\mathcode`a="8000 {\catcode`a=13 \gdef a{A}}
$a<b*c$ 
%\mathchardef\@M=10000
\end{verbatim}
In \TeX, the previous code is equivalent to $A*b<c$, in \Tralics, it gives:
{\mathcode`<="2203 \mathcode`*="313C
\mathcode`a="8000 {\catcode`a=13 \gdef a{A}}
$a<b*c$}. Since version 2.9.10, a capital letter A is produced.
The last line is commented out: the assignment is done at bootstrap.
You should use \cmd{@M} as the constant 10000, not as control-P in family 7
(binary operation).

Following code is unlikely to work
\begin{verbatim}[numbers=left,firstnumber=last]
\def\sum\{\mathchar"1350}
\mathchardef\sum"1350
\def\n@space{\nulldelimiterspace\z@ \m@th}
\newdimen\p@ \p@=1pt 
\def\bigl#{\mathopen{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}}
\delcode `x="123456
\def\langle{\delimiter"426830A }
\bigl\delimiter"426830A
\def\sqrt{\radical"270370 }
\def\idehat{\mathaccent"362 }
\end{verbatim}
\fi

\section{Fine points of Mathematics Typing, TB 18}
\ifTeXthree

\subsection{Punctuation}
Say: If $x<0$, we have shown that \[y=f(x).\]
Do not say: for $x = a, b$, or $c$, but: for $x=a$, $b$, $c$, or use a tie:
or~$c$. 
\ex{18.1} $R(n,t)=O(t^{n/2})$, as $t\to0^+$. Adding braces improves the Html version: ${R(n,t)}=O(t^{n/2})$.
\subsection{Non-italics letters in formulas}

\TeX\ has 32 predefined operators, some of them behave like sums according to
the placement of limits. 
\[\arccos_x +\arcsin_x + \arctan_x + \arg_x + \cos_x +
\cosh_x + \cot_x + \coth_x + \csc_x + \deg_x \]
\[\det_x +\dim_x + \exp_x + \gcd_x + \hom_x +\inf_x +\ker_x+
  \lg_x+  \lim_x+  \liminf_x\]
\[  \limsup_x+ \ln_x+   \log_x+  \max_x +  \min_x+  \Pr_x +
  \sec_x +   \sin_x +   \sinh_x +   \sup_x \]
\[   \tan_x  +\tanh_x + \injlim_x +\projlim_x\]
The last two operators are defined by amsmath. Variants shown later. More
formulas (there should be small space around these operators, that is
invisibile on my browser).
\begin{gather}
\sin2\theta=2\sin\theta\cos\theta\\
O(n\log n\log\log n)\\
Pr(X>x)=\exp(-x/\mu)\\
\displaystyle \max_{1\le n\le m}\log_2P_n\\
\displaystyle \lim_{x\to0}\frac{\sin x}{x}=1
\end{gather}
\ex{18.2}
\[p_1(n)=\lim_{m\to\infty}\sum_{\nu=0}^\infty\big(1-\cos^{2m}(\nu!^n\pi/n)\big)\]
Example of formulas using \cmd{rm}:
$\sqrt{{\rm Var}(X)}$, $x_{\rm max}-x_{\rm min}$,
${\rm LL}(k)\Rightarrow{\rm LR}(k)$, $\exp(x+{\rm constant})$,
and $x^3+{\rm lower\ order\ terms}$.

Some formulas using \cmd{hbox} for roman font:
$\sqrt{\hbox{Var}(X)}$,
$\hbox{LL}(k)\Rightarrow\hbox{LR}(k)$, $\exp(x+\hbox{constant})$,
and $x^3+\hbox{lower order terms}$.

The same formulas using \cmd{text} for roman font:
$\sqrt{\text{Var}(X)}$,
$\text{LL}(k)\Rightarrow\text{LR}(k)$, $\exp(x+\text{constant})$,
and $x^3+\text{lower order terms}$.

\begin{verbatim}[numbers=left,firstnumber=last]
\def\Varliminf{\mathop{\underline{\mathmo{lim}}}}
\def\Varlimsup{\mathop{\overline{\mathmo{lim}}}}
\[\lim_{n\to\infty}x_n\text{ exists}\iff 
\Varlimsup_{n\to\infty}x_n=\Varliminf_{n\to\infty}x_n.\]
\end{verbatim}

\ex{18.3}
\def\Varliminf{\mathop{\underline{\mathmo{lim}}}}
\def\Varlimsup{\mathop{\overline{\mathmo{lim}}}}
\[
\lim_{n\to\infty}x_n\text{ exists}\iff 
\limsup_{n\to\infty}x_n=\liminf_{n\to\infty}x_n.\]

\[
\lim_{n\to\infty}x_n\text{ exists}\iff 
\Varlimsup_{n\to\infty}x_n=\Varliminf_{n\to\infty}x_n.\]

The code above is wrong, because `lim' is a known operator, with movable
limits, hence, in non-display mode, both the underline and the real subscript
will move. The real definitions adds
\attpair{movablelimits}{false} to the operator. 

\begin{verbatim}[numbers=left,firstnumber=last]
$\gcd(m,n)=\gcd(n,m\bmod n)$, or $x\equiv y+1\pmod{m^2}$
$x\equiv0(\pmod y^n)$.
\end{verbatim}
Modulo: $\gcd(m,n)=\gcd(n,m\bmod n)$, or $x\equiv y+1\pmod{m^2}$
\ex{18.4} B.L. User got the unexpected formula $x\equiv0(\pmod y^n)$. 


\ex{18.5} In this example, there are braces around \LTC{n/p}, but not
\LTC{k/p}; this can affect the size of the slash operator (HTML version only).
\[\binom nk \equiv\binom{\lfloor {n/p}\rfloor}{\lfloor k/p\rfloor}
\binom{n \bmod p}{k \bmod p}\pmod p\]

Example of bold face $\bf a+b=\Phi_m$; normal Phi is U+03A6, bold Phi is
U+1D6BD, italic Phi is U+1D6F7, bold italic Phi is U+1D731, sans serif bold
Phi is U+1D76B, sans serif bold italic Phi is U+1D7A5. In the current version
of \Tralics, font changes apply only to ASCII letters. Commands like \cmd{cal}
are robust, so that 
\LTC{\$\textbackslash cal Ab\textbackslash Phi\$} produces $\cal Ab\Phi$;
command \cmd{mit} is not implemented. Note that in some cases, digits and
lower case letters do not exist in the font, and may be replaced by random
glyphs. 


\ex{18.6} If you want
$\bf\bar x^{\rm T}Mx={\rm0}\iff x=0$ in 
\Tralics\ 2.9.4, you have to explicitly say that you want a bold face zero, 
and an upright T, see below. In version 2.9.5, nothing special needed.
Note how we use colon-equal here.
\begin{verbatim}[numbers=left,firstnumber=last]
$\bf\bar x^{\mathmo{T}}Mx={\rm0}\iff x=\mathmn[mathvariant][bold]{0}$
Compare $This\ is\ math\ italics$ with {\it This is text italics}.
Compare $different$ and $\it different$. We have also
$\it last\mathmo{:=}first$, $\it x\_coord(point\_2)$
\end{verbatim}
Compare $This\ is\ math\ italics$ with {\it This is text italics}.
Compare $different$ and $\it different$. We have also
$\it last\mathmo{:=}first$, $\it x\_coord(point\_2)$. 

\ex{18.8} We use \cmd{mathit} instead of \cmd{it} here.
\[\mathit{available} +\sum_{i=1}^n\max(\mathit{full}(i),
\mathit{reserved}(i))= \mathit{capacity}\]

\ex{18.9} 
The following code was obtaining by taking the answer from the \TeX
book, with the following modifications: the \cmd{sfcode} of the semi colon not
changed; math formulas put outside scope of \cmd{bf}, because my browser shows
letters (not digits) in bold face otherwise. Note that the XML to HTML
processor converted the whole environment (seven paragraphs) into a single
paragraph 
with \elt{br} as separator (inter-paragraph width too big), and a huge
left margin (for fun). We show here the start of the code:
\begin{verbatim}[numbers=left,firstnumber=last]
\begin{xmlelement+}{pseudocode}\XMLaddatt{leftskip}{5cm}
\obeylines
\def\coleq{\mathmo{:=}}
\textbf{for} $j\coleq 2$ \textbf{step} $1$ \textbf{until} $n$ \textbf{do}
...
\end{xmlelement+}
\end{verbatim}


\begin{xmlelement+}{pseudocode}\XMLaddatt{leftskip}{5cm}
\obeylines
\def\coleq{\mathmo{:=}}
\textbf{for} $j\coleq 2$ \textbf{step} $1$ \textbf{until} $n$ \textbf{do}
\quad \textbf{begin} $\textit{accum}\coleq A[j]$; $k\coleq j-1$; $A[0]\coleq \mathit{accum}$;
\quad \textbf{while} $A[k]>\textit{accum}$ \textbf{do}
\qquad \textbf{begin} $A[k+1]\coleq A[k]$; $k\coleq k-1$;
\qquad \textbf{end};
\quad $A[k+1]\coleq \textit{accum}$;
\quad \textbf{end}.\par
\end{xmlelement+}

\subsection{Spacing between formulas}
Compare
\[F_n=F_{n-1}+F_{n-2}, n\ge 2.\]
with (lot of white space in the formula)
\[ F_n = F_{n-1} + F_{n-2}, \qquad n \ge 2. \]
and (no unnecessary white space in the formula)
\[F_n=F_{n-1}+F_{n-2},\hskip2em\relax n\ge2.\]
Normally, the spacing should be the same in the last two formulas. 
In fact, Knuth says that \cmd{quad} is the same as \cmd{hskip 1em}\cmd{relax}.
The translation of a \cmd{quad} in math mode is \elt{mspace width="1.em"},
but the \cmd{hskip} command reads a dimension, and converts one em into ten
points\footnote{Maybe, one day, \Tralics\ will have an em that depends on the context}. 

\ex{18.10} Three versions:

Let $H$~be a Hilbert space, \ $C$~a closed bounded convex subset
of~$H$, \ $T$~a non-expansive self map of~$C$. Suppose that as 
$n\to\infty$, \ $a_{n,k}\to0$ for each~$k$, and 
$\gamma_n=\sum_{k=0}^\infty(a_{n,k+1}-a_{n,k})^+\to0$. 
Then for each $x$~in~$C$, \ $A_nx=\sum_{k=0}^\infty a_{n,k}T^kx$ converges
weakly to a fixed point of~$T$.

Let $H$~be a Hilbert space,~~$C$~a closed bounded convex subset
of~$H$,~~$T$~a non-expansive self map of~$C$. Suppose that as 
$n\to\infty$,~~$a_{n,k}\to0$ for each~$k$, and 
$\gamma_n=\sum_{k=0}^\infty(a_{n,k+1}-a_{n,k})^+\to0$. 
Then for each $x$~in~$C$,~~$A_nx=\sum_{k=0}^\infty a_{n,k}T^kx$ converges
weakly to a fixed point of~$T$.

Let $C$ be a closed, bounded, convex subset of a Hilbert space $H$,
and let $T$ be a non-expansive self map of $C$. Suppose that as 
$n\to\infty$, we have $a_{n,k}\to0$ for each $k$, and 
$\gamma_n=\sum_{k=0}^\infty(a_{n,k+1}-a_{n,k})^+\to0$. 
Then for each $x$ in $C$, the infinite sum 
$A_nx=\sum_{k=0}^\infty a_{n,k}T^kx$ converges weakly to a fixed point of $T$.

Comments: the translation of the three characters: space, backslash, space is
formed of two spaces. Such a construct is used four times in the first
version. This produces a nice dvi file, but HTML interprets the double space
the same as a single space. In the second version, we have used a double tilde
character. This inhibits line breaks. (My browser does not seem to honor this).
No special characters appear in the last example. 

\subsection{Spacing within formulas}
\begin{verbatim}[numbers=left,firstnumber=last]
$a\,b\>c\;d\!e\quad f\qquad g\ h$~j
%\the\thinmuskip\the\medmuskip\the\thickmuskip
\end{verbatim}
The math spacing commands: $a\,b\>c\;d\!e\quad f\qquad g\ h~j$.
In \TeX, the value of the glue inserted depends on three registers:
\cmd{thinmuskip} (3mu), \cmd{medmuskip}
(4mu plus 2mu minus 4mu) and \cmd{thickmuskip} (5mu plus 5mu). You can try to
execute the line above that is commented out: all dimensions come out as 0mu
in \Tralics, but the math formula contains  0.166667em, 0.222222em, 0.277778em,
etc, this is the same as 3mu, 4mu and 5mu, because  1em=18mu. In \Tralics,
\cmd{mskip 18mu} is equivalent to \cmd{hskip1em}, and, as said above, this is
the same as \cmd{hskip10pt}. The same is true for \cmd{mkern18mu}; the
translation is an empty \elt{mspace} element, with attribute
\attpair{value}{10.0pt}. The amount of space given by backslash-space changed
from 6pt to 4pt (this is the same amount of space used by the \cmd{text}
command). 

\begin{verbatim}[numbers=left,firstnumber=last]
$\int_0^\infty f(x)\,dx$, $y\,dx-x\,dy$, $dx\,dy=r\,dr\,d\theta$, $x\,dy/dx$
\end{verbatim}
Translation $\int_0^\infty f(x)\,dx$, $y\,dx-x\,dy$, $dx\,dy=r\,dr\,d\theta$,
$x\,dy/dx$.
\ex{18.11}
\[ \int_1^x\frac{dt}{t}\qquad \int_0^\infty\frac{t-ib}{t^2+b^2}e^{iat}\,dt=
e^{ab}E_1(ab),\qquad a,b>0\]
\begin{verbatim}[numbers=left,firstnumber=last]
$55\,\mathrm{mi/hr}$, $g=9.8\,\mathrm{m/sec}^2$,
$1\mathrm{ml}=1.000028\,\mathrm{cc}$ 
\end{verbatim}
Units: $55\,\mathrm{mi/hr}$, $g=9.8\,\mathrm{m/sec}^2$,
$1\mathrm{ml}=1.000028\,\mathrm{cc}$. Note that digits are outside the scope
of \cmd{mathrm}.
\ex{18.12} Inline math, displaystyle: 
$\displaystyle\hbar=1.054\times10^{-27}\,\mathrm{erg}\,\mathrm{sec}.$
\begin{verbatim}[numbers=left,firstnumber=last]
$(2n)!/\bigl(n!\,(n+1)!\bigr)$, $\sqrt2\,x$,
$\sqrt{\,\log x}$, $O\bigl(1/\sqrt n\,\bigr)$,
$[\,0,1)$, $\log n\,(\log\log n)^2$, $x^2\!/2$, $n/\!\log n$, 
$\Gamma_{\!2}+\Delta^{\!2}$, $R_i{}^j{}_{\!kl}$, $\int_0^x\!\int_0^y dF(u,v)$ 
 \[\frac{52!}{13!\,13!\,26!}\qquad \int\!\!\!\int_D dx\,dy\]
\end{verbatim}
Test:
$(2n)!/\bigl(n!\,(n+1)!\bigr)$, $\sqrt2\,x$,
$\sqrt{\,\log x}$, $O\bigl(1/\sqrt n\,\bigr)$,
$[\,0,1)$, $\log n\,(\log\log n)^2$, $x^2\!/2$, $n/\!\log n$, 
$\Gamma_{\!2}+\Delta^{\!2}$, $R_i{}^j{}_{\!kl}$, $\int_0^x\!\int_0^y dF(u,v)$ 
\[\frac{52!}{13!\,13!\,26!}\qquad \int\!\!\!\int_D dx\,dy\]
%
Same formulas, without thin spaces\\
Test:
$(2n)!/\bigl(n!(n+1)!\bigr)$, $\sqrt2 x$,
$\sqrt{\log x}$, $O\bigl(1/\sqrt n\bigr)$,
$[0,1)$, $\log n(\log\log n)^2$, $x^2/2$, $n/\log n$, 
$\Gamma_{2}+\Delta^{2}$, $R_i{}^j{}_{kl}$, $\int_0^x\int_0^y dF(u,v)$ 
\[\frac{52!}{13!13!26!}\qquad \int\int_D dx\,dy\]

Amaya shows a strange behavior here. Without the space the first integral is
larger than the second. In thee case of negative space, the absolute value is
used. 

\ex{18.14} intervals with left/right: 
$\left]-\infty,T\right[\times\left]-\infty,T\right[$;
with mathopen, mathclose 
$\mathopen]-\infty,T\mathclose[\times\mathopen]-\infty,T\mathclose[$;
with nothing $]-\infty,T[\times]-\infty,T[$. And with left/right: 
$\left]-\infty,\frac{3}{4}\right[\times\left]-\infty,\frac{3}{4}\right[$;
with mathopen, mathclose 
$\mathopen]-\infty,\frac{3}{4}\mathclose[\times\mathopen]-\infty,\frac{3}{4}\mathclose[$;
with nothing $]-\infty,\frac{3}{4}[\times]-\infty,\frac{3}{4}[$.

\ex{18.15} The spacing in $x++1$  differs between \TeX\ and MathML.

\subsection{Ellipses}
\begin{verbatim}[numbers=left,firstnumber=last]
$x_1+\cdots+x_n$, $x_1=\cdots=x_n=0$, $A_1\times\cdots\times A_n$,
$f(x_1,\ldots,x_n)$, $x_1x_2\ldots x_n$, $(1-x)(1-x^2)\ldots(1-x^n)$,
$n(n-1)\ldots(1)$.
\end{verbatim}
Translation of these formulas $x_1+\cdots+x_n$, $x_1=\cdots=x_n=0$, $A_1\times\cdots\times A_n$,
$f(x_1,\ldots,x_n)$, $x_1x_2\ldots x_n$, $(1-x)(1-x^2)\ldots(1-x^n)$,
$n(n-1)\ldots(1)$.
\ex{18.16} Answer $x_1+x_1x_2+\cdots+ x_1x_2\ldots x_n$,
$(x_1,\ldots,x_n)\cdot(y_1,\ldots,y_n)=x_1y_1+\cdots+x_ny_n$.
Prove that $(1-x)^{-1}=1+x+x^2+\cdots\,$. Clearly $a_i<b_i$, for $i=1$,~2,
$\ldots\,$,~$n$. The coefficients $c_0$,~$c_1$, \dots,~$c_n$ are positive.
With braces surrounding the LHS: ${(1-x)^{-1}}=1+x+x^2+\cdots\,$.

\ex{18.17} Clearly $a_i<b_i$, for $i=1,2,\ldots,n$.  Note that the `2' here is
a math digit, while it is text digit in the sentence above.
\ex{18.18} Knuth used \cmd{dots}.

\subsection{Line breaking}
The \TeX\ book explains how \TeX\ can break a math formula. This does not
apply to \Tralics. Commands \cmd{nobreak} and \cmd{allowbreak}
do nothing in math mode.

\subsection{Braces}
You should use braces only for grouping. You can use a brace character via
\cmd{\char`\{} in text or math mode. This character is a delimiter (it can be
preceded by \cmd{left} or \cmd{big}).
\begin{verbatim}[numbers=left,firstnumber=last]
$\{a,b,c\}$, $\{1,2,\ldots,n\}$, $\{\mathrm{red,white,blue}\}$
$\{\,x\mid x>5\,\}$, $\{\,x:x>5\,\}$, 
$\bigl\{\,\bigl(x,f(x)\bigr)\bigm|x\in D\,\big\}$
$\bigl\{\,\bigl(x,f(x)\bigr)\bigm\mid x \in D\,\big\}$
$\bigl\{\,\bigl(x,f(x)\bigr)\mid x\in D\,\big\}$
\end{verbatim}

Translation
$\{a,b,c\}$, $\{1,2,\ldots,n\}$, $\{\mathrm{red,white,blue}\}$,
$\{\,x\mid x>5\,\}$, $\{\,x:x>5\,\}$,
$\bigl\{\,\bigl(x,f(x)\bigr)\bigm|x\in D\,\big\}$
$\bigl\{\,\bigl(x,f(x)\bigr)|x\in D\,\big\}$.
Note that \cmd{mid} gives better spacing than a single bar
$\bigl\{\,\bigl(x,f(x)\bigr)\bigm\mid x \in D\,\big\}$,
$\bigl\{\,\bigl(x,f(x)\bigr)\mid x\in D\,\big\}$.
\ex{18.21} $\bigl\{x^3\mid h(x) \in\{-1,0,+1\}\,\bigr\}$
\ex{18.22} $\{\,p\mid p$~and $p+2$ are prime$\,\}$.

We show here the use of the cases enviroment, this is a two-column cmatrix,
with a left brace delimiter on the left.
\[|x| = \begin{cases}x,&\text{if } x\ge 0;\\-x,&\text{otherwise}.
 \end{cases}\]
\[f(x) = \begin{cases}1/3&\text{if } 0\le x\le 1;\\
2/3&\text{if } 3\le x\le 4;\\[3mm]
1/3&\text{elsewhere};
\end{cases}\]
\ex{18.23} The \cmd{cases} command is not implemented, but there is 
a environment. You cannot use \cmd{noalign}. After a double backslash you can
put a dimension in brackets, but this is currently ignored. 
\begin{verbatim}[numbers=left,firstnumber=last]
\[\overbrace{x+\cdots+x}^{k\; \textrm{times}} \qquad \underbrace{x+y+z}_{>\,0}\]
\end{verbatim}
We show here braces can stretch horizontally, when used as over-accent or
under-accent.  
\[
\overbrace{x+\cdots+x}^{k\; \textrm{times}} \qquad 
\underbrace{x+y+z}_{>\,0}
\]

\subsection{Matrices}
The plain \TeX\ command \cmd{matrix} should not be used. The `array'
environment can be used in math mode, and you must specify for each column the
alignment method. The `matrix' environment can be used, cells are centered. He
we use `pmatrix', because it adds automatically parentheses. In
\Tralics\ 2.14.2 there is a possibility to put an attribute pair on
the current table. 
\begin{verbatim}[numbers=left,firstnumber=last]
\[A=\begin{pmatrix}x-\lambda&1&0\\0&x-\lambda&1\\0&0&x-\lambda\end{pmatrix}\]
\[\begin{pmatrix}a&b&c\\d&e&f\tableattribute{A}{B}\end{pmatrix}\mathattribute{C}{D}
\begin{pmatrix}u&x\\v&y\\w&z\end{pmatrix}\]
\end{verbatim}
\[A=\begin{pmatrix}x-\lambda&1&0\\0&x-\lambda&1\\0&0&x-\lambda\end{pmatrix}\]
\[\begin{pmatrix}a&b&c\\d&e&f\tableattribute{A}{B}\end{pmatrix}\mathattribute{C}{D}
\begin{pmatrix}u&x\\v&y\\w&z\end{pmatrix}\]
\ex{18.24} This looks bad in the HTML version, but it OK is Pdf. Delimiters
are \cmd{lgroup} and \cmd{rgroup}.
\[\left\lgroup\begin{matrix}a&b&c\\d&e&f\end{matrix}\right\rgroup
\left\lgroup\begin{matrix}u&x\\v&y\\w&z\end{matrix}\right\rgroup\]

\ex{18.25}
\[A=\begin{pmatrix}
a_{11}&a_{12}&\ldots&a_{1n}\\
a_{21}&a_{22}&\ldots&a_{2n}\\
\vdots&\vdots&\ddots&\vdots\\
a_{m1}&a_{m2}&\ldots&a_{mn}\\
\end{pmatrix}\qquad \begin{pmatrix}y_1\\\vdots\\y_k\end{pmatrix}\]

Border matrix\footnote{Command \cmd{bordermatrix} not yet implemented}

\def\Atop#1#2{\genfrac{}{}{0pt}{}{#1}{#2}}
Small matrices $\binom{1\,1}{0\,0}$ and $\bigl(
\Atop{a}{l}\Atop{b}{m}\Atop{c}{n}\bigr)$. Note that horizontal alignment is
only approximative.

\subsection{Vertical Spacing}
\begin{verbatim}[numbers=left,firstnumber=last]
\def\Limsup{\mathop{\smash\limsup\vphantom\liminf}}
$\Limsup\limits_3=\limsup\limits_3$
\end{verbatim}
\def\Limsup{\mathop{\smash\limsup\vphantom\liminf}}
Compare: $\Limsup\limits_3=\limsup\limits_3$! The second index should be lower
than the first.

Commands \cmd{raise} and  \cmd{lower} not yet implemented. 
Commands \cmd{llap} and  \cmd{rlap} not yet implemented.\footnote{Fixme}

\begin{verbatim}[numbers=left,firstnumber=last]
\def\undertext#1{$\underline{\hbox{#1}}$}
\undertext{This} \undertext{does} \undertext{not} \undertext{always}
\undertext{work} \undertext{right}. 
\def\undertext#1{$\underline{\smash{\hbox{#1}}}$}
\undertext{This} \undertext{does} \undertext{not} \undertext{always}
\undertext{work} \undertext{right}.
\end{verbatim}
\ex{18.26} 
\def\undertext#1{$\underline{\hbox{#1}}$} A sentence where each word is an
underlined math formula (text only):
\undertext{This} \undertext{does} \undertext{not} \undertext{always}
\undertext{work} \undertext{right}. The same, where the \cmd{smash} is used to
hide the depth of the text (all lines vertically aligned):
\def\undertext#1{$\underline{\smash{\hbox{#1}}}$}
\undertext{This} \undertext{does} \undertext{not} \undertext{always}
\undertext{work} \undertext{right}.

\begin{verbatim}[numbers=left,firstnumber=last]
$\rm Fe_2^{+2}Cr_2^{\vphantom{+2}}O_4^{\vphantom{+2}}$
\end{verbatim}
Use of phantoms: $\rm Fe_2^{+2}Cr_2^{\vphantom{+2}}O_4^{\vphantom{+2}}$

\subsection{Special features for math hackers}

Commands \cmd{nonscript}, \cmd{everymath} and \cmd{everydisplay} are OK.
\begin{verbatim}[numbers=left,firstnumber=last]
{\everydisplay{a}\everymath{b} \def\X{x\nonscript\qquad y}
\[u = \text{ v $w$ }\frac{\X}{\textstyle\X} \]}
\end{verbatim}
{\everydisplay{a}\everymath{b} \def\X{x\nonscript\qquad y}
\[u = \text{ v $w$ }\tfrac{\scriptstyle\X}{\textstyle\X} \]}


\subsection{Summary}

\ex{18.27} $n^{\rm th}$ from the \TeX book, $n^{\mathrm{th}}$ is \LaTeX, and
$n$\textsuperscript{th} is textsuperscript.  
\ex{18.28} $\textbf{S^{\mathnormal{-1}} TS=dg}(\omega_1,\ldots,\omega_n)
\textbf{\Lambda}$, uses \cmd{mathnormal}, no bf lambda?
\ex{18.29} $\Pr(\,m=n\mid m+n=3\,)$.
\ex{18.30} $\sin18^\circ=\frac14(\sqrt5-1)$.
\ex{18.31} $k=1.38\times10^{-16}\,\mathrm{erg}/^\circ \mathrm{K}$.
\ex{18.32} $\bar\Phi\subset NL_1^*/N=\bar L_1^*\subseteq\cdots\subseteq 
NL_n^*/N=\bar L_n^*$.
\ex{18.33} $I(\lambda)=\int\!\!\int_Dg(x,y)e^{i\lambda h(x,y)}\,dx\,dy$.
\ex{18.34} $\int_0^1\!\cdots\int_0^1f(x_1,\ldots,x_n)\,dx_1\ldots\,dx_n$.
Note: Firefox shows small integral signs, and larger ones in the previous
exercise. 
\ex{18.35} Using cases environment
\[x_{2m}\equiv\begin{cases}Q(X_m^2-P_2W_m^2)-2S^2& (m\text{ odd})\\[2pt]
P_2^2(X_m^2-P_2W_m^2)-2S^2& (m\text{ even})
\end{cases} \pmod N.\]
\ex{18.36} with a \cmd{frac}
\[(1+x_1z+x_1^2z+\cdots\,)\ldots(1+x_nz+x_n^2z^2+\cdots\,)=
\frac{1}{(1-x_1z)\ldots(1-x_nz)}\]
\ex{18.37}
\[\prod_{j\ge0}\biggl(\sum_{k\ge0}a_{jk}z^k\biggr)=\sum_{n\ge0}z^n\,\Biggl(
\sum_{\scriptstyle k_0,k_1,\ldots\ge0\atop\scriptstyle k_0+k_1+\cdots=n}
a_{0k_0}a_{1k_1}\ldots\,\biggr).\]
\ex{18.38} Using \cmd{frac} and \cmd{binom}
\[\frac{(n_1+n_2+\cdots+n_m)!}{n_1!\,n_2!\ldots n_m!}=
\binom{n_1+n_2}{n_2}\binom{n_1+n_2+n_3}{n_3}\ldots\binom{n_1+n_2+\cdots+n_m}{n_m}.\]
\ex{18.39} Using \cmd{genfrac}
\[\def\\#1#2{(1-q^{#1_#2+n})}
\Pi_R\genfrac[]{0pt}{}{a_1,a_2,\ldots,a_M}{b_1,b_2,\ldots,b_M}=
\prod_{n=0}^R\frac{\\a1\\a2\ldots\\aM}{\\b1\\b2\ldots\\bN}.\]
\ex{18.40}
\[\sum_{p\;\mathrm{prime}}f(p)=\int_{t>1}f(t)\,d\pi(t).\]
\begin{verbatim}[numbers=left,firstnumber=last]
\def\X{\char`'}
\[{
\{\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a\X\mathrm{s}},
  \overbrace{\mathstrut
    b,\ldots,b}^{l\;b\X\mathrm{s}}}_{k+l\;\mathrm{elements}}\}
}\quad\text{vs}\qquad {
{\{\,}\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a'\mathrm{s}},
  \overbrace{\mathstrut
    b,\ldots,b}^{l\;b'\mathrm{s}}}_{k+l\;\mathrm{elements}}{\}\,}.}\]
\end{verbatim}
\ex{18.41} In this formula, we want the denote the plural of the token $a$ by
as apostrophe followed by the letter s. The first attempt is not good. The
second is a bit better, because it is a-prime followed by s. The first
expression is formed of open brace, underbraced formula, closing brace; and this
produces large braces in the HTML version; small braces are obtaing by
replacing the first token by a list, containing the brace and little bit space. 
\def\X{\char`'}
\[{
\{\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a\X\mathrm{s}},
  \overbrace{\mathstrut
    b,\ldots,b}^{l\;b\X\mathrm{s}}}_{k+l\;\mathrm{elements}}\}
}\quad\text{vs}\qquad {
{\{\,}\underbrace{\overbrace{\mathstrut a,\ldots,a}^{k\;a'\mathrm{s}},
  \overbrace{\mathstrut
    b,\ldots,b}^{l\;b'\mathrm{s}}}_{k+l\;\mathrm{elements}}{\}\,}.}\]


\ex{18.42}
\[\begin{pmatrix}
\begin{pmatrix}a&b\\c&d\end{pmatrix}&
\begin{pmatrix}e&f\\g&h\end{pmatrix}\\
0&\begin{pmatrix}i&j\\k&k\end{pmatrix}
\end{pmatrix}.\]

A non trivial question: what is the distance $X$ between two lines in a matrix
like these? or said otherwise, what is the vertical glue $Y$ added between two
lines? Let $x$ be the value of \cmd{baselineskip}, $y$ the value of
\cmd{lineskiplimit} and $z$ the value of \cmd{lineskip}. Then, the quantity
$y$ is computed so that $X=x$, unless this gives $Y<y$, case where $z$ is used
instead. Typically, for a normal paragraph, $x=12$, $y=0$, $z=1$, and for a
`align' environment, we have $x=15$, $y=3$, $z=4$. In the case of an array,
all three values are zero. This means: normal baseline in a paragraph is 12pt,
but there is at least one pt between two lines, and in the case of multiline
equations, the baseline is larger, as well as the clearance. In the case of an
array, no extra space is added. However, a strut is added to each line, this
is an invisible rule; as a consequence, the total height plus depth of each
line is the matrix is at least 12pt, hence $X$ is at least 12pt.

This has as consequence that, in the big matrix above, parentheses do touch.
We changed, in the file \filename{raweb-cfg.sty}, the code of the \cmd{@array} command:
$z=5$,  and $y$ is 3 or 5, depending on whether the `displaystyle' attribute
array of the  array is true (if the attribute is true, then all entries are
typeset in \cmd{display} mode; this is the case for all environments like
`gather' or `align' that are translated by \Tralics\ as an array).


\ex{18.43} Note: entries are left aligned because of explicit \cmd{hfil}.
\[\det\begin{vmatrix}
c_0\hfil&c_1\hfil&c_2\hfil&\ldots&c_n\hfil\\
c_1\hfil&c_2\hfil&c_3\hfil&\ldots&c_{n+1}\hfil\\
c_2\hfil&c_3\hfil&c_4\hfil&\ldots&c_{n+2}\hfil\\
\vdots\hfil&\vdots\hfil&\vdots\hfil&&\vdots\hfil\\
c_n\hfil&c_{n+1}\hfil&c_{n+2}&\ldots&c_{2n}\hfil\\
\end{vmatrix}
\]

\ex{18.44} 
\[\mathop{{\sum}'}_{x\in A}f(x)\mathrel{\mathop=^{\mathrm{def}}}
\sum_{\scriptstyle x\in A\atop\scriptstyle x\ne 0}f(x).\]

\ex{18.45} This is not so nice 
\[{2\uparrow\uparrow k}\mathmo{^^^^225d}2^{2^{2^{\cdot^{\cdot^{\cdot^2}}}}}
\left.\vphantom{\frac12}\right\}k\]

\ex{18.46} Vertical arrow centered via the use of phantom on the left;
command \cmd{hidewidth} not used (the purpose of the command is to make
\cmd{halign} believe that the cell has a very small width; this will produce
an overfull box, but who cares: there is enough white space at both ends).

\[
\def\mapright#1{\smash{\mathop{\rightarrow}\limits^{#1}}}
\def\mapdown#1{\hphantom{{\scriptstyle#1}}\downarrow{\scriptstyle#1}}
\begin{matrix}
&&&&&&0\\
&&&&&&\mapdown{}\\
0&\mapright{}&\mathcal{O}_k&\mapright\iota&\mathcal{E}&\mapright\rho&
\mathcal{L}&\mapright{}&0\\
&&\Vert&&\mapdown\phi&&\mapdown\psi\\
0&\mapright{}&\mathcal{O}_C&\mapright{}&\pi_*\mathcal{O}_D&\mapright\delta&
R^1f_*\mathcal{O}_V(-D)&\mapright{}&0\\
&&&&&&\mapdown{\theta_i\otimes\gamma^{-1}}\\
&&&&&&R^1f_* \big(\mathcal{O}_V(-iM)\big)\otimes\gamma^{-1}\\
&&&&&&\mapdown{}\\
&&&&&&0
\end{matrix}
\]

\fi
\section {Displayed Equations, TB19}
\ifTeXfour

\subsection{One-line displays}
\tagasattribute
Example of a display, containing only text
$$\hbox{Displayed Text}$$
Another one, with text and math
$$X_n=X_k \qquad\hbox{if and only if}\qquad Y_n=Y_k\quad
   \text{and}\quad Z_n=Z_k.$$

Compare the following two examples: the translation is the same, but you cannot
put arbitrary text in a math formula! 
\begin{verbatim}[numbers=left,firstnumber=last]
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q \qquad\hbox{for all }n\ge 0.$$
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q\qquad\hbox{for all $n\ge0$}.$$
\end{verbatim}
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q \qquad\hbox{for all }n\ge 0.$$
$$Y_n=X_n\bmod p \quad\hbox{and}\quad Z_n=X_n\bmod q \qquad\hbox{for all $n\ge 0$}.$$
%$

\ex{19.1} The exercise  contains four formulas; for the first three ones, we
give a \LaTeX\ variant. For the first formula, the delimiters hace different
sizes. 
\begin{verbatim}[numbers=left,firstnumber=last]
$$\sum_{n=0}^\infty a_nz^n\qquad \hbox{converges if}\qquad |z| <
\Bigl(\limsup_{n\to\infty}\root n\!\of{|a_n|}\,\Bigr)^{-1}.$$
\[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
(\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}{\,)}^{-1}. \]
\[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
(\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}\,)^{-1}. \]
\end{verbatim}
$$\sum_{n=0}^\infty a_nz^n\qquad \hbox{converges if}\qquad |z| <
\Bigl(\limsup_{n\to\infty}\root n\!\of{|a_n|}\,\Bigr)^{-1}.$$
\[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
(\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}{\,)}^{-1}. \]
\[\sum_{n=0}^\infty a_nz^n\qquad \text{converges if} \qquad |z| <
(\limsup_{n\to\infty}\sqrt[n\!]{|a_n|}\,)^{-1}. \]

Next two formulas.
\begin{verbatim}[numbers=left,firstnumber=last]
$${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad \hbox{as $\Delta\to0$.}$$
\[\frac{f(x+\Delta x)-f(x)}{\Delta x}\to f'(x)\qquad \text{as }\Delta\to0.\]
$$\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$
\[\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\text{if } i\ne j.\]
\end{verbatim}
$${f(x+\Delta x)-f(x)\over\Delta x}\to f'(x)\qquad \hbox{as $\Delta\to0$.}$$
\[\frac{f(x+\Delta x)-f(x)}{\Delta x}\to f'(x)\qquad \text{as }\Delta\to0.\]
$$\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\hbox{if $i\ne j$.}$$
\[\|u_i\|=1,\qquad u_i\cdot u_j=0\quad\text{if } i\ne j.\]
Last formula; you cannot use the \cmd{matrix} command defined by plain \TeX,
but you have to use the \LTC{matrix} environment.
\begin{verbatim}[numbers=left,firstnumber=last]
\[\it\text{The confluent image of}\quad
\begin{Bmatrix}\text{an arc}\hfill\\\text{a circle}\hfill\\\text{a fan}\hfill
\end{Bmatrix}
\quad\text{is}\quad
\begin{Bmatrix}\text{an arc}\hfill\\\text{an arc or a circle}\hfill\\
\text{a fan or an arc}\hfill\end{Bmatrix}.\]
\end{verbatim}
\[\it\text{The confluent image of}\quad
\begin{Bmatrix}\text{an arc}\mathattribute{mathvariant}{italic}
\hfill\\\text{a circle}\hfill\\\text{a fan}\hfill
\end{Bmatrix}
\quad\text{is}\quad
\begin{Bmatrix}\text{an arc}\hfill\\\text{an arc or a circle}\hfill\\
\text{a fan or an arc}\hfill\end{Bmatrix}.
\]

Since version 2.9.5, you can use font changes in \cmd{text} commands and
friends (the previous formula is in italics). This is a more elaborate example
\begin{verbatim}[numbers=left,firstnumber=last,style=latex]
$\hbox{upright} \it \text{Italic\bf Boldface} {\tt \text{x = y$^2$}}$
\end{verbatim}
Translation: $\hbox{upright} \it \text{Italic\bf Boldface} {\tt \text{x = y$^2$}}$.

\ex{19.2} Compare B. L. User's solution, Knuth's solutions and \cmd{tfrac}:
\[y=\frac{\scriptstyle 1}{\scriptstyle 2}x
\quad\text{vs}\quad{\textstyle y=\frac 12x}\quad\text{vs}\quad \tfrac12x\]


\ex{19.3} We demonstrate in this example that using 
\LTC{\$\$\cmd{hbox}\argument{\$formula\$}\$\$} is non-trivial.
\begin{verbatim}[numbers=left,firstnumber=last]
\everymath={A}
\everyhbox={B}
\def\X{\ifhmode H\else \ifvmode V \else \ifmmode M \else U\fi\fi\fi}
\def\Y{\X\ensuremath{\beta}}
$$ \Y\hbox{\X$\Y $\X}\Y \text{\X}$$
\end{verbatim}

%$

\begingroup
\everymath={A}
\everyhbox={B}
\def\X{\ifhmode H\else \ifvmode V \else \ifmmode M \else U\fi\fi\fi}
\def\Y{\X\ensuremath{\beta}}
$$ \Y\hbox{\X$\Y $\X}\Y \text{\X}$$
\endgroup

Guess what happens if \cmd{X} were replaced by \cmd{Y}? the problem might be
solved in a future version. Note that \cmd{text} does not insert the
every-hbox token list.


\ex{19.4} Look at these four identical formulas.
\[1-\frac 12+\frac 13-\frac 14 +\cdots = \ln2 
\]
\[1-\frac 12+\frac 13-\frac 14 +\cdots = \ln2 
\eqno(14)
\]
\[1-\frac 12+\frac 13-\frac 14 +\cdots = \ln2 
   \formulaattribute{eqleft}{true}%
\eqno(14)
\]
\[1-\frac 12+\frac 13-\frac 14 +\cdots = \ln2 
   \formulaattribute{eqleft}{true}%
\]


In \TeX, equations are centered, and an equation number is added to the left
or the right. In the HTML version, an equation-with-number is a 3-column
table, columns 1 and 3 are of width 4em (this is defined in the CSS file),
one of them contains the equation number. If the equation  number is big, the
width of the column might be larger than 4em, columns 1 and 3 could have
different widths, so that column 2 is not centered. Otherwise it is centered,
and the equation is centered in column 2 (is there a way to do this better?)

Normally, there should be a way to put the equation at some position (say 3cm
from the left margin). This is done in \LaTeX\ via a package option (can we
easily modify \LaTeX\ so that each equation can be centered or not?). In this
examples, first two formulas should be centered, other ones should flushed
left. Equations two and three have a number. 

{\bf Note on Equation Numbering} For a very long time, I have used the
\cmd{eqno} command without any difficulty; of course, you have to be very
careful if you introduce an equation between equations (11) and (12), you
have to change every reference for any equation starting with 12. A big
advantage of \LaTeX\ is its automatic numbering scheme; more precisely if
you flag an equation with \cmd{label}\argument{eq+12}, you can get its number
via \cmd{ref}\argument{eq+12} (the only difficulty then is to find mnemonic
tag names). In a first pass, \LaTeX\ computes the value of the label, and
stores it in a file, in a second pass, it reads the file, and uses this
number. No number is computed by \Tralics, in some cases, this can be
annoying. A side effect of the translation of the \cmd{label} command is the
addition of an id (for instance `id12' to the equation\footnote{The label name
provided by the user cannot be used since it is an invalid XML id in this case}), and translation of
the \cmd{ref} is a \elt{ref} element with a reference to the id. 

Equation numbers are computed by the XML-to-whathever processor.
In fact, in the case of conversion from XML to HTML, the style sheet computes
the equation number twice: once when the equation is converted, and once when
the \elt{ref} is converted. In the case of XML to XSL/FO, a number is computed
only for \elt{ref}, the equation number is added to the equation by \LaTeX,
when the  XSL/FO is converted to Pdf (this is not really important, because
nobody looks at the FO file).


Assume that you have hundreds of equations, and you want to refer the previous
one; very often it is tagged `(*)', in some cases `(**)'. Some people use
`(***)'. Exercise 19.7 that follows says that, in math mode, these come out as
$(*)$, in some cases $(**)$ and $(***)$. In particular, a non-trivial question
is: should equation numbers by typeset as math or as text? In \Tralics, we
implemented  \cmd{eqno} and \cmd{tag}; that's a bit tricky, let's explain
some difficulties.

\begin{itemize}
\item The MathML recommendation says: automatic equation numbering and
  automatically resolving references to equations is outside the scope of
  MathML, but can be done by use of style sheets or other means. ``The
\elt{mlabeledtr} construction provides support for both of these functions in
a way that is intended to facilitate XSLT processing''.  The idea is to
construct an array, the first column contains equation numbers, with an
attribute that says if the tag should be on the left or the right.
This allows more than one tag per formula (there can be more than one row).
The problem is that my browser ignores the whole line. This is bad news.
\item The current implementation is: if the formula has a label, it has an
  equation number. It cannot have more than one label/id/equation number.
(here `formula' designates the element that contains the translated math
formula). The style sheet computes the equation number via
  \XC{<xsl:number} \XC{level='any'} \XC{count='formula[@id]'} \XC{/>}.
\item What happens if a formula has a tag and a label? Currently the tag is
  ignored. What we should do is modify the template above (count all formulas
  with id and without tags), this gives a value if the equation has no tag,
  and use the value of the tag otherwise. Note that, if you say
  \cmd{tag}\argument{x}, this gives $(x)$ as equation number, and \cmd{eqref}
  gives this value back. On the other hand, \cmd{eqno(x)} is equivalent to
\cmd{tag*}\argument{(x)}.
\item If a tag is part of a math formula, it can consist in any math
  construct. In our implementation, it may be an attribute so that only
  characters are allowed. You cannot use $\alpha$ or $\beta$ as tag. 
In \LaTeX, tags are typeset in text mode, and math shift characters are
sometimes used. These are removed by \Tralics.
\item A tag can appear anywhere in a formula, and more than one tag can be
  used. Thus \Tralics\ reads all tags and merges them (it complains if more
  than one label appears in a formula).
\item The final tag, after merge, removal of special characters, etc., is
  passed to a command; you can redefine it. In general it will either typeset
  the tag, or convert it to an attribute.
\end{itemize}


Summary: There are three ways to obtain an equation number.
First, if an equation has a label, an equation number will be assigned to it
automatically, when converting from XML to HTML, or whatever. The second method
consists in using the amsmath command \cmd{tag}, described below. Finally, you
can use the \TeX\ command \cmd{eqno}. This command reads everything up to the
end of the formula, expanding tokens when needed; if this yields \LTC{foo},
then \cmd{y@tag}\argument{foo} is evaluated again; this the same as if you said
\cmd{tag*}\argument{foo}. Its effect by default is to convert the tag as an
attribute to the formula.
 Moreover, the attribute \XC{eqnpos} is added to the
formula, with a value of \XC{left} and \XC{right}, depending on whether
\cmd{leqno} or \cmd{eqno} has been used. The equals signs should be aligned
for the five next formulas.
$$x^2-y^2=(x+y)(x-y).\eqno(15R)$$
$$x^2-y^2=(x+y)(x-y).\leqno(15L)$$

Equation number of \eqref{xxleft} is on the left, of \eqref{xxright} on the
right, and \eqref{xxdefault} depends on the class option.
$$x^2-y^2=(x+y)(x-y).\label{xxleft}\formulaattribute{eqnpos}{left}$$
$$x^2-y^2=(x+y)(x-y).\label{xxright}\formulaattribute{eqnpos}{right}$$
$$x^2-y^2=(x+y)(x-y).\label{xxdefault}$$


\ex{19.5} 

\[\prod_{k\ge0}\frac{1}{1-q^kz}=\sum_{n\ge0}z^n/ \,\,\prod_{1\le k\le
  n}(1-q^k).\eqno(16')\]

\ex{19.6} In \TeX, you can put an en-dash in an equation number by using
\cmd{hbox}. This is not allowed in \Tralics: the equation $1=1$ below gives an
error. On the other hand, any character can be put in an equation number; the
case of an apostrophe is a bit special: it is not converted to an exponent,
but replaced by \cmd{apostrophe}.

The example below illustrates one complexity. The end of the tag (via
\cmd{eqno}) is the end of the formula. In order to get the end of the formula,
all tokens have to be expanded. The question is what to do with \cmd{char}:
remember that this command reads and typesets a character. In this case it
cannot typeset a character; assume that we delay its interpretation. In this
case, the command that follows the backquote will be expanded (this is wrong:
we do not want to put an acute accent somewhere). Hence, the \cmd{char}
command reads a character, and pushes back a character token, with the same
value, but category code 12. We explained above that \cmd{mathchar} is not
implemented. This means that there is one and only one active math character:
the apostrophe, it produces a prime exponent even when it has category code
12. This is not desired: a tag should consist in characters only. This
explains why something special is done. You can define the \cmd{apostrophe}
command as you like (the default value is character U+B4, but you can use an
apostrophe, case where an exponent will be created when the token list is read
again; formula $2=2$ gives a double superscript error, guess why).
Note how we insert an en-dash (of course \cmd{textendash} is a
non-math command, we had to modify some files in order to allow this character
in the Pdf).

\begin{verbatim}[numbers=left,firstnumber=last]
\[1=1\eqno\hbox{(3--1)} \]
\[0=0\eqno(*,{**},{***},16'\char`\'\char`\^,3^^^^20131)\]
\[\def\apostrophe{'} 2=2\eqno(16'\char`\')\]
\[\def\apostrophe{'} 3=3\eqno(16')\]
\end{verbatim}
\[0=0\eqno(*,{**},{***},16'\char`\'\char`\^,3^^^^20131)\]


\ex{19.7} It is possible to insert the equation number in the formula.
What you can see here is that the spacing for two and three stars is the same:
Knuth says that \TeX\ converts binary star to type Ord, in the case of three
stars, the middle one is of type Ord.
\begingroup
\tagatendofformula
\[0=0\eqno(*,{**},{***},16'\char`\'\char`\^,3^^^^20131)\]
\[\def\apostrophe{'} 3=3\eqno(16')\]
\endgroup
\ex{19.8} Knuth says: if \cmd{hsize} is less than 10000pt, then the natural
width of the equation will be too large. \Tralics\ ignores the shrink part of
the glue. In the case of the HTML document, the
text will flush in the right margin (and the equation number will be far
away). We have replaced 10000 by 600, this should be big enough to see
something. 
\begin{verbatim}[numbers=left,firstnumber=last]
\[\quad x=y\hskip10000pt minus 1fill\eqno(5)\]
\end{verbatim}
\[\quad x=y\hskip600pt minus 1fill\eqno(5)\]

\subsection{Multi-line displays}

\ex{19.9} The \cmd{eqalign} feature of plain \TeX\ is not implemented; you can
use the \LTC{align} environment like here: 
\begin{align}
T(n)\le T(2^{\lceil\lg n \rceil})&
\le c(3^{\lceil\lg n \rceil})-c(2^{\lceil\lg n \rceil})\\
&<3c\cdot3^{\lg n}\\
&=3c\,n^{\lg3}.
\end{align}
Using \LTC{aligned}, you can get
\[\left\{\begin{aligned}\alpha&=f(z)\\\beta&=f(z^2)\\\gamma&=f(z^3)\end{aligned}
  \right\}\qquad\left\{
\begin{aligned}x&=\alpha ^2-\beta\\y&=2\gamma\end{aligned}\right\}
\]
\ex{19.10}
\begin{align}
\label{eq19-10}
P(x)&=a_0+a_1x+a_2x^2+\cdots+a_nx^n,\\
P(-x)&=a_0-a_1x+a_2x^2+\cdots+{(-1)^n}a_nx^n.
\end{align}

Currently, the following code does not work.
\begin{verbatim}[numbers=left,firstnumber=last]
\begin{eqalignno}
(x+y)(x-y)&=x^2-xy+yx-y^2\\
&=x^2-y^2;&(4)\\
(x+y)^2&=x^2+2xy+y^2 ;
\end{eqalignno}
\begin{leqalignno}
(x+y)(x-y)&=x^2-xy+yx-y^2\\
&=x^2-y^2;&(4)\\
(x+y)^2&=x^2+2xy+y^2 .
\end{leqalignno}
\end{verbatim}
The best we can do is using phantoms:
\begin{verbatim}[numbers=left,firstnumber=last]
\def\xcenter#1#2#3{\phantom{#3}{#1#2#3}\phantom{#1}}
\[\xcenter{(x+y)(x-y)}{=}{x^2-xy+yx-y^2} \]
\[\xcenter{{}}{=}{x^2-y^2;}\label{192-0}\]
\[\xcenter{{(x+y)^2}}{=}{x^2+2xy+y^2 .}\label{192-5}\]
\end{verbatim}
\def\xcenter#1#2#3{\phantom{#3}{#1#2#3}\phantom{#1}}
\[\xcenter{(x+y)(x-y)}{=}{x^2-xy+yx-y^2} \]
\[\xcenter{{}}{=}{x^2-y^2;}\label{192-0}\]
\[\xcenter{{(x+y)^2}}{=}{x^2+2xy+y^2 .}\label{192-5}\]

\ex{19.12} First two equations use \cmd{leqno},
Equations \eqref{e19.12.a} and \eqref{e19.12.b} have a label.
\[\xcenter{\gcd(u,v)}{=}{\gcd(v,u);}\leqno(9) \]
\[\xcenter{\gcd(u,v)}{=}{\gcd(-u,v).}\leqno(10) \]
\[\xcenter{\gcd(u,v)}{=}{\gcd(v,u);}\label{e19.12.a}
\formulaattribute{eqleft}{true} \]
\[\xcenter{\gcd(u,v)}{=}{\gcd(-u,v).}\label{e19.12.b} \formulaattribute{eqleft}{true}\]

\ex{19.13} Note: Knuth has a small space before the first \LTC{dx}, this seems
unnecessary. Some operators are big by default in MathML, so that no \cmd{big}
is required. However, there is a rule in \Tralics\ that says that small
parentheses are used in $\int f(x)dx$, even when the integral has limits. 
In this cases, this mechanism produces small parentheses. The remedy is to put
\LTC{f(x)} in a group; the size of the parentheses depend only on what is in
the group. In a case like $(x^2+y^2)$, large parentheses are used. If you want
small ones, you must use the \cmd{smash} command, and you get 
$(\smash{x^2+y^2})$. In the pdf version, the vertical bar is too small.
\begin{verbatim}[numbers=left,firstnumber=last]
\[\xcenter{\left(\int_{-\infty}^{\infty}e^{-x^2}dx\right)^2}{=}
{\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(\smash{x^2+y^2})}dx\,dy}\]
\[\xcenter{}{=}{\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta}\]
\[\xcenter{}{=}{\int_0^{2\pi}{\left(-\frac{e^{-r^2}}{2}|
        _{r=0}^{r=\infty}\right)}\,d\theta}\]
\[\xcenter{}{=}{\pi.}\label{e19.13}\]
\end{verbatim}
\[\xcenter{\left(\int_{-\infty}^{\infty}e^{-x^2}dx\right)^2}{=}
{\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(\smash{x^2+y^2})}dx\,dy}\]
\[\xcenter{}{=}{\int_0^{2\pi}\int_0^\infty e^{-r^2}r\,dr\,d\theta}\]
\[\xcenter{}{=}{\int_0^{2\pi}{\left(-\frac{e^{-r^2}}{2}|_{r=0}^{r=\infty}
\right)}\,d\theta}\]
\[\xcenter{}{=}{\pi.}\label{e19.13}\]

\ex{19.14} Knuth explains that \LTC{eqalign} and \LTC{eqalignno} environments
are based on \cmd{halign}, so that \cmd{noalign} can be used. In environments
like \LTC{gather}, you can try \cmd{multicolumn}. As you can see here, the word
`and' occurs at the left of the table, not at the left margin; this is the same
as what happens with \cmd{eqalign}.
\begin{gather}
x=y+z\\
\multicolumn{1}{l}{\text{and}}\\
x^2=y^2z^2
\end{gather}

\ex{19.16} This uses \cmd{gather}. There are no equation numbers, because
\cmd{hfil}, \cmd{hfill} or \cmd{hfilneg} are not allowed.
\begin{gather}
x\equiv x\\
\text{if}\quad x \equiv y \quad\text{then}\quad y\equiv x\\
\text{if} \quad x\equiv y \quad \text{and} \quad y\equiv z \quad\text{then}
\quad x\equiv z.
\end{gather}

\subsection{Long formulas}
\def\formA{\sigma(2^{34}-1,2^{35},1)}
\def\formB{-3+(2^{34}-1)/2^{35}+2^{35}\!/(2^{34}-1)}
\def\formC{7/2^{35}(2^{34}-1)-\sigma(2^{35},2^{34}-1,1)}
The long formula is
\[\formA=\formB+\formC.\]
It can be split as
\begin{align}
\formA&=\formB\\&\qquad{}+\formC.
\end{align}
\ex{19.17}
\begin{align}
x_nu_1+\cdots+x_{n+t-1}u_t &= x_nu_1+(ax_n+c)u_2+ \cdots\\
&\qquad{}+(a^{t-1}x_n+c(a^{t-2}+\cdots+1))u_t\\
&=(u_1+au_2+\cdots+a^{t-1}u_t)x_n+h(u_1,\ldots,u_t).\label{e19.17}
\end{align}

Attempt to use \LTC{multline} for the long formula. 
\begin{multline}
\formA=\formB\\{}+\formC.
\end{multline}

\ex{19.18}
\begingroup
\def\FF#1#2{(x_{#1}-x_{#2})}
\def\F#1{(x-x_{#1})}
\begin{multline}
\sum_{1\le j \le n}\frac{1}{\FF j1\ldots\FF j{j-1}\F j\FF j{j+1}\ldots
\FF j n}\\
=\frac{1}{\F 1\ldots\F n}.\label{e19.18}
\end{multline}
\endgroup

\ex{19.19} This is a silly expression. It is formed of A and B over C. 
We show here the code of A, B and C, using the shorthands of Knuth. We redefine
locally the \cmd{\textbackslash} command. The \cmd{Paren} command puts
parentheses around the argument., the \cmd{Slash} command produces a slash.
\begin{verbatim}[numbers=left,firstnumber=last]
{
\def\\#1;{\noexpand\Paren{#1;q^2}_\infty}
\xdef\formA{q^{\frac 12 n(n+1)}\\ea;\\eq\noexpand\Slash a;}
\xdef\formB{\\caq\noexpand\Slash e;\\cq^2\!\noexpand\Slash ae;}
\xdef\formC{(e;q)_\infty(cq/e;q)_\infty}
}
\end{verbatim}

The question is: What is the size of the parentheses? 
In the case of $\int f(x)dx$ some browsers  show parentheses whose size are the
same as that of the current group; if nothing special is done, it includes the
integral sign and the bounds, this is wrong. For this reason, \Tralics\
inserts some braces for opening and closing delimiters. If a group is created
for the parenthesis, it contains no big objects (e.g., something with
exponents).  If possible, opening and closing parentheses are part of the same
group. The algorithm is not obvious: consider what should be done if $x$ or
$f(x)$ is replaced by its square. The following exercise is interesting. Note:
in the Pdf version, all formulas look the same, this is because parentheses
have fixed size. See also discussion after exercise 16.2:  there are no
multiple scripts here.

We give here four
variants. In case one, there is no group, and the size of the parentheses is
given by the exponent of the q. Hence they are too big. \Tralics\ tries to
compensate, but this does not work well, because of the index attached to
parenthesis; there are two parts $(ea;$ and $q^2)_\infty$.
In the second case, we have added an empty group. In this case,
we have a group with $(ea;$ followed by $q^2$ followed by a group with $)$
followed by $_\infty$. This gives small parentheses. Variant three is
logically better: we put the parentheses in a group, so that its size depends
only on the content of the group; in this case \Tralics\ leaves the formula
unchanged. If you feel that the parentheses are too big, you can reduce them:
variant four uses \cmd{smash}.

A non trivial point is that the size of the slash character is also
variable. In the case where a group is used (variant 3 and 4), it size depends
on the $q^2$ that follows. Otherwise, when \Tralics\ tries to insert a group,
in order to reduce the size of the parentheses, it uses a complicated
algorithm: when a group is created for the parentheses, it does not include
big objects. In particular, since each semi-colon is followed by $q^2$, this
group cannot contain both parentheses. Expressions can be split after binary
operators or relations, in the case of $a/b=c$, only the equals sign is
considered. Understanding exactly where the expression is split is not
easy. Obviously, in the case when there are two $q^2$ in the expression, none
of them is in a group. Since the slash character is between these two
expressions, it is outside of the group, its size is affected by the exponent
of the first $q$. This gives a very big slash (in the case of the Pdf version,
only small characters are used).

One fundamental change in \Tralics\ 2.10.8 concerns the case where a
superscript or subscript is attatched to a parenthesis. In this case, the
script is detached, the soliiting algorithme is called, and the script is
attached to what preceeds. An like \LTC{(x)\HAT2}, will be  converted into
\LTC{(x)\argument{}\HAT2}, that can be converted into
\LTC{{(x)}\argument{}\HAT2}, and after removal of the dummy group into  
\LTC{{(x)}\HAT2}.

\begin{verbatim}[numbers=left,firstnumber=last]
\def\Paren#1{(#1)}
\def\Paren#1{(#1){}}
\def\Paren#1{{(#1)}}
\def\Paren#1{{(\smash{#1})}}
\def\Slash{/}
\[ \frac{\formA\formB}{\formC} \]
\[ \frac{\textstyle\formA\qquad \atop\hfill\textstyle\formB}{\formC} \]
\end{verbatim}

{
\def\\#1;{\noexpand\Paren{#1;q^2}_\infty}
\xdef\formA{q^{\frac 12 n(n+1)}\\ea;\\eq\noexpand\Slash a;}
\xdef\formB{\\caq\noexpand\Slash e;\\cq^2\!\noexpand\Slash ae;}
\xdef\formC{(e;q)_\infty(cq/e;q)_\infty}
}
\def\Slash{/}

The whole formula version 1
\def\Paren#1{(#1)}
\[ \frac{\formA\formB}{\formC} \]
Version two
\def\Paren#1{(#1){}}
\[ \frac{\formA\formB}{\formC} \]
Version 3
\def\Paren#1{{(#1)}}
\[ \frac{\formA\formB}{\formC} \]
Version 4
\def\Paren#1{{(\smash{#1})}}
\[ \frac{\formA\formB}{\formC} \]
\def\Paren#1{{(#1)}}
The split formula
\[ \frac{\textstyle\formA\qquad \atop\hfill\textstyle\formB}{\formC} \]

One trick in order to get a smaller slash: define \cmd{Slash} to be a group
consisting of a slash (and something else, here a \cmd{kern} of width minus 1pt). 
\def\Slash{{\kern-1.pt/}}
The whole formula version two
\def\Paren#1{(#1){}}
\[ \frac{\formA\formB}{\formC} \]
Version 4
\def\Paren#1{{(\smash{#1})}}
\[ \frac{\formA\formB}{\formC} \]
\def\Paren#1{{(#1)}}
The split formula, version 4
\[ \frac{\textstyle\formA\qquad \atop\hfill\textstyle\formB}{\formC} \]

\fi


\chapter{Higher Mathematics, TLC2}
\tagatendofformula
In this chapter we present examples from the \LaTeX\ companion, second
edition, chapter 8; the book is distributed with a CDrom containing all
examples. These examples are formed of two parts; black and blue, the blue
part contains material to be inserted before the
\cmd{begin}\argument{document}; whenever needed, we shall explain what these
commands are assumed to do, what they do, and how the feature might be
implemented.  Unless stated otherwise, the black part is taken verbatim.

\section{Introduction to amslatex}
The following packages are defined for use with \Tralics:
\begin{itemize}
\item amsmath is the main package, it loads amstext, amsbsy, amsopn; Options
  are sumlimits, nosumlimits, namelimits, nonamelimits, centertags, tbtags,
  cmex10, and fleqn.
\item amsgen contains some useful commands (currently unused).
\item amstext defines the \cmd{text} command, which is built-in in \Tralics.
\item amsbsy loads amsgen. It provides \cmd{boldsymbol} and \cmd{bm}, which do
  nothing in \Tralics. 
\item amsopn, no options. The package defines commands like \cmd{lim}, that
  are built-in in \Tralics.
\item amscd, implementes commutative diagrams.
\item amsthm, not yet implemented (theorems are built-in in \Tralics).
\item amsxtra, not yet implemented.
\item upref, not yet implemented.
\item amsfonts, not yet implemented; this package and the following recognize 
options psamsfonts.
\item amssymb. The package defines 204 symbols, all of them implemented in the
 \Tralics\ kernel, except the following one, that are declared undefined by
 the amsmath package: \cmd{vartriangle}, \cmd{doublebarwedge}, 
\cmd{varpropto}, \cmd{smallsmile}, \cmd{smallfrown}, \cmd{lvertneqq}
\cmd{gvertneqq}, \cmd{npreceq}, \cmd{nsucceq}, \cmd{varsubsetneq(q)} 
\cmd{varsupsetneq(q)}, \cmd{nsubseteqq},
\cmd{nsupseteqq}, \cmd{(n)shortmid}, \cmd{(n)shortparallel}.

\item eufrak. The package defines family \cmd{Eufrak}  (this command is
  \cmd{mathfrak} in \Tralics), this is assumed to use the font family `euf'.
The eufrak package is redundant if the  amsfonts package is used.
\item eucal. 
The package defines  family \cmd{Euscript}  (this command is \cmd{mathcal} in
\Tralics), this is assumed to use the font family `eus'.
Accepts options `mathcal' and `mathscr' (this make \cmd{mathscr}
equivalent to \cmd{mathcal}. 
\end{itemize}

All undefined math symbols are defined to be \cmd{ams@unimp}, a command that
expands to an undefined command, the one defined here to produce a red X.
\begin{verbatim}[numbers=left,firstnumber=last]
\def\UnimplementedOperator#1{\mathbox{mstyle}[color][red]{X}}
\end{verbatim}

\ifLatex


\section{Display and alignment structures for equations}
Source code for some formulas used below:
\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation} (a+b)^2 = a^2+2ab+b^2\end{equation}
\[  \sin^2\eta+\cos^2\eta = 1  \]
\begin{equation} x^2 + y^2  =  z^2 \end{equation}
\begin{align} x^2 + y^2 &=  z^2 \\ x^3 + y^3 &<  z^3 \end{align}
\begin{eqnarray} x^2 + y^2 &=& z^2 \\ x^3 + y^3 &<& z^3 \end{eqnarray}
\begin{equation*}  n^2 + m^2 = k^2 \end{equation*}
\begin{equation} n^p +m^p \neq k^p  \qquad p > 2 \end{equation}
\begin{multline}  \tag{2}
  \sum_{t \in \mathbf{T}} \int_a^t
    \biggl\lbrace \int_a^t f(t - x)^2 \,
            g(y)^2 \,dx \biggr\rbrace \,dy \\
  = \sum_{t \notin \mathbf{T}} \int_t^a
      \biggl\lbrace g(y)^2 \int_t^a
        f(x)^2 \,dx \biggr\rbrace \,dy
\end{multline}
\end{verbatim}

Example 8-2-1. This uses the `leqno' option of the amsmath package, 
that is assumed to put equation numbers on the left. In \Tralics, this will
set the attribute \attpair{equation-number}{left} of the document element.

In \Tralics, if a formula has no \cmd{label}, no number
is associated to it. Here we have a formula using the \LTC{equation}
environment, or a displaymath formula enclosed in a \cmd{[}, \cmd{]} pair.
\begin{equation} (a+b)^2 = a^2+2ab+b^2\end{equation}
\[  \sin^2\eta+\cos^2\eta = 1  \]

Example 8-2-2. This uses options `reqno' option of the amsmath package
(equations to the right), it puts
\attpair{equation-number}{left} on the document element. It uses also
`fleqn', that sets \attpair{flushed-equation}{true}; in \LaTeX, you must
define \cmd{mathindent}, here to 1pc, as the distance between the left margin
and the formula; ignored by \Tralics. Same formulas as above, with a label
added, in order to show the difference.
\setlength\mathindent{1pc}
\begin{equation} (a+b)^2 = a^2+2ab+b^2  \label{eq-8-2-2}\end{equation}
\[  \sin^2\eta+\cos^2\eta = 1  \]

Example 8-2-3. The code was modified in order to add labels; you see three 3
numbers; one per environment, equation, align, and eqnarray. Also text added
between the groups of equations. First environment is \LTC{equation}:
\begin{equation}
  x^2 + y^2  =  z^2 \label{8-2-3-a}
\end{equation}
Second environment is \LTC{align}:
\begin{align}
  x^2 + y^2 &=  z^2 \\
  x^3 + y^3 &<  z^3\label{8-2-3-b}
\end{align}
Third environment is \LTC{eqnarray}:
\begin{eqnarray}
x^2 + y^2 &=& z^2 \\
x^3 + y^3 &<& z^3\label{8-2-3-c}
\end{eqnarray}

Note: amsmath adds a new complexity to how spaces are handled: spaces after
\cmd{\textbackslash} are no more ignored. This mechanism is not implemented in
\Tralics. 

Example 8-2-4.  We modified the examples by adding a label; you can see that
this produces an equation number for  \LTC{equation*}, \eqref{8-2-4-a}
as well as \LTC{equation}, \eqref{8-2-4-b}. 
\begin{equation*}
  n^2 + m^2 = k^2\label{8-2-4-a}
\end{equation*}
\begin{equation}
  n^p +m^p \neq k^p  \qquad p > 2\label{8-2-4-b}
\end{equation}

Example 8-2-5. Translation of \cmd{multline}
is a table, elements are centered, except first, last, and lines using
\cmd{shoveleft} or \cmd{shoveright}.
No \verb=&= 
should be given; last line should not be terminated with \verb=\\=. 
\begin{multline}
 \text{First line of a multline}    \\
 \text{Centered Middle line}        \\
 \shoveright{\text{A right Middle}} \\
 \text{Another centered Middle}     \\
 \text{Yet another centered Middle} \\
 \shoveleft{\text{A left Middle}}   \\
 \text{Last line of the multline}
\end{multline}

Example 8-2-6. This is the default behavior for tags.
\begin{multline}  \tag{2}
  \sum_{t \in \mathbf{T}} \int_a^t
    \biggl\lbrace \int_a^t f(t - x)^2 \,
            g(y)^2 \,dx \biggr\rbrace \,dy \\
  = \sum_{t \notin \mathbf{T}} \int_t^a
      \biggl\lbrace g(y)^2 \int_t^a
        f(x)^2 \,dx \biggr\rbrace \,dy
\end{multline}

Same formulas, with \cmd{multlinegap} set to zero. This has no effect in
\Tralics 
\setlength\multlinegap{0pt}
\begin{multline}  \tag{2}
  \sum_{t \in \mathbf{T}} \int_a^t
    \biggl\lbrace \int_a^t f(t - x)^2 \,
            g(y)^2 \,dx \biggr\rbrace \,dy \\
  = \sum_{t \notin \mathbf{T}} \int_t^a
      \biggl\lbrace g(y)^2 \int_t^a
        f(x)^2 \,dx \biggr\rbrace \,dy
\end{multline}

From now on, we redefine the \cmd{tag} command via \cmd{tagasattribute}; 
the second equation with a tag gives:
\tagasattribute
\[  \sin^2\eta+\cos^2\eta = 1  \tag{3}\]

The magic is that this uses \cmd{formulaattribute}, a command added in
\Tralics\ 2.9.5 that adds an attribute pair to the formula; our style sheet
handles a formula with a tag in the same way as a formula with an id (after
converting the id into a tag). There are four commands of the form \cmd{XXattribute}
that add an attribute to an element under construction: the math formula, the
math expression, the current row, the current cell. In these cases
\cmd{mathattribute} cannot be used (it adds an attribute to the last element
created). It is not possible to use \cmd{XMLaddatt} in math mode, and it is
not possible to use this command after a math formula in order to add an
attribute (If the token that follows a display math formula is not a
\cmd{par}, then \cmd{noindent} is inserted, thus, if this token is
\cmd{XMLaddatt}, the current element is an empty paragraph). Example
\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align}
\formulaattribute{tag}{8-2-3}
\thismathattribute{background}{white}\tableattribute{color}{black}
\rowattribute{mathvariant}{bold} x^2 + y^2+100 &=  z^2 \\
\cellattribute{columnalign}{left}  x^3 + y^3+1 &<  z^3
\end{align}
\end{verbatim}

Translation (bold attribute ignored in the Pdf version):
\begin{align}
\formulaattribute{tag}{8-2-3}
\thismathattribute{background}{white}\tableattribute{color}{black}
\rowattribute{mathvariant}{bold} x^2 + y^2+100 &=  z^2 \\
\cellattribute{columnalign}{left}  x^3 + y^3+1 &<  z^3
\end{align}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation} \begin{split} % 8-2-7
 (a + b)^4
   &= (a + b)^2 (a + b)^2      \\
   &= (a^2 + 2ab + b^2)   (a^2 + 2ab + b^2)        \\
   &= a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4
 \end{split}\end{equation}
\begin{equation} \begin{split} % 8-2-8
  (a + b)^3 &= (a + b) (a + b)^2        \\
            &= (a + b)(a^2 + 2ab + b^2) \\
            &= a^3 + 3a^2b + 3ab^2 + b^3
 \end{split}\end{equation}
\end{verbatim}

Example 8.2.7 Single equation on several lines with alignment
\begin{equation}
 \begin{split}
 (a + b)^4
   &= (a + b)^2 (a + b)^2      \\
   &= (a^2 + 2ab + b^2)
      (a^2 + 2ab + b^2)        \\
   &= a^4 + 4a^3b + 6a^2b^2 + 4ab^3 + b^4
 \end{split}
\end{equation}

Example 8.2.8. The \LaTeX\ companion explains that the amsmath
 package can be loaded
with options `centertags' or `tbtags'. In the first case, tags centered with
the formula (left or right), in the second case, tags are on the first line
(on the left) or last line (on the right). By default, \Tralics\ does
nothing, and in the case of `tbtags', it sets \attpair{split-tags}{tb} on the
root element. 
\begin{equation}
 \begin{split}
  (a + b)^3 &= (a + b) (a + b)^2        \\
            &= (a + b)(a^2 + 2ab + b^2) \\
            &= a^3 + 3a^2b + 3ab^2 + b^3
 \end{split}
\end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\newcommand\relphantom[1]{\mathrel{\phantom{#1}}}
\newcommand\ve{\varepsilon}  \newcommand\tve{t_{\varepsilon}}
\newcommand\vf{\varphi}      \newcommand\yvf{y_{\varphi}}
\newcommand\bfE{\mathbf{E}}

\begin{equation} \begin{split}
  f_{h, \ve}(x, y)
    &= \ve \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve u)} \vf(x) \,du  \\
    &= h \int L_{x, z} \vf(x) \rho_x(dz)                             \\
    &\relphantom{=} {} + h \biggl[
       \frac{1}{\tve}
       \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
               - \tve \int L_{x, z} \vf(x) \rho_x(dz)      \biggr) + \\
    &\relphantom{=} \phantom{{} + h \biggl[ }
       \frac{1}{\tve}
       \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
               - \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve s)}
                                            \vf(x) \,ds    \biggr) \biggr]
\end{split} \end{equation}
\end{verbatim}

Example 8-2-9
\begingroup
\newcommand\relphantom[1]{\mathrel{\phantom{#1}}}
\newcommand\ve{\varepsilon}  \newcommand\tve{t_{\varepsilon}}
\newcommand\vf{\varphi}      \newcommand\yvf{y_{\varphi}}
\newcommand\bfE{\mathbf{E}}


\begin{equation} \begin{split}
  f_{h, \ve}(x, y)
    &= \ve \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve u)} \vf(x) \,du  \\
    &= h \int L_{x, z} \vf(x) \rho_x(dz)                             \\
    &\relphantom{=} {} + h \biggl[
       \frac{1}{\tve}
       \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
               - \tve \int L_{x, z} \vf(x) \rho_x(dz)      \biggr) + \\
    &\relphantom{=} \phantom{{} + h \biggl[ }
       \frac{1}{\tve}
       \biggl( \bfE_{y} \int_0^{\tve}  L_{x, y^x(s)} \vf(x) \,ds
               - \bfE_{x, y} \int_0^{\tve} L_{x, \yvf(\ve s)}
                                            \vf(x) \,ds    \biggr) \biggr]
\label{e-8-2-9}
\end{split} \end{equation}
\endgroup

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather}
  (a + b)^2 = a^2 + 2ab + b^2          \\
  (a + b) \cdot (a - b) = a^2 - b^2
\end{gather}
\end{verbatim}
Example 8-2-10, equation groups without alignment.
\begin{gather}
  (a + b)^2 = a^2 + 2ab + b^2          \\
  (a + b) \cdot (a - b) = a^2 - b^2
\end{gather}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather}
  D(a,r) \equiv \{ z \in \mathbf{C}   \colon |z - a| < r \}    \notag \\
  \operatorname{seg} (a, r) \equiv    \{ z \in \mathbf{C} \colon
      \Im z < \Im a, \ |z - a| < r \}    \\
    C (E, \theta, r) \equiv    \bigcup_{e \in E} c (e, \theta, r)
\end{gather}
\end{verbatim}
Example 8-2-11
\begin{gather}
  D(a,r) \equiv \{ z \in \mathbf{C}
         \colon |z - a| < r \}    \notag \\
  \operatorname{seg} (a, r) \equiv
    \{ z \in \mathbf{C} \colon
      \Im z < \Im a, \ |z - a| < r \}    \\
    C (E, \theta, r) \equiv
    \bigcup_{e \in E} c (e, \theta, r)
\end{gather}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align}
  (a + b)^3  &= (a + b) (a + b)^2        \\
             &= (a + b)(a^2 + 2ab + b^2) \\
             &= a^3 + 3a^2b + 3ab^2 + b^3
\end{align}
\begin{align} x^2  + y^2 & = 1 \\ x  & = \sqrt{1-y^2}\end{align}
\end{verbatim}
Example 8-2-12
\begin{align}
  (a + b)^3  &= (a + b) (a + b)^2        \\
             &= (a + b)(a^2 + 2ab + b^2) \\
             &= a^3 + 3a^2b + 3ab^2 + b^3
\end{align}
and
\begin{align}
  x^2  + y^2 & = 1                       \\
  x          & = \sqrt{1-y^2}
\end{align}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align}
 \text{Compare } x^2 + y^2 &= 1 &  x^3 + y^3 &= 1 \\
  x &= \sqrt   {1-y^2} & x &= \sqrt[3]{1-y^3}
\end{align}
\begin{align}
x&= y & X  &= Y  &a  &= b+c \\
x' &= y'& X' &= Y' &a' &= b\\
 x + x' &= y + y'  &  X + X' &= Y + Y' & a'b &= c'b
\end{align}
\end{verbatim}

Example 8-2-13.
This example has two column-pairs.
\begin{align}    \text{Compare }
  x^2 + y^2 &= 1               &
  x^3 + y^3 &= 1               \\
  x         &= \sqrt   {1-y^2} &
  x         &= \sqrt[3]{1-y^3}
\end{align}
This example has three column-pairs.
\begin{align}
    x    &= y      & X  &= Y  &
      a  &= b+c               \\
    x'   &= y'     & X' &= Y' &
      a' &= b                 \\
  x + x' &= y + y'            &
  X + X' &= Y + Y' & a'b &= c'b
\end{align}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{flalign}  \text{Compare }
  x^2 + y^2 &= 1               &  x^3 + y^3 &= 1               \\
  x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}
\end{flalign}
\begin{flalign}
    x    &= y      & X  &= Y  &      a  &= b+c               \\
    x'   &= y'     & X' &= Y' &      a' &= b                 \\
  x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b
\end{flalign}
\end{verbatim}
Example 8-2-14
This example has two column-pairs.
\begin{flalign}  \text{Compare }
  x^2 + y^2 &= 1               &
  x^3 + y^3 &= 1               \\
  x         &= \sqrt   {1-y^2} &
  x         &= \sqrt[3]{1-y^3}
\end{flalign}
This example has three column-pairs.
\begin{flalign}
    x    &= y      & X  &= Y  &
      a  &= b+c               \\
    x'   &= y'     & X' &= Y' &
      a' &= b                 \\
  x + x' &= y + y'            &
  X + X' &= Y + Y' & a'b &= c'b
\end{flalign}

\begin{verbatim}[numbers=left,firstnumber=last]
\renewcommand\minalignsep{0pt}
\begin{align}    \text{Compare }
  x^2 + y^2 &= 1               &  x^3 + y^3 &= 1              \\
  x         &= \sqrt   {1-y^2} &  x         &= \sqrt[3]{1-y^3}
\end{align}
\renewcommand\minalignsep{15pt}
\begin{flalign}
    x    &= y      & X  &= Y  &      a  &= b+c              \\
    x'   &= y'     & X' &= Y' &      a' &= b                \\
  x + x' &= y + y'            &  X + X' &= Y + Y' & a'b &= c'b
\end{flalign}
\end{verbatim}
Example 8-2-15
This example has two column-pairs.
\renewcommand\minalignsep{0pt}
\begin{align}    \text{Compare }
  x^2 + y^2 &= 1               &
  x^3 + y^3 &= 1              \\
  x         &= \sqrt   {1-y^2} &
  x         &= \sqrt[3]{1-y^3}
\end{align}
This example has three column-pairs.
\renewcommand\minalignsep{15pt}
\begin{flalign}
    x    &= y      & X  &= Y  &
      a  &= b+c              \\
    x'   &= y'     & X' &= Y' &
      a' &= b                \\
  x + x' &= y + y'            &
  X + X' &= Y + Y' & a'b &= c'b
\end{flalign}

\begin{verbatim}[numbers=left,firstnumber=last]
\renewcommand\minalignsep{2em}
\begin{align}
  x      &= y      && \text{by hypothesis} \\
      x' &= y'     && \text{by definition} \\
  x + x' &= y + y' && \text{by Axiom 1}
\end{align}
\end{verbatim}
Example 8-2-16

\renewcommand\minalignsep{2em}
\begin{align}
  x      &= y      && \text{by hypothesis} \\
      x' &= y'     && \text{by definition} \\
  x + x' &= y + y' && \text{by Axiom 1}
\end{align}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation}
\begin{aligned}
  x^2 + y^2  &= 1 \\ x &= \sqrt{1-y^2} \\ \text{and also }y &= \sqrt{1-x^2}
\end{aligned}               \qquad
\begin{gathered}
 (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2
\end{gathered}      \end{equation}
\end{verbatim}
Example 8-2-17
\begin{equation}
\begin{aligned}
  x^2 + y^2  &= 1               \\
  x          &= \sqrt{1-y^2}    \\
 \text{and also }y &= \sqrt{1-x^2}
\end{aligned}               \qquad
\begin{gathered}
 (a + b)^2 = a^2 + 2ab + b^2    \\
 (a + b) \cdot (a - b) = a^2 - b^2
\end{gathered}      \end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation}
\begin{aligned}[b]
  x^2 + y^2  &= 1\\ x &= \sqrt{1-y^2}    \\ \text{and also }y &= \sqrt{1-x^2}
\end{aligned}               \qquad
\begin{gathered}[t]
 (a + b)^2 = a^2 + 2ab + b^2    \\ (a + b) \cdot (a - b) = a^2 - b^2
\end{gathered}\end{equation}
\end{verbatim}
Example 8-2-18 \footnote{We should do something with the optional argument }
\begin{equation}
\begin{aligned}[b]
  x^2 + y^2  &= 1               \\
  x          &= \sqrt{1-y^2}    \\
 \text{and also }y &= \sqrt{1-x^2}
\end{aligned}               \qquad
\begin{gathered}[t]
 (a + b)^2 = a^2 + 2ab + b^2    \\
 (a + b) \cdot (a - b) = a^2 - b^2
\end{gathered}
\end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\newenvironment{rcase}{\left.\begin{aligned}} {\end{aligned}\right\rbrace}
\begin{equation*}
  \begin{rcase}
    B' &= -\partial\times E  \\  E' &=  \partial\times B - 4\pi j \,
  \end{rcase}
  \quad \text {Maxwell's equations}
\end{equation*}

\end{verbatim}
Example 8-2-19\footnote{Translation/rendering of apostrophe not always correct}

\newenvironment{rcase}
    {\left.\begin{aligned}}
    {\end{aligned}\right\rbrace}

\begin{equation*}
  \begin{rcase}
    B' &= -\partial\times E          \\
    E' &=  \partial\times B - 4\pi j \,
  \end{rcase}
  \quad \text {Maxwell's equations}
\end{equation*}

\begin{verbatim}[numbers=left,firstnumber=last]
\renewcommand\minalignsep{5pt}
\begin{equation} \begin{aligned}
  V_j &= v_j &  X_i &= x_i - q_i x_j &      &= u_j + \sum_{i\ne j} q_i \\
  V_i &= v_i - q_i v_j &  X_j &= x_j &  U_i &= u_i
\end{aligned} \end{equation}
\end{verbatim}
Example 8-2-20

\renewcommand\minalignsep{5pt}
\begin{equation} \begin{aligned}
  V_j &= v_j                      &
  X_i &= x_i - q_i x_j            &
      &= u_j + \sum_{i\ne j} q_i \\
  V_i &= v_i - q_i v_j            &
  X_j &= x_j                      &
  U_i &= u_i
\end{aligned} \end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align}
  A_1 &= N_0 (\lambda ; \Omega') -  \phi ( \lambda ; \Omega')   \\
  A_2 &= \phi (\lambda ; \Omega') \phi (\lambda ; \Omega)     \\
\intertext{and finally}
  A_3 &= \mathcal{N} (\lambda ; \omega)
\end{align}
\end{verbatim}
Example 8-2-21
\begin{align}
  A_1 &= N_0 (\lambda ; \Omega')
         -  \phi ( \lambda ; \Omega')   \\
  A_2 &= \phi (\lambda ; \Omega')
            \phi (\lambda ; \Omega)     \\
\intertext{and finally}
  A_3 &= \mathcal{N} (\lambda ; \omega)
\end{align}

Example 8-2-22, 8-2-23, 8-2-24 explain that spacing around equations can be
wrong; we omit them.

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align}
  x^2+y^2 &= z^2 \label{eq:A}            \\
  x^3+y^3 &= z^3 \notag                  \\
  x^4+y^4 &= r^4 \tag{$*$}               \\
  x^5+y^5 &= r^5 \tag*{$*$}              \\
  x^6+y^6 &= r^6 \tag{\ref{eq:A}$'$}     \\
      A_1 &= N_0 (\lambda ; \Omega')
             - \phi ( \lambda ; \Omega') \\
      A_2 &= \phi (\lambda ; \Omega')
             \, \phi (\lambda ; \Omega)
             \tag*{ALSO (\theequation)}  \\
      A_3 &= \mathcal{N} (\lambda ; \omega)
\end{align}
\end{verbatim}

Example 8-2-25. In the Companion, first equation is numbered \LTC{(1)},
second equation has no number, third is \LTC{(*)}, then come \LTC{*},
\LTC{(1')}, \LTC{(2)}, \LTC{ALSO (2)} and \LTC{(3)}. Since \Tralics\ does not 
compute equation numbers, you will not see \LTC{(1)}, \LTC{(2)}, \LTC{(3)}.
Since \LTC{(1')} is obtained by a reference to the first equation, the whole
set of equations is numbered, namely \eqref{eq:A}.  It is currently impossible
to use a reference,  we locally change \cmd{ref}, so that it produces a
number, here 17. This is also the current value of the equation counter.
Hence, the full tag, concatenation of all four tags is
\LTC{*,*,17x,ALSO (17)}; we have replaced the apostrophe by x, because 
of a bug in current \Tralics. This full tag is put on the math formula.

\textbf{Note:} the style sheet that converts XML to HTML attributes a number
to each equation that has a label, and \cmd{ref} uses this number. If the
equation has a tag, no number should be attributed, and \cmd{ref} should use
the tag. This might change.

\textbf{Note:} \LaTeX\ uses \cmd{text} to format the tag, and as a
consequence, spaces are not ignored. In \Tralics, nothing special is done, and
they are ignored. Should be fixed some day.

\setcounter{equation}{17}
\let\oref\ref
\def\ref#1{17}
\begin{align}
  x^2+y^2 &= z^2 \label{eq:A}            \\
  x^3+y^3 &= z^3 \notag                  \\
  x^4+y^4 &= r^4 \tag{$*$}               \\
  x^5+y^5 &= r^5 \tag*{$*$}              \\
  x^6+y^6 &= r^6 \tag{\ref{eq:A}$x$}     \\
      A_1 &= N_0 (\lambda ; \Omega')
             - \phi ( \lambda ; \Omega') \\
      A_2 &= \phi (\lambda ; \Omega')
             \, \phi (\lambda ; \Omega)
             \tag*{ALSO (\theequation)}  \\
      A_3 &= \mathcal{N} (\lambda ; \omega)
\end{align}

\begingroup
Same example, with default behavior of \cmd{tag}. Note that the equation
number is still the same. The equation has an another label, it is now
equation \eqref{eq:A1}, but \cmd{ref}  is still defined to be 17.
\tagatcurpos
\begin{align}
  x^2+y^2 &= z^2 \label{eq:A1}            \\
  x^3+y^3 &= z^3 \notag                  \\
  x^4+y^4 &= r^4 \tag{$*$}               \\
  x^5+y^5 &= r^5 \tag*{$*$}              \\
  x^6+y^6 &= r^6 \tag{\ref{eq:A1}$'$}     \\
      A_1 &= N_0 (\lambda ; \Omega')
             - \phi ( \lambda ; \Omega') \\
      A_2 &= \phi (\lambda ; \Omega')
             \, \phi (\lambda ; \Omega)
             \tag*{ALSO (\theequation)}  \\
      A_3 &= \mathcal{N} (\lambda ; \omega)
\end{align}
\endgroup
\let\ref\oref


\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation}  \begin{split} \label{e-8-2-26}
  \lvert I_2 \rvert  &=    \left\lvert \int_{0}^T \psi(t)
      \left\{  u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}
        (\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
      \right\} dt \right\rvert                                     \\
                     &\le  C_6  \Biggl\lvert
      \left\lvert f \int_\Omega \left\lvert
          \widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
        \right\rvert \ \right\rvert
      \left\lvert \lvert u \rvert
        \overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)
      \right\rvert              \Biggr\rvert
\end{split} \end{equation}
\end{verbatim}
Example 8-2-26. The book explains that the tag is not correctly positioned.
We modified the example by adding a label, and this gives an equation number
in the HTML file. This number is vertically centered, whatever the size of
the formula. 
\begin{equation}  \begin{split} \label{e-8-2-26}
  \lvert I_2 \rvert  &=    \left\lvert \int_{0}^T \psi(t)
      \left\{  u(a, t) - \int_{\gamma(t)}^a \frac{d\theta}{k}
        (\theta, t) \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
      \right\} dt \right\rvert                                     \\
                     &\le  C_6  \Biggl\lvert
      \left\lvert f \int_\Omega \left\lvert
          \widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
        \right\rvert \ \right\rvert
      \left\lvert \lvert u \rvert
        \overset{\circ}{\to} W_2^{\widetilde{A}} (\Omega; \Gamma_r,T)
      \right\rvert              \Biggr\rvert
\end{split} \end{equation}

Example 8-2-27. Equation \eqref{e-8-2-27} should be the same as 
\eqref{e-8-2-26}; but in order to test our algorithm we have replaced some
\cmd{lvert} and \cmd{rvert} by \cmd{lVert} and \cmd{rVert}, that are the same
as \cmd{Vert}, but declared as mathopen and mathclose symbols 
\begin{align}
  \lvert I_2 \rvert &= \label{e-8-2-27}
    \left\lvert \int_{0}^T \psi(t)
      \left\lbrace
        u(a, t) - \int_{\gamma(t)}^a \frac {d\theta} k(\theta, t)
        \int_{a}^\theta c (\xi) u_t (\xi, t) \,d\xi
      \right\rbrace dt
    \right\rvert                                          \notag \\
        &\le  C_6
    \Bigg\lVert
      \left\lvert f \int_\Omega
        \left\lvert
          \widetilde{S}^{-1,0}_{a,-} W_2(\Omega, \Gamma_l)
        \right\rvert \
      \right\rvert
      \left\lvert
        \lvert u \rvert \overset{\circ}{\to} W_2^{\widetilde{A}}
        (\Omega; \Gamma_r,T)
      \right\rvert
    \Bigg\rVert
\end{align}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather}   \raisetag{-40pt}
 \text{The sign function: \ } \mathcal{S}(x) = 
 \begin{cases}-1   &  x < 0 \\ 0   &  x = 0 \\ 1   &  x > 0\end{cases}
\end{gather}
\end{verbatim}
Example 8-2-28, showing the command \cmd{raisetag}.
It is defined as doing nothing in \Tralics\ (the tag, i.e., the equation
number, is inserted by the style sheet that converts from XML to HTML.)
We have redefined here the command as follows
\begin{verbatim}[numbers=left,firstnumber=last]
\def\raisetag#1{%
\dimen0=#1\relax
\ifdim\dimen0<0pt 
  \dimen0=-\dimen0
   \formulaattribute{tag-down}{\the\dimen0}%
\else
\formulaattribute{tag-up}{\the\dimen0}\fi}
\end{verbatim}


\def\raisetag#1{%
\dimen0=#1\relax
\ifdim\dimen0<0pt 
  \dimen0=-\dimen0
   \formulaattribute{tag-down}{\the\dimen0}%
\else
\formulaattribute{tag-up}{\the\dimen0}\fi}
Thus \cmd{raisetag} with a value of \LTC{-10pt} will add 
\attpair{tag-down}{10pt} to the formula element. In this case, the style sheet
adds \attpair{style}{padding-top:10pt} to the cell containing the equation
number. In the case of a positive value, padding-bottom is used instead.
In this example, we use 40pt. 

\begin{gather}   \raisetag{-40pt} \label{e-8-2-28}
  \text{The sign function: \ }
     \mathcal{S}(x) =  \begin{cases}
                         -1   &  x < 0 \\
                          0   &  x = 0 \\
                          1   &  x > 0
                       \end{cases}
\end{gather}



\begin{verbatim}[numbers=left,firstnumber=last]
begin{subequations}  \label{eq:1}
\begin{align}  f  &= g            \label{eq:1A} \\
               f' &= g'           \label{eq:1B} \\
    \mathcal{L}f  &= \mathcal{L}g \label{eq:1C}
\end{align}
\end{subequations}
\begin{subequations}  \label{eq:2}
\renewcommand\theequation{\theparentequation\roman{equation}}
\begin{align}  f  &= g            \label{eq:2A} \\
               f' &= g'           \label{eq:2B} \\
    \mathcal{L}f  &= \mathcal{L}g + K  \label{eq:2C}
\end{align}
\end{subequations}
Note the relationship between~\eqref{eq:1}
and~\eqref{eq:2}: only~\ref{eq:1C} and~\ref{eq:2C} differ.
\end{verbatim}
Example 8-2-29: the amsmath package provides a \LTC{subequations} environment
to support ``equation subnumbering'' with tags of the form (2a), (2b), (2c),
and so on. All the tagged equations within it use this sub-numbering scheme
based on two normal \LaTeX\ counters \LTC{parentequation} and \LTC{equation}.
First group, with only labels \LTC{eq:1} and \LTC{eq1:C}
\begin{subequations}  \label{eq:1}
\begin{align}  f  &= g \\
               f' &= g'\\
    \mathcal{L}f  &= \mathcal{L}g \label{eq:1C}
\end{align}
\end{subequations}
The \Tralics\ implementation is trivial: the environment does nothing. 
Thus, the \cmd{label} command in the \LTC{subequations} corresponds to the
current section. Second group, with only labels \LTC{eq:2} and \LTC{eq2:C}.
\def\theparentequation{}
\begin{subequations} \label{eq:2}
\renewcommand\theequation{\theparentequation\roman{equation}}
\begin{align}  f  &= g  \\
               f' &= g'  \\
    \mathcal{L}f  &= \mathcal{L}g + K  \label{eq:2C}
\end{align}
\end{subequations}
We have removed two \cmd{label}s from the \LTC{align},
because it produces a single equation number and accepts a single label.
Thus, the text after the equations reads:
 \textit{Note the relationship between~\eqref{eq:1}
and~\eqref{eq:2}: only~\ref{eq:1C} and~\ref{eq:2C} differ.}




\section{Matrix-like environments}
\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation}    P_{r - j} =
 \begin{cases}
    0   &  \text{if $r - j$ is odd,} \\
    r! \, (-1)^{(r - j)/2}
        &  \text{if $r - j$ is even.}
 \end{cases}                \end{equation}
\end{verbatim}
Example 8-3-1
\begin{equation}    P_{r - j} =
 \begin{cases}
    0   &  \text{if $r - j$ is odd,} \\
    r! \, (-1)^{(r - j)/2}
        &  \text{if $r - j$ is even.}
 \end{cases}                \end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather*}
  \begin{matrix}  0 &  1 \\ 1 &  0 \end{matrix}  \quad
  \begin{pmatrix} 0 & -i \\ i &  0 \end{pmatrix} \\
  \begin{bmatrix} 0 & -1 \\ 1 &  0 \end{bmatrix} \quad
  \begin{Bmatrix} 1 &  0 \\ 0 & -1 \end{Bmatrix} \\
  \begin{vmatrix} a &  b \\ c &  d \end{vmatrix} \quad
  \begin{Vmatrix} i &  0 \\ 0 & -i \end{Vmatrix}
\end{gather*}
\end{verbatim}

Example 8-3-2, using a single equation\footnote{The delimiter for Vmatrix is 
badly rendered by Amaya}
\[
  \begin{matrix}  0 &  1 \\ 1 &  0 \end{matrix}  \quad
  \begin{pmatrix} 0 & -i \\ i &  0 \end{pmatrix} \quad
  \begin{bmatrix} 0 & -1 \\ 1 &  0 \end{bmatrix} \quad
  \begin{Bmatrix} 1 &  0 \\ 0 & -1 \end{Bmatrix} \quad
  \begin{vmatrix} a &  b \\ c &  d \end{vmatrix} \quad
  \begin{Vmatrix} i &  0 \\ 0 & -i \end{Vmatrix}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\newcommand\hdotsfor[2][x]{\multicolumn{5}{c}{.\ .\ .\ .\ .\ .\ .\ .\ .}} 
\setcounter{MaxMatrixCols}{20}
\[
 \begin{Vmatrix}
  \,a&b&c&d&e&f&g&h&i&j &\cdots\,{} \\
     &a&b&c&d&e&f&g&h&i &\cdots\,{} \\
     & &a&b&c&d&e&f&g&h &\cdots\,{} \\
     & & &a&b&c&d&e&f&g &\cdots\,{} \\
     & & & &\ddots&\ddots&\hdotsfor[2]{5}%\,{}
 \end{Vmatrix} \]
\end{verbatim}
Example 8-3-3.
The example uses \cmd{hdotsfor}, a command equivalent to
\cmd{multicolumn}\argument{5}\argument{c}\argument{leaders}. Leaders cannot be
implemented in MathML, so that the command is redefined in this case.

\renewcommand\hdotsfor[2][x]{\multicolumn{5}{c}{.\ .\ .\ .\ .\ .\ .\ .\ .}}
\setcounter{MaxMatrixCols}{20}
\[
 \begin{Vmatrix}
  \,a&b&c&d&e&f&g&h&i&j &\cdots\,{} \\
     &a&b&c&d&e&f&g&h&i &\cdots\,{} \\
     & &a&b&c&d&e&f&g&h &\cdots\,{} \\
     & & &a&b&c&d&e&f&g &\cdots\,{} \\
     & & & &\ddots&\ddots&\hdotsfor[2]{5}%\,{}
 \end{Vmatrix} \]
In the example above, there was a \cmd{,}\argument{} at the end of each
line. We had to remove it on the last line, because \Tralics\ complains if a
cell contains \cmd{multicolumns} and additional commands. The following
example is refused by \Tralics; but \LaTeX\ is happy with it, but x is typeset
outside math mode. Thus the question: what is the exact effect of the last
\cmd{,}\argument{} in the \LaTeX\ case?
\begin{verbatim}[numbers=left,firstnumber=last]
$\begin{array}{ccc}
111&222&333\\
\hdotsfor{2}x&t\\
\end{array}$
\end{verbatim}


Example 8-3-4. This example uses the environment \LTC{smallmatrix}, which is
defined by \Tralics\ to be the same as \LTC{matrix}, i.e.,  a matrix without
delimiters, $\begin{smallmatrix} 1 & 0 \\ 0 & -1   \end{smallmatrix}$
the same with  \cmd{left} and \cmd{right} parentheses
$ \left( \begin{smallmatrix}1 & 0 \\ 0 & -1 \end{smallmatrix}  \right) $.
There is some text after the matrix. It happens that matrices in text style
are badly rendered by Firefox. There is a huge amount of white space on the
left of each column.

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather}
  \sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i, j) \\
  \sum_{\begin{subarray}{l}  i \in \Lambda   \\
                             0 \le i \le m   \\
                             0 < j < n
        \end{subarray}}  P(i, j)
\end{gather}
\end{verbatim}
Example 8-3-5. The style of the subarray should be smaller
\begin{gather}
  \sum_{\substack{0 \le i \le m \\ 0 < j < n}} P(i, j) \\
  \sum_{\begin{subarray}{l}  i \in \Lambda   \\
                             0 \le i \le m   \\
                             0 < j < n
        \end{subarray}}  P(i, j)
\end{gather}

\begin{verbatim}[numbers=left,firstnumber=last]
\DeclareMathOperator\add{add}
\DeclareMathOperator\cf {cf}
\DeclareMathOperator\cov{cov}
\DeclareMathOperator\non{non}
\DeclareMathOperator\End{End}
\[ \begin{CD}
     \cov (L) @>>> \non (K) @>>> \cf (K)  \\
       @VVV          @AAA          @AAA   \\
     \add (L) @>>> \add (K) @>>> \cov (K) \\
   \end{CD} \]
\end{verbatim}
Example 8-3-6. You must be careful with the CD environment, because the
at-sign is an active character, that reads some text, depending on the
character that follows; more examples are given below.
\begingroup
\DeclareMathOperator\add{add}
\DeclareMathOperator\cf {cf}
\DeclareMathOperator\cov{cov}
\DeclareMathOperator\non{non}
\DeclareMathOperator\End{End}

\[ \begin{CD}
     \cov (L) @>>> \non (K) @>>> \cf (K)  \\
       @VVV          @AAA          @AAA   \\
     \add (L) @>>> \add (K) @>>> \cov (K) \\
   \end{CD} \]
\endgroup

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \begin{CD}
     S^{W_\Lambda}\otimes T @>j>>      T       \\
      @VVV                        @VV{\End P}V \\
    (S \otimes T)/I         @=   (Z\otimes T)/J
   \end{CD} \]
\end{verbatim}
Example 8-3-7 
\[ \begin{CD}
  S^{W_\Lambda}\otimes T @>j>>      T       \\
  @VVV                        @VV{\End P}V \\
  (S \otimes T)/I         @=   (Z\otimes T)/J
\end{CD} \]

Example 8-3-8. This uses \cmd{longrightarrow}, that produces character
U+27F9, unknown to \textit{FM}. 
\makeatletter
\def\XX{\cd@arrow@right{\End P}\downarrow}
\makeatother
\[\begin{array}{ccc}
    S^{\mathcal{W}_\Lambda}\otimes T &  \stackrel{j}{\longrightarrow}  & T  \\
    \Big\downarrow  &   &    \XX\\
    (S\otimes T)/I  & = &    (Z\otimes T)/J
  \end{array}
\]


\begin{verbatim}[numbers=left,firstnumber=last]
\[ \mathcal{Q} =
\begin{delarray}[t] ( {cc} ) X & Y \end{delarray}
\begin{delarray}[t] [ {cc} ] A & B \\ C & D   \end{delarray}
\begin{delarray}[b] \lgroup{cc}\rgroup L \\ M \end{delarray}
\]
\end{verbatim}
Example 8-3-9. This example uses the \LTC{delarray} package that changes
the meaning of the \LTC{array} environment. In the current version of \Tralics,
there is no \cmd{array} command, hence no possibility to redefine it.
The \filename{delarray.plt} file defines a \LTC{delarray} environment that is
used here.  
\[ \mathcal{Q} =
\begin{delarray}[t] ( {cc} ) X & Y \end{delarray}
\begin{delarray}[t] [ {cc} ] A & B \\ C & D   \end{delarray}
\begin{delarray}[b] \lgroup{cc}\rgroup L \\ M \end{delarray}
\]

\section{Compound structures and decorations}

\begin{verbatim}[numbers=left,firstnumber=last]
\[   0 \xleftarrow [\zeta]{}  F \times \Delta (n - 1)
     \xrightarrow {\partial_0 \alpha(b)} E^{\partial_0 b}\]
\end{verbatim}
Example 8-4-1
\[
   0 \xleftarrow [\zeta]{}  F \times \Delta (n - 1)
     \xrightarrow {\partial_0 \alpha(b)} E^{\partial_0 b}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation*}
\cfrac {1}{\sqrt{2} +
 \cfrac {1}{\sqrt{3} +
  \cfrac {1}{\sqrt{4} +
   \cfrac[r] {1}{\sqrt{5} +
    \cfrac[l] {1}{\sqrt{6} + \dotsb }
   }}}}
\end{equation*}
\end{verbatim}

Example 8-4-2
\begin{equation*}
\cfrac {1}{\sqrt{2} +
 \cfrac {1}{\sqrt{3} +
  \cfrac {1}{\sqrt{4} +
   \cfrac[r] {1}{\sqrt{5} +
    \cfrac[l] {1}{\sqrt{6} + \dotsb }
   }}}}
\end{equation*}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation} \boxed { W_t - F \subseteq V(P_i) \subseteq W_t }\end{equation}
\end{verbatim}
Example 8-4-3
\begin{equation}
   \boxed { W_t - F \subseteq V(P_i) \subseteq W_t }
\end{equation}

\begin{verbatim}[numbers=left,firstnumber=last]
\[  \sum_{i=1}^n \qquad \int_0^\infty \qquad \lim_{n \to 0} \]
Text: $\sum_{i=1}^n$, $\int_0^\infty$, $\lim_{n \to 0}$.
\end{verbatim}
Example 8-4-4
\[
  \sum_{i=1}^n \qquad \int_0^\infty \qquad \lim_{n \to 0}
\]
Text: $\sum_{i=1}^n$, $\int_0^\infty$, $\lim_{n \to 0}$.

\begin{verbatim}[numbers=left,firstnumber=last]
\[
   \sum\nolimits_{i=1}^n \qquad \int\limits_0^\infty
   \qquad  \lim\displaylimits_{n \to 0}
\]
Text: $\sum\nolimits_{i=1}^n$, $\int\limits_0^\infty$,
$\lim\displaylimits_{n \to 0}$.
\end{verbatim}
Example 8-4-5 (limits placement is wrong in the Pdf version, text style).
\[
   \sum\nolimits_{i=1}^n \qquad \int\limits_0^\infty
   \qquad  \lim\displaylimits_{n \to 0}
\]
Text: $\sum\nolimits_{i=1}^n$, $\int\limits_0^\infty$,
$\lim\displaylimits_{n \to 0}$.



\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather*}
 \xiint     \limits _V \mu(v,w)   \,du \,dv  \quad
 \xiiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \quad
 \xiiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw  \\
 \idotsint \limits _V \mu(z_1, \dots, z_k)   \,\mathbf{dz}\\
 \iint     \limits _V \mu(v,w)   \,du \,dv \qquad 
 \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad
 \iiiint   \limits _V \mu(t,u,v,w)    \,dt \,du \,dv \,dw  \\ \textstyle
 \iint     \limits _V \mu(v,w)   \,du \,dv \qquad 
 \iiint    \limits _V \mu(u,v,w)   \,du \,dv \,dw  \qquad  
 \iiiint   \limits _V \mu(t,u,v,w)   \,dt \,du \,dv \,dw  
\end{gather*}
\end{verbatim}
Example 8-4-6. Modified, using \cmd{xiint}, \cmd{xiiint}, \cmd{xiiiint}
command that produce Unicode character U+222c, U+222D and U+2A0C,
or simple integrals.
\begin{gather*}
 \xiint     \limits _V \mu(v,w)
   \,du \,dv                      \quad
 \xiiint    \limits _V \mu(u,v,w)
   \,du \,dv \,dw                 \quad
 \xiiiint   \limits _V \mu(t,u,v,w)
   \,dt \,du \,dv \,dw            \\
 \idotsint \limits _V \mu(z_1, \dots, z_k)
   \,\mathbf{dz}\\
 \iint     \limits _V \mu(v,w)
   \,du \,dv \qquad
 \iiint    \limits _V \mu(u,v,w)
   \,du \,dv \,dw  \qquad
 \iiiint   \limits _V \mu(t,u,v,w) 
   \,dt \,du \,dv \,dw  \\ \textstyle
 \iint     \limits _V \mu(v,w)
   \,du \,dv \qquad
 \iiint    \limits _V \mu(u,v,w)
   \,du \,dv \,dw  \qquad
 \iiiint   \limits _V \mu(t,u,v,w)
   \,dt \,du \,dv \,dw  
\end{gather*}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align*}
  u & \equiv v + 1 \mod{n^2}  \\
  u & \equiv v + 1 \bmod{n^2} \\
  u &   =    v + 1 \pmod{n^2} \\
  u &   =    v + 1 \pod{n^2}
\end{align*}
The in-text layout: $ u = v + 1 \pmod{n^2} $
\begin{gather*}
   (m \bmod n) = k^2 \, ; \quad
  x \equiv y \pmod b \, ;     \\
  x \equiv y \mod c \, ;  \quad
  x \equiv y \pod d\, .
\end{gather*}
\end{verbatim}
Example 8-4-7
\begin{align*}
  u & \equiv v + 1 \mod{n^2}  \\
  u & \equiv v + 1 \bmod{n^2} \\
  u &   =    v + 1 \pmod{n^2} \\
  u &   =    v + 1 \pod{n^2}
\end{align*}
The in-text layout: $ u = v + 1 \pmod{n^2} $
\begin{gather*}
   (m \bmod n) = k^2 \, ; \quad
  x \equiv y \pmod b \, ;     \\
  x \equiv y \mod c \, ;  \quad
  x \equiv y \pod d\, .
\end{gather*}


\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation} \frac{1}{k} \log_2 c(f)
          \quad \tfrac{1}{k} \log_2 c(f) \end{equation}
Text: $ \sqrt{ \frac{1}{k} \log_2 c(f) } \quad
        \sqrt{ \dfrac{1}{k} \log_2 c(f) }\, $.
\end{verbatim}
Example 8-4-8
\begin{equation} \frac{1}{k} \log_2 c(f)
          \quad \tfrac{1}{k} \log_2 c(f) \end{equation}
Text: $ \sqrt{ \frac{1}{k} \log_2 c(f) } \quad
        \sqrt{ \dfrac{1}{k} \log_2 c(f) }\, $. 

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{equation} \binom{k}{2} 2^{k - 1}
          + \tbinom{k - 1}{2} 2^{k - 2} \end{equation} 
Text: $ \binom{k}{2} 2^{k - 1} + \dbinom{k - 1}{2} 2^{k - 2} $.
$ \dot{S} \quad \ddot{P} \quad \dddot{Q} \quad \ddddot{R} $
\end{verbatim}        
Example 8-4-9
\begin{equation} \binom{k}{2} 2^{k - 1}
          + \tbinom{k - 1}{2} 2^{k - 2} \end{equation}
Text: $ \binom{k}{2} 2^{k - 1}
        + \dbinom{k - 1}{2} 2^{k - 2} $.


Example 8-4-10: Four dots above: character unknown by FM.
$ \dot{S} \quad \ddot{P} \quad \dddot{Q} \quad \ddddot{R} $

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \accentset{\ast}{X}                 \quad
   \hat{\accentset{\star}{\hat h}}     \quad
   \underaccent{\diamond}{\mathcal{M}} \quad
   \undertilde{C}\quad\undertilde{M}\quad\undertilde{ABC} \]
\end{verbatim}

Example 8-4-11. Commands \cmd{accentset} and \cmd{underaccent}
are defined in the amsmath.plt file, they produce a \elt{munder} or 
\elt{mover} element, with attribute accent or mathaccent set to true.
Note that accents might be too big.

\[ \accentset{\ast}{X}                 \quad
   \hat{\accentset{\star}{\hat h}}     \quad
   \underaccent{\diamond}{\mathcal{M}} \quad
   \undertilde{C}\quad\undertilde{M}\quad\undertilde{ABC}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
$(xyz)\spdddot$ \quad $(xyz)\spddot$ \quad $(xyz)\spdot$
$(xyz)\spbreve$ \quad $(xyz)\spcheck$ 
$(xyz)\sphat$   \quad $(xyz)\sptilde$
\end{verbatim}
   
Example 8-4-12. (breve and hat are invisible on Firefox, too high on Amaya).
$(xyz)\spdddot$ \quad $(xyz)\spddot$ \quad $(xyz)\spdot$ \quad
$(xyz)\spbreve$ \quad $(xyz)\spcheck$  \quad
$(xyz)\sphat$   \quad $(xyz)\sptilde$

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \overset{*}{X} > \underset{*}{X}
     \iff \sideset{}{'}\sum_{a,b \in \mathbf{R^*}}
                       \overset{a}{\underset{b}{X}} = X \]
\end{verbatim}
Example 8-4-13.  Commands \cmd{overset} and \cmd{underset}
are defined in the \filename{amsmath.plt} file, they produce a \elt{munder} or 
\elt{mover} element.
\[ \overset{*}{X} > \underset{*}{X}
     \iff \sideset{}{'}\sum_{a,b \in \mathbf{R^*}}
                       \overset{a}{\underset{b}{X}} = X 
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \sideset{_{i = 1}^n}{_{j = 2}^m}\prod_{k > 1}  \mathcal{T}_{i, j}^k \]
\end{verbatim}
Example 8-4-14.
\[ \sideset{_{i = 1}^n}{_{j = 2}^m}\prod_{k > 1}  \mathcal{T}_{i, j}^k \]


\section{Variable symbol commands}

\begin{verbatim}[numbers=left,firstnumber=last]
A series $H_1, H_2, \dots, H_n$, a sum
$H_1 + H_2 + \dots + H_n$, an orthogonal product
$H_1 \times H_2 \times \dots \times H_n$.
A series $H_1, H_2, \dotsc\,$, a sum
$H_1 + H_2 + \dotsb\,$, an orthogonal product
$H_1 \times H_2 \times \dotsm\,$, and an infinite
integral:   \[ \int_{H_1} \int_{H_2} \dotsi \;  {-\Gamma}\, d\Theta \]
\end{verbatim}

Example 8-5-1.
A series $H_1, H_2, \dots, H_n$, a sum
$H_1 + H_2 + \dots + H_n$, an orthogonal product
$H_1 \times H_2 \times \dots \times H_n$.

Example 8-5-2.
A series $H_1, H_2, \dotsc\,$, a sum
$H_1 + H_2 + \dotsb\,$, an orthogonal product
$H_1 \times H_2 \times \dotsm\,$, and an infinite
integral:   \[ \int_{H_1} \int_{H_2} \dotsi \;
                           {-\Gamma}\, d\Theta \]

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{align*}
\widehat  {\psi_\delta(t) E_t h} &= \widetilde   {\psi_\delta(t) E_t h}    \\
\overline  {\psi_\delta(t) E_t h}&= \underline   {\psi_\delta(t) E_t h}    \\
\overbrace      {\psi_\delta(t) E_t h}&= \underbrace  {\psi_\delta(t) E_t h}
& & \text{Do not change style}            \\
\overrightarrow {\psi_\delta(t) E_t h}&= \overleftarrow {\psi_\delta(t) E_t h}
& &   \text{Do not change style}     \\[-3pt]
& & & \text{without \textsf{amsmath}}     \\
\underrightarrow  {\psi_\delta(t) E_t h}
&= \underleftarrow  {\psi_\delta(t) E_t h}
& & \text{Do need \textsf{amsmath}}       \\
\overleftrightarrow {\psi_\delta(t) E_t h}
&=\underleftrightarrow{\psi_\delta(t) E_t h}
& & \text{Do need \textsf{amsmath}}
\end{align*}
\end{verbatim}
                           
Example 8-5-3
\begin{align*}
\widehat        {\psi_\delta(t) E_t h}
&= \widetilde   {\psi_\delta(t) E_t h}    \\
\overline       {\psi_\delta(t) E_t h}
&= \underline   {\psi_\delta(t) E_t h}    \\
\overbrace      {\psi_\delta(t) E_t h}
&= \underbrace  {\psi_\delta(t) E_t h}
& & \text{Do not change style}            \\
\overrightarrow {\psi_\delta(t) E_t h}
&= \overleftarrow {\psi_\delta(t) E_t h}
& &   \text{Do not change style}     \\[-3pt]
& & & \text{without \textsf{amsmath}}     \\
\underrightarrow  {\psi_\delta(t) E_t h}
&= \underleftarrow  {\psi_\delta(t) E_t h}
& & \text{Do need \textsf{amsmath}}       \\
\overleftrightarrow {\psi_\delta(t) E_t h}
&=\underleftrightarrow{\psi_\delta(t) E_t h}
& & \text{Do need \textsf{amsmath}}
\end{align*}

\begin{verbatim}[numbers=left,firstnumber=last]
\[   \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 +
      \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 + x}}}}}} \]
\end{verbatim}
Example 8-5-4
\[
   \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 +
      \sqrtsign{1 + \sqrtsign{1 + \sqrtsign{1 + x}}}}}}
\]




\begin{table}\XMLaddatt{simple-table}{true}
\begin{tabular}{clclcl}
$(\BMS)$ & \LTC{( )} & $\{\BMS\}$ & \cmd{\{} \cmd{\}}& $\lVert \BMS\rVert$&
\cmd{lVert} \cmd{rVert}\\
$\langle\BMS\rangle$ & \cmd{langle} \cmd{rangle} & $\lbrace\BMS\rbrace$ & 
\cmd{lbrace} \cmd{rbrace}& $\lvert \BMS\rvert$&\cmd{lvert} \cmd{rvert}\\
$\lgroup\BMS\rgroup$ & \cmd{lgroup} \cmd{rgroup} & $[\BMS]$ & \LTC{[ ]} 
& $| \BMS$& \LTC{|}\\
$\lmoustache\BMS\rmoustache$ & \cmd{lmoustache} \cmd{rmoustache} & 
$\lbrack\BMS\rbrack$ & \cmd{lbrack} \cmd{rbrack}& $\vert \BMS$&\cmd{vert}\\
$\Downarrow\BMS$ & \cmd{Downarrow}  & $\lceil\BMS\rceil$ & 
\cmd{lceil} \cmd{rceil}& $\arrowvert \BMS$&\cmd{arrowvert}\\
$\Uparrow\BMS$ & \cmd{Uparrow}  & $\lfloor\BMS\rfloor$ & 
\cmd{lfloor} \cmd{rfloor}& $\bracevert \BMS$&\cmd{bracevert}\\
$\Updownarrow\BMS$ & \cmd{Updownarrow}  & $\llbracket\BMS\rrbracket$ & 
\cmd{llbracket} \cmd{rrbracket}& $\Arrowvert \BMS$&\cmd{Arrowvert}\\
$\downarrow\BMS$ & \cmd{downarrow}  & $/\BMS$ & 
\LTC{/}& $\| \BMS$&\cmd{|}\\
$\uparrow\BMS$ & \cmd{uparrow}  & $\backslash\BMS$ & 
\cmd{backslash}& $\Vert \BMS$&\cmd{Vert}\\
$\updownarrow\BMS$ & \cmd{updownarrow}  & $\BMS$ & 
\LTC{.}& $\sqrtsign{\BMS~~~~~~~}$&\cmd{sqrtsign}\\
\end{tabular}
\caption{Vertically extensible symbols}
\end{table}



\section{Words in mathematics}

\begin{table}\XMLaddatt{simple-table}{true}
\begin{tabular}{clclclcl}
$\arccos$ &\cmd{arccos} & v$\arcsin$ &\cmd{arcsin}& $\arctan$ &\cmd{arctan}
&$\arg$&\cmd{arg}\\
$\cos$&\cmd{cos}& $\cosh$&\cmd{cosh}& $\cot$&\cmd{cot}& $\coth$&\cmd{coth}&\\ 
$\csc$&\cmd{csc}& $\deg$&\cmd{deg}& $\det$&\cmd{det}& $\dim$&\cmd{dim}&\\ 
$\exp$&\cmd{exp}& $\gcd$&\cmd{gcd}& $\hom$&\cmd{hom}& $\inf$&\cmd{inf}&\\ 
$\injlim$&\cmd{injlim}& $\ker$&\cmd{ker}& $\lg$&\cmd{lg}& $\lim$&\cmd{lim}&\\ 
$\liminf$&\cmd{liminf}& $\limsup$&\cmd{limsup}& $\ln$&\cmd{ln}& $\log$&\cmd{log}&\\ 
$\max$&\cmd{max}& $\min$&\cmd{min}& $\Pr$&\cmd{Pr}& $\projlim$&\cmd{projlim}&\\ 
$\sec$&\cmd{sec}& $\sin$&\cmd{sin}& $\sinh$&\cmd{sinh}& $\sup$&\cmd{sup}&\\ 
$\tan$&\cmd{tan}& $\tanh$&\cmd{tanh}& $\varinjlim$&\cmd{varinjlim}& $\varliminf$&\cmd{varliminf}&\\ 
$\varlimsup$&\cmd{varlimsup}& $\varprojlim$&\cmd{varprojlim}
\end{tabular}
\caption{Predefined operators and functions}
\end{table}

\begin{verbatim}[numbers=left,firstnumber=last]
\begin{gather}
  \text{Also, if } \Delta_{\text{max up}}
           = \Delta_{\text{min down}} \notag \\
  \text{(for all ups and downs) then} \notag \\
  \Delta_{\text{sum of ups}}
           = \Delta_{\text{sum of downs}}
\end{gather}
\end{verbatim}
Example 8-6-1
\begin{gather}
  \text{Also, if } \Delta_{\text{max up}}
           = \Delta_{\text{min down}} \notag \\
  \text{(for all ups and downs) then} \notag \\
  \Delta_{\text{sum of ups}}
           = \Delta_{\text{sum of downs}}
\end{gather}

\begin{verbatim}[numbers=left,firstnumber=last]
\newcommand\abs[1]{\lvert#1\rvert}
\setlength\mathindent{0pt}
\begin{gather*}
  \lim_{x \rightarrow 0} \frac{ \sin^2(x) }{ x^2 } = 1 \\
  \varliminf_{n \rightarrow \infty}
    \abs{a_{n+1}} / \abs{a_n} = 0                      \\
 %{ JG
 \varinjlim (m_i^\lambda \cdot M)^* 
  %} JG
\le \varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0
\end{gather*}
\end{verbatim}
Example 8-6-2. Braces uncommented out for the last equation.
\newcommand\abs[1]{\lvert#1\rvert}
\setlength\mathindent{0pt}
\begin{gather*}
  \lim_{x \rightarrow 0} \frac{ \sin^2(x) }{ x^2 } = 1 \\
  \varliminf_{n \rightarrow \infty}
    \abs{a_{n+1}} / \abs{a_n} = 0                      \\
  \varinjlim (m_i^\lambda \cdot M)^* \le
    \varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0 \\
{ \varinjlim (m_i^\lambda \cdot M)^*} \le
    \varprojlim_{A/p \rightarrow \lambda(A)}A_p \le 0
\end{gather*}


\begin{verbatim}[numbers=left,firstnumber=last]
\let\abs\relax
\DeclareMathOperator \meas    {meas}
\DeclareMathOperator*\esssup  {ess \, sup}
\DeclareMathOperator*\supminus{sup - minus*}
\newcommand\abs [1]{\lvert#1\rvert}
\newcommand\norm[1]{\lVert#1\rVert}
\begin{gather*}
  \norm{f}_\infty = \esssup_{x \in R^n} \abs{f(x)}  \\
  \norm{f}_\infty = \smash{\esssup_{x \in R^n}} \abs{f(x)}  \\
  \meas_1 \{ u \in R_+^1 \colon f^*(u)>\alpha \} =  
   \esssup_{x \in R^i} \; \meas_i
     \{ u \in R^n \colon \abs{f(u)} \geq \alpha \}  \\
  \quad (\forall \alpha \in \supminus_{f^*} R_{*+})
\end{gather*}
\end{verbatim}
Example 8-6-3. We removed the line break between equations 2 and 3. Note that
an asterisk is printed as a normal character. Note the use of the \cmd{smash}
command: 

\let\abs\relax
\DeclareMathOperator \meas    {meas}
\DeclareMathOperator*\esssup  {ess \, sup}
\DeclareMathOperator*\supminus{sup - minus*}
\newcommand\abs [1]{\lvert#1\rvert}
\newcommand\norm[1]{\lVert#1\rVert}
\begin{gather*}
  \norm{f}_\infty = \esssup_{x \in R^n} \abs{f(x)}  \\
  \norm{f}_\infty = \smash{\esssup_{x \in R^n}} \abs{f(x)}  \\
  \meas_1 \{ u \in R_+^1 \colon f^*(u)>\alpha \} =  
   \esssup_{x \in R^i} \; \meas_i
     \{ u \in R^n \colon \abs{f(u)} \geq \alpha \}  \\
  \quad (\forall \alpha \in \supminus_{f^*} R_{*+})
\end{gather*}


\begin{verbatim}[numbers=left,firstnumber=last]
\[\varlimsup_{n\to\infty}\calQ (u_n, u_n - u^{\#}) \ge \csc (\calQ' (u^{\#})) \]
\end{verbatim}
Example 8-6-4 
\newcommand\calQ{\mathcal{Q}}
\[ 
\let\csc\relax
\DeclareMathOperator\csc{cosec}
\varlimsup_{n\to\infty} \calQ (u_n, u_n - u^{\#})  \ge \csc (\calQ' (u^{\#})) \]



\section{Fine tuning the mathematical layout}

\begin{verbatim}[numbers=left,firstnumber=last]
\let\LB\relax\let\RB\relax\let\DS\relax
\def\Test{
   b                       %% D
    ^0                     %% S
   +                       %% D
   \frac{\LB(k + p)        %% T
          _{j'}\RB         %% S'
         \DS% \displaystyle
         \pm               %% T  [D]
         \frac{(f + q)     %% S  [T]
                ^{(pk)     %% SS [S]
                   ^y      %% SS
                   _{j'}}} %% SS'
              {(h + y)}}   %% S' [T']
        {(l + q)           %% T'
          ^{(pk)}}         %% S'
}
\[\Test\qquad \let\LB={ \let \RB=} \Test \]
\end{verbatim}

Example 8-7-1. Original \LaTeX\ version, plus version with braces added.

\normalsize                %% Style:
\let\LB\relax\let\RB\relax\let\DS\relax
\def\Test{
 b                       %% D
    ^0                     %% S
   +                       %% D
   \frac{\LB(k + p)           %% T
          _{j'}\RB            %% S'
         \DS% \displaystyle
         \pm               %% T  [D]
         \frac{(f + q)     %% S  [T]
                ^{(pk)     %% SS [S]
                   ^y      %% SS
                   _{j'}}} %% SS'
              {(h + y)}}   %% S' [T']
        {(l + q)           %% T'
          ^{(pk)}}         %% S'
}
\[\Test\qquad \let\LB={ \let \RB=} \Test \]


Example 8-7-2. Same, with \cmd{DS} replaced by \cmd{displaystyle}
\let\DS\displaystyle
\[\Test\qquad \let\LB={ \let \RB=} \Test \]

\begin{verbatim}[numbers=left,firstnumber=last]
\[ \biggl( \mathbf{E}_{y} \int_0^{t_\varepsilon}
   L_{x, y^x(s)} \varphi(x)\, ds \biggr) \]
\end{verbatim}
Example 8-7-3. This demonstrates that commands like \cmd{Large} do affect the
size delimiters as \cmd{biggl}. In \Tralics, translation of math formulas is
unaffected by font size commands. Thus, second part of example omitted.
\[ \biggl( \mathbf{E}_{y} \int_0^{t_\varepsilon}
   L_{x, y^x(s)} \varphi(x)\, ds \biggr) \]


\begin{verbatim}[numbers=left,firstnumber=last]
\[
   \sqrt[\beta]{k} \qquad
   \sqrt[\leftroot{2}\uproot{4} \beta]{k} \qquad
   \sqrt[\leftroot{1}\uproot{3} \beta]{k}
\]
\end{verbatim}
Example 8-7-4 Commands \cmd{leftroot} and \cmd{uproot} implemented as no-op.
\[
   \sqrt[\beta]{k} \qquad
   \sqrt[\leftroot{2}\uproot{4} \beta]{k} \qquad
   \sqrt[\leftroot{1}\uproot{3} \beta]{k}
\]


\begin{verbatim}[numbers=left,firstnumber=last]
$\sqrt{x} + \sqrt{y}            + \sqrt{z}$,
$\sqrt{x} + \sqrt{\mathstrut y} + \sqrt{z}$,
$\sqrt{x} + \sqrt{\smash{y}}    + \sqrt{z}$,
$\sqrt{x} + \sqrt{\smash[b]{y}} + \sqrt{z}$
\end{verbatim}
Example 8-7-5, explaining smash.
$\sqrt{x} + \sqrt{y}            + \sqrt{z}$,
$\sqrt{x} + \sqrt{\mathstrut y} + \sqrt{z}$,
$\sqrt{x} + \sqrt{\smash{y}}    + \sqrt{z}$,
$\sqrt{x} + \sqrt{\smash[b]{y}} + \sqrt{z}$


More uses of smash (top, bottom, all):
\[\sqrt{x} + \sqrt{\frac12}            + \sqrt{z},
\sqrt{x} + \sqrt{\smash[t]{\frac12}} + \sqrt{z},
\sqrt{x} + \sqrt{\smash[b]{\frac12}}    + \sqrt{z},
\sqrt{x} + \sqrt{\smash{\frac12}} + \sqrt{z}. \]

\begin{verbatim}[numbers=left,firstnumber=last]
\[
  f_p (x) =
  \begin{cases}
    \frac{1}{\smash[b]{p}}                & x = p  \\
    \frac{\strut
          \smash[t]{\frac{(1 - x)^{\frac{1}{2}} }
                         { x - \sin (x - p)     } } }
         {\sqrt{1 - p} \, \cos (x - p)}   & x \neq p
  \end{cases}
\]
\end{verbatim}
Example 8-7-6. The \cmd{strut} above needed by amsmath, see TLC2.
\[
  f_p (x) =
  \begin{cases}
    \frac{1}{\smash[b]{p}}                & x = p  \\
    \frac{\strut
          \smash[t]{\frac{(1 - x)^{\frac{1}{2}} }
                         { x - \sin (x - p)     } } }
         {\sqrt{1 - p} \, \cos (x - p)}   & x \neq p
  \end{cases}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[
   \sqrt{ \frac{a+b}{x_j} }           \quad
   \sqrt{ \frac{a+b}{\smash{x_j}} }   \quad
   \sqrt{ \frac{a+b}{{}\smash{x_j}} } \quad
   \sqrt{ \frac{a+b}{\smash{x_j+b}} }
\]
\end{verbatim}
Example 8-7-7. The empty group above needed by amsmath, see TLC2.
\[
   \sqrt{ \frac{a+b}{x_j} }           \quad
   \sqrt{ \frac{a+b}{\smash{x_j}} }   \quad
   \sqrt{ \frac{a+b}{{}\smash{x_j}} } \quad
   \sqrt{ \frac{a+b}{\smash{x_j+b}} }
\]

\section{Fonts in formulas}
\begin{verbatim}[numbers=left,firstnumber=last]
$ \forall n \in \mathbb{N} : \mathfrak{M}_n \leq \mathfrak{A} $
\DeclareMathAlphabet\mathbb{U}{fplmbb}{m}{n}
$ \lbrace n,m \in \mathbb{N} \mid  \mathfrak{N}_{n,m} \rbrace $
\DeclareMathAlphabet\mathscr{T1}{hlcw}{m}{it}
$A_B \neq \mathscr{A}_\mathscr{B} \neq \mathcal{A}_\mathcal{B}$
\end{verbatim}
Example 8-8-1
$ \forall n \in \mathbb{N} : \mathfrak{M}_n \leq \mathfrak{A} $

Example 8-8-2
\DeclareMathAlphabet\mathbb{U}{fplmbb}{m}{n}
$ \lbrace n,m \in \mathbb{N} \mid  \mathfrak{N}_{n,m} \rbrace $

Example 8-8-3
The \cmd{DeclareMathAlphabet} command takes five arguments and defines the
first one to be \cmd{relax}.
\DeclareMathAlphabet\mathscr{T1}{hlcw}{m}{it}
$A_B \neq \mathscr{A}_\mathscr{B} \neq \mathcal{A}_\mathcal{B}$

\begin{verbatim}[numbers=left,firstnumber=last]
\newcommand\bfB{\mathbf{B}}   \newcommand\bfx{\mathbf{x}}
\bmdefine\bpi{\pi}            \bmdefine\binfty{\infty}
\section{The bold equivalence
  $\sum_{j < B} \prod_\lambda : \bm{\sum_{x_j} \prod_\lambda}$}
\begin{gather}
  B_\infty + \pi B_1 \sim  \bfB_{\binfty} \bm{+}\bpi \bfB_{\bm{1}}
    \bm {\sim B_\infty + \pi B_1}                                   \\
  B_\binfty + \bpi B_{\bm{1}} \bm{\in} \bm{\biggl\lbrace}
    (\bfB, \bfx) : \frac {\partial \bfB}{\partial \bfx}
    \bm{\lnapprox} \bm{1} \bm{\biggr\rbrace}
\end{gather}
\end{verbatim}
Example 8-8-4. %Replaced \cmd{section} by \cmd{subsection}. 
Currently \cmd{bndefine} is \cmd{def} and \cmd{bm} is \cmd{mathbf}.
\newcommand\bfB{\mathbf{B}}   \newcommand\bfx{\mathbf{x}}
\bmdefine\bpi{\pi}            \bmdefine\binfty{\infty}


\section{The bold equivalence
  $\sum_{j < B} \prod_\lambda : \bm{\sum_{x_j} \prod_\lambda}$}
\begin{gather}
  B_\infty + \pi B_1 \sim  \bfB_{\binfty} \bm{+}\bpi \bfB_{\bm{1}}
    \bm {\sim B_\infty + \pi B_1}                                   \\
  B_\binfty + \bpi B_{\bm{1}} \bm{\in} \bm{\biggl\lbrace}
    (\bfB, \bfx) : \frac {\partial \bfB}{\partial \bfx}
    \bm{\lnapprox} \bm{1} \bm{\biggr\rbrace}
\end{gather}

Example 8-8-5: same code different packages

\begin{verbatim}[numbers=left,firstnumber=last]
$\bm{\Biggl\lbrace\biggl\lbrace\Bigl\lbrace\bigl\lbrace \lbrace
     \mathcal{Q}
     \rangle \bigr\rangle\Bigr\rangle\biggr\rangle\Biggr\rangle}$
\end{verbatim}

Example 8-8-6
$\bm{\Biggl\lbrace\biggl\lbrace\Bigl\lbrace\bigl\lbrace \lbrace
     \mathcal{Q}
     \rangle \bigr\rangle\Bigr\rangle\biggr\rangle\Biggr\rangle}$

Example 8-8-7: same code different packages.


\begin{verbatim}[numbers=left,firstnumber=last]
$ \bm{\sqrt[2]{x \times \alpha}} $  but
$\let\unboldmath\relax
 \bm{\sqrt[2]{x \mathbin{\mbox{\unboldmath$\times$}} \alpha}} $
  or the similar
\def\sqrtsign{\sqrt{}}
$ \bm{\sqrtsign}{\bm{x} \times \bm{\alpha}} $
%% $\bf \sqrt \it {\bf x \IT \times \bf \alpha \IT } $ see below A
%% $\bf {\sqrt} \it {\bf {x} \IT \times \bf {\alpha} \IT } $ see below B
\end{verbatim}
Example 8-8-8. Second formula modified: you cannot use \cmd{unboldmath}. Third
formula: the command \cmd{sqrtsign} is identical to \cmd{sqrt}; you may wonder
what the argument is. Currently \cmd{bm} is the same as \cmd{mathbf}, it takes
one argument and typesets it in bold face font. Hence, \Tralics\ executes the
line shown above, marked `see below A'. Here \cmd{bf} and \cmd{it} are the
tokens inserted by the \cmd{bm} command corresponding to the new and old font
(in reality, these tokens have complicated names). 
Thus, the argument of \cmd{sqrt} is the \cmd{it}
command. Note that the \cmd{sqrt} command uses a local group (is this good
idea?), so that the \cmd{it} command changes font locally; said otherwise,
current font remains bold, and \cmd{IT} is \cmd{bf}. It is a wonder that this
works. We noticed that \LaTeX\ font change commands like \cmd{mathbf} typeset
their arguments in a group, and modified the \Tralics\ code; thus the
equivalent of line marked `see below B' is executed. Suddenly \cmd{sqrt}
looses its argument. For this reason, we changed the command \cmd{sqrtsign} 
to \cmd{sqrt}\argument{}. The example is
$ \bm{\sqrt[2]{x \times \alpha}} $  but
$\let\unboldmath\relax
 \bm{\sqrt[2]{x \mathbin{\mbox{\unboldmath$\times$}} \alpha}} $
  or the similar
$\def\sqrtsign{\sqrt{}} \bm{\sqrtsign}{\bm{x} \times \bm{\alpha}} $

\begin{verbatim}[numbers=left,firstnumber=last]
\bmdefine\bhat{\hat}
% This does not work
%$\hat a \neq \bm{\hat a} \neq \bm{\hat a} = \bhat a \neq \bm{\widehat a}$
$\hat a \neq \bm{\hat a} \neq \bm\hat a = \bhat a \neq \bm\widehat a$
\end{verbatim}
Example 8-8-9 modified
\bmdefine\bhat{\hat}
$\hat a \neq \bm{\hat a} \neq \bm{\hat a} = \bhat a \neq \bm{\widehat a}$

\begin{verbatim}[numbers=left,firstnumber=last]
\section{Sample page of mathematical typesetting}

First some large operators
both in text: \( \iiint\limits_{\mathcal{Q}}
f(x,y,z)\,dx\,dy\,dz \) and
\(\prod_{\gamma\in\Gamma_{\widetilde{C}}}
\partial(\widetilde{X}_\gamma)\); and also on display:

\begin{equation}
\begin{split}
%%     This line is deliberately long so as to show
%%     differences in widths; it is a little over the measure
%%     in article/cmr.
\iiiint\limits_{\mathbf{Q}} f(w,x,y,z)\,dw\,dx\,dy\,dz  &\leq
\oint_{\bm{\partial Q}} f' \left( \max \left\lbrace
\frac{\lVert w \rVert}{\lvert w^2 + x^2 \rvert} ;
\frac{\lVert z \rVert}{\lvert y^2 + z^2 \rvert} ;
\frac{\lVert w \oplus z \rVert}{\lVert x \oplus y \rVert}
\right\rbrace\right)
\\
&\precapprox \biguplus_{\mathbb{Q} \Subset \bar{\mathbf{Q}}}
\left[ f^{\ast} \left(
    \frac{\left\lmoustache\mathbb{Q}(t)\right\rmoustache}
         {\sqrt {1 - t^2}}
    \right)\right]_{t=\alpha}^{t=\vartheta}
\\
\end{split}
\end{equation}

For $x$ in the open interval \( \left] -1, 1 \right[ \)
the infinite sum in Equation~\eqref{eq:binom1} is convergent;
however, this does not hold
throughout the closed interval \( \left[ -1, 1 \right] \).
\begin{align}
  (1 - x)^{-k} &=
    1 + \sum_{j=1}^{\infty} (-1)^j \ibinom{k}{j} x^j
    \quad \text{ for } k \in \mathbb{N}; k \neq 0.
    \label{eq:binom1}
\end{align}
\end{verbatim}
Example 8-8-10. Changed a little bit: it is currently not possible to put a
\cmd{quad} in a \cmd{text} in math mode. Thus, the \cmd{text} contains only
the word `for'.



\section{Sample page of mathematical typesetting}

First some large operators
both in text: \( \iiint\limits_{\mathcal{Q}}
f(x,y,z)\,dx\,dy\,dz \) and
\(\prod_{\gamma\in\Gamma_{\widetilde{C}}}
\partial(\widetilde{X}_\gamma)\); and also on display:

\begin{equation}
\begin{split}
%%     This line is deliberately long so as to show
%%     differences in widths; it is a little over the measure
%%     in article/cmr.
\iiiint\limits_{\mathbf{Q}} f(w,x,y,z)\,dw\,dx\,dy\,dz  &\leq
\oint_{\bm{\partial Q}} f' \left( \max \left\lbrace
\frac{\lVert w \rVert}{\lvert w^2 + x^2 \rvert} ;
\frac{\lVert z \rVert}{\lvert y^2 + z^2 \rvert} ;
\frac{\lVert w \oplus z \rVert}{\lVert x \oplus y \rVert}
\right\rbrace\right)
\\
&\precapprox \biguplus_{\mathbb{Q} \Subset \bar{\mathbf{Q}}}
\left[ f^{\ast} \left(
    \frac{\left\lmoustache\mathbb{Q}(t)\right\rmoustache}
         {\sqrt {1 - t^2}}
    \right)\right]_{t=\alpha}^{t=\vartheta}
\\
\end{split}
\end{equation}

For $x$ in the open interval \( \left] -1, 1 \right[ \)
the infinite sum in Equation~\eqref{eq:binom1} is convergent;
however, this does not hold
throughout the closed interval \( \left[ -1, 1 \right] \).
\begin{align}
  (1 - x)^{-k} &=
    1 + \sum_{j=1}^{\infty} (-1)^j \ibinom{k}{j} x^j
    \quad \text{ for } k \in \mathbb{N}; k \neq 0.
    \label{eq:binom1}
\end{align}


Other examples here omitted.
\section{Symbols in formulas}

\begin{verbatim}[numbers=left,firstnumber=last]
\[ a          \#          \top _x^\alpha x^\alpha_b \]
\[ a \mathrel{\#} \mathop{\top}_x^\alpha x^\alpha_b \]
\thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
\[ a  -  b  =  -\max \{ x , y \}\]
\end{verbatim}

Example 8-9-1. In this example, \cmd{\char`\#} and \cmd{top} are changed into a
Rel and a Op operator, so that \elt{msub} or \elt{mover} is used in the
translation, but in the current version of \Tralics, 
no information is attached to the symbol.
\[ a          \#          \top _x^\alpha x^\alpha_b \]
\[ a \mathrel{\#} \mathop{\top}_x^\alpha x^\alpha_b \]

Example 8-9-2. This example demonstrates that spacing in math formulas depend
on three registers that the user can change, but the value is ignored by
\Tralics. 
\thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
\[
     a  -  b  =  -\max \{ x , y \}
\]

Example 8-9-3. This demonstrates that different spacing is used for
\cmd{bigl}/\cmd{bigr} or \cmd{left}/\cmd{right}. \Tralics\ tries  very hard to
convert big open/close pairs to left-right ones. 
 
\begin{verbatim}[numbers=left,firstnumber=last]
\thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
\[ a \Bigl( \sum x \Bigr) \neq  a \left( \sum x \right) \]
\end{verbatim}
\thinmuskip=10mu \medmuskip=17mu \thickmuskip=30mu
\[ a \Bigl( \sum x \Bigr) \neq  a \left( \sum x \right) \]

\begin{verbatim}[numbers=left,firstnumber=last]
\DeclareMathSymbol\bneg   {\mathbin}{symbols}{"3A}
\DeclareMathSymbol\rsquare{\mathrel}{AMSa}{"03}
\[ a \neg b           \qquad  x \square           y + z \]
\[ a \mathbin{\neg} b \qquad  x \mathrel{\square} y + z \]
\[ a \bneg          b \qquad  x \rsquare          y + z \]
\end{verbatim}
Example 8-9-4. This example demonstrates that 1) spacing is wrong if an
ordinary symbol is used instead of a binary symbol, 2) adding \cmd{mathrel} or
\cmd{mathbin} in \Tralics\ does not change this behavior, 3) using the
declare-something command is not enough in \Tralics: no error is signaled, but
no symbol appears.

\DeclareMathSymbol\bneg   {\mathbin}{symbols}{"3A}
\DeclareMathSymbol\rsquare{\mathrel}{AMSa}{"03}
\[ a \neg b           \qquad  x \square           y + z \]
\[ a \mathbin{\neg} b \qquad  x \mathrel{\square} y + z \]
\[ a \bneg          b \qquad  x \rsquare          y + z \]

\begin{verbatim}[numbers=left,firstnumber=last]
\[  a = b  \text{ but }  a \tilde{=} b
   \text{ which is not } a \mathrel{\tilde{=}} b  \]
\end{verbatim}

Example 8-9-5. This example indicates how embellished operators can have type
Rel or whatever. As usual, nothing special is added to the XML file. This
means that the equal-with-hat should be a relation in the HTML file, an
ordinary symbol in the Pdf version.
\[  a = b  \text{ but }  a \tilde{=} b
   \text{ which is not } a \mathrel{\tilde{=}} b  \]

\begin{verbatim}[numbers=left,firstnumber=last]
$ u \not< v$ or $a \not\in \mathbf{A} $, 
{\makeatletter\let\not\@@not $ u \not< v$ or $a \not\in \mathbf{A} $}
$ \not\leq \ \not\succeq \ \not\sim $ $ \nleq \ \nsucceq \ \nsim $
\end{verbatim}
Example 8-9-6. By default \cmd{not<} is translated at \cmd{neg<}; this is
wrong, so that we redefined it. The only trouble is that
\cmd{not}\cmd{in} does not work. We show here both behaviors:

$ u \not< v$ or $a \not\in \mathbf{A} $, 
{\makeatletter\let\not\@@not $ u \not< v$ or $a \not\in \mathbf{A} $}


Example 8-9-7. This is not really good.
$ \not\leq \ \not\succeq \ \not\sim $ and
 $ \nleq    \ \nsucceq    \ \nsim    $

\begin{verbatim}[numbers=left,firstnumber=last]
$\Longarrownot\longleftrightarrow \qquad  \arrownot\hookleftarrow$
\end{verbatim}
Example 8-9-8, demonstrating how to negate an arrow
$\Longarrownot\longleftrightarrow \qquad  \arrownot\hookleftarrow$,
this is not implemented in \Tralics.


\def\X#1{$\csname#1\endcsname$&\cmd{#1}}



\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$*$&\LTC{*}&$+$&\LTC{+}&$-$&\LTC{-}\\
\X{amalg}&\X{ast}&\X{baro}\\
\X{barwedge}&\X{bbslash}&\X{bigtriangledown}\\
\X{bigtriangleup}&\X{Cap}&\X{cap}\\
\X{Cup}&\X{cup}&\X{curlyvee}\\
\X{curlywedge}&\X{dag}&\X{dagger}\\
\X{ddag}&\X{ddagger}&\X{diamond}\\
\X{divideontimes}&\X{div}&\X{dotplus}\\
\X{doublecap}&\X{doublecup}&\X{fatbslash}\\
\X{fatsemi}&\X{fatslash}&\X{gtrdot}\\
\X{intercal}&\X{interleave}&\X{land}\\
\X{lbag}&\X{leftslice}&\X{leftthreetimes}\\
\X{lessdot}&\X{lor}&\X{ltimes}\\
\X{merge}&\X{minuso}&\X{moo}\\
\X{mp}&\X{nplus}&\X{pm}\\
\X{rbag}&\X{rightslice}&\X{rightthreetimes}\\
\X{rtimes}&\X{setminus}&\X{smallsetminus}\\
\X{sqcap}&\X{sqcup}&\X{sslash}\\
\X{star}&\X{talloblong}&\X{times}\\
\X{triangleleft}&\X{triangleright}&\X{uplus}\\
\X{varbigtriangledown}&\X{varbigtriangleup}&\X{varcurlyvee}\\
\X{varcurlywedge}&\X{vartimes}&\X{veebar}\\
\X{vee}&\X{wedge}&\X{wr}\\
\X{Ydown}&\X{Yleft}&\X{Yright}\\
\X{Yup}
\end{tabular}
\caption{Symbols of class \cmd{mathbin}, miscellaneous}\label{Tbl-bin1}
\end{table}


\let\xhpos0
\def\nexthpos{
\ifx\xhpos0\global\let\xhpos1&
\else \ifx\xhpos1\global\let\xhpos2&
\else\global\let\xhpos0\\\fi\fi
}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\let~\nexthpos
\begin{tabular}{clclclclclcl}
\X{circlearrowleft}~ \X{circlearrowright}~
\X{curvearrowleft}~\X{curvearrowright}~\X{dasharrow}~
\X{dashleftarrow}~\X{dashrightarrow}~\X{Downarrow}~
\X{downarrow}~\X{downdownarrows}~\X{downharpoonright}~
\X{gets}~\X{hookleftarrow}~\X{hookleftarrow}~
\X{hookrightarrow}~\X{Leftarrow}~\X{leftarrow}~
\X{leftarrowtail}~\X{leftarrowtriangle}~\X{leftrightarrowtriangle}~
\X{leftharpoondown}~\X{leftharpoonup}~\X{leftleftarrows}~
\X{Leftrightarrow}~\X{leftrightarrows}~\X{leftrightarrow}~
\X{leftrightharpoons}~\X{leftrightsquigarrow}~\X{Lleftarrow}~
\X{Longleftarrow}~\X{longleftarrow}~\X{Longleftarrow}~
\X{longleftrightarrow}~\X{Longmapsfrom}~\X{longmapsfrom}~
\X{Longmapsto}~\X{longmapsto}~\X{Longrightarrow}~
\X{longrightarrow}~\X{looparrowleft}~\X{looparrowright}~
\X{Lsh}~\X{Mapsfrom}~\X{mapsfrom}~
\X{Mapsto}~\X{mapsto}~\X{multimap}~
\X{nearrow}~
\X{nwarrow}~\X{restriction}~\X{rightarrowtail}~
\X{rightarrowtriangle}~\X{Rightarrow}~\X{rightarrow}~
\X{rightharpoondown}~\X{rightharpoonup}~\X{rightleftarrows}~
\X{rightleftharpoons}~\X{rightrightarrows}~\X{rightsquigarrow}~
\X{Rrightarrow}~\X{Rsh}~\X{searrow}~
\X{shortdownarrow}~\X{shortleftarrow}~\X{shortrightarrow}~
\X{shortuparrow}~
\X{swarrow}~\X{to}~\X{twoheadleftarrow}~
\X{twoheadrightarrow}~\X{Uparrow}~
\X{uparrow}~\X{upharpoonleft}~\X{upharpoonright}~
\X{Updownarrow}~\X{updownarrow}~\X{upuparrows}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (arrows)}\label{Tbl-rel1}
\end{table}

\clearpage

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{curlyveedownarrow}&\X{curlyveeuparrow}&\X{curlywedgedownarrow}\\
\X{curlywedgeuparrow}&\X{nnearrow}&\X{nnwarrow}\\
\X{ssearrow}&\X{sswarrow}\\
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (arrows, continued)}
\end{table}

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclcl}
\X{Delta}&\X{Gamma}&\X{Lambda}&\X{Omega}&\X{Phi}\\
\X{Pi}&\X{Psi}&\X{Sigma}&\X{Theta}&\X{Upsilon}\\
\X{Xi}&\X{alpha}&\X{beta}&\X{chi}&\X{delta}\\
\X{digamma}&\X{epsilon}&\X{eta}&\X{gamma}&\X{iota}\\
\X{kappa}&\X{lambda}&\X{mu}&\X{nu}&\X{omega}\\
\X{phi}&\X{pi}&\X{psi}&\X{rho}&\X{sigma}\\
\X{tau}&\X{theta}&\X{upsilon}&\X{varepsilon}&\X{varkappa}\\
\X{varphi}&\X{varpi}&\X{varrho}&\X{varsigma}&\X{vartheta}\\
\X{xi}&\X{zeta}
\end{tabular}
\caption{Symbols of class \cmd{mathord}, Greek}
\end{table}

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclcl}
$\$$&\cmd{\$}& \X{Im}&\X{Re}&\X{aleph}\\
\X{Bbbk}& \X{beth}&\X{circledS}&\X{complement}\\
\X{daleth}&\X{ell}&\X{eth}&\X{Finv}\\
\X{Game}&\X{gimel}&\X{hbar}&\X{hslash}\\
\X{imath}&\X{jmath}&\X{mathdollar}&\X{mathparagraph}\\
\X{mathsection}&\X{mathsterling}&\X{mho}&\X{P}&\\
\X{partial}&\X{pounds}&\X{S}&\X{wp}
\end{tabular}
\caption{Symbols of class \cmd{mathord}, letter-shaped}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$!$&\LTC{!}&$.$&\LTC{.}&$/$&\LTC{/}&$?$&\LTC{?}\\
$@$&\LTC{@}&$|$&\LTC{|}&$\#$&\cmd{\#}&$\%$&\cmd{\%}\\
$\&$&\cmd{\&}&$\_$&\cmd{\_}& \X{|}&\X{angle}\\
\X{Arrowvert}&\X{arrowvert}&\X{backprime}&\X{backslash}\\
\X{bracevert}&\X{bigstar}&\X{blacklozenge}&\X{blacksquare}\\
\X{blacktriangledown}&\X{blacktriangle}&\X{bot}&\X{clubsuit}\\
\X{copyright}&\X{diagdown}&\X{diagup}&\X{diamondsuit}\\
\X{emptyset}&\X{exists}&\X{flat}&\X{forall}\\
\X{heartsuit}&\X{infty}&\X{lightning}&\X{lnot}\\
\X{lozenge}&\X{measuredangle}&\X{nabla}&\X{natural}\\
\X{neg}&\X{nexists}&\X{prime}&\X{sharp}\\
\X{spadesuit}&\X{sphericalangle}&\X{square}&\X{surd}\\
\X{top}&\X{triangledown}&\X{triangle}&\X{varcopyright}\\
\X{varnothing}&\X{Vert}&\X{vert}
\end{tabular}
\caption{Symbols of class \cmd{mathord}, miscellaneous}
\end{table}

\def\XY#1#2{$\csname#1\endcsname{#2}$&\cmd{#1}\argument{#2}}
\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\XY{acute}{x}&\XY{bar}{x}&\XY{breve}{x}&\XY{check}{x}\\
\XY{ddddot}{x}&\XY{dddot}{x}&\XY{ddot}{x}&\XY{dot}{x}\\
\XY{grave}{x}&\XY{hat}{x}&\XY{mathring}{x}&\XY{tilde}{x}\\
\XY{vec}{x}&\XY{widehat}{xyz}&\XY{widetilde}{xyz}
\end{tabular}
\caption{Mathematical accents}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{boxast}&\X{boxbar}&\X{boxbox}&
\X{boxbslash}&\X{boxcircle}&\X{boxdot}\\
\X{boxempty}&\X{boxminus}&\X{boxplus}&
\X{boxslash}&\X{boxtimes}&\X{oblong}
\end{tabular}
\caption{Symbols of class \cmd{mathbin}, (boxes)}
\end{table}

\clearpage
%\count0="2980
%\count1="2A00
%\loop\ifnum\count0<\count1 $\mathmo{\char\count0}$ \advance\count0 by1 \repeat



\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{bullet}&\X{cdot}&\X{centerdot}&\X{bigcirc}\\
\X{circledast}&\X{circledcirc}&\X{circleddash}&\X{circ}\\
\X{oast}&\X{obar}&\X{ocircle}&\X{obar}\\
\X{odot}&\X{ogreaterthan}&\X{olessthan}&\X{ominus}\\
\X{oplus}&\X{oslash}&\X{otimes}&\X{ovee}\\
\X{owedge}&\X{varobslash}&\X{varocircle}&\X{varodot}\\
\X{varogreaterthan}&\X{varolessthan}&\X{varominus}&\X{varoplus}\\
\X{varoslash}&\X{varotimes}&\X{varovee}&\X{varowedge}
\end{tabular}
\caption{Symbols of class \cmd{mathbin}, (circles)}
\end{table}





\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$<$&\LTC{<} &$=$&\LTC{=}&$>$&\LTC{>}& \X{approxeq}\\
\X{approx}&\X{asymp}&\X{backsimeq}&\X{backsim}\\
\X{Bumpeq}&\X{bumpeq}&\X{circeq}&\X{cong}\\
\X{curlyeqprec}&\X{curlyeqsucc}&\X{Doteq}&\X{doteqdot}\\
\X{doteq}&\X{eqcirc}&\X{eqsim}&\X{eqslantgtr}\\
\X{eqslantless}&\X{equiv}&\X{fallingdotseq}&\X{geqq}\\
\X{geqslant}&\X{geq}&\X{ge}&\X{gggtr}\\
\X{ggg}&\X{gg}&\X{gtrapprox}&\X{gtreqless}\\
\X{gtreqqless}&\X{gtrless}&\X{gtrsim}&\X{leftrightarroweq}\\
\X{leqq}&\X{leqslant}&\X{leq}&\X{lessapprox}\\
\X{lesseqgtr}&\X{lesseqqgtr}&\X{lessgtr}&\X{lesssim}\\
\X{le}&\X{llless}&\X{lll}&\X{ll}\\
\X{precapprox}&\X{preccurlyeq}&\X{preceq}&\X{prec}\\
\X{risingdotseq}&\X{simeq}&\X{sim}&\X{succapprox}\\
\X{succcurlyeq}&\X{succeq}&\X{succsim}&\X{succ}\\
\X{thickapprox}&\X{thicksim}&\X{triangleq}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (equality and order)}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{gnapprox}& \X{gneqq} &\X{gneq}& \X{gnsim}\\
\X{gvertneqq}&\X{lnapprox}&\X{lneqq}&\X{lneq}\\
\X{lnsim}&\X{lvertneqq}&\X{ncong}&\X{neq}\\
\X{ne}&\X{ngeqq}& \X{ngeqslant}&\X{ngeq}\\
\X{ngtr}&\X{nleqq}&\X{nleqslant}&\X{nleq}\\
\X{nless}&\X{npreceq}&\X{nprec}&\X{nsim}\\
\X{nsucceq}&\X{nsucc}&\X{precnapprox}&\X{precneqq}\\
\X{precnsim}&\X{precsim}&\X{succnapprox}&\X{succneqq}\\
\X{succnsim}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (equality and order---negated)}
\end{table}



\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{blacktriangleleft}&\X{blacktriangleright}&\X{inplus}\\
\X{in}&\X{niplus}&\X{ni}\\
\X{ntriangleleftsqslant}&\X{ntrianglerightsqslant}&\X{owns}\\
\X{sqsubseteq}&\X{sqsubset}&\X{sqsupseteq}\\
\X{sqsupset}&\X{Subset}&\X{Supset}\\
\X{subseteqq}&\X{subseteq}&\X{subsetpluseq}\\
\X{subsetplus}&\X{subset}&\X{supseteqq}\\
\X{supseteq}&\X{supsetpluseq}&\X{supsetplus}\\
\X{supset}&\X{trianglelefteq}&\X{trianglerighteq}\\
\X{trianglerighteqslant}&\X{trianglelefteqslant}&\X{vartriangleleft}\\
\X{vartriangleright}&\X{vartriangle}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (sets and inclusions)}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$,$ &\LTC{,}\quad & \X{cdots}\quad& \X{hdots}\quad & \X{ldots}\quad &\X{mathellipsis}\\
$;$ & \LTC{;}& \X{colon} & \X{ddots}&\X{vdots}
\end{tabular}
\caption{Symbols of class \cmd{mathpunct}, \cmd{mathord}, \cmd{mathinner} (punctuation)}
\end{table}

\clearpage

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{notin}&\X{nsubseteqq} &\X{nsubseteq} &\X{nsupseteqq} \\
\X{nsupseteq} &\X{ntrianglelefteq}&\X{ntriangleleft}&\X{ntrianglerighteq}\\
\X{ntriangleright}&
\X{subsetneqq}&\X{subsetneq}&\X{supsetneqq}\\
\X{supsetneq}\\\X{varsubsetneqq}&\X{varsubsetneq}&
\X{varsupsetneqq}&\X{varsupsetneq}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (sets and inclusions---negated)}
\end{table}

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{nLeftarrow}\qquad&\X{nLeftrightarrow}\qquad&\X{nRightarrow}\\
\X{nleftarrow}&\X{nleftrightarrow}&\X{nrightarrow}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (arrows---negated)}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
\X{Arrownot}&\X{Longarrownot}&\X{Mapsfromchar}&\X{Mapstochar}\\
\X{arrownot}&\X{longarrownot}&\X{mapsfromchar}&\X{mapstochar}\\
\X{lhook}&\X{not}&\X{rhook}
\end{tabular}
\caption{Symbols of class \cmd{mathrel}, (negation  and arrow
  extensions). These are currently unimplemented.}
\end{table}




\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$:$& \LTC{:}& \X{backepsilon}& \X{because}&\X{between}\\
\X{bowtie}&\X{dashv}&\X{frown}&\X{Join}\\
\X{mid}&\X{models}&\X{nmid}&\X{nparallel}\\
\X{nshortmid}&\X{nshortparallel}&\X{nVDash}&\X{nvDash}\\
\X{nVdash}&\X{nvdash}&\X{parallel}&\X{perp}\\
\X{pitchfork}&\X{propto}&\X{shortmid}&\X{shortparallel}\\
\X{smallfrown}&\X{smallsmile}&\X{smile}&\X{therefore}\\
\X{varpropto}&\X{Vdash}&\X{vDash}&\X{vdash}\\\X{Vvdash}
\end{tabular}
\caption{Symbols of class \cmd{mathrel} (miscellaneous). Symbols short-foo,
  small-foo, var-foo not implemented.}
\end{table}


\def\Y#1{${\displaystyle\csname#1\endcsname}{\textstyle\csname#1\endcsname}$
&\cmd{#1}}
\begin{table}\XMLaddatt{simple-table}{true}
\begin{tabular}{clclclclclcl}
\Y{int}&\Y{oint}&\Y{bigbox}\\
\Y{bigcap}&\Y{bigcup}&\Y{bigcurlyvee}\\
\Y{bigcurlywedge}&\Y{biginterleave}&\Y{bignplus}\\
\Y{bigodot}&\Y{bigoplus}&\Y{bigotimes}\\
\Y{bigparallel}&\Y{bigsqcap}&\Y{bigsqcup}\\
\Y{bigtriangledown}&\Y{bigtriangleup}&\Y{biguplus}\\
\Y{bigvee}&\Y{bigwedge}&\Y{coprod}\\
\Y{prod}&\Y{smallint}&\Y{sum}
\end{tabular}
\caption{Symbol pairs of class \cmd{mathop} }
\end{table}

\begin{table}\XMLaddatt{simple-table}{true}
\begin{tabular}{clclclclclcl}
 $[\BMS]$ &\LTC{[]}&
 $\{\BMS\}$& \cmd{\{}\cmd{\}}& 
 $\lVert\BMS\rVert$ &\cmd{lVert}\cmd{rVert}&\\
 $\lbrack\BMS\rbrack$ &\cmd{lbrack}\cmd{rbrack}&
 $\lbrace\BMS\rbrace$ &\cmd{lbrace}\cmd{rbrace}&
 $\lvert\BMS\rvert$ &\cmd{lvert}\cmd{rvert}&\\
 $\lceil\BMS\rceil$ &\cmd{lceil}\cmd{rceil}&
$(\BMS)$ &\LTC{()}&
 $\lgroup\BMS\rgroup$ &\cmd{lgroup}\cmd{rgroup}&\\
 $\lfloor\BMS\rfloor$ &\cmd{lfloor}\cmd{rfloor}&
 $\langle\BMS\rangle$ &\cmd{langle}\cmd{rangle}&
 $\lmoustache\BMS\rmoustache$ &\cmd{lmoustache}\cmd{rmoustache}&\\
 $\llbracket\BMS\rrbracket$ &\cmd{llbracket}\cmd{rrbracket}&
\end{tabular}
\caption{Symbol pairs of class \cmd{mathopen} and \cmd{mathclose} extensible.
\cmd{bgroup} and \cmd{lgroup} wrong on HTML, not better in Pdf. Moustaches
not good in Pdf.}
\end{table}

\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{clclclclclcl}
$\llceil\rrceil$&\cmd{llceil}\cmd{rrceil} &$\binampersand\bindnasrepma$&
\cmd{binampersand}\cmd{bindnasrepma}& $\Lbag\Rbag$ &\cmd{Lbag}\cmd{Rbag}\\
$\llfloor\rrfloor$&\cmd{llfloor}\cmd{rrfloor}&
$\llparenthesis\rrparenthesis$&\cmd{llparenthesis}\cmd{rrparenthesis}
\end{tabular}
\caption{Symbol pairs of class \cmd{mathopen} and \cmd{mathclose} 
non-extensible> Lets of symbols missing in Unicode}
\end{table}


\begin{table}\XMLaddatt{simple-table}{true}
\centering
\begin{tabular}{c}
$ABCDEFGHIJKLMNOPQRSTUVWXYZ$\\
$abcdefghijklmnopqrstuvwxyz$\\
$0123456789$ 
\end{tabular}
\caption{Latin letters and arabic numerals}
\end{table}

\clearpage
\fi


\chapter{Other Examples}

\begin{verbatim}[numbers=left,firstnumber=last]
\def\EXP{\frac{x^1_2}3Foo}
\[\dfrac {\EXP1}{\phantom{\EXP}1}=\dfrac {\EXP1}{\hphantom{\EXP}1}=\dfrac21=
\dfrac{\EXP1}{\EXP1}=
\dfrac{\EXP1}{\vphantom{\EXP}1}\]
\end{verbatim}

Example of a \cmd{phantom}, a \cmd{hphantom} and a \cmd{vphantom}. In the case
of a \cmd{hphantom}, the 1 should be vertically aligned as in the case of 2/1,
otherwise should be aligned as in the case E/E (where E is the big expression);
in the case of a \cmd{vphantom}, it should be centered otherwise flushed
right (aligned with the numerator).  
\def\EXP{\frac{x^1_2}3Foo}
\[\dfrac {\EXP1}{\phantom{\EXP}1}=\dfrac {\EXP1}{\hphantom{\EXP}1}=\dfrac21=
\dfrac{\EXP1}{\EXP1}=
\dfrac{\EXP1}{\vphantom{\EXP}1}\]


Test of multiscripts: 
$\mathbox{mmultiscripts}{F1\none\mathbox{mprescripts}{}0\none}$,
$\mathbox{mmultiscripts}{F 1 2 3 4\mathbox{mprescripts}{}a\none b\none cd}$,
$\mathbox{mmultiscripts}{F 1\none 2\none 3\none 4\none
5 6\mathbox{mprescripts}{}a\none b\none cde\none \none f}$,


\ifOther
\begin{verbatim}[numbers=left,firstnumber=last]
\[\sideset{}{_d^c}\sum _xy \qquad \sideset{^a_b}{}\sum _xy \qquad
\sideset{'^a}{^c}\sum_xy\qquad \sideset{_b}{_d}\sum_xy \qquad
\sideset{^{aA}_{bB}}{^{cC}_{dD}}\sum_xy 
\]
\end{verbatim}
More examples of sideset

\[\sideset{}{_d^c}\sum _xy \qquad \sideset{^a_b}{}\sum _xy \qquad
\sideset{'^a}{^c}\sum_xy\qquad \sideset{_b}{_d}\sum_xy \qquad
\sideset{^{aA}_{bB}}{^{cC}_{dD}}\sum_xy 
\]

Differences between \cmd{uplus} and \cmd{biguplus}. Consider the following 
input lines.
\begin{verbatim}[numbers=left,firstnumber=last]
\[{\uplus a}, {\uplus _ab}, {\mathop \uplus_ab}, {\mathop \uplus\limits_ab} \]
\[{x\uplus a}, {x\uplus _ab}, {x\mathop \uplus_ab}, {x\mathop \uplus\limits_ab} \]
\end{verbatim}
%
Initial code
\[{\uplus a}, {\uplus _ab}, {\mathop \uplus_ab}, {\mathop \uplus\limits_ab}
\label{uplus1} \]
\[{x\uplus a}, {x\uplus _ab}, {x\mathop \uplus_ab}, {x\mathop \uplus\limits_ab}\label{uplus2}  \]
%
Unicode character U+2A04 used instead of \cmd{uplus}.
{
\def\uplus{\mathmo{^^^^2a04}}
\[{\uplus a}, {\uplus _ab}, {\mathop \uplus_ab}, {\mathop \uplus\limits_ab} \label{uplus3} \]
\[{x\uplus a}, {x\uplus _ab}, {x\mathop \uplus_ab}, {x\mathop \uplus\limits_ab} \label{uplus4} \]
}

In \Tralics\ 2.9.4,
translation of \cmd{uplus} was a character \entity{uplus}, translation of 
\cmd{biguplus} was  \entity{biguplus}, characters
U+22E8 (multiset union) and U+2A04 (n-ary union operator with plus). 
Thus lines \ref{uplus1}  and \ref{uplus2}  correspond to \cmd{uplus}, 
while  lines \ref{uplus3}  and \ref{uplus4} 
correspond to \cmd{biguplus}. On FL, I see a big operator on line
\ref{uplus1}, a  smaller one on line \ref{uplus2}  
(the version without index being smaller than the
other ones), and small operators on lines \ref{uplus3}  and \ref{uplus4}. 
On FM, I see a very big
operator on line \ref{uplus1}, a small one on line \ref{uplus2},  
question marks on lines \ref{uplus3} and \ref{uplus4}, and Amaya gives the
same for\ref{uplus3} and \ref{uplus4}. 
Thus, translation of \cmd{biguplus} seems to be wrong. Thus, we changed it:
in \Tralics\ 2.9.5, \cmd{biguplus} is the same character as \cmd{uplus}.
Same formulas as above, with
command \cmd{biguplus} used instead of \cmd{uplus}
\[{\biguplus a}, {\biguplus _ab}, {\mathop \biguplus_ab}, {\mathop \biguplus\limits_ab} \label{uplus5} \]
\[{x\biguplus a}, {x\biguplus _ab}, {x\mathop \biguplus_ab}, {x\mathop \biguplus\limits_ab} \label{uplus6} \]
Same, with \cmd{textstyle}
\[{\textstyle \biguplus a}, {\textstyle\biguplus _ab}, {\textstyle\mathop \biguplus_ab}, {\textstyle\mathop \biguplus\limits_ab} \label{uplus7} \]
\[{\textstyle x\biguplus a}, {\textstyle x\biguplus _ab}, {\textstyle x\mathop
  \biguplus_ab}, {\textstyle x\mathop \biguplus\limits_ab} \label{uplus8} \]


\begin{verbatim}[numbers=left,firstnumber=last]
\[ A\xleftarrow{u}B\xleftarrow[d]{}C\xleftarrow[d]{u}
   D\xrightarrow{u}E\xrightarrow[d]{}F\xrightarrow[d]{u}G \]
\end{verbatim}

This example shows the use of \cmd{xleftarrow} and \cmd{xrightarrow}.
Optional argument below the arrow, mandatory argument below.
\[
A\xleftarrow{u}B\xleftarrow[d]{}C\xleftarrow[d]{u}
D\xrightarrow{u}E\xrightarrow[d]{}F\xrightarrow[d]{u}G
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[\begin{CD}
@.  0               @.     0\\
@.       @VVV                @VVV\\
0 @>>> D^{1 \times q} @>.R>> D^{1 \times p} @>\pi>> M @>>> 0\\
@.     @|  @VV.UV\\
0 @>>> D^{1 \times q} @>.J>> D^{1 \times p} @>\kappa>> D^{1 \times (p-q)} @>>>0\\
@.       @VVV                @VVV\\
@.  0               @.     0\\
\end{CD}\]
\end{verbatim}

This example shows how to produce a commutative diagram (adapted from 
\cite{FABIANSKA:2007:INRIA-00131035:2})
\[\begin{CD}
  @.  0               @.     0\\
@.       @VVV                @VVV\\
0 @>>> D^{1 \times q} @>.R>> D^{1 \times p} @>\pi>> M @>>> 0\\
@.     @|  @VV.UV\\
0 @>>> D^{1 \times q} @>.J>> D^{1 \times p} @>\kappa>> D^{1 \times (p-q)} @>>>0\\
@.       @VVV                @VVV\\
@.  0               @.     0\\
\end{CD}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
\[\begin{CD}
@.  0               @.     0\\
@.       @VLLVV                @VVDV\\
0 @<\mathrm{above}<< D      @))\mathrm{below}) D @>\mathrm{above}>\mathrm{below}> 0\\
@.     @\vert  @VLLVDV\\
@.  0               @.     0\\
\end{CD}\]
\end{verbatim}
% Emacs >>

A variant that shows how to put data above and below the arrows.
\[\begin{CD}
@.  0               @.     0\\
@.       @VLLVV                @VVDV\\
0 @<\mathrm{above}<< D      @))\mathrm{below}) D @>\mathrm{above}>\mathrm{below}> 0\\
@.     @\vert  @VLLVDV\\
@.  0               @.     0\\
\end{CD}
\]
% Emacs >>




Some formulas that were badly rendered:
$u(t)=\displaystyle{\frac{1}{2} \, (\dot x_1(t-h)-\ddot x_1(t)),}$
$\displaystyle{z_2(t)=-\frac{1}{2} \, (\ddot \psi(t)+2 \, \psi(t)),} $
$\displaystyle{v(t)=\frac{1}{2} \, (-\ddot \psi(t)+\dot \psi(t)).}$

More formulas:
formula A:
$u(t)=\displaystyle{\frac{1}{2}}$,
formula B:
$u(t)=\dfrac{1}{2}$,
formula C:
$u(t)=\displaystyle \frac{1}{2}$,
formula D:
$u(t)={\frac{1}{2}}$,
and finally $u(t)={\frac{1}{2}}+1$.
Using display style
$\displaystyle \frac{1}{2} \, (x (1)+ \psi(t)) $


\subsection{The connexion examples}
\label{additional}
These are example where Tralics 2.10.5 produces the wrong size for closing
delimiters. 

\def\x{x}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the following are examples where closing parentheses, braces, norm symbols, etc.
% have a larger sizing than their opening counterparts in the MathML generated
% by Tralics

Example 1: $d'_{fine} = \{d'_{j,\lambda}\}_{\lambda \in
\Delta_{J-1}\cup\cdots\cup\Delta_{j_{max}}}$ and
 \[d'_{fine} = \{d'_{j,\lambda}\}_{\lambda \in
\Delta_{J-1}\cup\cdots\cup\Delta_{j_{max}}}\]


Example 2: $\mu_{1}(d)=d(1-e^{-d^{2}/2})^{-1}-2d^{-1}$.


%***************************************************************************

Example 3: $a_k^* \leq \|(a_n)\|_{\ell_p}k^{-\frac{1}{p}}$.


%***************************************************************************

Example 4: $\sigma_{n}(x)_{\ell_p} \leq
Cn^{-r}\norm{x}_{w_{l_\tau}}, \qquad \frac{1}{\tau} = r+
\frac{1}{p}$.


%***************************************************************************

Example 5: $\# \Lambda_k \ 2^{(-k-1)p} \leq \sum_{c_j \in
\Lambda_k} |c_j|^p \leq \norm{f}_{X_p}^p$ and 
\[\# \Lambda_k \ 2^{(-k-1)p} \leq \sum_{c_j \in
\Lambda_k} |c_j|^p \leq \norm{f}_{X_p}^p.\]

%***************************************************************************

Example 6: $d^n(K)_X \le E_n(K)_X$.


%***************************************************************************

Example 7: $||\x-\Delta\Phi(\x)||_{\ell_2} \leq
\frac{C \sigma_k(\x)_{\ell_1}}{\sqrt{k}}$.

Example 8:
smaller parens $\bar f(\frac{n}{\lambda A})$ versus larger parens
$f(\frac{n}{A\lambda})$.

%***************************************************************************

Example 9:
\begin{eqnarray}
||\eta_0||_{\ell_2} & \leq & \frac{C_2^2}{\sqrt{k}} \sum_{j=2}^s ||\eta_{T_{j-1}}+\eta_{T_j}||_{\ell_1} \nonumber \\
& \leq & \frac{C_2^2}{\sqrt{k}} \sum_{j=2}^s ||\eta_{T_{j-1}}||_{\ell_1}+||\eta_{T_j}||_{\ell_1} \nonumber \\
& \leq & \frac{2C_2^2}{\sqrt{k}} \sum_{j=1}^s ||\eta_{T_j}||_{\ell_1} \nonumber \\
& \leq & \frac{2C_2^2}{\sqrt{k}} \sigma_{2k}(\eta)_{\ell_1}.
\label{eqn:main2}
\end{eqnarray}

\subsection{Test of brackets}
\begin{verbatim}[numbers=left,firstnumber=last]
$\bra{X}=\bra{x^2}=\ket{Y}=\ket{y^2} = \braket{X|Y}=\braket{x^2| y^2}$
$\Bra{X}=\Bra{x^2}=\Ket{Y}=\Ket{y^2} = \Braket{X|Y}=\Braket{x^2| y^2}$
$\Braket{x|y||z}$, $\Braket{x\|y|z}$
$\Braket{x+x_2|y+y^3||z+z^4+-5}$, $\Braket{x+x_2\|y+y^2|z+z^4_5}$
$   \Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } $
$   \Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 }$
\end{verbatim}

Formula one $\bra{X}=\bra{x^2}=\ket{Y}=\ket{y^2} = \braket{X|Y}=\braket{x^2| y^2}$\\
Formula two $\Bra{X}=\Bra{x^2}=\Ket{Y}=\Ket{y^2} = \Braket{X|Y}=\Braket{x^2| y^2}$\\
Formula three $\Braket{x|y||z}$, $\Braket{x\|y|z}$\\
Formula four $\Braket{x+x_2|y+y^3||z+z^4+-5}$, \\
Formula five $\Braket{x+x_2\|y+y^2|z+z^4_5}$.

These are from the style file
$\Braket{ \phi | \frac{\partial^2}{\partial t^2} | \psi } $
and
$\Set{ x\in\mathbf{R}^2 | 0<{|x|}<5 }$.

\section{Recursion test}

\[\mathopen\|\mathopen|f\mathclose|^2 - \mathopen|\frac{p_n}{q_n}\mathclose|^2
\mathclose\|_{L^\infty(T)} <\varepsilon,\]
\[
\|g\|_{L^2(d \mu)}^2=\frac{1}{2\pi} \int_{-\pi}^{\pi}|g(e^{i\theta})|^2
d\mu(\theta),
\]

$$\mbox{ letting: }
E_{n,m}(K,K')=\{p\in P_m(K),q \in P_n(K') \mbox{ such that } \forall x \in
I\,,\, \left|\frac{p(x)}{q(x)}\right| \leq 1 \},$$

\chapter{Font tests}
We assume that the property of each math font is one (later one we shall set
it to zero), and the translation of a character is an ASCII character
with an attribute. Otherwise, it is a Unicode character between
U+1D400 and U+1F7FF. In our test we use internal font commands
like \cmd{mml@font@italic}.


\begin{verbatim}[numbers=left,firstnumber=last]
\def\F#1{\mbox{#1: }\csname mml@font@#1\endcsname}
\def\La{AB=c+1+23}
\def\Lb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\def\Lc{$\Lx abcde$ $\Lx fghijklm$ $\Lx nopqrs$ $\Lx tuvwxyz$}
\def\Ld{0123456789}
\def\Test#1{\par Test of #1: \def\Lx{\csname mml@font@#1\endcsname}
  $\Lx\La$, $\Lx\Lb$, \Lc, $\Lx\Ld$.}

\Test{normal}
\Test{upright}
\Test{bold}
\Test{italic}
\Test{bolditalic}
\Test{script}
\Test{boldscript}
\Test{fraktur}
\Test{doublestruck}
\Test{boldfraktur}
\Test{sansserif}
\Test{boldsansserif}
\Test{sansserifitalic}
\Test{sansserifbolditalic}
\Test{monospace} 
\end{verbatim}
\def\F#1{\mbox{#1: }\csname mml@font@#1\endcsname}
\def\La{AB=c+1+23}
\def\Lb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\def\Lc{$\Lx abcde$ $\Lx fghijklm$ $\Lx nopqrs$ $\Lx tuvwxyz$}
\def\Ld{0123456789}
\def\Test#1{\par Test of #1: \def\Lx{\csname mml@font@#1\endcsname}
  $\Lx\La$, $\Lx\Lb$, \Lc, $\Lx\Ld$.}

\Test{normal}
\Test{upright}
\Test{bold}
\Test{italic}
\Test{bolditalic}
\Test{script}
\Test{boldscript}
\Test{fraktur}
\Test{doublestruck}
\Test{boldfraktur}
\Test{sansserif}
\Test{boldsansserif}
\Test{sansserifitalic}
\Test{sansserifbolditalic}
\Test{monospace} 

In the Pdf version, we have problems with script and bold script for lower
letters and digits. In the MTML version, Firefox has no script, fraktur or
double struck font.

\begin{verbatim}[numbers=left,firstnumber=last]
\mathfontproperty0=0
\mathfontproperty1=0
\mathfontproperty2=0
\mathfontproperty3=0
\mathfontproperty4=0
\mathfontproperty5=0
\mathfontproperty6=0
\mathfontproperty7=0
\mathfontproperty8=0
\mathfontproperty9=0
\mathfontproperty10=0
\mathfontproperty11=0
\mathfontproperty12=0
\mathfontproperty13=0
\mathfontproperty14=0
\end{verbatim}

\mathfontproperty0=0
\mathfontproperty1=0
\mathfontproperty2=0
\mathfontproperty3=0
\mathfontproperty4=0
\mathfontproperty5=0
\mathfontproperty6=0
\mathfontproperty7=0
\mathfontproperty8=0
\mathfontproperty9=0
\mathfontproperty10=0
\mathfontproperty11=0
\mathfontproperty12=0
\mathfontproperty13=0
\mathfontproperty14=0



\Test{normal}
\Test{upright}
\Test{bold}
\Test{italic}
\Test{bolditalic}
\Test{script}
\Test{boldscript}
\Test{fraktur}
\Test{doublestruck}
\Test{boldfraktur}
\Test{sansserif}
\Test{boldsansserif}
\Test{sansserifitalic}
\Test{sansserifbolditalic}
\Test{monospace} 

The Pdf version should be the same. The HTML version is different; only
characters in the BMP are shown (for instance, the set of integers, complex
numbers, etc, are often represented using a blackboard font, using characters
U+2124, U+2102, these are not repeated at U+1D551 and UD1D3A).   

Testing internal commands that read/write math font properties.
\begin{verbatim}[numbers=left,firstnumber=last]
\def\entity#1{\xmllatex{\&\#x#1;}{}}
\makeatletter
\mathfontproperty2=3 $\mathbf{x}$
Font property:\the\mathfontproperty\mml@font@bold,
Character propery:\the\setmathchar\mathbf`x.\\
\mathfontproperty\mathbf=0
Bold x: \setmathchar\mathbf`x={\entity{1d431}}$\mathbf{x}$
ComplexC: \setmathchar\mathbf`c={\entity{2102}}$\mathbf{c}$ 
\setmathchar 5 6 7 ok 
\end{verbatim}


\def\xentity#1{\xmllatex{\&\#x#1;}{}}
\makeatletter
\mathfontproperty2=3 $\mathbf{x}$
Font property:\the\mathfontproperty\mml@font@bold,
Character property:\the\setmathchar\mathbf`x.
\mathfontproperty\mathbf=0
Bold x: \setmathchar\mathbf`x={\xentity{1d431}}$\mathbf{x}$
ComplexC: \setmathchar\mathbf`c={\xentity{2102}}$\mathbf{c}$
\setmathchar 5 6 7 ok 



\mathfontproperty0=1
\mathfontproperty1=1
\mathfontproperty2=1
\mathfontproperty3=1
\mathfontproperty4=1
\mathfontproperty5=1
\mathfontproperty6=1
\mathfontproperty7=1
\mathfontproperty8=1
\mathfontproperty9=1
\mathfontproperty10=1
\mathfontproperty11=1
\mathfontproperty12=1
\mathfontproperty13=1
\mathfontproperty14=1

\fi

\chapter{Examples from the MathML recommendation}
Examples and italic text taken from \cite{mathml2} (Mathematical Markup
Language (MathML) Version 2.0, W3C recommendation 21 October 2003.


\ifMml

\section{Introduction}
\begin{verbatim}[numbers=left,firstnumber=last]
\newcommand\Apply[2]{\mathbox{apply}{\mathbox{#1}{}#2}}
$\mathbox{mfenced}{{a+b}}^2$  % F1
$\Apply{power}{\Apply{plus}{\mathci{a}\mathci{b}} \mathcn{2}}$ %F2
${(a+b)}^2$ % F3
\end{verbatim}
The four lines above show a command and three math formulas, representing the
square of the sum of $a$ and $b$. The MathML recommendation, in its
introduction, explains that there are three types of elements: presentation
elements (formula F1) and content elements (formula F2), as well as interface
elements (the toplevel \elt{math} element, not discussed here).  In any case,
a formula is a tree; leafs are token elements or canonically empty elements.
The main difference between these two types is the following: in the case of
formula F2, there is a possibility to evaluate the formula, for instance,
with a=2 and b=3, this should yield 25. In the case of F1, we have a formula
with a superscript; in a case like $x^2$, it is impossible to tell if this
means the square of the variable $x$, or the second component of the vector
$x$.

In the example F3, there are five leafs, two identifiers, a number, two
operators. The default translation is a token element in presentation markup.
This means that the translation of `a' is implicitly a \elt{mi}
obtained by \cmd{mathmi}, instead of a \elt{ci} obtained by \cmd{mathci}.
A non-trivial question is how to translate `xy25' (the default is one or two
identifiers, followed by a number). Our formulas contain characters that are
neither letters nor digits: parenthesis, plus sign, superscript
character. These are operators; in the case of presentation markup,
an operator can be represented as a special element (\elt{msup} for a
construction base plus exponent), or a token element (a \elt{mo} element for a
sum). In the case of content markup, special element can be used (for instance
\elt{list}, or empty elements, like \elt{plus/}.

In content markup, the sum of two objects is specified by a \elt{apply}
element, whose children are the operator \elt{plus/} followed by the objects,
and a list of three objects is represented by a \elt{list} element whose children are the
objects. In presentation markup, a sum is a sequence (an explicit or implicit
\elt{mrow} element) containing the arguments and operators in order. In the
same fashion, a list can be defined as the sequence of all elements, plus the
separators (opening parentheses, closing parentheses, commas, etc.); it can
also be specified by a \elt{mfenced} element, whose attributes define what is
at the start of the list, the end of the list, and between the
elements. These attributes have a default value adapted for lists, meaning
that $f(x,y,z)$ can be obtained by the juxtaposition of $f$ and a
\elt{mfenced} element containing $x$, $y$ and $z$. In the case of formula F1,
the content of \elt{mfenced} element is the translation of \argument{a+b};
because of the braces this is a \elt{mrow} element, with three children.
Formulas F1 and F3 are equivalent: a base and an exponent, the base contains
an opening parenthesis, the identifier a, the operator plus,  the identifier b,
and a closing parenthesis. The renderer gives $\mathbox{mfenced}{{a+b}}^2$.

The second formula renders as
$\Apply{power}{\Apply{plus}{\mathci{a}\mathci{b}} \mathcn{2}}$.
My Web browser knows only some of the operators; hence it is possible that you
see the same as $ab2$. In the Pdf version, we implement the \elt{apply}
element as follows: first the operator, then the arguments as a list. We could
do better, but all n-ary operators can have implicit arguments: it is possible
to represent the sum of all $f(x)$ such that $x$ satisfies some condition,
for instance, $x\in\mathbb{N}$ and $x$ is a square.
Since \Tralics\ does not generate content markup, this is not implemented at
all. 

\begin{verbatim}[numbers=left,firstnumber=last]
${\mathbox{apply}{\mathbox{minus}{}\mathci{a}\mathci{b}}}$ %2.1.3
\end{verbatim}
Simple example of presentation markup:
${\mathbox{apply}{\mathbox{minus}{}\mathci{a}\mathci{b}}}$. Note that the
minus operator takes one or two arguments.


\section{More complicated examples}

\begin{verbatim}[numbers=left,firstnumber=last]
${x^2+{4\*x}+4}=0$
\end{verbatim}
Rendering:
${x^2+{4\* x}+4}=0$. 
\textsl{Note the use of nested elements, to denote terms, for example, the
  left-hand side of the equation}; this is obtained here by simply putting
braces in the \TeX\ source. \textsl{The \entity{InvisibleTimes} MathML
  character entity is used here to indicate to a renderer that there are
  special spacing rules between the 4 and the x and that the 4 and the x should not be broken
  onto separate lines}. This special character can be obtained by the \cmd{*}
command whose meaning is: do not consider any special spacing rule, but allow
a break here. We decide to translate \cmd{*} in this way because it converts
an invisible product into an invisible product. We do not believe in
hyphenation for math formulas (inline formulas should be small, and not split,
big formulas should be in display mode).
Translation from XML to Pdf is empty for this character.


\begin{verbatim}[numbers=left,firstnumber=last]
$x=\frac{{-b}\pm\sqrt{b^2-{4\* a\* c}}}{2\* a}$
\end{verbatim}
Second example, 
$x=\frac{{-b}\pm\sqrt{b^2-{4\* a\* c}}}{2\* a}$.
\textit{Notice that the `plus or minus' sign is given by the entity name
  \&PlusMinus; this is equivalent to using the character reference
  \&\#00B1;}. When converting an XML document into Pdf,  the character
reference is 
required (notice that the style sheet that converts from XML to XSL/FO
replaces entity names by character references, so that this is not a
problem). On the other hand, there are cases where entity names are refused in
a HTML document: if that document is presented as XML, and the DTD makes no
reference to MathML (this very document is likely to be XHTML1.0 strict).


\begin{verbatim}[numbers=left,firstnumber=last]
$z\mathbox{mfenced}{{x+y}}$
$A=\begin{bmatrix}x&y\\z&w\end{bmatrix}$
\end{verbatim}

Example three: $z\mathbox{mfenced}{{x+y}}$. The MathML recommendation says
that there is some ambiguity: what is the relation between $z$ and the
expression $x+y$ that follows? implicit product or function application? A
translator like \Tralics\ cannot guess.

Example four
$A=\begin{bmatrix}x&y\\z&w\end{bmatrix}$.
\textsl{Most elements have a number of attributes that control the details of
  their screen and print rendering. The attributes for operator elements given
using \elt{mo} are set to default values determined by a
dictionary}. Translation of the environment is a \elt{mfenced} element, with
two attributes; all other attributes are ignored in the XML to Pdf
conversion. No dictionary is currently used; translation of a \elt{mo} is
complicated:  the difference between $\lim$ and $\sum$ is that we have a
sequence of 3 ASCII characters, and a character reference (that could be
given in base 10, in base 16, or directly as a UTF-8 character). The XML
reader converts this into a command (with a complicated name) that expands to
\cmd{sum}, that expands to whatever is defined by the style files. 

\begin{verbatim}[numbers=left,firstnumber=last]
\def\Cx{\mathci{x}} \def\Dz{\mathcn{0}}
\def\Dt{\mathcn{2}} \def\Df{\mathcn{4}}
$\Apply{eq}{ 
  \Apply{plus}{ \Apply{power}{\Cx\Dt} \Apply{times}{\Df\Cx}\Df}
  \Dz}$
\end{verbatim}

Example 2.3.2, content markup.
\def\Cx{\mathci{x}} \def\Dz{\mathcn{0}}
\def\Dt{\mathcn{2}} \def\Df{\mathcn{4}}
$\Apply{eq}{ 
  \Apply{plus}{ \Apply{power}{\Cx\Dt} \Apply{times}{\Df\Cx}\Df}
  \Dz}$
This example shows that content markup is sometimes easier. 

\begin{verbatim}[numbers=left,firstnumber=last]
\def\Ca{\mathci{a}}\def\Cb{\mathci{b}} \def\Cc{\mathci{c}}
\def\Cpm{\mathcsymbol{^^b1}}
$\Apply{eq}{
   \Cx 
   \Apply{divide}{
     \mathbox{apply}{
       \Cpm
       \Apply{minus}{\Cb}
       \Apply{root}{\mathbox{degree}{\Dt}
          \Apply{minus}{
            \Apply{power}{\Cb\Dt}
            \Apply{times}{\Df\Ca\Cc}}}}
     \Apply{times}{\Dt\Ca}}}$
\end{verbatim}

Next example
\def\Ca{\mathci{a}}\def\Cb{\mathci{b}} \def\Cc{\mathci{c}}
\def\Cpm{\mathcsymbol{^^b1}}
$\Apply{eq}{
   \Cx 
   \Apply{divide}{
     \mathbox{apply}{
       \Cpm
       \Apply{minus}{\Cb}
       \Apply{root}{\mathbox{degree}{\Dt}
          \Apply{minus}{
            \Apply{power}{\Cb\Dt}
            \Apply{times}{\Df\Ca\Cc}}}}
     \Apply{times}{\Dt\Ca}}}$.
This example has two interesting points. The first one is that some operators
can have optional arguments (in this case, the default value 2 is used). The
second point is that the first child of \elt{apply} can be any function; 
in this example, it is a \elt{csymbol} element (equivalent of \elt{mo}), whose
value is the character $\pm$ (that has to be entered as a character, not a
command). Other content markup examples omitted.
%


\begin{verbatim}[numbers=left,firstnumber=last]
$\mathbox{mrow}{\mathbox{apply}{\mathbox{eq}{}\mathci{A}
\mathbox{matrix}{\mathbox{matrixrow}{\mathci{x}\mathci{y}}
\mathbox{matrixrow}{\mathci{z}\mathci{w}}}}}$
\end{verbatim}

Next example
$\mathbox{mrow}{\mathbox{apply}{\mathbox{eq}{}\mathci{A}
\mathbox{matrix}{\mathbox{matrixrow}{\mathci{x}\mathci{y}}
\mathbox{matrixrow}{\mathci{z}\mathci{w}}}}}$. This example is badly rendered
in the Pdf (matrix operators not implemented), and my favorite HTML browser
shows the same result! 



\section{Presentation Markup}
\begin{verbatim}[numbers=left,firstnumber=last]
\def\X#1#2{\mathbox{#1}{\mathcnothing{\char32#2\char32}}}
$\X{mi}{x}\X{mo}{+}{\X{mi}{a}\X{mo}{/}\X{mi}{b}}$
$x+{a/b}$ 
\end{verbatim}

\def\X#1#2{\mathbox{#1}{\mathcnothing{\char32#2\char32}}}
Compare
`$\X{mi}{x}\X{mo}{+}{\X{mi}{a}\X{mo}{/}\X{mi}{b}}$'
with `$x+{a/b}$'. 
These two examples  should look the same; in the first case the content of each
element is a space, a character, a space; for the second example, there are no
spaces. 

\begin{verbatim}[numbers=left,firstnumber=last]
$\mathmi[fontweight][bold][mathvariant][normal]{a}$
$\mathmi[fontweight][bold][mathvariant][sans-serif]{a}$
$\mathmi[fontweight][bold][mathvariant][fraktur]{a1}$
$\mathbox{mstyle}[fontstyle][italic]{\mathbf{a}b}$
\end{verbatim}

Deprecated styles: `$\mathmi[fontweight][bold][mathvariant][normal]{a}$'
should be a normal a, `$\mathmi[fontweight][bold][mathvariant][sans-serif]{a}$'
should be a sans-serif a, and 
`$\mathmi[fontweight][bold][mathvariant][fraktur]{a1}$' should be fraktur.
In the case of 
`$\mathbox{mstyle}[fontstyle][italic]{\mathbf{a}b}$', the a should be bold
upright, and the b should be italic. The MathML recommendation says that
`mathvariant' should have precedence over `fontstyle', which is deprecated,
and not used by \Tralics. In the Pdf, attributes of \cmd{mstyle} are
currently ignored. 

\begin{verbatim}[numbers=left,firstnumber=last]
$x$ $\mathmi{\char32x\char32}$
$D$ $\mathmi{\char32sin\char32}$ $\mathmi[mathvariant][script]{L}$
$\mathmi{}$
\end{verbatim}

Examples for 3.2.3: `$x$' (an x without spaces), 
`$\mathmi{\char32x\char32}$' (an x with spaces), 
`$D$', `$\mathmi{\char32sin\char32}$', '$\mathmi[mathvariant][script]{L}$'
and `$\mathmi{}$' (empty identifier). An italic font should be used unless
defined by an attribute, or an upright font if the element has more than 
one character. In the Pdf, spaces are incorreclty counted as characters.

\begin{verbatim}[numbers=left,firstnumber=last]
$\sin(x)$ $\mathmi{sin}\ApplyFunction x$ $1+x+\mathmo{...}+n$
$1+x+\mathmi{...}+n$ $\pi, \ImaginaryI,\ExponentialE$
\end{verbatim}
This is $\sin(x)$, using \&ApplyFunction;, Unicode character U+2061:
`$\mathmi{sin}\ApplyFunction x$'. Ellipses using \elt{mo}: `$1+x+\mathmo{...}+n$'
and \elt{mi}: `$1+x+\mathmi{...}+n$', constants $\pi, \ImaginaryI,\ExponentialE$
(these are somehow unusual in Pdf).

\begin{verbatim}[numbers=left,firstnumber=last]
$2, \mathmn{0.123}, \mathmn{1,000,000}, \mathmn{2.1e10},
\mathmn{0xFFEF}, \mathmn{MCMLXIX}, \mathmn{twenty one}$.
$2+{3\*\ImaginaryI},\frac12, \pi, \ExponentialE$.
\end{verbatim}
A \elt{mathmn} element represents a number, typeset with an upright font,
for instance
$2$, $\mathmn{0.123}$, $\mathmn{1,000,000}$, $\mathmn{2.1e10}$,
$\mathmn{0xFFEF}$, $\mathmn{MCMLXIX}$, $\mathmn{twenty one}$. 
Numbers, that could be \elt{mathcn} (content markup numbers), but are not
\elt{mathmn} (presentation markup numbers): 
$2+{3\*\ImaginaryI},\frac12, \pi, \ExponentialE$. 

\begin{verbatim}[numbers=left,firstnumber=last]
$+, <,\le, \mathmo{<=}, \mathmo{++}, \sum,\mathmo{.NOT}, \mathmo{and},
\*,\mathmo[mathvariant][bold]{+}$
$({a+b})$, $[{0,1})$, $f\ApplyFunction {({x,y})}$
 $x\* y$, $f\ApplyFunction{(x)}$, $\sin\ApplyFunction x$
and $m_{1\InvisibleComma2}$.
\end{verbatim}
Example of \elt{mathmo} (operators): 
$+, <,\le, \mathmo{<=}, \mathmo{++}, \sum,\mathmo{.NOT}, \mathmo{and},
\*,\mathmo[mathvariant][bold]{+}$. In the Pdf version, font attributes are
ignored for operators (they are complicated to implement, and only `bold'
variant is available with the current math fonts).

More examples: $({a+b})$, $[{0,1})$, $f\ApplyFunction {({x,y})}$.

Invisible operators: $x\* y$, $f\ApplyFunction{(x)}$, $\sin\ApplyFunction x$
and $m_{1\InvisibleComma2}$.

\begin{verbatim}[numbers=left,firstnumber=last]
$\frac{\DifferentialD}{\DifferentialD x}$
\end{verbatim}
Embellishment $\frac{\DifferentialD}{\DifferentialD x}$. The MathML
recommendation says that the spacing around an embellished operator like $+_4$
should be the same as that of the operator at its core. An expression like
$4_+$ is not an embellished operator, but phantoms are. More surprising: a
fraction whose numerator is an operator  is an embellished  operator, the
example shown here being the motivation. 


\begin{verbatim}[numbers=left,firstnumber=last]
$\underline{(}\frac ab \overline)$. 
$\mathmo[maxsize][1]{(} \frac ab\mathmo[maxsize][1]{)}$,
$(\frac ab)$
$x\mathop\rightarrow\limits_{\mtext{ maps to }}y$
\end{verbatim}

Stretching: $\underline{(}\frac ab \overline)$. With maxsize
$\mathmo[maxsize][1]{(} \frac ab\mathmo[maxsize][1]{)}$, and without
$(\frac ab)$. The rule is the following. An enbellished operator (for
instance an underlined parenthesis) should stretch vertically, 
as it it were not embellished, this is not
implemented in the Pdf. A maximum size can be given (either as a dimension, or
a ratio to the default size, a value of 1 says that the operator should not
stretch. Horizontal stretching: 
$x\mathop\rightarrow\limits_{\mtext{ maps to }}y$. In the Pdf version, we have
a normal arrow. 

\begin{verbatim}[numbers=left,firstnumber=last]
$\mtext{ Theorem 1: }$
$X\mathbox{mtext}{\mathcnothing{^^^^2009}}X$
$X\mathbox{mtext}{\mathcnothing{^^^^2009^^^^200a^^^^200a^^^^2009%
^^^^200a^^^^200a}}X$'
$X\mkern10muX$
$X\mtext{ /* a comment */ }X$'
$\mathmo{ there exists }{{\delta>0}\mathmo{ such that
}{{f\ApplyFunction{(x)}}<1}}$
\end{verbatim}
Text: `$\mtext{ Theorem 1: }$',
`$X\mathbox{mtext}{\mathcnothing{^^^^2009}}X$'
`$X\mathbox{mtext}{\mathcnothing{^^^^2009^^^^200a^^^^200a^^^^2009%
^^^^200a^^^^200a}}X$' (expression obtained by inserting twice three characters:
thickspace, thinspace and verythinspace, should be the same as 
`$X\mkern10muX$',
`$X\mtext{ /* a comment */ }X$'. Other example:
$\mathmo{ there exists }{{\delta>0}\mathmo{ such that
  }{{f\ApplyFunction{(x)}}<1}}$. The MathML rules say that initial and final
space should be removed and consecutive space characters should be replaced by
a single space character in elements like \elt{mtext} or \elt{mo}. This is not
done in the Pdf version, and you will see the following: normally \elt{mtext}
is typeset via \cmd{text}, and spaces are typeset as usual outside math mode;
the default for all other operators is a math font, and spaces are ignored. 
A non-trivial question is: what amount of space is inserted between the
`exists' and the $\delta$ that follows? Firefox uses none, this is not good,
\TeX\ uses a small space, but ignores the space before it, the MathML
recommendation is unclear, and the sample renderings of the MathML test suite
show no space between two \elt{mtext} elements or between  a \elt{mtext} and a
comma. 

\begin{verbatim}[numbers=left,firstnumber=last]
${x\mathbox{malignmark}[edge][right]{}}^2$
\end{verbatim}

Alignment: ${x\mathbox{malignmark}[edge][right]{}}^2$.  The empty element used
in this formula is ignored in the Pdf version, (and, it seems,  by my browser
also). It defines an alignment mark, that is ignored outside  tables.
The idea is the following. If you want a table where all elements are
centered, except for the first row, first column, and element at position
(2,2), the easy way is to use a \elt{mtable} element, specifying that
alignment is left, center, etc, specify alternative alignment for the first
row, or some specific elements. If this is not sufficient, an alternate method
is provided. Typically each row contains a single cell, with some empty
\elt{maligngroup} elements. You can specify alignments for groups in the same
way as alignment for cells, with two additions: if the group contains numbers,
you can say that decimal points are aligned (there is an implicit point at the
end of the group); moreover you can explicitly set a mark. In the example
above, the mark is between the letter x and the superscript. Using a mark does
not alter rendering of the expression.

\begin{verbatim}[numbers=left,firstnumber=last]
$\mathbox{ms}{\mathcnothing{\&}}$
$\mathbox{ms}{\mathcnothing{\&amp;}}$
$\mathbox{ms}{\mathcnothing{double quote is "}}$ 
$\mathbox{ms}[lquote][aa][rquote][bb]{\mathcnothing{test}}$ 
\end{verbatim}

Literals $\mathbox{ms}{\mathcnothing{\&}}$,
$\mathbox{ms}{\mathcnothing{\&amp;}}$,
$\mathbox{ms}{\mathcnothing{double quote is "}}$, 
$\mathbox{ms}[lquote][aa][rquote][bb]{\mathcnothing{test}}$.
This element is not yet correctly converted in Pdf. There should be some kind
of quotes around the expression, the quotes may be given by attributes; my
browser shows strange characters.

\begin{verbatim}[numbers=left,firstnumber=last]
${2\* x}+y-z$, $({x,y})$
\end{verbatim}

Example of \elt{mrow}: ${2\* x}+y-z$, $({x,y})$. 

\begin{verbatim}[numbers=left,firstnumber=last]
\[\frac{(\frac ab\mathattribute{linethickness}{0})\qquad 
\frac ab}{\frac cd}\mathattribute{linethickness}{2}\qquad
\frac{1}{x^3+\frac x3} = \frac{1}{x^3+\frac x3}
\mathattribute{bevelled}{true}\qquad \frac{1+\sqrt 5}{2}
\]
\end{verbatim}
Example of \elt{mfrac}; if the bevelled attribute is true, a diagonal line
should separate numerator and denoninator (not implemented in Pdf).
\[\frac{(\frac ab\mathattribute{linethickness}{0})\qquad 
\frac ab}{\frac cd}\mathattribute{linethickness}{2}\qquad
\frac{1}{x^3+\frac x3} = \frac{1}{x^3+\frac x3}
\mathattribute{bevelled}{true}\qquad \frac{1+\sqrt 5}{2}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
$\mathbox{mstyle}[maxsize][1]{(\frac ab)}$
\end{verbatim}
Example of \elt{mstyle}: $\mathbox{mstyle}[maxsize][1]{(\frac ab)}$. 
Attributes of the element are used by children as default value. In the
example, both opening and closing parentheses should use maxsize=1.
This mechanism is not yet implemented in the Pdf.

\begin{verbatim}[numbers=left,firstnumber=last]
$\mathbox{merror}{
\mtext{ Unrecognised element: mfraction; arguments were: }
{1+\sqrt5}\mtext{ and } 2}$
\end{verbatim}
Error: $\mathbox{merror}{
\mtext{ Unrecognised element: mfraction; arguments were: }
{1+\sqrt5}\mtext{ and } 2}$.

\begin{verbatim}[numbers=left,firstnumber=last]
\def\test{C\mathbox{mpadded}[width][0em]{\kern-0.3em\text{|}}}
$\test$, $\mathbox{semantics}
{\test\mathbox{annotation-xml}[encoding][MathML-Presentation]{\mathbb{C}}}$
$\mathbb{C}$
$\mathbox{mpadded}[width][0em]{C}\kern0.3em\text{|}$
\end{verbatim}

\def\test{C\mathbox{mpadded}[width][0em]{\kern-0.3em\text{|}}}
Padding: $\test$, $\mathbox{semantics}
{\test\mathbox{annotation-xml}[encoding][MathML-Presentation]{\mathbb{C}}}$.
The previous expression contains two letters C with a vertical bar over
it. None of them looks OK on my browser, because of the negative space. The Pdf
version contains a third C because the \elt{semantics} element is not
implemented. The formula should mimic $\mathbb{C}$. 
Positive padding $\mathbox{mpadded}[width][0em]{C}\kern0.3em\text{|}$ is
better in my browser.

\begin{verbatim}[numbers=left,firstnumber=last]
$\frac{x+y+z}{x\phantom{\mathmo[form][infix]{+}y}+z}$
$\frac{x+y+z}{x\phantom{+}\phantom{y}+z}$
\end{verbatim}
Phantom: $\frac{x+y+z}{x\phantom{\mathmo[form][infix]{+}y}+z}$ 
and $\frac{x+y+z}{x\phantom{+}\phantom{y}+z}$. These two expressions should
produce the same result, the numerator and the denoninator have the same
width. Said otherwise, spacing around the plus symbol (inside or outside
phantom) should be that of a prefix plus operator if it is the first 
element in a row, followed by something else, should be infix if it is the
sole element, or neither first nor last, should be postfix otherwise.


\begin{verbatim}[numbers=left,firstnumber=last]
\def\mfence{\mathbox{mfenced}}
Fences: $\mfence{x}$, $(x)$, $\mfence{xy}$, $f\ApplyFunction\mfence{xy}$,
$(x,y)$, $\mfence{{a+b}}$, $\mfence[open][[]{0\relax1}$.
Wrong $\mfence{a+b}$, $\mfence{01}, \bf\mfence{xy}$,
right: $\bf\mfence{x y}$, $\bf\mfence{{x}{y}}$.
\end{verbatim}
\def\mfence{\mathbox{mfenced}}
Fences: $\mfence{x}$, $(x)$, $\mfence{xy}$, $f\ApplyFunction\mfence{xy}$,
$(x,y)$, $\mfence{{a+b}}$, $\mfence[open][[]{0\relax1}$.
Wrong $\mfence{a+b}$, $\mfence{01}, \bf\mfence{xy}$,
right: $\bf\mfence{x y}$,  $\bf\mfence{{x}{y}}$.
Note that separators do not show in the Pdf, so that it is unclear why some
expressions are wrong. 

The first expression is wrong, because the MathML
documentation says that a \elt{mrow} is necessary so that the \elt{mfenced}
has just one argument; a pair of braces should be added, this gives the 
\cmd{mrow}. Examples that follow are wrong because `01' or `xy' produce a
single \elt{mn} or \elt{mi} element; in the case of an identifier this may
depend on the font. You can use a separator (space or
\cmd{relax}) or uses braces (no \elt{mrow} is produced if there is a single
element in the math list). Note: spaces are ignored in math mode; it is not
completely clear whether or not a space is allowed as separator.

\begin{verbatim}[numbers=left,firstnumber=last]
\[
\def\mtr{\mathbox{mtr}}
\def\mtdr{\mathbox{mtd}[columnalign][right]}
\def\ralign{\cellattribute{columnalign}{right}}
\def\X#1#2{\mathbox{menclose}[notation][#1]{#2}}
\mathbox{mtable}[columspacing][0pt][rowspacing][0pt]{
  \mtr{\mathbox{mtd}{}\mtdr{10}}
  \mtr{\mtdr{131}\mtdr{\X{longdiv}{1413}}}
  \mtr{\mathbox{mtd}{}\mtdr{{\underline{131}\phantom{3}}}}
  \mtr{\mathbox{mtd}{}\mtdr{103}}}
\qquad
a_{\X{actuarial}{n}\*i}
\qquad
\begin{array}{cc}
  &\ralign10\\
\ralign131&\ralign\X{longdiv}{1413}\\
  &\ralign \underline{131}\phantom{3}\\
  &\ralign 103
\end{array}\mathattribute{columspacing}{0pt}\mathattribute{rowspacing}{0pt}
\]
\end{verbatim}

Examples of menclose (Does not work in the Pdf or with Firefox; works with Amaya).
\[
\def\mtr{\mathbox{mtr}}
\def\mtdr{\mathbox{mtd}[columnalign][right]}
\def\ralign{\cellattribute{columnalign}{right}}
\def\X#1#2{\mathbox{menclose}[notation][#1]{#2}}
\mathbox{mtable}[columspacing][0pt][rowspacing][0pt]{
  \mtr{\mathbox{mtd}{}\mtdr{10}}
  \mtr{\mtdr{131}\mtdr{\X{longdiv}{1413}}}
  \mtr{\mathbox{mtd}{}\mtdr{{\underline{131}\phantom{3}}}}
  \mtr{\mathbox{mtd}{}\mtdr{103}}}
\qquad
a_{\X{actuarial}{n}\*i}
\qquad
\begin{array}{cc}
  &\ralign10\\
\ralign131&\ralign\X{longdiv}{1413}\\
  &\ralign \underline{131}\phantom{3}\\
  &\ralign 103
\end{array}\mathattribute{columspacing}{0pt}\mathattribute{rowspacing}{0pt}
\]

\begin{verbatim}[numbers=left,firstnumber=last]
$(x+y)^2$ ${(x+y)}^2$ $\int_0^1{\ExponentialE^x\*{\DifferentialD x}}$
\end{verbatim}
Scripts:
Compare $(x+y)^2$ (without braces) with ${(x+y)}^2$ (recommended), 
$\int_0^1{\ExponentialE^x\*{\DifferentialD x}}$

\begin{verbatim}[numbers=left,firstnumber=last]
$\underbrace{x+y+z}\mathattribute{accentunder}{true} \text{~versus~} 
\underbrace{x+y+z}\mathattribute{accentunder}{false}
$, $\hat x \text{~versus~}\hat x\mathattribute{accent}{false}$,
$\overbrace{x+y+z}\mathattribute{accent}{true} \text{~versus~}
\overbrace{x+y+z}\mathattribute{accent}{false}$, 
$\mathop{\int\limits_0}\limits^\infty \text{~versus~} \int\limits_0^\infty$
\end{verbatim}

Underscript, overscripts:
$\underbrace{x+y+z}\mathattribute{accentunder}{true} \text{~versus~} \underbrace{x+y+z}\mathattribute{accentunder}{false}
$, $\hat x \text{~versus~}\hat x\mathattribute{accent}{false}$,
$\overbrace{x+y+z}\mathattribute{accent}{true} \text{~versus~}
\overbrace{x+y+z}\mathattribute{accent}{false}$. Converting mathml to Pdf is
not obvious because if a brace character is an accent-declared overscript, we
must apply some command to the kernel. In order for this example to work,
another command must be applied if the brace is non-accent (we use the same
command, that's simplier). In a case like 
$\mathop{\int\limits_0}\limits^\infty \text{~versus~} \int\limits_0^\infty$
there is no difference between an operator with underscript  to which an
overscript is added, and an operator with two scripts. 

\begin{verbatim}[numbers=left,firstnumber=last]
$\mathbox{mmultiscripts}{F1\none\mathbox{mprescripts}{}0\none}
\ApplyFunction{({;a;z})}$
$\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$
\end{verbatim}
Multiscripts:
$\mathbox{mmultiscripts}{F1\none\mathbox{mprescripts}{}0\none}
\ApplyFunction{({;a;z})}$ and 
$\mathbox{mmultiscripts}{Ri\none\none jk \none l\none}$.

\begin{verbatim}[numbers=left,firstnumber=last]
$(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{array})$,
$\mathbox{mtable}{\mathbox{mlabeledtr}[id][e-is=m-c-square]{
\mathbox{mtd}{\text{(2.1)}}
\mathbox{mtd}{{E={m\*c^2}}}}}$.
\end{verbatim}
Tables: a matrix
$(\begin{array}{ccc}1&0&0\\0&1&0\\0&0&1\end{array})$,
and an numbered equation:
$\mathbox{mtable}{\mathbox{mlabeledtr}[id][e-is=m-c-square]{
\mathbox{mtd}{\text{(2.1)}}
\mathbox{mtd}{{E={m\*c^2}}}}}$. 

\begin{verbatim}[numbers=left,firstnumber=last]
$\def\X{\mathbox{maligngroup}{}}
\def\A{{{\X\mathmn{8.44}\*\X x} \X +{\X \mathmn{55} \*\X y}}\X=\X0}
\def\B{{{\X\mathmn{3.1} \*\X x} \X -{\X \mathmn{0.7}\*\X y}}\X=\X{-\mathmn{1.1}}}
\mathbox{mtable}[groupalign][\char`\{decimalpoint left left decimalpoint left
decimalpoint\char`\}]{
\mathbox{mtr}{\mathbox{mtd}{{\A}}}
\mathbox{mtr}{\mathbox{mtd}{{\B}}}}
$
\end{verbatim}
Alignment
$\def\X{\mathbox{maligngroup}{}}
\def\A{{{\X\mathmn{8.44}\*\X x} \X +{\X \mathmn{55} \*\X y}}\X=\X0}
\def\B{{{\X\mathmn{3.1} \*\X x} \X -{\X \mathmn{0.7}\*\X y}}\X=\X{-\mathmn{1.1}}}
\mathbox{mtable}[groupalign][\char`\{decimalpoint left left decimalpoint left
decimalpoint\char`\}]{
\mathbox{mtr}{\mathbox{mtd}{{\A}}}
\mathbox{mtr}{\mathbox{mtd}{{\B}}}}
$. As explained above, this could be typeset, by aligning the \cmd{X}. the
material between two \cmd{X} commands should be left-aligned, or aligned on
the decimal point. In some cases, the \cmd{X} is a direct child of the cell,
but not always. For this reason, it is nearly impossible to typeset this
correctlty in \TeX.


\fi

\bibliography{tralics}


\tableofcontents

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: