summaryrefslogtreecommitdiff
path: root/support/mathtex/mathtex.html
blob: d1eee53648f1c378abd24f9f15598c364997ab25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
<!--
 ****************************************************************************
 * Copyright(c) 2007-2012, John Forkosh Associates, Inc. All rights reserved.
 *           http://www.forkosh.com   mailto: john@forkosh.com
 * ==========================================================================
 * This file is part of mathTeX, which is free software. You may redistribute
 * and/or modify it under the terms of the GNU General Public License,
 * version 3 or later, as published by the Free Software Foundation.
 *      MathTeX is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
 * See the GNU General Public License for specific details.
 *      By using mathTeX, you warrant that you have read, understood and
 * agreed to these terms and conditions, and that you possess the legal
 * right and ability to enter into this agreement and to use mathTeX
 * in accordance with it.
 *      Your mathtex.zip distribution should contain the file COPYING,
 * an ascii text copy of the GNU General Public License, version 3.
 * If not, point your browser to  http://www.gnu.org/licenses/
 * or write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
 ****************************************************************************
 -->

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Preamble
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<html>
  <head>
    <title> mathTeX manual </title>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    <style type="text/css">
      body      { background-image:  none; /* none; or :url(); */
                  /*background-image:  url(GBCBindBorder.gif);*/ /*or :none;*/
                  /*background-repeat: repeat-y;*/
                  /*background-attachment: scroll;*/ /* fixed; or scroll; */
                  /*margin-left: 4.0em;*/
                  background-color:  #ffffff;   color: #000000;
                  margin-left: 0.5em;  margin-right: 0.1em;
                  font-size: large;
                  clear: both }
      A:active  { color: blue/*#0000FF*/; text-decoration: none }
      A:link    { color: blue/*#0000FF*/; text-decoration: none }
      A:visited { color: blue/*#0000FF*/; text-decoration: none }
      A:hover   { color: red/*#FF0000*/;  text-decoration: underline
                /*font-style: italic; font-weight: bold;*/
                /*font-size: medium;  line-height: normal*/ }
      h2        { color: maroon;  text-decoration: underline;
                  font-style: normal;  /* italic oblique */
                  padding-top: 2.0em;
                  letter-spacing: 0.25em }
      h3        { color: maroon; /*black;   text-decoration: underline;*/
                  font-style: normal;  /* italic oblique */
                  font-size: large;
                  margin-left: 1em;
                  padding-top: 0.5em;
                  letter-spacing: 0.15em }
      h4        { color: maroon; /*black;   text-decoration: underline;*/
                  font-style: normal;  /* italic oblique */
                  font-size: large;
                  margin-left: 1.5em; margin-bottom: 0.0em;
                  padding-top: 0.5em; padding-bottom: 0.0em;
                  letter-spacing: 0.125em }
      table     { font-size: large }
      dl        { font-size: large;
                  margin-left: 2.0em;   margin-right: 2.5em }
      dt        { color:maroon }
      dd        { margin-left: 1.0em;   margin-bottom: 0.5em }
      ul        { margin-left: 1.0em;   margin-right: 2.5em;
                  list-style-type: square }
      ul ul     { margin-left: -0.5em;  margin-right: 3.5em;
                  list-style-type: disc }
      p         { margin-left: 1.5em;   margin-right: 1.5em }
    /*pre       { margin-left: 4.0em; font-size: medium }*/
      pre       { margin-left: 1.5em }
      pre.medium { margin-left: 1.5em; font-size:medium }
      p:first-letter
                { font-size: x-large;   font-weight: bold;
                  color: maroon }
      p.continue { margin-left: 1.5em;   margin-right: 1.5em;
                   padding-top: -0.1em }
      p.continue:first-letter
                { font-size: large;   font-weight: normal;
                  color: black }
      p.warning { color: red } /* defines p class="warning"... */
      td.paragraph:first-letter
                { font-size: x-large;   font-weight: bold;
                  color: maroon }
    </style>
    <style type="text/css">
      a.info{
        position:relative;
        z-index:24;
        /*background-color:#8692A5;*/
        visibility: inherit;
        text-decoration: none; }
      a.info:hover{
        z-index:25;
        /*background-color:#999999;
        color: #FFFF00;*/
        text-decoration: none; }
      a.info span{
        display: none;
        /*color: #FFFF00;*/ }
      a.info:hover span{
        display:block;
        position:absolute;
        top:2em;
        left:2em;
        /*width:15em;*/
        border:1px solid #330066;
        background-color:#FFFF99;
        color:#660000;
        text-align: left;
        font-size: 13px;
        font-weight: normal;
        margin: 3px;
        padding: 6px; }
      a.info:link {
        text-decoration: none;
        /*color: #FFFF00;*/ /*themecolour1%0;*/ }
      a.info:visited {
        text-decoration: none;
        /*color: #FFFF00;*/ /*themecolour1%0;*/ }
    </style>
    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + php functions
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <?php
    $mathtexurl = "../cgi-bin/mathtex.cgi?";
    //$mathtexurl = "http://psi7star/cgi-bin/mathtex.cgi?";
    //$mathtexurl = "http://www.forkosh.com/cgi-bin/mathtex.cgi?";
    function mathtextag( $label, $valign, $expression ) {
      global $mathtexurl;
      $url    = $mathtexurl . $expression;
      echo  '<a href="#preview" class="info"><img id="',$label,'" ';
      echo  ' onclick="eqntext(',"'",$label,"'",')"  ';
      echo  ' src="',$url,'" ';
      echo  ' style="Vertical-Align:',$valign,'px" ';
      //echo  ' align="absmiddle" ';
      echo  ' alt="" border=0>';
      echo  '<span>',$expression,'</span>';
      echo  '</a>', "\n";
      }
    ?>
    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    + javascript functions
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <script type="text/javascript">
      <!--
      // add/clear text to expression
      function eqntext(eqn)
        { var eqnSrc = document.getElementById(eqn).src;
          var texSrc = eqnSrc.substring(eqnSrc.indexOf('?')+1,eqnSrc.length);
          addtext(texSrc); }
      function addtext(text)
        { cleartext();
          document.expression.formdata.value += unescape(text);
          document.expression.formdata.focus(); }
      function cleartext()
        { document.expression.formdata.value = "";
          //document.inlineframe.value = "";
          document.expression.formdata.focus(); }
      -->
    </script>
  </head>
<body>

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Banner across top of page containing title and two example mathTeX images
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<br>
<hr size=4>
<center>
 <table cellspacing=10>
  <tr>
   <td align="center">
      <?php mathtextag('imageTop1',0,
      'f=b_o+\frac{a_1}{b_1+\frac{a_2}
      {b_2+\frac{a_3}{b_3+a_4}}}'); ?> </td>
   <td align="center" valign="middle">
      <center><font color="maroon" size=4><b>
      <nobr>m a t h T e X &nbsp; <!-- u s e r s &nbsp; -->
      m a n u a l</nobr></b> <br>
      <font size=3>( for mathTeX version 1.04 )</font> <br>
      <font size=3> <b>Click for:</b> &nbsp;
        <a href="http://www.forkosh.com/mathtex.zip">
        <font size=4>download&nbsp;mathTeX</font></a> </font>
      </font></center> </td>
   <td align="center">
      <?php mathtextag('imageTop2',0,
      '\usepackage{mathrsfs}{\mathscr J}^{ij}=\frac12\varepsilon_{ijk}
      \left[\begin{array}{cc}\sigma_k&0\\\\0&\sigma_k\end{array}\right]'); ?>
      <br> <a href="#examples">more_examples...</a> </td>
  </tr>
  <tr> <td align="center" colspan="3"> <font size="3">
   This page discusses mathTeX, a program that displays math on the web.<br>
   See <a href="http://www.americanscientist.org/issues/pub/2009/3/writing-math-on-the-web/1"
   target="_top">Writing&nbsp;Math&nbsp;on&nbsp;the&nbsp;Web</a>
   for a more general discussion. </font> </td> </tr>
 </table>
</center>
<hr size=4>
<center><b><font color="maroon" size=3>
Copyright <font size=5>&copy;</font> 2007-2012,
<a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a> <br>
email: <a href="mailto:john&#64;forkosh&#46;com">john&#64;forkosh&#46;com</a>
</font></b> <br><br>
<a href="#preview"><img id="timestamp1" onclick="eqntext('timestamp1')"
src="../cgi-bin/mathtex.cgi?\parstyle\usepackage{color}
\large\color{blue}\begin{center}\today\\\time\end{center}"
alt="" border=0 align=middle></a> </center>

<!--
<p id="notice">&nbsp;</p> <center>
<table border="1" frame="box">
<tr><td align="center">
<font color="red"> <font size="5"> &#151;&#151;
Important Notice &#151;&#151; </font> <br> <nobr> <u> &nbsp; f o r  &nbsp;
p u b l i c  &nbsp;  m a t h T e X  &nbsp;  w e b  &nbsp;  s e r v i c e
&nbsp;  u s e r s  &nbsp; </u> </nobr> </font>
</td></tr>
<tr><td align="left"> <font color="blue">
mathTeX's ISP no longer permits subdomains. <br>
That means your &lt;img&gt; tags of the form <br>
<font color="red"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;img src="http://www.forkosh.dreamhost.com/mathtex.cgi?c=\sqrt{a^2+b^2}"
&gt; </font> <br>
will not work after November 30, 2011. <br>
Change them all to <br>
<font color="red"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;img src="http://www.forkosh.com/mathtex.cgi?c=\sqrt{a^2+b^2}" &gt;
</font> <br>
That is, just remove the &quot;<font color="red">dreamhost.</font>&quot;
from all tags.<br>
That works now. And the pesky message that brought you here disappears.<br>
To repeat, the address of the
<a href="#webservice">public mathTeX server</a> is now <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
http://www.forkosh.com/mathtex.cgi <br>
so write tags of the form <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&lt;img src="http://www.forkosh.com/mathtex.cgi?c=\sqrt{a^2+b^2}" &gt; <br>
to access it. Thanks.
</font> </td> </tr>
<tr><td align="left"> <font color="#333333">
I'm sorry if this change is inconvenient, particularly for
<a href="http://wordpress.org/extend/plugins/youngwhans-simple-latex/"
target="_top">wordpress</a> or
<a href="http://www.mediawiki.org/wiki/Mediawiki_and_LaTeX_on_a_host_with_shell_access"
target="_top">mediawiki</a> or<br>
other users who may not even know
their application's LaTeX plugin uses mathTeX.<br>
Just edit your plugin and remove
&quot;<font color="red">dreamhost.</font>&quot;
from any &lt;img&gt; tag that contains it,<br>
as illustrated above.<br>
&nbsp; &nbsp; &nbsp;
Or contact <a href="http://dreamhost.com/contact/"
target="_top">http://dreamhost.com/contact/</a>
with any complaints, as I can't change<br>
the situation, and dreamhost refused my request to make
an exception for mathTeX.
</font> </td> </tr> </table> </center>
-->

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Table of Contents and QuickStart Summary
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<br>
<p> <font color="blue"> This manual contains more information
than you'll probably need to read.  If you follow the
QuickStart instructions below, try installing mathTeX immediately.
If you need more information,
continue reading until you feel comfortable trying to install mathTeX.
Return to the manual as needed.
Prerequisites are: some knowledge of Unix shell, of installing cgi's,
of LaTeX. </font>
<font color="maroon"> <br>
&nbsp; &nbsp; &nbsp; &nbsp;
     <b>&quot</b><i>Computers are like Old Testament gods<b>:</b>
     lots of rules and no mercy.</i><b>&quot</b><br>
&nbsp; &nbsp; &nbsp; &nbsp;
     Joseph Campbell, The Power of Myth &nbsp;
     (Doubleday 1988, page 18) </font> </p>

<br> <center>
<table border="0">
<tr> <!-- banner -->
 <td align="center">
   <b><font color="maroon" size=4>
   <u> &nbsp; &nbsp; C o n t e n t s &nbsp; &nbsp; </u></font></b></td>
 <td> &nbsp; </td>
 <td align="center"><b><font color="maroon" size=4>
   <u> &nbsp; &nbsp; Q u i c k S t a r t &nbsp; &nbsp;
   </u></font></b></td>
</tr>
<tr>
 <td valign="top"> <!-- table of contents -->
  <table cellspacing=0>
   <tr>
    <td valign="top" align="left">
     <font size=4>
      <a href="#introduction">  (1) Introduction </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#dependencies"> dependencies </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#plugins">           plugins </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#alternatives"> alternatives </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#webservice">   web services </a><br>
      <a href="#latexmarkup">   (2) LaTeX markup </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#preview">        input form </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#examples">         examples </a><br>
      <a href="#mathtexmarkup"> (3) MathTeX markup </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#directives"> extra directives </a><br>
      <a href="#install">       (4) Installation </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#messages">   error messages </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#switches"> compile switches </a><br>
        &nbsp; &nbsp; &nbsp; <a href="#shell">      run from shell </a><br>
 <!-- <a href="#weblog">       () mathTeX Forum </a><br> -->
      <a href="#gpl">           (5) GPL License </a><br>
      <font color="maroon" size=4> <br> <b><u> &nbsp;
      Related &nbsp; Pages &nbsp; </u></b></font> <br>
      <a href="http://www.forkosh.com/mathtextutorial.html" target="_top">
         <font size=4>LaTeX Tutorial</font></a> <br>
      <a href="http://www.forkosh.com/mathtexchangelog.html" target="_top">
         <font size=4>mathTeX changeLog</font></a> <br>
      <a href="http://www.forkosh.com/cgi-bin/weblist.cgi?-t=weblist
     &-f=sources/weblistemplate.html
     &files=@sources/sourcecode/mathtex.lis&copyright=2007-2011&counter=mathtex
     &title=mathtex&description=m a t h T e X  S o u r c e   L i s t i n g"
       target="_top">
         <font size=4>mathTeX Listing</font></a> <br>
     </font>
    </td>
   </tr>
  </table>
 </td>
 <td> &nbsp; </td>
 <td valign="top"> <!-- summary -->
  <table border="0" cellpadding="0" cellspacing="0" hspace="0" vspace="0">
    <!-- tr><td colspan="2" align="left" valign="top">
       <font color="maroon" size="-1">
       <b>&quot</b><i>Computers are like Old Testament gods<b>:</b>
       lots of rules and no mercy.</i><b>&quot</b><br>
       Joseph Campbell, The Power of Myth &nbsp;
       (Doubleday 1988, page 18) </font> </td></tr -->
    <tr><td align="right" valign="top">
      <a href="#install">Installation</a>: &nbsp; &nbsp; </td>
      <td> <font color="maroon"><b>Note: The current release of mathTeX
       only <br> runs under Unix-like operating systems.</b></font> <br>
       First, install mathTeX's <a href="#dependencies">dependencies</a>: <br>
       <b> &nbsp; &nbsp; </b> a recent <a href="http://www.latex-project.org/ftp.html"
       target="_top">TeX&nbsp;distribution</a> with
       <a href="http://savannah.nongnu.org/projects/dvipng/"
       target="_top">dvipng</a>,
       <!-- and
       <a href="http://www.imagemagick.org" target="_top">ImageMagick</a --> 
       on <br>
       <b> &nbsp; &nbsp; </b> your server.  Or see
       <a href="http://www.forkosh.com/mimetex.html"
       target="_top">mimeTeX</a> if you can't. <br>
       Then, download <a href="http://www.forkosh.com/mathtex.zip">
       mathtex.zip</a> and type <br>
       <b> &nbsp; &nbsp; unzip mathtex.zip</b> <br>
       <b> &nbsp; &nbsp; cc mathtex.c &nbsp; \ <br>
       &nbsp; &nbsp; &nbsp; &#150;DLATEX=\"$(which latex)\" &nbsp; \ <br>
       &nbsp; &nbsp; &nbsp; &#150;DDVIPNG=\"$(which dvipng)\" &nbsp; \ <br>
       <!-- &nbsp; &nbsp; &nbsp; &#150;DDVIPS=\"$(which dvips)\" &nbsp; \ <br>
       &nbsp; &nbsp; &nbsp; &#150;DCONVERT=\"$(which convert)\" &nbsp; \ <br -->
       &nbsp; &nbsp; &nbsp; &#150;o mathtex.cgi</b> <br>
       <nobr> &nbsp; &nbsp; (see
       <a href="#pathswitches">&#150;D<i>switches</i></a>
       for more information). </nobr> <br>
       Finally, just <br>
       <b> &nbsp; &nbsp; mv mathtex.cgi </b> to your <b>cgi-bin/</b>
       directory, <br>
       <!-- b> &nbsp; &nbsp; mkdir&nbsp;cgi-bin/mathtex </b>
       for mathTeX's cache, <br -->
       <b> &nbsp; &nbsp; chmod </b> permissions as necessary, <br>
       and you're all done.
       </td></tr>
    <tr><td colspan="2"> &nbsp; </td></tr>
    <tr><td align="right" valign="top">
      <a href="#introduction">Usage</a>: &nbsp; &nbsp; </td>
      <td>To see the image <br> <b> &nbsp; &nbsp; </b>
       <?php mathtextag('summary1',0,'x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'); ?>
       <br> in your html page, just write the tag <br>
       <b> &nbsp; &nbsp; &lt;img&nbsp;src="/cgi-bin/mathtex.cgi?<br>
       &nbsp; &nbsp; x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}"&gt;</b> </td></tr>
  </table>
 </td>
</tr>
</table>
</center>


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ INTRODUCTION
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="introduction"> (1) Introduction &nbsp; </h2>

<p> <font color="maroon">MathTeX, licensed under the
    <a href="http://www.gnu.org/licenses/gpl.html" target="_top">gpl</a>,
    is a <a href="http://www.w3.org/CGI/" target="_top">cgi</a> program
    that lets you easily embed
    <a href="http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/latex_maths+pix/latex_maths+pix.html"
    target="_top">LaTeX&nbsp;math</a>
    in your own  html pages, blogs, wikis, etc.</font>
    It parses a LaTeX math expression and immediately emits the
    corresponding gif (or png) image, rather than the usual
    <a href="http://en.wikipedia.org/wiki/DVI_(file_format)"
    target="_top">TeX&nbsp;dvi</a>.
    So just place an html &lt;img&gt; tag in your document
    wherever you want to see the corresponding LaTeX expression.
    For example, </p>
<pre>   <b>&lt;img&nbsp;src="/cgi-bin/mathtex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt"
    alt="" border=0 align="middle"&gt;</b></pre>
    <p class="continue"> immediately generates the corresponding gif,
    displaying
    <?php mathtextag('imageA1',-13,
    '\small f(x)=\int_{-\infty}^xe^{-t^2}dt'); ?>
    wherever you put that &lt;img&gt tag. </p>

