mathtex.html 149 KB
Newer Older
Fjen Undso's avatar
Fjen Undso committed
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
<!--
 ****************************************************************************
 * 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">
For faster browsing, not all history is shown. View entire blame