<h3> <a name="dependencies"> </a>
mathTeX dependencies<font size=5>...</font> </h3>
<p> MathTeX's uses the
    <a href="http://en.wikipedia.org/wiki/LaTeX" target="_top">latex</a> and
    <a href="http://en.wikipedia.org/wiki/Dvipng" target="_top">dvipng</a>
    programs, along with all necessary fonts, etc, from your
    <a href="http://www.latex-project.org/ftp.html"
    target="_top">TeX&nbsp;distribution</a>.  Occasionally, you may need to
    <a href="http://savannah.nongnu.org/projects/dvipng/"
    target="_top">download&nbsp;dvipng</a> separately. <br>
    &nbsp; &nbsp; If you can't, or don't want to,
    install dvipng, then you may optionally specify the
    <a href="#dvipsswitch">
    &#150;DDVIPS&nbsp;and&nbsp;&#150;DCONVERT</a>&nbsp;switches when
    <a href="#compilestep">compiling&nbsp;mathTeX</a>.  Then mathTeX uses
    <a href="http://en.wikipedia.org/wiki/Dvips" target="_top">dvips</a>
    from your TeX&nbsp;distribution,
    and <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> from the
    <a href="http://www.imagemagick.org" target="_top">ImageMagick</a>
    package, instead of dvipng. </p>

<p style="margin-bottom:0;"> That is, </p>
    <pre class="medium" style="margin-top:0;margin-bottom:0"
>   <b>cc &#150;</b>DLATEX<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>latex<b>\"</b> <b>&#150;</b>DDVIPNG<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>dvipng<b>\"</b> mathtex.c <b>&#150;o</b> mathtex.cgi</pre>
<p class="continue" style="margin-bottom:0;margin-top:0;">
    compiles mathtex.cgi with dependencies latex and dvipng, whereas, </p>
    <pre class="medium" style="margin-top:0;margin-bottom:0"
>   <b>cc &#150;</b>DLATEX<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>latex<b>\"</b> <b>&#150;</b>DDVIPS<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>dvips<b>\"</b> <b>\</b>
   <b>&#150;</b>DCONVERT<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>convert<b>\"</b> mathtex.c <b>&#150;o</b> mathtex.cgi</pre>
<p class="continue" style="margin-top:0;">
    compiles mathtex.cgi with dependencies latex and dvips and convert. <br>
    <b>(</b>Note:&nbsp;dvipng is easily twice as fast
    as dvips/convert, and it produces somewhat smaller image files,
    with no discernible (to me) loss of quality or other downside.
    So I recommend its use if you have it installed or can
    install it.<b>)</b> </p>

<p> These dependencies  &#151; always latex and either dvipng or
    dvips/convert &#151; must all be installed on your server
    before you can run mathTeX.   Ask your ISP or sysadmin if
    you have any questions or problems installing them.  Or see
    <a href="http://www.forkosh.com/mimetex.html" target="_top">mimeTeX</a>
    if you can't install them. </p>

<h4> <a name="convertadvisory"> </a> Advisory for
    <a href="http://en.wikipedia.org/wiki/Dvips" target="_top">
    dvips</a>/<a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> users:</h4>
<p class="continue" style="margin-top:0.0em;"> If you're using
    <a href="http://en.wikipedia.org/wiki/Dvips" target="_top">dvips</a> and
    and <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> (rather than
    <a href="http://en.wikipedia.org/wiki/Dvipng" target="_top">dvipng</a>),
    then be advised that recent versions of
    <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> seem to exhibit a minor bug whereby
    the program's <b>&#150;gamma</b>&nbsp;correction option is ignored
    when converting postscript images to any other format.
    The default, and unchangeable, gamma renders
    acceptable-looking png images, but unacceptably light gif images.
    Earlier versions of
    <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> seem to respect the
    <b>&#150;gamma</b>&nbsp;option and, moreover, render acceptable
    default gif images anyway.
    So if you're using
    <a href="http://en.wikipedia.org/wiki/Dvips" target="_top">
    dvips</a>/<a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> and are seeing very light images,
    I'd recommend downloading
    <a href="http://www.imagemagick.org/"
    target="_top">ImageMagick</a>&nbsp;version&nbsp;6.2.6 source from
    <a href="http://sourceforge.net/projects/imagemagick/files/"
    target="_top">http://sourceforge.net/projects/imagemagick/files/</a>
    and building your own version of
    <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a>.  That should fix your problem.
    Alternatively, an even easier fix is to <!-- you can simply -->
    compile mathtex with the <a href="#gifswitch">-DPNG</a>&nbsp;switch,
    which renders acceptable-looking default png images regardless of
    <a href="http://www.imagemagick.org/script/convert.php"
    target="_top">convert</a> version.
    </p>


<h4> <a name="pictureenviron"> </a> Additional dependencies for
    LaTeX's picture environment: </h4>
<p> LaTeX's picture environment provides a rudimentary markup
    for drawing simple diagrams.  For example, you can submit a
    rather <!-- elaborate --> complicated &lt;img&gt; tag
    to mathTeX like </p>
<pre>   <b>&lt;img&nbsp;src=&quot;/cgi-bin/mathtex.cgi?
      \png
      \definecolor{blueblack}{RGB}{0,0,135}
      \color{blueblack}
      \begin{picture}(4,1.75)
        \thicklines
        \put(2,0.01){\arc{3}{3.53588}{5.8888}}
        \put(.375,.575){\line(1,0){3.25}}
        \put(1.22,1.375){\makebox(0,0){\footnotesize$ds$}}
        \put(.6,.5){\makebox(0,0){\footnotesize$x=0$}}
        \put(3.36,.5){\makebox(0,0){\footnotesize$x=\ell$}}
        \dottedline{.05}(1.0,.575)(1.0,1.10)
        \put(1.0,.5){\makebox(0,0){\footnotesize$x$}}
        \dottedline{.05}(1.5,.575)(1.5,1.40)
        \put(1.5,.5){\makebox(0,0){\footnotesize$x+dx$}}
        \put(1.22,.65){\makebox(0,0){\footnotesize$dx$}}
        \dottedline{.04}(0.6,1.12)(1.25,1.12)
        \put(1.0,1.14){\vector(-1,-1){.45}}
        \put(.58,0.83){\makebox(0,0){\footnotesize$T$}}
        \put(.77,1.05){\makebox(0,0){\scriptsize$\theta(x)$}}
        \put(1.18,1.16){\makebox(0,0){\scriptsize$\theta(x)$}}
        \dottedline{.04}(1.5,1.41)(2.1,1.41)
        \put(1.5,1.44){\vector(4,1){.67}}
        \put(2.22,1.59){\makebox(0,0){\footnotesize$T$}}
        \put(1.95,1.45){\makebox(0,0){\scriptsize$\theta(x+dx)$}}
      \end{picture}&quot;
    alt="" border=0 align="middle"&gt;</b></pre>
<p class="continue"> which, in this case, uses LaTeX's
    &nbsp; \begin{picture}...\end{picture} &nbsp; environment
    to render the image </p>
    <center>
    <a href="#preview"><img id="picenv1" onclick="eqntext('picenv1')"
    src="../cgi-bin/mathtex.cgi?\png
      \definecolor{blueblack}{RGB}{0,0,135}
      \color{blueblack}
      \begin{picture}(4,1.75)
        \thicklines
        \put(2,0.01){\arc{3}{3.53588}{5.8888}}
        \put(.375,.575){\line(1,0){3.25}}
        \put(1.22,1.375){\makebox(0,0){\footnotesize$ds$}}
        \put(.6,.5){\makebox(0,0){\footnotesize$x=0$}}
        \put(3.36,.5){\makebox(0,0){\footnotesize$x=\ell$}}
        \dottedline{.05}(1.0,.575)(1.0,1.10)
        \put(1.0,.5){\makebox(0,0){\footnotesize$x$}}
        \dottedline{.05}(1.5,.575)(1.5,1.40)
        \put(1.5,.5){\makebox(0,0){\footnotesize$x+dx$}}
        \put(1.22,.65){\makebox(0,0){\footnotesize$dx$}}
        \dottedline{.04}(0.6,1.12)(1.25,1.12)
        \put(1.0,1.14){\vector(-1,-1){.45}}
        \put(.58,0.83){\makebox(0,0){\footnotesize$T$}}
        \put(.77,1.05){\makebox(0,0){\scriptsize$\theta(x)$}}
        \put(1.18,1.16){\makebox(0,0){\scriptsize$\theta(x)$}}
        \dottedline{.04}(1.5,1.41)(2.1,1.41)
        \put(1.5,1.44){\vector(4,1){.67}}
        \put(2.22,1.59){\makebox(0,0){\footnotesize$T$}}
        \put(1.95,1.45){\makebox(0,0){\scriptsize$\theta(x+dx)$}}
      \end{picture}"
    alt="" border=0 align=middle></a> </center>
<p class="continue"> Diagrams like this <!-- the one illustrated above -->
    are more often drawn using separate drawing programs.
    However, for example, if you're posting to
    a bulletin&nbsp;board/blog/wiki that supports mathTeX but doesn't
    let you upload separate images, then mathTeX &lt;img&gt; tags
    <!-- like this --> may be a satisfactory alternative.
    And note the special mathTeX <a href="#gifdirective">\png</a>
    directive at the very beginning of the example expression above.
    That's removed before LaTeX sees your expression, but first it
    directs mathTeX to generate a png image even if the default
    is gif.  Png's seem to produce slightly sharper picture images:
    try clicking the above image, change the \png to \gif, submit
    the expression and compare images. </p>

<p> Using &nbsp; \begin{picture}...\end{picture} &nbsp;
    has a few mathTeX dependency requirements.
    The dvipng program doesn't recognize LaTeX
    postscript \specials generated in the picture environment.
    So you must compile mathTeX with the &#150;DDVIPS and
    &#150;DCONVERT switches described above, and (of course)
    these two programs must be available on your server.
    Moreover, even dvips has problems generating encapsulated
    postscript (which is what mathTeX uses) containing these
    \specials.  So a separate script, ps2epsi, that's usually
    included with <a href="http://pages.cs.wisc.edu/~ghost/index.htm"
    target="_top">ghostscript</a> distributions, is used by mathTeX
    to "encapsulate" dvips's output.  Therefore, the ps2epsi script
    must also be available on your server, and you must compile
    mathTeX with the additional switch &#150;DPS2EPSI=\"path/to/ps2epsi\"
    that specifies the path to it. </p>

<p class="continue" style="margin-bottom:0;"> Note that you can,
    and should if possible, also compile mathTeX with the &#150;DDVIPNG
    switch if the dvipng program is also available on your server.
    Then your compile line will look something like </p>
    <pre class="medium" style="margin-top:0;margin-bottom:0"
>   <b>cc  &#150;</b>DLATEX<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>latex<b>\"</b>  <b>&#150;</b>DDVIPNG<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>dvipng<b>\"</b>  <b>&#150;</b>DDVIPS<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>dvips<b>\"</b> <b>\</b>
   <b>&#150;</b>DCONVERT<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>convert<b>\"</b>  <b>&#150;</b>DPS2EPSI<b>=\"</b><i>path</i><b>/</b><i>to</i><b>/</b>ps2epsi<b>\"</b>  mathtex.c <b>&#150;o</b> mathtex.cgi</pre>
<p class="continue" style="margin-top:0;">
    In this case mathTeX defaults to dvipng unless your expression
    contains \begin{picture}, when it automatically uses
    dvips/ps2epsi/convert instead.
    And when your expression contains \begin{picture}, mathTeX
    also automatically runs LaTeX with \usepackage{eepic}. </p>


<h3> <a name="plugins"> </a>
mathTeX plugins<font size=5>...</font> </h3>
<p> There's no inherent need to repeatedly write the cumbersome
    &lt;img&gt; tag illustrated above.  You can write your own <a href=
    "http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro9.html#wp73314"
    target="_top">custom&nbsp;tags</a>,
    or write a wrapper&nbsp;script around mathTeX to simplify the
    notation. </p>

<p style="margin-bottom:0">  For example,
    the following javascript snippet (based on
    <a href="http://www.mathtran.org" target="_top">mathtran</a>'s
    <a href="http://www.mathtran.org/js/mathtran_img.js"
    target="_top">mathtran_img.js</a>) lets you just write &nbsp;
    <b>&lt;img&nbsp;alt="mathtex:c=\sqrt{a^2+b^2}"&gt;</b> &nbsp;
    wherever you want to see
    <a href="#preview"><img id="imageJS1" onclick="eqntext('imageJS1')"
    src="../cgi-bin/mathtex.cgi?\footnotesize c=\sqrt{a^2+b^2}"
    alt="" border=0 align=middle></a>&nbsp; </p>
    <pre class="medium" style="margin-top:0;margin-bottom:0"
>   &lt;script type="text/javascript"&gt;
   &lt;!--
   // Create a namespace to hold variables and functions
   mathtex = new Object();
   // Change this to use your server
   mathtex.imgSrc = "http://www.<i>yourdomain</i>.com/cgi-bin/mathtex.cgi?";
   // Transform the whole document: add src to each img with
   // alt text starting with "mathtex:", unless img already has a src.
   mathtex.init = function () {
       if (! document.getElementsByTagName) return;
       var objs = document.getElementsByTagName("img");
       var len  = objs.length;
       for (i=0; i&lt;len; i++) {
          var img = objs[i];
          if (img.alt.substring(0,8) == 'mathtex:')
             if (!img.src) {
                var tex_src = img.alt.substring(8);
                img.src = mathtex.imgSrc + encodeURIComponent(tex_src);
                // Append TEX to the class of the IMG.
                img.className +=' tex'; }
          }
       mathtex.hideElementById("mathtex.error"); }
   // Utility function
   mathtex.hideElementById = function (id) {
       var obj = document.getElementById(id);
       if (obj) obj.style.display = 'none'; }
   // resolve a cross-browser issue (see <a href="http://scottandrew.com/weblog/articles/cbs-events" target="_top">CBS&nbsp;events</a>)
   mathtex.addEvent = function (obj, evType, fn, useCapture) {
       if (obj.addEventListener) { //For Mozilla.
           obj.addEventListener(evType, fn, useCapture);
           return true; }
       else if (obj.attachEvent) { //For Internet Explorer.
           var r = obj.attachEvent("on"+evType, fn);
           return r; }
       }
   // Initialize after entire document is loaded
   mathtex.addEvent(window, 'load', mathtex.init, false);
   --&gt;
   &lt;/script&gt;</pre>

<p style="margin-bottom:0">
    Bulletin boards, wikis, etc, can also incorporate mathTeX images
    with short scripts.  For example, if you're using
    <a href="http://www.phpbb.com" target="_top">phpBB2</a>, then
    <a href="http://www.themathforum.com/" target="_top">Jameson</a>
    contributed the following <!-- typical --> one-line mod that lets
    you write <b>[tex]&nbsp;...&nbsp;[/tex]</b> for mathTeX images: </p>
    <pre class="medium" style="margin-top:0;margin-bottom:0"
>   #--------[open]-----------------------------------------------------
     /includes/bbcode.php
   #--------[find]-----------------------------------------------------
     // Remove our padding from the string..
   #--------[before, add]----------------------------------------------
     $text = preg_replace('/\[tex\](.*?)\[\/tex\]/ie',
     "'&lt;img src=\"/cgi-bin/mathtex.cgi?'.rawurlencode('$1').'\" align=\"middle\" /&gt;'",
     $text);</pre>
<p class="continue" style="margin-top:0">
    <!-- &nbsp; &nbsp; &nbsp; --> Similarly, if you're using
    <a href="http://www.phpbb.com" target="_top">phpBB3</a>,
    then no mod is even needed.
    Just click Postings from the Administrator Control Panel,
    and add the Custom BBCode&nbsp;<b>[tex]{TEXT}[/tex]</b> &nbsp;
    with the HTML replacement
    <b>&lt;img&nbsp;src="/cgi-bin/mathtex.cgi?{TEXT}"&nbsp;align=middle&gt;</b>
    &nbsp; Now you can also write <b>[tex]&nbsp;...&nbsp;[/tex]</b>
    to obtain mathTeX images of the enclosed expression.

<p> Plugins for several additional packages already exist for my other
    math-rendering program, 
    <a href="http://www.forkosh.com/mimetex.html" target="_top">mimeTeX</a>,
    which runs without dependencies, but produces slightly lower
    quality images than LaTeX.  These plugins also work with mathTeX.
    Just substitute <b>mathtex.cgi</b> wherever the instructions say
    <b>mimetex.cgi</b>. </p>
    <center><table>
     <tr> <td align=center> <u>&nbsp;<b>Package</b>&nbsp;</u> </td>
      <td> &nbsp; </td>
      <td align=center> <u>&nbsp;&nbsp;<b>Plugin</b>&nbsp;&nbsp;</u> </td>
      </tr>
     <tr> <td align=center>
	  <a href="http://www.pmwiki.org/" target="_top">
	  PmWiki</a> </td> <td> &nbsp; </td>
	  <td align=center>
	  <a href="http://www.pmwiki.org/wiki/Cookbook/MimeTeX"
	  target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
     <tr> <td align=center>
	  <!-- a href="http://www.wikimedia.org/wiki/Main_Page" target="_top">
	  Wikimedia</a> </td -->
	  <a href="http://www.mediawiki.org/wiki/MediaWiki" target="_top">
	  MediaWiki</a> </td>
	  <td align=center> &nbsp; </td>
	  <td align=center>
	  <!-- a href="http://meta.wikimedia.org/wiki/Mimetex_alternative" -->
	  <a href="http://www.mediawiki.org/wiki/Mimetex_alternative"
	  target="_top">&quot;mimeTeX&nbsp;alternative&quot;</a> </td> </tr>
     <tr> <td align=center>
	  <a href="http://www.unitorganizer.com/mathwiki/index.php/Main_Page"
	  target="_top">MathWiki</a> </td> <td> &nbsp; </td>
	  <td align=center> <a href=
	  "http://www.unitorganizer.com/mathwiki/index.php/MimetexParser"
	  target="_top">&quot;mimeTeX&nbsp;Parser&quot;</a> </td> </tr>
     <tr> <td align=center>
	  <a href="http://forums.punbb.org/" target="_top">PunBB</a> </td>
	  <td> &nbsp; </td> <td align=center>
	  <a href="http://www.math-linux.com/spip.php?article44"
	  target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
     <tr> <td align=center>
	  <a href="http://www.sixapart.com/movabletype/" target="_top">
	  Movable&nbsp;Type</a> </td> <td> &nbsp; </td>
	  <td align=center> <a href=
	  "http://www.unitorganizer.com/myblog/2006/08/creating_equations_in_movable.html"
          target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
     <tr> <td align=center>
	  <a href="http://wordpress.org/" target="_top">WordPress</a> </td>
	  <td> &nbsp; </td> <td align=center> <a href=
	  "http://www.anlak.com/?page_id=66" target="_top">
     <!-- "http://sixthform.info/steve/wordpress/index.php?p=13&page=2" -->
	  mimeTeX&nbsp;plugin</a> <!-- &nbsp; (see item 9) --> </td> </tr>
     <!--- dead links --->
     <!-- tr> <td align=center>
	  <a href="http://www.phpbb.com" target="_top">phpBB</a> </td>
	  <td> &nbsp; </td> <td align=center>
	  <a href=
	  "http://www.themathforum.com/math/showthread.php?p=621#post621"
	  target="_top">mimeTeX&nbsp;plugin</a> </td> </tr -->
     <!-- tr> <td align=center>
	  <a href="http://www.mamboserver.com/" target="_top">Mambo</a> </td>
	  <td> &nbsp; </td> <td align=center>
	  <a href="http://mamboxchange.com/projects/mimetexbot/"
	  target="_top">&quot;mimeTeX&nbsp;bot&quot;</a> </td> </tr -->
    </table></center>

<p> <b>Please note:</b> If you're writing your own plugin for mathTeX,
    please write code using <b>system(&nbsp;)</b>, or any other
    shell escape mechanisms, carefully.  <b>system(&nbsp;)</b> raises
    security issues, either real ones if used carelessly, or just in
    the minds of system administrators.  Either way, I've received emails
    from people unable to use mathTeX because of unnecessary
    <b>system(&nbsp;)</b> calls prohibited by security-conscious sysadmins.
    MathTeX itself poses minimal risk when used as illustrated above,
    but you're responsible for any plugin/wrapper script you write
    around it. </p>

<h3> <a name="valignment"> </a>
vertical alignment<font size=5>...</font> </h3>
<p> An image like
    <a href="#preview"><img id="imageAV1" onclick="eqntext('imageAV1')"
    src="../cgi-bin/mathtex.cgi?
    \small f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
    alt="" border=0 align=middle></a>
    doesn't look as good as the same image
    <a href="#preview"><img id="imageAV2" onclick="eqntext('imageAV2')"
    src="../cgi-bin/mathtex.cgi?
    \small f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
    alt="" border=0 style="Vertical-Align:-21px"></a>
    that's vertically aligned with your surrounding text.
    Along with several standard 
    <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">
    HTTP&nbsp;header&nbsp;fields</a>, mathTeX can also emit a special
    &nbsp; <b>Vertical-Align:&nbsp;&#150;<i>nn</i></b> &nbsp;
    header, where <b>&#150;<i>nn</i></b> is the number of pixels
    (usually negative as illustrated) needed for a
    &nbsp; <b>style="Vertical-Align:&nbsp;&#150;<i>nn</i>&nbsp;px"</b>
    &nbsp; attribute in the <b>&lt;img&gt;</b>&nbsp;tag used to
    render your expression.
    To obtain its vertical-align information, mathTeX places
    your expression inside a LaTeX&nbsp;lrbox, where additional
    environments like <nobr>\begin{gather*}...\end{gather*}</nobr>
    are not permitted.
    If your expression is compatible with LaTeX's&nbsp;lrbox-environment,
    the Vertical-Align&nbsp;header is obtained by
    placing the directive &nbsp; <b>\depth</b> &nbsp; anywhere
    in your expression. </p>

<p> But mathTeX's special Vertical-Align: header
    is unrecognized and ignored by your browser.  You have to get the
    header, interpret it, and write the corresponding &lt;img&gt; tag.
    The only feasible way to do all this is using a scripting language,
    as illustrated by the following, rather naive, php code </p>
    <pre class="medium" style="margin-top:.5em;margin-bottom:.5em"
>   &lt;?php
   $mathtexurl = "http://www.<i>yourdomain</i>.com/cgi-bin/mathtex.cgi?";
   function verticalalign( $expression ) {
      global $mathtexurl;
      // note: curl_init() stops at the first whitespace char in $url argument
      $expression = ereg_replace(" ","~",$expression); // so remove whitespace
      $url     = $mathtexurl . "\depth~" . $expression;
      $valign  = "0";
      $ch      = curl_init( $url );
      curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
      curl_setopt( $ch, CURLOPT_HEADER, true );
      $gif     = curl_exec( $ch );
      $errno   = curl_errno( $ch );
      curl_close( $ch );
      if ( $errno == 0 ) {
        $fields = explode("Vertical-Align:",$gif);
        $vfield = trim($fields[1]);
        $fldlen = strspn($vfield,"+-0123456789");
        $valign = substr($vfield,0,$fldlen); }
      return $valign;
      }
   function mathtextag( $expression ) {
      global $mathtexurl;
      $valign = verticalalign($expression);
      $url    = $mathtexurl . "\depth~" . $expression;
      echo ' &lt;img src="',$url,'" ';
      echo ' style="Vertical-Align:',$valign,'px" ';
      echo ' alt="" border=0&gt;', "\n";
      }
   ?&gt;</pre>

<p> Now you can write &nbsp;
    &lt;?php&nbsp;mathtextag('\frac12\left(a^2+b^2\right)');&nbsp;?&gt;
    wherever you want to see
    <a href="#preview"><img id="imageAV5" onclick="eqntext('imageAV5')"
    src="../cgi-bin/mathtex.cgi?
    \small\frac12\left(a^2+b^2\right)"
    alt="" border=0 style="Vertical-Align:-10px"></a>
    correctly aligned. Note that the php code automatically prepends
    &nbsp; <b>\depth</b> &nbsp; to your expression for you.
    <b>(</b>And also note that this code calls mathTeX twice
    to render each expression, once to get the Vertical-Align: header
    and build an &lt;img&gt; tag, and then again to render that tag.
    If you're a good php programmer and write better code,
    please email me a copy.<b>)</b> </p>

<h3> <a name="alternatives"> </a>
mathTeX alternatives<font size=5>...</font> </h3>
<p> Other math-on-the-web solutions are discussed at
    <a href="http://www.tug.org/interest.html#web" target="_top">
    www.tug.org/interest.html</a>, and in the
    <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=LaTeX2HTML"
    target="_top">tex-faq/LaTex2Html</a> and
    <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=mathml"
    target="_top">tex-faq/mathml</a>.
    Several LaTeX-based solutions
    similar to mathTeX that you may want to look at are
    <a href="http://www.mayer.dial.pipex.com/tex.htm#latexrender"
    target="_top">latexrender</a>,
    <a href="http://www.mathtran.org" target="_top">mathtran</a>,
    <a href="http://www.fourmilab.ch/webtools/textogif/textogif.html"
    target="_top">textogif</a>, and
    <a href="http://www.math.uio.no/~martingu/gladtex/"
    target="_top">gladTeX</a>.
    However, if you can't install a
    <a href="http://www.latex-project.org/ftp.html" target="_top">
    TeX&nbsp;distribution</a>
    <!-- and suitable image conversion utilities like
    <a href="http://www.imagemagick.org" target="_top">ImageMagick</a -->
    on your server, then you may prefer to look at a stand-alone
    math rendering program like
    <a href="http://www.forkosh.com/mimetex.html" target="_top">mimeTeX</a>,
    which has no dependencies whatsoever, but which produces slightly
    lower quality images than LaTeX.
    Alternative kinds of solutions that you may want to look at are
    <a href="http://www.math.union.edu/~dpvc/jsMath/" target="_top">jsmath</a>
    and <a href="http://www.integretechpub.com/techexplorer/"
    target="_top">techexplorer</a>. </p>

<h3> <a name="webservice"> </a>
mathTeX web services<font size=5>...</font> </h3>
 <p> If you have trouble installing mathTeX on your own server, a
     mathTeX web service is currently <!-- (but maybe not permanently) -->
     available.  An &lt;img&gt; tag of the form </p>
<pre><b>  &lt;img&nbsp;src="http://www.forkosh.com/mathtex.cgi?c=\sqrt{a^2+b^2}"
   alt="" border=0 align=middle&gt;</b></pre>
 <p class="continue"> displays
     <a href="#preview"><img id="public1" onclick="eqntext('public1')"
     src="../cgi-bin/mathtex.cgi?\small c=\sqrt{a^2+b^2}"
     alt="" border=0></a> wherever you put that &lt;img&gt tag
     in your own document.  Note that the typical
     <b>/cgi-bin/mathtex.cgi?</b> has been replaced by
     <b>http://www.forkosh.com/mathtex.cgi?</b>
     in this &lt;img&gt; tag, using mathTeX on my
     server to render your expression for you.
     For production use, please install mathTeX on your own server. </p>

<!-- +++++++++++++++++++++++++++
 <p> To encourage you to install mathTeX on your own server,
     one request out of every 25 submitted to mine is
     randomly selected to be rendered with the
     &quot;<a href="#adswitches">advertisement</a>&quot; <br>
     &nbsp; &nbsp; &nbsp;
     <a href="#preview"><img id="public2" onclick="eqntext('public2')"
     src="../cgi-bin/mathtex.cgi?\advertisement c=\sqrt{a^2+b^2}"
     alt="" align="middle" border=0></a> &nbsp; &nbsp; instead of
     just &nbsp; &nbsp;
     <a href="#preview"><img id="public3" onclick="eqntext('public3')"
     src="../cgi-bin/mathtex.cgi?c=\sqrt{a^2+b^2}"
     alt="" border=0></a> <br>
     Advertisements are completely disabled when you compile
     mathTeX yourself.  To enable them you must include the
     <a href="#adfrequencyswitch">&#150;DADFREQUENCY</a> switch.
     And in this case you'd typically also include the
     <a href="#advertisementswitch">&#150;DADVERTISEMENT</a> switch
     to define your own advertisement, replacing my default message
     illustrated above. </p>
++++++++++++++++++++++++++++ -->

 <p> Installing mathTeX on your own server sets up a <i>de&nbsp;facto</i>
     web service, unless you compile it with the
   <a href="#refererswitch">&#150;DREFERER=<b>\"</b><i>domain</i><b>\"</b></a>
     switch, restricting requests to that specific <i>domain</i>.
     Until <a href="http://www.w3.org/Math/" target="_top">mathML</a>
     becomes widespread, LaTeX-based web services,
     like mathTeX or <a href="#alternatives">alternatives</a>,
     may be the best math-on-the-web solutions.  If you set one up that's
     intended for public access, <!-- then --> email me its url,
     and I'll add it to the following list... </p>
       <center><table border="1" cellpadding=3 cellspacing=0>
        <tr align="center">
         <td>url of service</td> <td>test</td> </tr>
        <tr align="center">
         <td> http://www.forkosh.com/mathtex.cgi </td>
         <td> <a href="#preview"> <img id="server1" onclick="eqntext('server1')"
         src="http://www.forkosh.com/mathtex.cgi?
         c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
        <tr align="center">
         <td> http://www.cyberroadie.org/cgi-bin/mathtex.cgi </td>
         <td> <a href="#preview">
	      <img id="server2" onclick="eqntext('server2')"
         src="http://www.cyberroadie.org/cgi-bin/mathtex.cgi?
         c=\sqrt{a^2+b^2}" border=0> </a> <!-- unavailable --> </td> </tr>
<!-- to comment out cyberroadie...
 +      <tr align="center">
 +       <td> http://www.cyberroadie.org/cgi-bin/mathtex.cgi </td>
 +       <td> <++++!-- a href="#preview"> <img id="server2" onclick="eqntext('server2')"
 +       src="http://www.cyberroadie.org/cgi-bin/mathtex.cgi?
 +       c=\sqrt{a^2+b^2}" border=0> </a --++++> unavailable </td> </tr>
 +++++++++++++++++++++++++++++ -->
        <tr align="center">
         <td> http://www.problem-solving.be/cgi-bin/mathtex.cgi </td>
         <td> <!-- a href="#preview">
	      <img id="server3" onclick="eqntext('server3')"
         src="http://www.problem-solving.be/cgi-bin/mathtex.cgi?
         c=\sqrt{a^2+b^2}" border=0> </a --> unavailable </td> </tr>
        <tr align="center">
         <td> http://www.openmaths.org/cgi-bin/mathtex.cgi </td>
         <td> <!-- a href="#preview">
              <img id="server4" onclick="eqntext('server4')"
         src="http://www.openmaths.org/cgi-bin/mathtex.cgi?
         c=\sqrt{a^2+b^2}" border=0> </a --> unavailable </td> </tr>
        <!-- tr align="center">
         <td> http://www.quantnet.com/cgi-bin/mathtex.cgi </td>
         <td> <XXX!-- a href="#preview">
              <img id="server5" onclick="eqntext('server5')"
         src="http://www.quantnet.com/cgi-bin/mathtex.cgi?
         c=\sqrt{a^2+b^2}" border=0> </a --XXX> unavailable </td> </tr -->
       </table></center>
     <p class="continue"> The "test" column just exercises the link
     to its left.  Thanks to everyone. </p>

 <p> An alternative mathTeX-based public web service you may also want to
     consider is <a href="http://mathcache.appspot.com/static/docs.html"
     target="_top">Embedding&nbsp;math&nbsp;with&nbsp;replacemath.js</a>,
     which allows you to embed math in your html pages without any
     &lt;img&gt;&nbsp;tags at all, just by writing LaTeX math markup
     between&nbsp;<nobr>&#036;&#036;...&#036;&#036;</nobr>&nbsp;.
     Just prepare your html document in the form </p>
<pre><b>  &lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt; test page &lt;/TITLE&gt; &lt;/HEAD&gt;
    &lt;BODY&gt;
      Put any LaTeX math expression you like between <code>$$</code>...<code>$$</code>,
      for example &#036;&#036;y=\frac1{1-x^2}&#036;&#036; renders <img src="../cgi-bin/mathtex.cgi?\small y=\frac1{1-x^2}" alt="" border=0 align="absmiddle">
    &lt;/BODY&gt;
      &lt;script type="text/javascript"
        src="http://mathcache.s3.amazonaws.com/replacemath.js"&gt; &lt;/script&gt;
      &lt;script type="text/javascript"&gt;
        replaceMath( document.body ); &lt;/script&gt;
  &lt;/HTML&gt;</b></pre>
<p class="continue"> That is, near the bottom of your document,
    after the &lt;<b>/</b>BODY&gt;&nbsp;tag, place exactly the
    two &lt;script&gt;&nbsp;tags shown.  Then, anywhere in
    your document, any LaTeX math expressions surrounded
    by&nbsp;<nobr>&#036;&#036;...&#036;&#036;</nobr> will be rendered
    for you by their public web service. </p>

<!-- +++++++++++++++++++++++++++
 <p> The drawback to hosting public mathTeX web services is the
     compute and disk resources necessary to run LaTeX and cache its
     results for many thousands of different images (and I may
     be unable to host this one permanently).
     One possible incentive might be a method to monetize the effort.
     Advertising seems to be the standard internet way to monetize
     anything.  With those two thoughts in mind, I built a rudimentary
     <a href="#adswitches">advertising&nbsp;facility</a> into
     mathTeX. <comment , as you can see illustrated above. comment/> </p>

 <p> MathTeX web services could also be monetized by direct subscription.
     Instead of validating users with its
   <a href="#refererswitch">&#150;DREFERER=<b>\"</b><i>domain</i><b>\"</b></a>
     switch, a small MySQL database of valid domains would easily support
     a mathTeX-based subscription service.  You could also provide
     free math&nbsp;rendering with&nbsp;advertisements, whereas paid
     subscribers receive images without&nbsp;ads.  But I haven't programmed
     these enhancements into mathTeX's current release. </p>

 <p> Whether mathTeX's current
     <a href="#adswitches">advertising&nbsp;facility</a>,
     or an enhanced subscription facility,
     serve any useful purpose remains to be seen.
     Perhaps they will just stimulate better ideas
     about proliferating LaTeX-based, math-rendering web services.
     It would be terrific if
     <a href="http://www.tug.org" target="_top">www.tug.org</a>,
     or other supported TeX organizations, host some such free services. </p>
++++++++++++++++++++++++++++ -->


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ LATEX MATH MARKUP
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="latexmarkup"> (2) LaTeX math markup &nbsp; </h2>

 <p> MathTeX uses latex to render images,
     and you must already be familiar with LaTeX
     math markup to use it.  If you're not, many online
     <a href="http://www.tug.org/begin.html#doc" target="_top">
     LaTeX&nbsp;tutorials</a> are readily available.
     You may also want to browse Andrew Roberts'
     <a href="http://www.andy-roberts.net/misc/latex/latextutorial9.html"
     target="_top">Latex&nbsp;Math&nbsp;I</a> and
     <a href="http://www.andy-roberts.net/misc/latex/latextutorial10.html"
     target="_top">Latex&nbsp;Math&nbsp;II</a>, or my own
     <a href="http://www.forkosh.com/mimetextutorial.html" target="_top">
     LaTeX&nbsp;math&nbsp;tutorial</a>.
     You can also download and read the
     <a href="http://www.ams.org/tex/" target="_top">AMS</a>'s
     <a href="ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf">
     Short&nbsp;math&nbsp;guide</a>. </p>

<h3>  <a name="preview"> </a>
LaTeX markup<font size=5>...</font> </h3>
 <p> Now, to try out mathTeX, just enter any <!-- LaTeX math -->
     expression you like in the Query Box below.  I've started
     you out with a little example already in the box, or
     you can Click any of the <a href="#examples">Examples</a> below
     to place that corresponding expression in the Query Box.
     Then press the Submit button, and mathTeX's rendering should be
     displayed in the little window immediately below it. </p>
     <center>
      <table border="2" cellpadding="5" cellspacing="0">
       <tr align="center"><td>
         <form name="expression" action="../cgi-bin/mathtex.cgi"
         method="get" target="inlineframe">
           <table border="0" cellpadding="0" cellspacing="1">
             <tr align="left"><td align="center">
               <b>First enter your own LaTeX expression,
                or Click any example...</b> <br>
               <textarea name="formdata" rows="5" cols="72"
                >\Large f(x)=\int_{-\infty}^x e^{-t^2}dt</textarea> <br>
             </td></tr>
             <tr align="center"><td>
               <font size="-1"> <input type="button" onClick="cleartext()"
               value="Clear Expression"> &nbsp; &nbsp;
               &nbsp; <input type="submit" value="Submit Expression"> </font>
             </td></tr>
           </table>
         </form> </td></tr>  <tr align="left"><td align="center">
         <b>Now click Submit to see it rendered below...</b> <br>
         <iframe name="inlineframe" align="middle" width="85%" height="110">
         &lt;p&gt;iframe's not supported if you see this.&lt;/p&gt; 
         </iframe>
       </td></tr>
      </table>
     </center>
 <p class="continue"> You should see &nbsp;
     <a href="#preview"><img id="imageB3" onclick="eqntext('imageB3')"
     src="../cgi-bin/mathtex.cgi?\small
     f(x)=\int\limits_{-\infty}^x~e^{-t^2}dt"
     alt="" border=0 align=middle></a> if you submit the sample expression
     already in the box. </p>

<h3> <a name="examples"> </a>
Examples<font size=5>...</font> </h3>
 <p> Here are various additional random examples further demonstrating
     mathTeX's features and usage.  To see how they're done, Click any
     one of them to place its corresponding expression in the
     <a href="#preview">Query&nbsp;Box</a> above.  Then press Submit
     to re-render it, or you can edit the expression first to suit
     your own purposes.
     <!-- You may also want to look at a
     <a href="lint1d.html">sample&nbsp;document</a>
     prepared using mathTeX to render equations. --> </p>

<table cellspacing=15>
<!-- first example:  taylor series for e^x at various font sizes
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5><a name="example1">(1)</a></font> &nbsp;&nbsp;&nbsp; </td>
  <td align="left" colspan=4>
   <nobr>
    <a href="#preview">
      <img id="example1a" onclick="eqntext('example1a')"
      src="../cgi-bin/mathtex.cgi?\usepackage{color}\color{red}\large
      e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
      alt="" border=0 align=middle></a> &nbsp &nbsp
    <a href="#preview">
      <img id="example1b" onclick="eqntext('example1b')"
      src="../cgi-bin/mathtex.cgi?\usepackage{color}\color{blue}\Large
      e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
      alt="" border=0 align=middle></a> &nbsp &nbsp
    <a href="#preview">
      <img id="example1c" onclick="eqntext('example1c')"
      src="../cgi-bin/mathtex.cgi?\Large
      e^x=\lim_{n\to\infty} \left(1+\frac xn\right)^n"
      alt="" border=0 align=middle></a>
   </nobr>
  </td>
 </tr>

<!-- second example:  definition of derivative
++++++++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5>(2)</font> </td>
  <td align="left" colspan=4>
    <table>
      <tr>
       <td align="left">
         <a href="#preview">
         <img id="example2" onclick="eqntext('example2')"
         src="../cgi-bin/mathtex.cgi?\large f^\prime(x)\ =
         \lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}"
         alt="" border=0 align=middle></a> </td>
       <td>
         definition of derivative </td>
      </tr>
    </table> </td>
 </tr>

<!-- third example:  demonstrating  \left\{ ... \right.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5>(3)</font> </td>
  <td align="left">
    <a href="#preview">
    <img id="example3" onclick="eqntext('example3')"
    src="../cgi-bin/mathtex.cgi?\LARGE\tilde y=\left\{
    {\ddot x\mbox{ if $\widevec x$ odd}
    \atop\widehat{\,\bar x+1}\mbox{ if even}}\right."
    alt="" border=0 align=middle></a> </td>
  <td>
    illustrating <b>\left\{...\right<font size=5>.</font></b> <br>
    and note the accents </td>
 </tr>

<!-- fourth example:  demonstrating \overbrace \underbrace
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5>(4)</font> </td>
  <td align="center">
    <a href="#preview">
    <img id="example4" onclick="eqntext('example4')"
    src="../cgi-bin/mathtex.cgi?\small\overbrace{a,...,a}^{\mbox{k a's}},
    \underbrace{b,...,b}_{\mbox{l b's}}\hspace{10}
    \large\underbrace{\overbrace{a...a}^{\mbox{k a's}},
    \overbrace{b...b}^{\mbox{l b's}}}_{\mbox{k+l elements}}"
    alt="" border=0 align=middle></a> </td>
  <td>
    <b>\overbrace{}^{}</b> and <b>\underbrace{}_{}</b> <br>
    (TeXbook page 181, Exercise 18.41) </td>
 </tr>

<!-- fifth example:  demonstrating \array
+++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5>(5)</font> </td>
  <td align="left" colspan=4>
    <table>
      <tr>
        <td align="left">
         <a href="#preview">
         <img id="example5" onclick="eqntext('example5')"
         src="../cgi-bin/mathtex.cgi?\large A\ =\ \left(
         \begin{array}{cccc}
         a_{11}&a_{12}&\cdots&a_{1n}\\
         a_{21}&a_{22}&\cdots&a_{2n}\\
         \vdots&\vdots&\ddots&\vdots\\
         a_{n1}&a_{n2}&\cdots&a_{nn}\end{array}\right)"
         alt="" border=0 align=middle></a> </td>
        <td>
         <b>\begin{array}</b> </td>
      </tr>
    </table> </td>
 </tr>

<!-- sixth example:  demonstrating eqnarray to align equations
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
 <tr>
  <td>
    <font size=5>(6)</font> </td>
  <td align="center">
    <a href="#preview">
    <img id="example6" onclick="eqntext('example6')"
    src="../cgi-bin/mathtex.cgi?\large\parstyle\begin{eqnarray*}
    x+y+z&=&3\\2y&=&x+z\\2x+y&=&z\end{eqnarray*}"
    alt="" border=0 align=middle></a> </td>
  <td>
    using <b>\begin{eqnarray*}</b> to align equations </td>
 </tr>

<!-- end-of-examples
++++++++++++++++++++ -->
</table>


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ MATHTEX MARKUP EXTENSIONS
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="mathtexmarkup"> (3) MathTeX markup extensions &nbsp; </h2>
 <p> To facilitate its use in html &lt;img&gt; tags,
     mathTeX recognizes several special <b>\</b><i>directives</i>
     <!-- in your math expression --> that modify latex's <!-- underlying -->
     behavior. <!-- , and several <b>&#150;</b><i>directives</i> that modify
     dvipng's (or convert's) behavior. -->
     These <b>\</b><i>directives</i>
     <!-- and <b>&#150;</b><i>directives</i> -->
     are usually interpreted by mathTeX, and then removed from
     your expression before it's submitted to latex for rendering. </p>

 <p style="margin-bottom:0em;"> For example, </p>
     <ul style="margin-top:0em;">
     <li> &lt;img&nbsp;src=<b>"</b>/cgi-bin/mathtex.cgi?<b>\png&nbsp;x^2"</b>&gt;
     renders <b>x^2</b> as a png image
     <a href="#preview"> <img id="markup1" onclick="eqntext('markup1')"
     src="../cgi-bin/mathtex.cgi?\png x^2" border=0> </a> instead
     of the <a href="#gifswitch">default&nbsp;gif</a> format. </li>
     <li> &lt;img&nbsp;src=<b>"</b>/cgi-bin/mathtex.cgi?<b>\usepackage{color}\color{blue}x^2"</b>&gt;
     renders
       <a href="#preview"> <img id="markup2" onclick="eqntext('markup2')"
       src="../cgi-bin/mathtex.cgi?\usepackage{color}\color{blue}x^2"
       border=0> </a> in blue.  In this case, mathTeX removes the familiar
     LaTeX <b>\</b>usepackage directive from your math expression, and
     places it in the preamble where it belongs. </li>
     </ul>

 <p> You can have as many special mathTeX <b>\</b><i>directives</i>
     <!-- and <b>&#150;</b><i>directives</i> --> in an expression
     as you like.  They're recognized anywhere at all in an expression,
     though these examples show them at the beginning.
     To simplify readability, additional examples below are
     more tersely illustrated as
     <b>"</b><i>query-string</i><b>"</b> rather than as
     &lt;img&nbsp;src=<b>"</b>/cgi-bin/mathtex.cgi?<i>query-string</i><b>"</b>&gt;.
     </p>

<h3> <a name="directives"> </a>
mathTeX directives<font size=5>...</font> </h3>
     <dl>
      <dt> <a name="styledirective"> </a> <b>\displaystyle</b> or
      <b>\textstyle</b> or <b>\parstyle</b> </dt>
       <dd> mathTeX's usual <a href="#styleswitch">default</a>
       wraps the ?query-string expression
       &nbsp; <b>"\int_0^1&nbsp;f(x)dx"</b> &nbsp; as &nbsp;
       <b>\[&nbsp;\int_0^1&nbsp;f(x)dx&nbsp;\]</b>, &nbsp; rendering
       it in LaTeX's <b>\</b>displaystyle math mode as
       <a href="#preview"> <img id="styledir1" onclick="eqntext('styledir1')"
       src="../cgi-bin/mathtex.cgi?\int_0^1f(x)dx" border=0
       align="middle"></a>. <br>
          &nbsp; &nbsp; &nbsp; But the expression &nbsp;
       <b>"\textstyle&nbsp;\int_0^1&nbsp;f(x)dx"</b> &nbsp; is wrapped
       as &nbsp; <b>$&nbsp;\int_0^1&nbsp;f(x)dx&nbsp;$</b>, &nbsp;
       rendering
       <a href="#preview"> <img id="styledir2" onclick="eqntext('styledir2')"
       src="../cgi-bin/mathtex.cgi?\textstyle\int_0^1f(x)dx"
       border=0 align="middle"></a> instead.
       However, if you compiled mathtex.cgi with the
       <a href="#styleswitch">-DTEXTSTYLE</a> option, then
       <b>\</b>textstyle is the default, and you can write &nbsp;
       <b>\displaystyle</b> &nbsp; in your expressions to override it. <br>
          &nbsp; &nbsp; &nbsp; Finally, writing &nbsp; <b>\parstyle</b>
       &nbsp; in an expression leaves it completely unwrapped, and rendered
       in LaTeX's paragraph mode.  When using &nbsp; <b>\parstyle</b>,
       &nbsp; write your own <b>\[&nbsp;\]</b>'s and <b>$&nbsp;$</b>'s
       as needed.  For example, &nbsp;
       <b>"\parstyle\noindent&nbsp;the&nbsp;answer&nbsp;is&nbsp;$\frac89$"</b>
       &nbsp; renders &nbsp;
       <a href="#preview"> <img id="styledir3" onclick="eqntext('styledir3')"
       src="../cgi-bin/mathtex.cgi?\parstyle\noindent the anwser is $\frac89$"
       border=0 align="middle"></a>. &nbsp;
       <!-- The special &nbsp; <b>\parstyle</b> &nbsp; directive is
       interpreted and removed by mathTeX, whereas <b>\</b>noindent is
       passed on to LaTeX. -->
       In this case you could just as easily write a LaTeX
       <b>\</b>mbox{&nbsp;} in math mode.  But you may find
       &nbsp; <b>\parstyle</b> &nbsp; useful for expressions
       using LaTeX's eqnarray environment, or for other purposes. </dd>

      <dt> <a name="usepackagedirective"> </a>
      <b>\usepackage{</b><i>packagename</i><b>}</b> </dt>
       <dd> When mathTeX sees a \usepackage in your expression,
       it's removed from the expression and placed in the preamble.
       So, for example, &nbsp;
       <b>\usepackage{color}&nbsp;\color{blue}&nbsp;x^2+y^2</b> &nbsp;
       renders
       <a href="#preview"> <img id="pkgdir1" onclick="eqntext('pkgdir1')"
       src="../cgi-bin/mathtex.cgi?\usepackage{color}\color{blue}x^2+y^2"
       border=0></a> in blue.  You can have up to nine
       \usepackages's in an expression.  The preamble of mathTeX's
       <a href="#usepackageswitch">default</a> wrapper script already
       contains \usepackage[latin1]{inputenc}, \usepackage{amsmath}
       \usepackage{amsfonts} and \usepackage{amssymb}. </dd>

      <dt> <a name="fontsizedirective"> </a>
      <b>\tiny</b> thru <b>\Huge</b> </dt>
       <dd> mathTeX moves LaTeX's ten standard size directives
       outside the math mode wrapper, so that they can have their
       intended effect.  For example, the expression &nbsp;
       <b>"\Large&nbsp;x^2"</b> &nbsp; is wrapped as &nbsp;
       <b>\Large&nbsp;\[&nbsp;x^2&nbsp;\]</b>, &nbsp; rendering
       <a href="#preview"> <img id="fontdir1" onclick="eqntext('fontdir1')"
       src="../cgi-bin/mathtex.cgi?\Large x^2" border=0></a>. &nbsp;
       LaTeX's <a href="#fontsizeswitch"><b>\</b>normalsize&nbsp;default</a>
       renders
       <a href="#preview"> <img id="fontdir2" onclick="eqntext('fontdir2')"
       src="../cgi-bin/mathtex.cgi?x^2" border=0></a>. <!-- br>
          &nbsp; &nbsp; --> &nbsp; However, if your expression contains
       mathTeX's &nbsp; <b>\parstyle</b> &nbsp; directive, then any
       LaTeX size directives are left in place, exactly where
       you've written them. <!-- br>
          &nbsp; &nbsp; &nbsp; LaTeX note: &nbsp;
      <b>\tiny</b> thru <b>\Huge</b> select a font size for your _entire_
      expression.  Use LaTeX's <b>\mbox{&nbsp;}</b> to resize a part, e.g.,
      <b>\Large&nbsp;e^{-\mbox{\small&nbsp;$x^2$}}</b>
      selects \Large as the overall font size
      but sets x^2 as \small. --> </dd>

      <dt> <a name="dpidirective"> </a>
      <b>\dpi{</b><i>dots-per-inch</i><b>}</b> </dt>
       <dd> mathTeX runs dvipng (or convert) at
       <a href="#dpiswitch">default&nbsp;screen&nbsp;resolution</a>
       of 120dpi.
       The directive <b>\dpi{300}</b> generates a much larger
       300dpi image instead.  Here are samples of several
       dpi's rendered at \scriptsize and \normalsize,
         <center><table border="1" cellpadding=3 cellspacing=0>
           <tr align="center">
             <td>dpi</td> <td>\scriptsize</td> <td>\normalsize</td> </tr>
           <tr align="center">
             <td> <b>100</b> </td>
             <td> <a href="#preview"> <img id="dpi1" onclick="eqntext('dpi1')"
              src="../cgi-bin/mathtex.cgi?\dpi{100}
              \scriptsize c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="dpi2" onclick="eqntext('dpi2')"
              src="../cgi-bin/mathtex.cgi?\dpi{100}
              \normalsize c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>120</b> </td>
             <td> <a href="#preview"> <img id="dpi3" onclick="eqntext('dpi3')"
              src="../cgi-bin/mathtex.cgi?\dpi{120}
              \scriptsize c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="dpi4" onclick="eqntext('dpi4')"
              src="../cgi-bin/mathtex.cgi?\dpi{120}
              \normalsize c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>160</b> </td>
             <td> <a href="#preview"> <img id="dpi5" onclick="eqntext('dpi5')"
              src="../cgi-bin/mathtex.cgi?\dpi{160}
              \scriptsize c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="dpi6" onclick="eqntext('dpi6')"
              src="../cgi-bin/mathtex.cgi?\dpi{160}
              \normalsize c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>200</b> </td>
             <td> <a href="#preview"> <img id="dpi7" onclick="eqntext('dpi7')"
              src="../cgi-bin/mathtex.cgi?\dpi{200}
              \scriptsize c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="dpi8" onclick="eqntext('dpi8')"
              src="../cgi-bin/mathtex.cgi?\dpi{200}
              \normalsize c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
         </table></center> </dd>

      <dt> <a name="gammadirective"> </a>
      <b>\gammacorrection{</b><i>gamma-correction</i><b>}</b> </dt>
       <dd> mathTeX runs dvipng with
       <a href="#gammaswitch">default&nbsp;gamma</a>=2.5
       (or convert with default&nbsp;0.5).
       The directive <b>\gammacorrection{3.5}</b> renders a
       darker-than-usual gamma=3.5 image when run with dvipng
       (or lighter-than-usual when run with convert).
       <!-- See <a href="#gammaswitch">&#150;DGAMMA&nbsp;switch</a>
       for some samples. --> <br>
            &nbsp; &nbsp; &nbsp; <b>Note:</b> This gamma&nbsp;correction
       confusion arises, I believe, as follows.  Consider a grayscale from
       x=0&nbsp;for&nbsp;black&nbsp;to&nbsp;x=1&nbsp;for&nbsp;white.
       Then, the canonical formula to apply
       gamma&nbsp;correction&nbsp;<img src="../cgi-bin/mathtex.cgi?
       \gamma" align="bottom">&nbsp;is&nbsp;<img
       src="../cgi-bin/mathtex.cgi?\mbox{x}\mapsto \mbox{x}^{1/\gamma}"
       align="bottom">, whereby
       <img src="../cgi-bin/mathtex.cgi?\mbox{\raisebox{.5mm}{$\gamma$}}<1"
       align="bottom">&nbsp;becomes&nbsp;blacker and
       <img src="../cgi-bin/mathtex.cgi?\mbox{\raisebox{.5mm}{$\gamma$}}>1"
       align="bottom">&nbsp;becomes&nbsp;whiter.  The convert program
       appears to follow this convention, whereas dvipng applies
       <img src="../cgi-bin/mathtex.cgi?\mbox{x}\mapsto \mbox{x}^{\gamma}"
       align="bottom"> instead. <br>
            &nbsp; &nbsp; &nbsp; Here are some samples (unchanging
       grayscale values up and down a column signal the corresponding
       program is unavailable) <br>
         <center><table border="1" cellpadding=3 cellspacing=0>
           <tr align="center">
             <td> gamma </td> <td> dvipng </td> <td> dvips/convert </td> </tr>
           <!-- tr align="center">
             <td> <b>0.125</b> </td>
             <td> <a href="#preview"> <img id="gam1a" onclick="eqntext('gam1a')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{0.125} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam2a" onclick="eqntext('gam2a')"
      src="../cgi-bin/mathtex.cgi?\dvips
      \gammacorrection{0.125} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr -->
           <tr align="center">
             <td> <b>0.25</b> </td>
             <td> <a href="#preview"> <img id="gam1" onclick="eqntext('gam1')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{0.25} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam2" onclick="eqntext('gam2')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{0.25} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>0.50</b> </td>
             <td> <a href="#preview"> <img id="gam3" onclick="eqntext('gam3')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{0.50} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam4" onclick="eqntext('gam4')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{0.50} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>1.0</b> </td>
             <td> <a href="#preview"> <img id="gam5" onclick="eqntext('gam5')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{1.0} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam6" onclick="eqntext('gam6')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{1.0} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>2.0</b> </td>
             <td> <a href="#preview"> <img id="gam7" onclick="eqntext('gam7')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{2.0} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam8" onclick="eqntext('gam8')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{2.0} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <tr align="center">
             <td> <b>4.0</b> </td>
             <td> <a href="#preview"> <img id="gam9" onclick="eqntext('gam9')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{4.0} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam10" onclick="eqntext('gam10')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{4.0} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr>
           <!-- tr align="center">
             <td> <b>8.0</b> </td>
             <td> <a href="#preview"> <img id="gam11" onclick="eqntext('gam11')"
              src="../cgi-bin/mathtex.cgi?\dvipng
              \gammacorrection{8.0} c=\sqrt{a^2+b^2}" border=0> </a> </td>
             <td> <a href="#preview"> <img id="gam12" onclick="eqntext('gam12')"
              src="../cgi-bin/mathtex.cgi?\dvips
              \gammacorrection{8.0} c=\sqrt{a^2+b^2}" border=0> </a> </td> </tr -->
         </table></center> </dd>

      <dt> <a name="gifdirective"> </a>
      <b>\gif</b> or <b>\png</b> </dt>
       <dd> mathTeX's <a href="#gifswitch">default</a> renders
       expressions as gif images.
       If you want a png image instead, write the directive
       &nbsp; <b>\png</b> &nbsp; in your expression.
       However, if you compiled mathtex.cgi with the
       <a href="#gifswitch">&#150;DPNG&nbsp;switch</a>,
       then png is the default, and you can write
       &nbsp; <b>\gif</b> &nbsp; in your expression to obtain
       a gif image. </dd>

      <dt> <a name="dvipngdirective"> </a>
      <b>\dvips</b> or <b>\dvipng</b> </dt>
       <dd> mathTeX uses dvipng when it's available,
       or dvips and convert otherwise, to render LaTeX's
       dvi output as gif or png images.  If all three programs
       are available on your server, then expressions containing
       &nbsp; <b>\dvips</b> &nbsp; are rendered using dvips/convert
       instead of dvipng.  Or, when dvips/convert is the default
       (see <a href="#switchesdirective">\switches</a> below),
       expressions containing &nbsp; <b>\dvipng</b> &nbsp; are
       rendered using dvipng instead of dvips/convert. </dd>

      <dt> <a name="quietdirective"> </a>
      <b>\quiet</b> or <b>\noquiet</b> or <b>\nquiet{<i>n</i>}</b> </dt>
       <dd> If any "!&nbsp;LaTeX&nbsp;Error:" is emitted while
       processing your expression, mathTeX's
       <a href="#quietswitch">default</a> replies
       &lt;Enter&gt; to the first three errors, and then
       replies&nbsp;"x", halting LaTeX before it produces a&nbsp;.dvi file.
       But if your expression contains &nbsp; <b>\quiet</b>, &nbsp;
       then mathTeX replies&nbsp;"q" to the first error,
       making LaTeX enter batchmode,
       whereas if your expression contains &nbsp; <b>\noquiet</b>, &nbsp;
       then mathTeX replies&nbsp;"x" to the first error,
       halting LaTeX immediately.
       If your expression contains &nbsp;<b>\nquiet{<i>n</i>}</b>, &nbsp;
       then mathTeX replies &lt;Enter&gt; to the first&nbsp;<i>n</i> errors,
       and then replies&nbsp;"x". </dd>

      <dt> <a name="depthdirective"> </a> <b>\depth</b> </dt>
       <dd> The special &nbsp; <b>\depth</b> &nbsp; directive
       signals mathTeX to emit an extra
       <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">
       HTTP&nbsp;header&nbsp;field</a>, of the form
       &nbsp;<b>Vertical-Align:&nbsp;&#150;<i>nn</i></b>&nbsp;,
       where <b>&#150;<i>nn</i></b> is the number of pixels
       (usually negative as illustrated) needed for a
       &nbsp; <b>style="Vertical-Align:&nbsp;&#150;<i>nn</i>&nbsp;px"</b>
       &nbsp; attribute in the <b>&lt;img&gt;</b>&nbsp;tag used to
       render your expression.
       The <a href="#valignment">vertical&nbsp;alignment</a> section
       of this document discusses its use in more detail. </dd>

      <dt> <a name="cachedirective"> </a>
      <b>\cache</b> or <b>\nocache</b> </dt>
       <dd> By default, mathTeX saves each new image
       in its <a href="#cacheswitch">cache&nbsp;directory</a>,
       rather than re-rendering the same image every time
       the same expression is submitted.  But expressions
       containing &nbsp; <b>\nocache</b> &nbsp; are not cached.
       Expressions containing <b>\today</b> and/or
       <a href="#timedirective">\time</a> are automatically
       not cached.  Otherwise, include <b>\nocache</b> in your
       expression if it contains volatile information that might
       affect its appearance between renderings.
       (The <b>\cache</b> directive forces the image of that
       expression to be cached, but is usually unnecessary
       since caching is the default.) </dd>

      <dt> <a name="msgleveldirective"> </a>
      <b>\msglevel{</b><i>verbosity</i><b>}</b> </dt>
       <dd> To help debug problems that matheTeX's
       <a href="#messages">error&nbsp;messages</a>
       don't resolve, resubmit the same failed expression
       with &nbsp; <b>\msglevel{9}</b> &nbsp; added. <br>
            &nbsp; &nbsp; &nbsp; After it fails again,
       login to a shell on your server, and
       &nbsp; <b>cd&nbsp;cgi-bin/mathtex/</b> &nbsp; to
       mathTeX's cache directory.  Then &nbsp;
       <b>ls&nbsp;-alt|less</b> &nbsp; to see the most recent
       files.  These should include &nbsp;
       <i>yourexpression</i><b>.out</b> &nbsp;
       (and <i>yourexpression</i><b>.gif</b> if an image was created),
       where filename <i>yourexpression</i> is the 32-character
       MD5&nbsp;hash of your failed expression. <br>
            &nbsp; &nbsp; &nbsp; Now &nbsp; <b>cd&nbsp;..</b> &nbsp;
       back up to your cgi-bin/ directory, and you should see a new
       directory <b>cgi-bin/</b><i>yourexpression</i><b>/</b>
       created by mathTeX. &nbsp; <b>cd</b> to it, and follow
       the <a href="#commandlineerrors">command-line&nbsp;error</a>
       instructions below.  When done, you should probably
       &nbsp; <b>rm&nbsp;-r&nbsp;cgi-bin/</b><i>yourexpression</i><b>/</b>
       &nbsp; which is no longer needed (ditto the .out and .gif files
       in mathTeX's cache if you want to clean up completely). </dd>

      <dt> <a name="whichdirective"> </a>
      <b>\which{</b><i>programname</i><b>}</b> </dt>
       <dd> mathTeX must be compiled with several
       <a href="#pathswitches">&#150;D<i>switches</i></a>
       that specify paths to its <a href="#dependencies">dependencies</a>.
       If you can't determine these required paths, mathTeX's
       &nbsp; <b>\which{</b><i>programname</i><b>}</b> &nbsp;
       may provide some help (also see
       <a href="#switchesdirective">\switches</a> below).
       For example, <!-- on this machine, -->
         <center><table border="1" cellpadding=3 cellspacing=0>
           <tr align="center">
             <td>directive</td> <td>renders</td> </tr>
           <tr align="center">
             <td> \which{latex} </td>
             <td> <a href="#preview"> <img id="which1" onclick="eqntext('which1')"
             src="../cgi-bin/mathtex.cgi?\which{latex}"
             border=0> </a> </td> </tr>
           <tr align="center">
             <td> \which{dvipng} </td>
             <td> <a href="#preview"> <img id="which2" onclick="eqntext('which2')"
             src="../cgi-bin/mathtex.cgi?\which{dvipng}"
             border=0> </a> </td> </tr>
           <tr align="center">
             <td> \which{dvips} </td>
             <td> <a href="#preview"> <img id="which3" onclick="eqntext('which3')"
             src="../cgi-bin/mathtex.cgi?\which{dvips}"
             border=0> </a> </td> </tr>
           <tr align="center">
             <td> \which{convert} </td>
             <td> <a href="#preview"> <img id="which4" onclick="eqntext('which4')"
             src="../cgi-bin/mathtex.cgi?\which{convert}"
             border=0> </a> </td> </tr>
         </table></center>
       displays known paths to mathTeX's dependencies, as they're
       installed on this server.
       However, there's a small "Catch-22" (circular logic that
       may bite you)<b>:</b> mathTeX must already know these paths
       before it runs the programs that display them.
       You may be able to temporarily circumvent this
       problem by compiling <br>
    <pre style="margin-top:0;margin-bottom:0"
>   <b>cc</b> mathtex.c <b>&#150;o</b> mathtex.cgi</pre>
       without any required switches at all.  When compiled like this,
       mathTeX uses <b>which</b> to determine the
       required paths.  If they're found, then mathTeX will run
       and display them<b>;</b>
       if not, you'll likely see <a href="#message7">message&nbsp;7</a>
       or <a href="#message9">message&nbsp;9</a> instead. <!-- br>
            &nbsp; &nbsp; &nbsp; --> If mathTeX does run, and displays
       the required paths, you should immediately re-compile it with
       the required <a href="#pathswitches">&#150;D<i>switches</i></a>.
       Execution time can be doubled, or even worse, when mathTeX
       has to find these paths itself. <br>
            &nbsp; &nbsp; &nbsp; When <b>\which{</b><i>programname</i><b>}</b>
       can't find the path, mathTeX displays
       <img src="../cgi-bin/mathtex.cgi?\parstyle\fbox{\footnotesize
       which(programname) = not found}" align="middle" border=0> instead.
       But mathTeX may also display
       <img src="../cgi-bin/mathtex.cgi?\parstyle\fbox{\footnotesize
       locate(programname) = /path/to/programname}" align="middle" border=0>,
       signalling that Unix&nbsp;which failed.  In this case, mathTeX
       searches your server's locate&nbsp;database, if it exists,
       and displays that path instead.  The "not&nbsp;found" message
       signals which and locate both failed. </dd>

      <dt> <a name="switchesdirective"> </a>
      <b>\switches</b> </dt>
       <dd> Submitting the expression &nbsp; <b>\switches</b> &nbsp;
       to mathTeX renders <center>
       <a href="#preview"><img id="switch1" onclick="eqntext('switch1')"
       src="../cgi-bin/mathtex.cgi?\switches" align="bottom"
       border=0></a>&nbsp;<font size="+3"><b>,</b></font> </center>
       displaying several (more will be added) of mathTeX's
       <a href="#switches">compile-line&nbsp;switches</a>.
       "Program&nbsp;image" isn't really a switch: it's the filename
       of the running program, usually &nbsp; mathtex.cgi &nbsp;
       unless you compiled it differently. <br>
            &nbsp; &nbsp; &nbsp; "Paths" displays what mathTeX knows
       about the full&nbsp;paths to its
       <a href="#dependencies">dependencies</a>.  On the
       right-hand&nbsp;side of each path is the source of that information.
       There are four possible sources, listed in order of reliablility
       (most reliable first):
       <ul>
        <li> <b>(switch)</b> &nbsp; means you compiled mathTeX with a
          <a href="#pathswitches">&#150;D<i>switch</i></a> for that path.
          You should always compile mathTeX with its
          <a href="#dependencies">dependencies</a><b>:</b> &nbsp;
          <b>&#150;DLATEX</b>, and either <b>&#150;DDVIPNG</b> or both
          <b>&#150;DDVIPS</b>&nbsp;and&nbsp;<b>&#150;DCONVERT</b>.
          When that's not possible, read
          <a href="#whichdirective">\which{&nbsp;}</a> above
          and temporarily compile mathTeX without them. </li>
        <li> <b>(which)</b> &nbsp; means the corresponding
          <a href="#pathswitches">&#150;D<i>switch</i></a> was not
          supplied, but Unix&nbsp;which found the program.  If that's
          latex or another of your
          <a href="#dependencies">dependencies</a>, then re-compile
          mathTeX with a &#150;D<i>switch</i> containing the displayed
          information. </li>
        <li> <b>(locate)</b> &nbsp; means Unix&nbsp;which failed,
          but your server's locate&nbsp;database found the path.
          Again, re-compile mathTeX if that's one of your
          <a href="#dependencies">dependencies</a>. </li>
        <li> <b>(default)</b> &nbsp; means no path information
          was found.  A default path programmed into mathTeX is
          displayed instead.  This default is frequently wrong.
          In fact, <b>(default)</b> typically means that the
          corresponding program isn't installed on your server at all.
          In that case, if the program is one of your
          <a href="#dependencies">dependencies</a>, you'll likely
          see <a href="#message7">message&nbsp;7</a> or
          <a href="#message9">message&nbsp;9</a> instead of the
          \switches output illustrated above. </li>
       </ul>
       Either dvipng or dvips&nbsp;and&nbsp;convert
       can render LaTeX's dvi output as gif or png images.
       MathTeX's default choice is based on the reliablity of path
       information to these programs<b>:</b> &nbsp; (switch)
       is most reliable, followed by (which) or (locate),
       rated equally, and finally (default) is least realiable.
       If a (switch) path to dvipng is available (i.e., if you compiled
       mathTeX with a &#150;DDVIPNG switch), then dvipng is default.
       Otherwise, if (switch) paths to both dvips and convert are
       available, then they're default.  Otherwise, (which) or (locate)
       paths are preferred to (default), and dvipng wins a "tie".
       </dd>

      <dt> <a name="evaldirective"> </a>
      <b>\eval{&nbsp;<i>expression</i>&nbsp;}</b> </dt>
       <dd> mathTeX can evaluate arithmetic expressions,
       which is a feature intended primarily for use in
       <a href="#newcommandswitch">\newcommand</a>'s discussed below.
       Expressions can be built up from the following elements
       <ul>
         <li> digits &nbsp; <b>0</b>-<b>9</b>
           &nbsp; and numbers composed of uninterrupted (no whitespace)
           sequences of digits, </li>
         <li> binary operators &nbsp;
           <b>+</b>,&nbsp;<b>-</b>,&nbsp;<b>*</b>,&nbsp;<b>/</b>,&nbsp;<b>%</b>
           &nbsp; (<b>+</b>&nbsp;and&nbsp;<b>-</b> can be unary, preceding
           the first number in an expression, and&nbsp;<b>%</b>&nbsp;is
           the modulo operator), </li>
         <li> balanced &nbsp; <b>(</b>&nbsp;...&nbsp;<b>)</b>
           &nbsp; parentheses nested to any level (see below), </li>
         <li> whitespace anywhere
           (except between digits comprising a number), </li>
         <li> also interpreted by <b>\eval{&nbsp;}</b>
           is a construction similar to (but not identical to) the
           <a href="http://wikipedia.org/wiki/Conditional_(programming)#As_a_ternary_operator"
           target="_top">?:&nbsp;conditional</a>, as follows.
           The expression <b>(i?v0:v1:v2:<i>etc</i>)</b>, usually
           parenthesized as illustrated, evaluates to <b>v0</b>
           if <b>i</b> evaluates to <b>0</b>, or evaluates to <b>v1</b>
           if <b>i</b> evaluates to <b>1</b>, etc. If <b>i&nbsp;&lt;&nbsp;0</b>
           then <b>v0</b> is used, and if <b>i</b> is too large, the last
           <b>v</b> is used. All components, <b>i</b> and all <b>v</b>'s,
           can themselves be expressions, even another
           <b>(i?v0:v1:v2:<i>etc</i>)</b>, which in this case must be
           parenthesized. The only situation where parentheses aren't
           required is when <b>i?v0:v1:v2:<i>etc</i></b> comprises
           your entire expression.
           For example, <center>
             <b>\eval{1+2?10:11:12:13:14:15}</b> renders
            <a href="#preview"><img id="eval1" onclick="eqntext('eval1')"
            src="../cgi-bin/mathtex.cgi?\large\eval{1+2?10:11:12:13:14:15}"
            alt="" border=0 align=bottom></a></center> </li>
         <li> and <u>&nbsp;most&nbsp;importantly,&nbsp;</u>
             the built-in variable<br>
             &nbsp; &nbsp; &nbsp; <b>fs</b> for current fontsize,<br>
             &nbsp; &nbsp; &nbsp;
             with 1=\tiny, 2=\scriptsize, ..., 10=\Huge,<br>
           which provides the capability for useful constructions,
           as follows... </li>
       </ul>
       All optional <b>[</b>&nbsp;</b>]</b> and mandatory
       <b>{</b>&nbsp;</b>}</b> numeric arguments for &nbsp;
       <b>\rule[<i>lift</i>]{<i>width</i>}{<i>height</i>}</b>, &nbsp;
       <b>\raisebox{<i>lift</i>}[<i>height</i>][<i>depth</i>]{&nbsp;}</b>,
       &nbsp; etc, &nbsp; can be <b>\eval{&nbsp;}</b>expressions as
       described above, rather than just numeric constants. By using
       the <b>fs</b> variable, you can construct
       <a href="#newcommandswitch">\newcommand</a>
       expressions that properly scale with font&nbsp;size.
       For example,<br>
       &nbsp; &nbsp; &nbsp;
         <b>\small a\rule{1}{\eval{2*fs}pt}b</b> renders
         <a href="#preview"><img id="eval2" onclick="eqntext('eval2')"
         src="../cgi-bin/mathtex.cgi?\small a\rule{1}{\eval{2*fs}pt}b"
         alt="" border=0 align=bottom></a> <br>
       &nbsp; &nbsp; &nbsp;
         <b>\large a\rule{1}{\eval{2*fs}pt}b</b> renders
         <a href="#preview"><img id="eval3" onclick="eqntext('eval3')"
         src="../cgi-bin/mathtex.cgi?\large a\rule{1}{\eval{2*fs}pt}b"
         alt="" border=0 align=bottom></a> <br>
       whose rendering automatically varies appropriately with
       font&nbsp;size. This kind of
       <a href="#newcommandswitch">\newcommand</a> construction
       is the primary use intended for mathTeX's expression
       evaluation feature. <br>
       &nbsp; &nbsp; &nbsp;
          But mathTeX also provides the <b>\eval{<i>expression</i>}</b>
       command to make the expression evaluation feature render
       &quot;visible&quot; results. It's not particularly useful,
       but an expression like &nbsp; <b>1+2+3+4+5=\eval{1+2+3+4+5}</b> &nbsp;
       renders &nbsp;
        <a href="#preview"><img id="eval2" onclick="eqntext('eval2')"
        src="../cgi-bin/mathtex.cgi?\small 1+2+3+4+5=\eval{1+2+3+4+5}"
        alt="" border=0 align="bottom"></a>. <br>
       &nbsp; &nbsp; &nbsp;
          Finally, one little &quot;gotcha&quot; is mathTeX's
       order&nbsp;of&nbsp;evaluation when interpreting expressions.
       Parentheses are respected as you'd expect. But within
       &nbsp; <b>(</b>...<b>)</b> &nbsp; parentheses, or in an
       unparenthesized expression, mathTeX finds the first (reading
       from the left) operator, then iteratively evaluates the
       separate subexpressions to that operator's left and to its right,
       and then finally combines those two separate results.
       So an expression like <b>2*3+4</b>&nbsp;renders&nbsp;<b>14</b>,
       and you need to write <b>(2*3)+4</b>&nbsp;to&nbsp;get&nbsp;<b>10</b>.
       </dd>

      <dt> <a name="timedirective"> </a>
      <b>\time</b> </dt>
       <dd> LaTeX's <b>\</b>today is usually sufficient for the
       slow-paced world of print.  But you may want finer-grained
       resolution for the faster-paced online world.  mathTeX provides
       &nbsp; <b>\time</b> &nbsp; for this purpose, replacing it with
       the current hh:mm:ss wherever it occurs.  The
       <a href="#timestamp1">date/timestamp</a>
       at the top of this document is rendered by mathTeX with an
       expression like &nbsp;
       "\parstyle\begin{center}\today\\\time\end{center}". &nbsp;
       You can see the exact expression by clicking on
       <a href="#timestamp1">that&nbsp;image</a>.
       I'm not reproducing it here because mathTeX doesn't
       cache images containing <b>\</b>today or <b>\</b>time.
       So use &nbsp; <b>\time</b> &nbsp; sparingly because
       every occurrence is re-rendered through LaTeX. </dd>

      <dt> <a name="advertisementdirective"> </a>
      <b>\advertisement</b> </dt>
       <dd> An expression containing &nbsp; <b>\advertisement</b> &nbsp;
       is displayed along with your
       <a href="#adswitches">mathTeX&nbsp;advertisement</a>
       rather than by itself, regardless of
       <a href="#adfrequencyswitch">-DADFREQUENCY</a>. For example,
       <center><table border="0">
       <tr align="center"> <td>
         <b><u> &nbsp; c=\sqrt{a^2+b^2} &nbsp; </u></b> </td>
         <td> &nbsp; &nbsp; &nbsp; </td> <td>
         <b><u> &nbsp; \advertisement c=\sqrt{a^2+b^2} &nbsp; </u></b>
         </td> </tr>
       <tr align="center"> <td>
         <a href="#preview"><img id="addir1" onclick="eqntext('addir1')"
         src="../cgi-bin/mathtex.cgi?c=\sqrt{a^2+b^2}"
         alt="" border=0> </a> </td> <td> &nbsp; </td> <td>
         <a href="#preview"><img id="addir2" onclick="eqntext('addir2')"
         src="../cgi-bin/mathtex.cgi?\advertisement c=\sqrt{a^2+b^2}"
         alt="" align="middle" border=0> </a> </td> </tr>
       </table></center>
       See <a href="#advertisementswitch">Advertisement</a>
       to replace the default advertisement, illustrated above,
       with your own. </dd>

      <dt> <a name="versiondirective"> </a>
      <b>\version</b> </dt>
       <dd> An expression containing &nbsp; <b>\version</b> &nbsp;
       is displayed along with mathTeX's current version number.
       For example,
       <center><table border="0">
       <tr align="center"> <td>
         <b><u> &nbsp; \version c=\sqrt{a^2+b^2} &nbsp; </u></b>
         </td> </tr>
       <tr align="center"> <td>
         <a href="#preview"><img id="verdir1" onclick="eqntext('verdir1')"
         src="../cgi-bin/mathtex.cgi?\version c=\sqrt{a^2+b^2}"
         alt="" align="middle" border=0> </a> </td> </tr>
       </table></center> </dd>

      <dt> <a name="environmentdirective"> </a>
      <b>\environment</b> </dt>
       <dd> Submitting the expression &nbsp; <b>\environment</b> &nbsp;
       to mathTeX renders <center>
       <a href="#preview"><img id="environ1" onclick="eqntext('environ1')"
       src="../cgi-bin/mathtex.cgi?\environment" align="bottom"
       border=0></a></center>
       displaying the http environment variables known to mathTeX.
       This is primarily a programming aid, showing information
       available to mathTeX that might facilitate future enhancements. </dd>
     </dl>


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ INSTALLATION AND TESTING
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="install"> (4) Installation and Testing &nbsp; </h2>
<font color="maroon"><b>Note: The current release of mathTeX only runs <br>
on Unix-like operating systems.</b></font> <br>
    <table border="0" cellpadding="0" cellspacing="0">
      <tr><td colspan=2><hr size="2">
          Very quickly &nbsp; --- &nbsp;
          First, install mathTeX's
          <a href="#dependencies">dependencies</a>: </td></tr>
      <tr><td> &nbsp; &nbsp; &nbsp; &nbsp; </td>
          <td>a recent </b><a href="http://www.latex-project.org/ftp.html"
          target="_top">TeX&nbsp;distribution</a>
          with <a href="http://savannah.nongnu.org/projects/dvipng/"
          target="_top">dvipng</a>,
          <!-- and <a href="http://www.imagemagick.org"
          target="_top">ImageMagick</a> --> <br>
          on your server, or see
          <a href="http://www.forkosh.com/mimetex.html"
          target="_top">mimeTeX</a> if you can't. </td></tr>
      <tr><td colspan=2>
          Then, download
          <a href="http://www.forkosh.com/mathtex.zip">mathtex.zip</a>
          and type </td></tr>
      <tr><td> &nbsp; &nbsp; &nbsp; &nbsp; </td>
          <td><b>unzip mathtex.zip</b> <br>
              <b>cc mathtex.c &#150;DLATEX=\"$(which latex)\" &nbsp; \ <br>
              &nbsp; &#150;DDVIPNG=\"$(which dvipng)\" &nbsp; \ <br>
              <!-- &nbsp; &#150;DCONVERT=\"$(which convert)\" &nbsp; \ <br -->
              &nbsp; &#150;o mathtex.cgi</b> <br>
              <nobr>(see
              <a href="#pathswitches">&#150;D<i>switches</i></a>
              below for more information). </nobr> </td></tr>
      <tr><td colspan=2> Finally, </td></tr>
      <tr><td> &nbsp; &nbsp; &nbsp; &nbsp; </td>
          <td> <b>mv&nbsp;mathtex.cgi</b> &nbsp; to your
               <b>cgi-bin/</b> directory, <br>
               <!-- b>mkdir&nbsp;cgi-bin/mathtex/</b>
               &nbsp; for mathTeX's cache, <br -->
               <b>chmod</b> permissions as necessary,
               and you're all done. </td></tr>
      <tr><td colspan=2>
        Read the rest of this section only if you want
        more information.<hr size="2"></td>
     </tr></table>

<p class="continue"> mathTeX's source code is standard Unix C,
    which should compile and run without change on
    any posix-compliant Unix platform.
    <font color="maroon"><b>The current release of mathTeX only
    runs under Unix-like operating systems.</b></font>
    <!-- Instructions below are for Unix.  Modify them as necessary
    for your particular situation (note the -DWINDOWS switch if
    applicable). -->
    The three steps needed to compile, install and test
    mathTeX are: </p>

  <h3 style="margin-bottom:0;">
  (1) Install LaTeX <!-- and ImageMagick, -->
  and download mathTeX<font size=5>...</font> </h3>
  <ul style="margin-top:0">
   <li> First, make sure you have a recent <br>
        <nobr> <b> &nbsp; &nbsp; &nbsp; &nbsp; </b>
          <a href="http://www.latex-project.org/ftp.html"
          target="_top">TeX&nbsp;distribution</a>
          with <a href="http://savannah.nongnu.org/projects/dvipng/"
          target="_top">dvipng</a>
          installed on your server. </nobr> <br>
        MathTeX's <a href="#dependencies">dependencies</a> are the
        <a href="http://en.wikipedia.org/wiki/LaTeX"
        target="_top">latex</a> and
        <a href="http://en.wikipedia.org/wiki/Dvipng"
        target="_top">dvipng</a>
        programs, along with all necessary fonts, etc, from your
        TeX&nbsp;distribution. <br>
        <b> &nbsp; &nbsp; &nbsp; &nbsp; </b>
             If you prefer to compile mathTeX with the optional
        <a href="#dvipsswitch">&#150;DDVIPS&nbsp;and&nbsp;&#150;DCONVERT</a>
        switches (<a href="#compilestep">Step&nbsp;2</a> immediately below),
        then <a href="http://en.wikipedia.org/wiki/Dvips"
        target="_top">dvips</a>
        from your TeX&nbsp;distribution, and
        <a href="http://www.imagemagick.org/script/convert.php"
        target="_top">convert</a> from the
        <a href="http://www.imagemagick.org" target="_top">ImageMagick</a>
        package, are used instead of dvipng. <br>
        <b> &nbsp; &nbsp; &nbsp; &nbsp; </b>
             These  <a href="#dependencies">dependencies</a>
        &#151; always latex and either dvipng or dvips/convert &#151;
        must all be installed on your server
        before you can run mathTeX.  Ask your ISP or sysadmin
        if you have any questions or problems installing them.
        Or see <a href="http://www.forkosh.com/mimetex.html"
        target="_top">mimeTeX</a> if you can't install them.
        </li>
   <li> Then download and unzip 
        <a href="http://www.forkosh.com/mathtex.zip">
        mathtex.zip</a> in any convenient working directory.
        Your working directory should now contain
        <center> <table cellpadding=0 cellspacing=0>
         <tr><td width=100>README</td> <td>mathTeX release notes</td></tr>
          <tr><td>COPYING</td>    <td>GPL license, version 3, under which
                                     you may use mathTeX</td></tr>
          <tr><td>mathtex.c</td>  <td>mathTeX source program and all
                                     required functions</td></tr>
          <tr><td>mathtex.html</td> <td>this file, the mathTeX user
                                     manual</td></tr>
        </table> </center> </li>
  </ul>

  <h3 style="margin-bottom:0;"> <a name="compilestep"> </a>
  (2) Compile mathTeX and test it
  from the Unix shell<font size=5>...</font> </h3>
  <ul style="margin-top:0">
   <li> To compile a mathTeX executable that emits default
        gif images generated by dvipng (recommended), just type <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              cc &nbsp; mathtex.c &nbsp;
              &#150;DLATEX=\"$(which latex)\" &nbsp; \ </b></nobr><br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;DDVIPNG=\"$(which dvipng)\" &nbsp;
              &#150;o &nbsp; mathtex.cgi </b></nobr><br>
        Alternatively, to compile a mathTeX executable that emits default
        gif images generated by dvips/convert, just type <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              cc &nbsp; mathtex.c &nbsp;
              &#150;DLATEX=\"$(which latex)\" &nbsp; \ </b></nobr><br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;DDVIPS=\"$(which dvips)\" &nbsp;
              &#150;DCONVERT=\"$(which convert)\" &nbsp; \ </b></nobr><br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;o &nbsp; mathtex.cgi </b></nobr><br>
        But note that dvipng is easily twice as fast
        as dvips/convert, and it produces somewhat smaller image files. <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
             For default png (instead of gif) images, add the optional
        <b>&#150;DPNG</b>&nbsp;switch to either <b>cc</b>&nbsp;command
        above.  All of mathTeX's optional
        <a href="#switches">compile-line&nbsp;switches</a> are discussed
        below. <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
             The <a href="#pathswitches">required&nbsp;switches</a>
        shown above define paths to mathTeX's
        <a href="#dependencies">dependencies</a>, either latex and dvipng,
        or latex and dvips/convert.
        See <a href="#pathswitches">required&nbsp;switches</a>&nbsp;below
        for additional information about these path switches, including
        discussion of that <b>$(which</b>&nbsp;<i>program</i><b>)</b>
        construction.
        <!-- If not explicitly supplied on the compile line,
        they default to <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;DLATEX=\"/usr/share/texmf/bin/latex\" </b></nobr> <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;DDVIPNG=\"/usr/share/texmf/bin/dvipng\" </b></nobr> <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              &#150;DCONVERT=\"/usr/bin/convert\" </b></nobr> <br> -->
        </li>
   <!-- li> Windows compile notes: <ul>
        <li> If (and only if) you're compiling a Windows executable,
        then add <b>&#150;DWINDOWS</b><br>
             <nobr>&nbsp; &nbsp; &nbsp; &nbsp; <b>gcc -DWINDOWS
             mathtex.c &#150;o mathtex.exe</b></nobr> <br>
        The above Unix-like syntax works with
        <a href="http://www.mingw.org" target="_top">MinGW</a> and
        <a href="http://www.delorie.com/djgpp/" target="_top">djgpp</a>
        Windows compilers, but probably not with most others,
        where it's only intended as a "template". </li>
        </ul> <br> </li -->
   <li> Immediately after compiling mathTeX, test it
        from the Unix shell by typing <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              ./mathtex.cgi &nbsp; "x^2+y^2" &nbsp; &#150;m 9
              &nbsp; &#150;o test </b></nobr> <br>
        at the command prompt.  After the copyright notice,
        screen output should look something like
    <pre class="medium" style="margin-top:0;margin-bottom:0;">
    mathTeX> running image:     ./mathtex.cgi
    mathTeX> input expression:  "x^2+y^2"
    mathTeX> working directory: 8dfaf8281769c217b7e78b27a4747285/
    mathTeX> output image file: test.gif </pre>
        Bring up the output&nbsp;file <b>test.gif</b> in your browser,
        which should display the rendered image of <b>x^2+y^2</b>.
        If it does, you can <b>rm&nbsp;-r</b> that working directory
        and proceed to the next (Install) step.
        If not, there's some error that <b>_must_</b> be fixed before
        proceeding<b>:</b> mathTeX is not going to emit gifs from
        your server if it won't run from the command line. <br>
        <font color="maroon"> <a name="commandlineerrors"> </a>
        <b>To troubleshoot command-line errors...</b></font>
        <ul>
        <li> First, &nbsp; <b>cd&nbsp;8dfaf8281769c217b7e78b27a4747285/</b>
         &nbsp; to that working&nbsp;directory (whose name is the
         32-character MD5 hash of your expression)
         shown on the screen output above. </li>
        <li> If it's not an empty file, &nbsp; <b>view&nbsp;latex.err</b>
         &nbsp; A message something like
         &nbsp; <b>latex:&nbsp;command&nbsp;not&nbsp;found</b> &nbsp;
         probably means that your
         &nbsp; <b>&#150;DLATEX=\"path/to/latex\"</b> &nbsp;
         is wrong, or that latex is installed wrong.
         Fix that, or any other indicated error, and then
         re-compile mathTeX and test it again. </li>
        <li> Otherwise, if latex.err is empty, then
         &nbsp; <b>view&nbsp;latex.out</b> &nbsp; which
         contains runtime messages issued by latex,
         including messages reporting unresolved errors.
         For example, <b>\usepackage{junk}</b> reports the error
         <b>File&nbsp;`junk.sty'&nbsp;not&nbsp;found.</b> &nbsp;
         Find and fix any reported errors, and then
         re-compile mathTeX and test it again. </li>
        <li> If latex.err and latex.out contain no errors,
         then latex.dvi should contain the dvi image of
         your expression.  Check it with <b>xdvi</b> or any
         other dvi&nbsp;viewer supplied with your latex distribution.
         Then view dvipng.err and dvipng.out for any reported errors
         (note that dvipng emits a benign copyright message to dvipng.out).
         <!-- Then view dvips.err and dvips.out for any reported errors
         (note that dvips emits a benign copyright message to dvips.err),
         and check dvips.ps with <b>gv</b> or any other
         postscript viewer.  Finally, view convert.err and convert.out
         for any reported errors. --> </li>
        <li> You should have found some error along the way.
         Troubleshoot as necessary.
         Your most likely (and most obvious) problems are:
         <a href="#dependencies">mathTeX's&nbsp;dependencies</a>
         are installed incorrectly or not at all, you compiled
         mathtex.cgi with the wrong paths (check <b>which</b>'s
         output), or you don't have rw permissions in the directory
         you're testing from. </li>
        </ul> </li>
  </ul>

  <h3 style="margin-bottom:0;">
  (3) Install mathTeX and test it from a browser<font size=5>...</font> </h3>
  <ul style="margin-top:0">
   <li> Install your compiled mathtex.cgi executable only after
        successfully testing it from the Unix shell.  Just <br>
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              mv&nbsp;mathtex.cgi</b> &nbsp; to your web server's
              <b>cgi-bin/</b> directory, </nobr> <br>
        <!-- nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              mkdir&nbsp;cgi-bin/mathtex/</b>
              &nbsp; for mathTeX's cache, </nobr> <br -->
        <nobr><b> &nbsp; &nbsp; &nbsp; &nbsp;
              chmod</b> permissions as necessary,
              and you're all done. </nobr> <br>
        <b>cgi-bin/mathtex.cgi</b> must be executable by your web server,
        and it must have <b>rw</b> permissions in the <b>cgi-bin/</b>
        directory where it's installed.  The first time it runs,
        mathtex.cgi will <b>mkdir&nbsp;mathtex/</b>, where rendered
        images are subsequently cached.  Permissions and ownerships
        must be set to allow this.
        <!-- and the <b>cgi-bin/mathtex/</b> cache directory must be <b>rw</b>
        by mathtex.cgi. --> <b>chmod&nbsp;755</b> typically works,
        <!-- for both, --> but ask your ISP or sysadmin if you have
        any questions or problems. </li>
   <li> Immediately after installation, type a url into your browser's
        locator window something like <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
     <b>http://www.</b><i>yourdomain</i><b>.com/cgi-bin/mathtex.cgi?\message</b> <br>
        which should display <a href="#message1">message&nbsp;1</a><br>
        &nbsp; &nbsp; &nbsp; &nbsp;
        <img src="../cgi-bin/mathtex.cgi?\message" alt="" border=0
        align=middle> <br>
        in the upper-left corner of your window.  If, instead, you see
        <a href="#message0a">Not&nbsp;Found</a> or
        <a href="#message0b">Error&nbsp;500</a> emitted by your server,
        then mathTeX isn't running.  Check that you installed
        it in the correct directory, set its permissions properly, etc. </li>
   <li> The preceding test just checked that mathtex.cgi runs from
        your server.  This current test checks that your &#150DLATEX, etc,
        paths are correct, and that mathtex.cgi has rw permissions in your
        cgi-bin/ directory.  Type a url into your browser's locator
        window something like <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
     <b>http://www.</b><i>yourdomain</i><b>.com/cgi-bin/mathtex.cgi?x^2+y^2</b> <br>
        which should display &nbsp;
        <img src="../cgi-bin/mathtex.cgi?x^2+y^2" alt="" border=0
        align=middle> &nbsp; in the upper-left corner of your window,
        just like clicking this link does, which tests my mathtex.cgi, <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
        <a href="http://www.forkosh.com/cgi-bin/mathtex.cgi?x^2+y^2"
        target="_top">http://www.forkosh.com/cgi-bin/mathtex.cgi?x^2+y^2</a>
        <br> If you see the same image from your own
        &nbsp; <i>yourdomain</i> &nbsp; link, then you've completed
        a successful mathTeX installation. <br>
        &nbsp; &nbsp; &nbsp; &nbsp;
             Otherwise, you'll probably see one of mathTeX's
        <a href="#messages">error&nbsp;messages</a> illustrated below.
        Read the accompanying description, and try to resolve the
        problem accordingly. </li>
  </ul>

<h3> <a name="messages"> </a>
Run-time error messages<font size=5>...</font></h3>
 <p> Gif images for 15 messages are embedded in mathTeX,
     displayable so long as mathtex.cgi can run from your server,
     even without latex and without rw permissions
     in your cgi-bin/ directory.  In addition, your server may display
     the first two messages below if mathtex.cgi can't run.
     Any embedded mathTeX message can be intentionally displayed
     by submitting an expression containing the
     special mathTeX directive <b>\message{1}</b> through
     <b>\message{15}</b> (an out-of-bounds argument, or
     <b>\message</b> with no argument, displays message&nbsp;<b>1</b>).
     Otherwise, various errors signal "unintentional" displays of
     the corresponding message, e.g., if your &#150;DLATEX&nbsp;switch
     specifies the wrong path to latex, then you'll see
     <a href="#message7">message&nbsp;7</a> (unless some earlier
     error supercedes it). </p>
     <center> <table cellspacing=0 cellpadding=2 width="95%" border=0>
      <tr> <td align="center">
         <u><b> &nbsp; &nbsp; Message &nbsp; &nbsp; </b></u> </td>
         <td align="center">
         <u><b> &nbsp; &nbsp; Description &nbsp; &nbsp; </b></u> </td> </tr>
      <tr> <td> <a name="message0a"> </a> </td> </tr>
      <tr> <!-- maybe tr valign="top" --> <td align="center">
         <b>The requested URL was not found.</b> </td>
         <td class="paragraph" align="left">
         You typed the wrong url, or mathtex.cgi is not
         installed where you think it is.
         </td> </tr>
      <tr> <td> <a name="message0b"> </a> </td> </tr>
      <tr> <td align="center">
         <b>Internal server error 500</b> </td>
         <td class="paragraph" align="left">
         If mathtex.cgi's permissions are chmod'ed improperly,
         if your account isn't set up to run cgi's, etc,
         then mathTeX will not run at all.
         You'll probably see this error message emitted by your
         server instead.
         </td> </tr>
      <tr> <td> <a name="message1"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{1}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Immediately after installing mathtex.cgi
         to your cgi-bin/ directory, type a url of the form <br>
         <nobr> &nbsp; &nbsp; <font size="-1"><b><i>yourdomain</i>.com/cgi-bin/mathtex.cgi?\message</b></font></nobr> <br>
         into your browser.  You should see this message.
         It means mathtex.cgi ran successfully,
         its permissions are set properly, and the account hosting
         <i>yourdomain</i> can run cgi's.
         </td> </tr>
      <tr> <td> <a name="message2"> </a> </td> </tr>
      <tr> <td align="center">
         </a><img src="../cgi-bin/mathtex.cgi?\message{2}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Traps any otherwise unidentified error condition.
         </td> </tr>
      <tr> <td> <a name="message3"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{3}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         The combination of permissions/ownerships on mathtex.cgi itself,
         and on the cgi-bin/ directory where it's installed, prohibit mathTeX
         from creating its cache directory mathtex/ underneath
         cgi-bin/.  Change permissions/ownerships as needed.
         </td> </tr>
      <tr> <td> <a name="message4"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{4}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left"> Same problem
         as <a href="#message3">message&nbsp;3</a> above,
         except this time mathTeX can't create a temporary
         work directory under cgi-bin/.
         </td> </tr>
      <tr> <td> <a name="message5"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{5}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Unanticipated error.  MathTeX should be able to
         cd to a directory it just created.
         </td> </tr>
      <tr> <td> <a name="message6"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{6}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Unanticipated error.  MathTeX should be able to
         open a file (for write) in a directory it just created.
         </td> </tr>
      <tr> <td> <a name="message7"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{7}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Either latex is not installed,
         or your <b>&#150;DLATEX</b> path to it is incorrect.
         It's also possible that the shell host on which you compiled
         mathTeX has different volumes or mount points than your server
         (see <a href="#pathswitches">path&nbsp;switches</a>).
         Check with your ISP or sysadmin, or try mathTeX's
         <a href="#whichdirective">\which&nbsp;directive</a>.
         </td> </tr>
      <tr> <td> <a name="message8"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{8}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         A simple latex error, like \alfa instead of \alpha,
         should not cause this problem (unless your expression
         contains <a href="#quietdirective">\noquiet</a>).
         It's more likely caused by a missing font or package,
         etc.  Simplify your expression until it works, and see
         if that helps identify the cause.  Or add
         <a href="#msgleveldirective">\msglevel{9}</a>
         to your expression, and check files latex.out and latex.err
         for error messages.
         </td> </tr>
      <tr> <td> <a name="message9"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{9}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Either dvipng is not installed,
         or your <b>&#150;DDVIPNG</b> path to it is incorrect.
         Also see the remark in <a href="#message7">message&nbsp;7</a>.
         </td> </tr>
      <tr> <td> <a name="message10"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{10}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Rerun the same expression with
         <a href="#msgleveldirective">\msglevel{9}</a>
         added.  Then check files latex.out and latex.err,
         and dvipng.out and dvipng.err for any clues to
         the cause of this error.
         </td> </tr>
      <tr> <td> <a name="message11"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{11}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Either dvips is not installed,
         or your <b>&#150;DDVIPS</b> path to it is incorrect.
         Also see the remark in <a href="#message7">message&nbsp;7</a>.
         </td> </tr>
      <tr> <td> <a name="message12"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{12}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Rerun the same expression with
         <a href="#msgleveldirective">\msglevel{9}</a>
         added.  Then check files latex.out and latex.err,
         and dvips.out and dvips.err for any clues to
         the cause of this error.
         </td> </tr>
      <tr> <td> <a name="message13"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{13}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Either convert is not installed,
         or your <b>&#150;DCONVERT</b> path to it is incorrect.
         Also see the remark in <a href="#message7">message&nbsp;7</a>.
         </td> </tr>
      <tr> <td> <a name="message14"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{14}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         Rerun the same expression with
         <a href="#msgleveldirective">\msglevel{9}</a>
         added.  Then check files latex.out and latex.err,
         dvips.out and dvips.err, and convert.out and
         convert.err for any clues to the cause of this error.
         </td> </tr>
      <tr> <td> <a name="message15"> </a> </td> </tr>
      <tr> <td align="center">
         <img src="../cgi-bin/mathtex.cgi?\message{15}"
         alt="" align="middle" border=0> </td>
         <td class="paragraph" align="left">
         An image file was apparently created successfully,
         but is now inaccessible to mathTeX.  Rerun the same
         expression.  If it fails again, rerun it with
         <a href="#msgleveldirective">\msglevel{9}</a>
         added.  Then check all .out and .err files
         for any clues to the cause of this error.
         </td> </tr>
      </table> </center>

<h3> <a name="switches"> </a>
Compile-line switches<font size=5>...</font></h3>

     <dl>
      <dt> <a name="pathswitches"> </a> <font color="black">
      <b>Required switches</b><font size=5>...</font></font> <br> </dt>
       <dd style="margin-left:0em;">
       &nbsp; &nbsp; &nbsp;
            MathTeX's required <b>&#150;D</b> switches
       specify paths to the programs it needs to render
       LaTeX expressions as images.  Your Unix <b>PATH</b> environment
       variable usually contains the directories where these programs
       reside.  And in that case, the Unix shell command
       &nbsp; <b>which</b>&nbsp;<i>progname</i> &nbsp; emits the
       string &nbsp; <i>/path/to/progname</i>. <br>
       &nbsp; &nbsp; &nbsp;
            Then you can manually copy <b>which</b>'s
       output to the switch, e.g., if &nbsp; <b>which&nbsp;latex</b>
       &nbsp; emits &nbsp; <b>/usr/bin/latex</b> &nbsp;
       then just write the switch &nbsp;
       <b>&#150;DLATEX=\"/usr/bin/latex\"</b> &nbsp;
       Alternatively, you can use the Unix shell's
       &nbsp; <b>$(&nbsp;)</b> &nbsp; construction to automatically
       pipe <b>which</b>'s output into the switch, e.g., &nbsp;
       <b>&#150;DLATEX=\"$(which&nbsp;latex)\"</b> &nbsp;
       automatically places that same path to latex between the
       literal <b>\"&nbsp;&nbsp;\"</b> quotes. <br>
       &nbsp; &nbsp; &nbsp;
            If <b>which</b> doesn't work, you must nevertheless
       make sure that latex and mathTeX's other
       <a href="#dependencies">dependencies</a> are all installed
       on your server.  Then determine the proper paths to them
       yourself (ask your ISP or sysadmin, or try mathTeX's
       <a href="#whichdirective">\which&nbsp;directive</a>),
       and manually write mathTeX's required <b>&#150;D</b>
       switches as described above.<br>
       &nbsp; &nbsp; &nbsp;
            Occasionally, <b>which</b> may seem
       to work, but actually doesn't, because your shell account
       and internet server are hosted on different machines,
       with different volumes mounted and/or different mount
       points.  When this happens, server volumes are
       nfs-mounted by your shell machine, so you can work
       on your internet files.  Conversely, shell volumes aren't
       necessarily mounted by the server, so latex could be
       visible from your shell but not from the server.
       Check with your ISP or sysadmin about network topology
       if you suspect something like this, or mathTeX's
       <a href="#whichdirective">\which&nbsp;directive</a>
       may help.  In any case,
       mathTeX's <a href="#dependencies">dependencies</a>,
       latex and either dvipng or dvips/convert, must be
       available to your server, and you must compile
       mathtex.cgi with their paths on your server. </dd>

      <dt> <b>&#150;DLATEX=\"/</b><i>path</i><b>/</b><i>to</i><b>/latex\" <br>
      &#150;DDVIPNG=\"/</b><i>path</i><b>/</b><i>to</i><b>/dvipng\" </b> </dt>
       <dd> mathTeX always requires the <b>&#150;DLATEX</b>&nbsp;switch,
       and its recommended default (using
       <a href="http://en.wikipedia.org/wiki/Dvipng"
       target="_top">dvipng</a> to render
       latex's dvi output as gif or png images)
       also requires the <b>&#150;DDVIPNG</b>&nbsp;switch.
       So your standard <b>cc</b> command to compile mathTeX looks like <br>
       &nbsp; &nbsp; &nbsp;
         <b> cc &nbsp; mathtex.c &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DLATEX=\"$(which latex)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DDVIPNG=\"$(which dvipng)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;o &nbsp; mathtex.cgi </b> <br>
       </dd>

      <dt> <a name="dvipsswitch"> </a>
      <b>&#150;DDVIPS=\"/</b><i>path</i><b>/</b><i>to</i><b>/dvips\" <br>
      &#150;DCONVERT=\"/</b><i>path</i><b>/</b><i>to</i><b>/convert\" </b> </dt>
       <dd> If you can't (or don't want to) use dvipng, 
       then compile mathTeX with the <b>&#150;DDVIPS</b> and
       <b>&#150;DCONVERT</b>&nbsp;switches (instead of &#150;DDVIPNG).
       Then
       <a href="http://en.wikipedia.org/wiki/Dvips" target="_top">dvips</a>
       from your <a href="http://www.latex-project.org/ftp.html"
       target="_top">TeX&nbsp;distribution</a>, and
       <a href="http://www.imagemagick.org/script/convert.php"
       target="_top">convert</a> from the
       <a href="http://www.imagemagick.org" target="_top">ImageMagick</a>
       package, are used (instead of dvipng) to render latex's dvi output
       as gif or png images.
       In this case, your <b>cc</b> command to compile mathTeX looks like <br>
       &nbsp; &nbsp; &nbsp;
         <b> cc &nbsp; mathtex.c &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DLATEX=\"$(which latex)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DDVIPS=\"$(which dvips)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DCONVERT=\"$(which convert)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;o &nbsp; mathtex.cgi </b> <br>
       Finally, if all three programs (dvipng and dvips and convert)
       are installed on your server, you can compile mathTeX with all
       the <b>&#150;D</b>&nbsp;switches.  This defaults to dvipng,
       but permits users to submit expressions containing the special
       <a href="#dvipsdirective">\dvips</a> and
       <a href="#dvipsdirective">\dvipng</a> directives, regardless of
       mathTeX's default.  So a comprehensive <b>cc</b> command looks
       like <br>
       &nbsp; &nbsp; &nbsp;
         <b> cc &nbsp; mathtex.c &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DLATEX=\"$(which latex)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DDVIPNG=\"$(which dvipng)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DDVIPS=\"$(which dvips)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;DCONVERT=\"$(which convert)\" &nbsp; \ </b> <br>
       &nbsp; &nbsp; &nbsp; &nbsp;
         <b> &#150;o &nbsp; mathtex.cgi </b> <br>
       along with any other optional switches you choose
       from those described below, </dd>

      <dt> <a name="optionalswitches"> </a> <font color="black">
      <b>Optional switches</b><font size=5>...</font></font> <br> </dt>
       <dd style="margin-left:0em;">
       &nbsp; &nbsp; &nbsp;
            In addition to the &#150;DLATEX and &#150;DDVIPNG
       switches required on the mathTeX's compile line, as discussed above,
       you may also include the following optional <b>&#150;D</b> switches,
       whose functionality is discussed below.  Whenever a switch takes
       a value, its <font color="maroon"><b>default&nbsp;value</b></font>
       is illustrated.  An
       <font color="maroon"><i>italicized&nbsp;value</i></font>
       means there is no default. </dd>

      <dt> <a name="cacheswitch"> </a> <b>&#150;DCACHE=\"mathtex/\"</b> </dt>
       <dd> By default, mathTeX saves each new image it renders
       to a file in directory &nbsp; <b>mathtex/</b> &nbsp; (relative
       to the cgi-bin/ directory where you installed mathtex.cgi).
       Then, every time it's given the same expression, mathTeX
       reads that file rather than re-rendering the same image.
       You can specify any other cache directory with the &nbsp;
       <b>&#150;DCACHE=\"</b><i>path</i><b>/\"</b> &nbsp; switch.
       Either way, mathTeX's cache directory must be read/writable by
       it, so set permissions (typically chmod&nbsp;755) as necessary. <br>
       &nbsp; &nbsp; &nbsp; mathTeX occasionally disables caching,
       e.g., expressions containing <b>\today</b> are
       always re-rendered since the date may have changed.
       Otherwise, caching is mandatory and cannot be disabled. <br>
       &nbsp; &nbsp; &nbsp; Cached image files are named
       <i>filename</i><b>.gif</b> or <i>filename</i><b>.png</b>,
       where <i>filename</i> is the 32-character MD5 hash of the
       LaTeX expression.  When caching a new image, mathTeX also
       updates the file <i>path</i><b>/mathtex.log</b> containing
       a timestamp, filename, LaTeX expression, and http&nbsp;referer
       for each new file created.  A sample entry looks like
<pre>---------------------------------------------------------------------
2007-10-11:09:00:53am            f8ccc8dd93c8eeb1d9c40b353ef781e0.gif
\LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
http://www.forkosh.com/mathtex.html
---------------------------------------------------------------------</pre></dd>

      <dt> <a name="gifswitch"> </a><b>&#150;DGIF</b>
      &nbsp; or &nbsp; <b>&#150;DPNG</b> </dt>
       <dd> mathTeX generates gif or png images.  Users can specify
       which format they want by including a 
       <a href="#gifdirective"><b>\gif</b>&nbsp;or&nbsp;<b>\png</b></a>
       mathTeX&nbsp;directive in submitted
       expressions.  Otherwise, mathTeX's default is specified at
       compile time by a &nbsp; <b>&#150;DGIF</b> &nbsp; or
       &nbsp; <b>&#150;DPNG</b> &nbsp; switch.  If a submitted expression
       contains neither directive, and if mathTeX was compiled with
       neither switch, then gif is the default. </dd>

      <dt> <a name="styleswitch"> </a> <b>&#150;DDISPLAYSTYLE</b>
      &nbsp; or &nbsp;  <b>&#150;DTEXTSTYLE</b>
      &nbsp; or &nbsp; <b>&#150;DPARSTYLE</b> </dt>
       <dd> mathTeX's default wraps user expressions inside
       &nbsp; <b>\[&nbsp;&nbsp;\]</b>, &nbsp; rendering
       generated images in LaTeX's <b>\</b>displaystyle math mode.
       The &nbsp; <b>&#150;DTEXTSTYLE</b> &nbsp; switch wraps expressions
       inside &nbsp; <b>$&nbsp;&nbsp;$</b>, &nbsp; rendering
       generated images in LaTeX's <b>\</b>textstyle math mode.
       And the &nbsp; <b>&#150;DPARSTYLE</b> &nbsp; switch
       leaves expressions unwrapped, rendering
       generated images in LaTeX's default paragraph mode.
       Users can override any compiled default with a mathTeX
       <a href="#styledirective">style&nbsp;directive</a>. </dd>

      <dt> <a name="fontsizeswitch"> </a> <b>&#150;DFONTSIZE=5</b> </dt>
       <dd> You can specify &nbsp; <b>&#150;DFONTSIZE=1</b> &nbsp;
       thru &nbsp; <b>&#150;DFONTSIZE=10</b> &nbsp; on mathTeX's
       compile line, corresponding to default LaTeX font sizes
       <b>\</b>tiny thru <b>\</b>Huge.  If no switch is supplied,
       the default&nbsp;<b>5</b> corresponds to <b>\</b>normalsize.
       Users can override any compiled default with a mathTeX
       <a href="#fontsizedirective">\tiny...\Huge&nbsp;directive</a>. </dd>

      <dt> <a name="dpiswitch"> </a> <b>&#150;DDPI=\"120\"</b> </dt>
       <dd> The &nbsp; <b>&#150;DPI</b> &nbsp; switch changes mathTeX's
       default <a href="#dpidirective">screen&nbsp;resolution</a>
       of <b>\"120\"</b> dots-per-inch, which you enter as a string.
       <a href="#dpidirective">Some&nbsp;samples</a>
       are illustrated above. </dd>

      <dt> <a name="gammaswitch"> </a> <b>&#150;DGAMMA=\"2.5\"</b> </dt>
       <dd> The &nbsp; <b>&#150;DGAMMA</b> &nbsp; switch changes mathTeX's
       default <a href="#gammadirective">gamma&nbsp;correction</a>
       of <b>\"2.5\"</b>&nbsp;(for&nbsp;dvipng), which you enter
       as a string.  <a href="#gammadirective">Some&nbsp;samples</a>
       are illustrated above. </dd>

      <dt> <a name="quietswitch"> </a>
      <b>&#150;DQUIET</b> &nbsp; &nbsp; or <br>
      <b>&#150;DNOQUIET</b> &nbsp; &nbsp; or <br>
      <b>&#150;DNQUIET=</b><i>n</i> </dt>
       <dd> If any "!&nbsp;LaTeX&nbsp;Error:" is emitted while
       processing your expression, mathTeX's default replies
       &lt;Enter&gt; to the first three errors, and then
       replies&nbsp;"x", halting LaTeX before it produces a&nbsp;.dvi file.
       Compiling mathTeX with &nbsp; <b>&#150;DQUIET</b> &nbsp;
       replies&nbsp;"q" to the first error, making LaTeX enter batchmode,
       whereas compiling with &nbsp; <b>&#150;DNOQUIET</b> &nbsp;
       replies&nbsp;"x" to the first error, halting LaTeX immediately.
       Compiling mathTeX with &nbsp; <b>&#150;DNQUIET=</b><i>n</i> &nbsp;
       replies &lt;Enter&gt; to the first&nbsp;<i>n</i> errors, and then
       replies&nbsp;"x".
       User expressions may contain <a href="#quietdirective">
       <b>\quiet</b>,&nbsp;<b>\noquiet</b>&nbsp;or&nbsp;<b>\nquiet{</b><i>n</i><b>}</b></a>
       to override any compiled default. </dd>

      <dt> <a name="refererswitch"> </a>
      <b>&#150;DREFERER=\"</b><i>domain</i><b>\"</b> &nbsp; &nbsp; or <br>
      <b>&#150;DREFERER=\"</b><i>domain1,domain2,etc</i><b>\"</b> </dt>
       <dd> If you compile mathTeX without a &nbsp;
       <b>&#150;DREFERER=\"&nbsp;\"</b> &nbsp; switch, then anyone on
       the internet can use your mathtex.cgi program by writing a url
       of the form &nbsp;
       <b>http://www.</b><i>yourdomain</i><b>.com/cgi-bin/mathtex.cgi?x^2+y^2</b>.
       &nbsp;  So you're essentially providing mathTeX as a free
       <a href="#webservice">web&nbsp;service</a>.  I encourage this if
       you have the compute and disk resources to spare. </br>
       &nbsp; &nbsp; &nbsp; Otherwise, if compiled with &nbsp;
       <b>&#150;DREFERER=\"</b><i>domain</i><b>\"</b>, &nbsp; then mathTeX
       performs a case-insensitive search of the environment variable
       HTTP_REFERER to verify that it contains the authorized
       &nbsp; <i>domain</i> &nbsp; as a substring. <br>
       &nbsp; &nbsp; &nbsp; Or, if given a comma-separated list
       containing several &nbsp; <i>domain</i>'s</i> &nbsp; (second
       form of the switch), then HTTP_REFERER must contain either
       <i>domain1</i> or <i>domain2</i>, or <i>etc</i>, as a
       (case-insensitive) substring. <br>
       &nbsp; &nbsp; &nbsp; If HTTP_REFERER doesn't contain a substring
       matching any of these <i>domain</i>(s), then mathTeX emits the
       error message image (reporting HTTP_REFERER on the first line) <br>
       &nbsp; &nbsp; &nbsp;
       <img src="../cgi-bin/mathtex.cgi?\invalidreferer\small\sqrt{a^2+b^2}"
       alt="" border=0> <br>
       instead of the requested image. </dd>

      <dt> <a name="killtimeswitch"> </a>
      <b>&#150;DKILLTIME=10</b> </dt>
       <dd> Some expressions can unintentionally (or not) force LaTeX
       to loop endlessly, causing mathTeX to hang.  To avoid this problem,
       if LaTeX fails to complete within KILLTIME seconds, mathTeX
       kills it and emits an error.  The built-in code for this purpose
       is in mathTeX's timelimit(&nbsp;) function, which was adapted from
       <a href="http://devel.ringlet.net/sysutils/timelimit/"
       target="_top">timelimit-1.4</a>.
       Compiling mathTeX with &nbsp; <b>&#150;KILLTIME=0</b> &nbsp;
       places no timelimit restrictions on LaTeX whatsoever;
       probably not a good idea. </dd>

      <dt> <a name="timelimitswitch"> </a>
      <b>&#150;DTIMELIMIT=\"/</b><i>path</i><b>/</b><i>to</i><b>/timelimit\"
      </b> </dt>
       <dd> Rather than using mathTeX's built-in timelimit(&nbsp;) code to
       throttle LaTeX (see <a href="#killtimeswitch">&#150;DKILLTIME</a>
       immediately above), you may optionally install a standalone
       copy of <a href="http://devel.ringlet.net/sysutils/timelimit/"
       target="_top">timelimit-1.4</a> and use that instead.
       Compiling mathTeX with a switch of the form
       &nbsp; <b>&#150;TIMELIMIT=\"$(which&nbsp;timelimit)\"</b> &nbsp;
       uses your installed program instead of mathTeX's built-in
       timelimit(&nbsp;) function to throttle LaTeX.
       </dd>

      <dt> <a name="maxmsglevelswitch"> </a>
      <b>&#150;DMAXMSGLEVEL=999999</b> </dt>
       <dd> If you're running mathTeX as a
       <a href="#webservice">web&nbsp;service</a>,
       you should probably compile it with the
       &nbsp; <b>&#150;DMAXMSGLEVEL=0</b> &nbsp; switch.
       This sets the maximum verbosity allowed in a
       <a href="#msgleveldirective">\msglevel{&nbsp;}&nbsp;directive</a>.
       At <b>9</b> and above, the work directory and files
       temporarily created by mathTeX to run latex are left in place
       as a debugging aid.  These remain on your file&nbsp;system
       unless manually removed.  And remote users can't
       access them, anyway. </dd>

      <dt> <a name="usepackageswitch"> </a>
      <b>&#150;DUSEPACKAGE=\"</b><i>filename</i><b>\"</b> </dt>
       <dd> The preamble of mathTeX's default LaTeX wrapper script
       already contains \usepackage[latin1]{inputenc}, \usepackage{amsmath}
       \usepackage{amsfonts} and \usepackage{amssymb}.  All these packages
       are used with every expression submitted to mathTeX for rendering.
       And a specific expression may contain one or more
       <a href="#usepackagedirective">
       <b>\usepackage{&nbsp;}</b>&nbsp;directive</a>'s
       applied to that expression only.
       However, if you want additional packages applied to every
       expression, edit a file containing lines of the form <br>
       &nbsp; &nbsp; &nbsp; <b>"\\</b>usepackage{color}<b>\n"</b> <br>
       &nbsp; &nbsp; &nbsp; <b>"\\</b>usepackage{bm}<b>\n"</b> <br>
       &nbsp; &nbsp; &nbsp; <b>"</b><i>etc</i><b>\n"</b> <br>
       and place a corresponding
       <b>&#150;</b>DUSEPACKAGE=\"<i>filename</i><b>\"</b>
       switch on mathTeX's compile line.
       Every line in the file is enclosed in <b>"</b>quotes<b>"</b>,
       contains a <b>\n</b> before the closing quote, and
       all other backslashes are written as double-backslashes <b>\\</b>.
       And note that, although <b>\</b>usepackage's are illustrated,
       you aren't limited to them.
       All directives from this file are just placed in mathTeX's preamble.
       So you can modify the preamble any way you like. </dd>

      <dt> <a name="newcommandswitch"> </a>
      <b>&#150;DNEWCOMMAND=\"</b><i>filename</i><b>\"</b> </dt>
       <dd> Besides modifying the preamble, you may also
       want to modify the LaTeX wrapper script's body,
       particularly with (though not limited to)
       <b>\</b>newcommand's.
       Again, edit a file containing lines of the form <br>
       <nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>newcommand{\\vec}[2]{\\left({#1}_1,\\ldots,{#1}_{#2}\\right)}<b>\n"</b></nobr> <br>
       <!-- &nbsp; &nbsp; &nbsp; <b>"\\</b>newcommand{}{}<b>\n"</b> <br> -->
       &nbsp; &nbsp; &nbsp; <b>"</b><i>etc</i><b>\n"</b> <br>
       and place a corresponding
       <b>&#150;</b>DNEWCOMMAND=\"<i>filename</i><b>\"</b>
       switch on mathTeX's compile line.
       The same editing rules apply: every line in the file is
       enclosed in <b>"</b>quotes<b>"</b>,
       contains a <b>\n</b> before the closing quote, and all other
       backslashes are written as double-backslashes <b>\\</b>. <br>
       &nbsp; &nbsp; &nbsp; <b>\</b>renewcommand's in this file are
       useful to disable LaTeX commands that might pose security risks
       in mathTeX.  For example, although Unix's /etc/passwd file
       doesn't actually contain passwords, you probably don't want
       users submitting expressions like <b>\</b>input{/etc/passwd}.
       MathTeX already disables <b>\</b>input with <br>
       <nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>renewcommand{\\input}[1]{\\mbox{[[$\\backslash$input\\{#1\\} illegal]]}}\n"</b></nobr> <br>
       which just displays &nbsp; [[<b>\</b>input{file}&nbsp;illegal]]
       &nbsp; when the user tries to &nbsp; <b>\</b>input{file}. &nbsp;
       You may want to disable other commands as well. </dd>

      <dt> <a name="adswitches"> </a> <font color="black">
      <b>Advertising switches</b><font size=5>...</font></font> <br> </dt>
       <dd style="margin-left:0em;"> The next three switches
       set up a mathTeX web service that embeds advertising messages
       along with rendered images.  See
       <a href="#webservice">mathTeX&nbsp;web&nbsp;service</a> above
       for further discussion. </dd>

      <dt> <a name="adfrequencyswitch"> </a>
      <b>&#150;DADFREQUENCY=0</b> </dt>
       <dd> If ADFREQUENCY is defined as a positive number <b><i>n</i></b>,
       then one request out of every <b><i>n</i></b> submitted to mathTeX
       is randomly selected to be displayed along with a pre-defined
       "advertisement".  For example, if your expression is
       &nbsp; <b>\large\int_0^xe^{-x^2}dx</b>, &nbsp; then the default
       advertisement displays <br>
       &nbsp; &nbsp; &nbsp;
       <a href="#preview"><img id="adswitch1" onclick="eqntext('adswitch1')"
        src="../cgi-bin/mathtex.cgi?\large\advertisement
        \int_0^xe^{-x^2}dx" alt="" align="middle" border=0></a>
       &nbsp; &nbsp; instead of just &nbsp; &nbsp;
       <a href="#preview"><img id="adswitch2" onclick="eqntext('adswitch2')"
        src="../cgi-bin/mathtex.cgi?\large
        \int_0^xe^{-x^2}dx" alt="" align="middle" border=0></a> <br>
       See the <b>&#150;DADVERTISEMENT</b> switch <!-- immediately -->
       below for instructions to define your own advertisement replacing
       my default. </dd>

      <dt> <a name="adhostswitch"> </a>
      <b>&#150;DHOST_SHOWAD=\"\\000\"</b> </dt>
       <dd> Advertisement messages are usually displayed randomly,
       in one request to mathTeX out of every <b><i>n</i></b>,
       as defined by the <b>&#150;DADFREQUENCY</b> switch above.
       But if a HOST_SHOWAD string is also defined,
       then advertisements are only displayed when mathTeX is running
       on a host whose HTTP_HOST (or SERVER_NAME) environment variable
       contains that string. For example,
       <b>&#150;DHOST_SHOWAD=\"mathsite\"</b> displays advertisements
       on www.mathsite.com but never on www.mathhouse.com&nbsp;.
       The default HOST_SHOWAD value is an empty string,
       which displays advertisements on any host. </dd>

      <dt> <a name="advertisementswitch"> </a>
      <b>&#150;DADVERTISEMENT=\"</b><i>filename</i><b>\"</b> </dt>
       <dd> To define your own advertisement, replacing my default
       illustrated immediately above, edit a file containing lines
       of the form <br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>begin{center}<b>\n"</b></nobr><br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>fbox{$<b>\\</b>mbox{<b>\\</b>footnotesize<b>\\</b>LaTeX{} rendering courtesy of}<b>\n"</b></nobr><br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>atop <b>\\</b>mbox{<b>\\</b>scriptsize http://www.forkosh.com/mathtex.html}$}<b>\\\\ \n"</b></nobr><br>
        <nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>vspace*{-4mm}<b>\n"</b></nobr><br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"</b> %%beginmath%% %%expression%% %%endmath%% <b>\n"</b></nobr><br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"\\</b>end{center}<b>\n"</b></nobr><br>
       Use the same editing rules as &#150;DUSEPACKAGE and &#150;DNEWCOMMAND
       above: every line in the file is enclosed in <b>"</b>quotes<b>"</b>,
       contains a <b>\n</b> before the closing quote, and all other
       backslashes are written as double-backslashes <b>\\</b>.
       Note <b>\\\\</b> at the end of the third line,
       which LaTeX sees as <b>\\</b>.  The entire example shows how my
       default advertisement is defined. <br>
       &nbsp; &nbsp; &nbsp; Your advertisement may consist of any valid
       LaTeX commands you like.  But it must somewhere contain the line <br>
	<nobr>&nbsp; &nbsp; &nbsp; <b>"</b> %%beginmath%% %%expression%% %%endmath%% <b>\n"</b></nobr><br>
       which is replaced by the user's expression, surrounded by whatever
       math mode delimiters it specifies.  The document remains in paragraph
       mode, allowing &nbsp; <b>$&nbsp;$</b> &nbsp; and
       &nbsp; <b>\[&nbsp;\]</b> &nbsp; to be placed wherever you like. <br>
       &nbsp; &nbsp; &nbsp; Once mathTeX is compiled with your advertisement,
       test it by submitting an expression like &nbsp;
       <b>\advertisement&nbsp;x^2+y^2</b> &nbsp; containing the special
       mathTeX
       <a href="#advertisementdirective">\advertisement&nbsp;directive</a>,
       which forces that
       expression to be rendered with your advertisement.  In this case
       (and with my default advertisement message) we see <br>
       &nbsp; &nbsp; &nbsp;
       <a href="#preview"><img id="adswitch3" onclick="eqntext('adswitch3')"
       src="../cgi-bin/mathtex.cgi?\advertisement x^2+y^2"
       alt="" align="middle" border=0></a> &nbsp; &nbsp; instead of
       just &nbsp; &nbsp;
       <a href="#preview"><img id="adswitch4" onclick="eqntext('adswitch4')"
       src="../cgi-bin/mathtex.cgi?\png x^2+y^2"
       alt="" border=0></a> <br>
       regardless of your ADFREQUENCY value. </dd>
     </dl>

<h3> <a name="shell">
Running mathTeX from the shell<font size=5>...</font></a> </h3>
 <p> MathTeX is usually run by your web server as a cgi program,
     obtaining its input expression from the query-string of an
     html &lt;img&gt; tag.  But you can also run mathTeX from your Unix
     shell, supplying all input on the command line.  For example,
     &nbsp; <b>./mathtex.cgi&nbsp;"x^2+y^2"&nbsp;&#150;o&nbsp;equation1</b>
     &nbsp; renders an image of <b>x^2+y^2</b> in file <b>equation1.gif</b>.
     And with the &nbsp; <b>&#150;m&nbsp;9</b> &nbsp; switch, it's
     also useful for testing. </p>

 <p> The complete command-line syntax for mathTeX is </p>
   <pre>
   ./mathtex.cgi "expression"     expression in quotes, e.g., "x^2+y^2",
               | -f input_file    or read (unquoted) expression from input_file
               [ -o output_file ] write image to ouput_file instead of cache
               [ -m msglevel ]    verbosity of debugging message level
               [ -c cache_directory ]   path to cache directory

   "expression"    Either place LaTeX expression directly on
        the command line, between "quotes", with no -switch
        preceding it, or.....

   -f input_file   .....read (unquoted) expression from input_file.
        The input_file may contain the expression on one line
        or spread out over many lines.  If -o is not also given,
        it defaults to the same filename, e.g., -f expression.tex
        produces output file expression.tex.gif unless an
        explicit -o switch is given.

   -o output_file  write output gif or png image to this filename,
        with .gif or .png extension added to it.  If you want the
        image file written in a directory other than your pwd,
        then specify  -o path/output_file  instead.

   -m msglevel     0-99, controls verbosity/message level for
        debugging output.  If msglevel>=9 then the temporary
        directory containing latex-dvips-convert output is
        not removed.  This is your major debugging aid.

   -c cache_directory  If you specify  -o output_file  then no
        cache directory is used (-c is ignored even if you supply it).
        But if you don't specify  -o output_file  then mathTeX writes
        the rendered image to a filename in its usual cache directory
        path.  This switch maintains the standard mathTeX filename
        convention, but writes files into the specified cache directory
        instead.

   Test or Debugging Example:

     ./mathtex.cgi "\Large\frac1{\sqrt{x^2+y^2}}" -o equation1 -m 9
        creates file equation1.gif and saves all the intermediate
        work in temp subdirectory 673d88e172f77f0aafabf6d72e5777ba/
        which is the MD5 hash of the input expression.

     After the copyright notice, screen output from the above command
     should look something like
        mathTeX> running image:     ./mathtex.cgi
        mathTeX> input expression:  "\Large\frac1{\sqrt{x^2+y^2}}"
        mathTeX> working directory: 673d88e172f77f0aafabf6d72e5777ba/
        mathTeX> output image file: equation1.gif

   Production Example (same as above, but without -m 9):

     ./mathtex.cgi "\Large\frac1{\sqrt{x^2+y^2}}" -o equation1
        creates file equation1.gif containing an image of
        the expression (all intermediate work files are removed).

     After the copyright notice, screen output from the above command
     should look something like
        mathTeX> input expression:  "\Large\frac1{\sqrt{x^2+y^2}}"
        mathTeX> output image file: equation1.gif
     Redirect stdout to /dev/null if you don't want to see it.
   </pre>


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ GPL
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="gpl"> (5) GPL License &nbsp; </h2>

<font color="black">
<b>&quot</b><i>My grandfather once told me there are two kinds of people:<br>
&nbsp &nbsp Those who do the work and those who take the credit.<br>
&nbsp &nbsp He told me to try to be in the first group; there was much
less competition.</i><b>&quot</b><br>
Indira Gandhi, the late Prime Minister of India</font> <br>

 <p> MathTeX's copyright is registered by me with the US Copyright Office,
     and I hereby license it to you under the terms and conditions of the
     <a href="http://www.gnu.org/licenses/gpl.html" target="_top">GPL</a>.
     There is no official support of any kind whatsoever,
     and you use mathTeX entirely at your own risk, with no guarantee
     of any kind, in particular with no warranty of merchantability. </p>

 <p> By using mathTeX, you warrant that you have read, understood
     and agreed to these terms and conditions, and that you possess
     the legal right and ability to enter into this agreement
     and to use mathTeX in accordance with it. </p>

 <p> Hopefully, the law and ethics regarding computer programs will
     evolve to make this kind of obnoxious banter unnecessary.
     In the meantime, please forgive me my paranoia. </p>

 <p> To protect your own intellectual property, I recommend (both pdf)
     <a href="http://www.copyright.gov/circs/circ01.pdf"
     target="_top">Copyright&nbsp;Basics</a> from The Library of Congress,
     in particular <a href="http://www.copyright.gov/circs/circ61.pdf"
     target="_top">Circular&nbsp;61</a>, Copyright Registration for
     Computer Programs.
     <!-- and similarly,
     <a href="http://www.abanet.org/intelprop/comm106/106copy.html"
     target="_top">Copyright Basics</a> from The American Bar Association. -->
     Very briefly, download
     <a href="http://www.copyright.gov/forms/formtxi.pdf">Form&nbsp;TX</a>
     and follow the included instructions.
     In principle, you automatically own the copyright
     to anything you write the moment it's on paper.  In practice,
     if the matter comes under dispute, the courts look _very_ favorably
     on you for demonstrating your intent by registering the copyright.
     For example, courts will stop unauthorized use of unregistered
     material, but monetary damages are awarded _only_ if you
     register the copyright before infringement occurs. </p>


<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ CONCLUDING REMARKS
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<h2 id="remarks"> Concluding Remarks &nbsp; </h2>

<p> I hope you find mathTeX useful.  If so, a contribution to your
  country's <a href="http://www.tug.org" target="_top">TeX Users Group</a>,
  or to the <a href="http://www.gnu.org" target="_top">GNU</a> project, is
  suggested, especially if you're a company that's currently profitable. </p>
  

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Footer across bottom of page
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
<hr size=4>
<table> <tr>
 <td align="left" width="70%"> <font size=3 color="maroon"> <b>
  <nobr>Copyright <font size=5>&copy;</font> 2007-2012,
  <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a>
  </nobr><br>
  email: <a href="mailto:john&#64;forkosh&#46;com">john&#64;forkosh&#46;com</a>
  </b> </font> </td>
<!-- -->
 <td align="left" width="30%">
      <img src="../cgi-bin/mimetex.cgi?\blue{\small\rm You're the }
       \Large\counter[mathtexcounters.log]
       {mathtexcounters.txt:mathtex.html}\\[0]
       {\small\rm visitor to this page.}" alt="" border=0 align=bottom> </td>
<!-- -->
</tr> </table>
</body>
<!--
<script type="text/javascript"
    src="http://mathcache.s3.amazonaws.com/replacemath.js"> </script>
<script type="text/javascript">
    replaceMath( document.body ); </script>
-->
</html>
<!-- end-of-file mathtex.html -->