--- loncom/cgi/mimeTeX/mimetex.html 2006/03/24 23:08:33 1.2 +++ loncom/cgi/mimeTeX/mimetex.html 2007/10/09 21:41:41 1.3 @@ -1,6 +1,6 @@ @@ -126,7 +126,7 @@ Banner across top of page, containing ti mimeTeX QuickStart
- + download mimeTeX @@ -140,7 +140,7 @@ Banner across top of page, containing ti
-Copyright © 2002-2005, +Copyright © 2002-2006, John Forkosh Associates, Inc.
email: john@forkosh.com


@@ -219,7 +219,8 @@ Table of Contents     unzip mimetex.zip
    cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi
Now just mv mimetex.cgi to your cgi-bin/ - directory,
and you're all done. + directory,
set permissions as necessary, and you're all done. +   Usage:     @@ -263,23 +264,28 @@ SECTION I. INTRODUCTION f(x)=\int\limits_{-\infty}^xe^{-t^2}dt" alt="" border=0 align=middle> wherever you put that <img> tag. MimeTeX doesn't need intermediate dvi-to-gif conversion, and it doesn't - create separate gif files for each converted expression.

- -

There's also no inherent need to repeatedly write the cumbersome - <img> tag illustrated above. You can write your own custom - tags, or write a wrapper script around mimeTeX to simplify the - notation. For example, - - PmWiki already has a - - mimeTeX plugin that lets you just write - {$ f(x)=\int_{-\infty}^xe^{-t^2}dt $} - to obtain the same image. Or, if you're using - phpBB, then - Jameson - contributed the following one-line mod that lets you just write - [tex] ... [/tex] to obtain mimeTeX images:

-
   #--------[open]-----------------------------------------------------
+    create separate gif files for each converted expression.
+    (But you can enable image caching with mimeTeX's
+      -DCACHEPATH=\"path/\"  
+    compile option.) 

+ +

+mimeTeX plugins...

+

There's no inherent need to repeatedly write the cumbersome + <img> tag illustrated above. You can write your own custom tags, + or write a wrapper script around mimeTeX to simplify the + notation.

+ +

For example, if you're using + phpBB2, then + Jameson + contributed the following typical one-line mod that lets you just write + [tex] f(x)=\int_{-\infty}^xe^{-t^2}dt [/tex] + to obtain the same image illustrated above:

+
   #--------[open]-----------------------------------------------------
      /includes/bbcode.php
    #--------[find]-----------------------------------------------------
      // Remove our padding from the string..
@@ -287,7 +293,91 @@ SECTION I.  INTRODUCTION
      $text = preg_replace('/\[tex\](.*?)\[\/tex\]/ie',
      "'<img src=\"/cgi-bin/mimetex.cgi?'.rawurlencode('$1').'\" align=\"middle\" />'",
      $text);
+

If you're using + phpBB3, + then no mod is even needed. + Just click Postings from the Administrator Control Panel, + and add the custom BBCode [tex]{TEXT}[/tex]   + with the HTML replacement + <img src="/cgi-bin/mimetex.cgi?{TEXT}" align=middle>

+ +

Similarly, PmWiki also has a + + mimeTeX plugin that lets you just write + {$ f(x)=\int_{-\infty}^xe^{-t^2}dt $} + to obtain that same image.   Several other packages + also have similar mimeTeX plugins:

+
+ + + + + + + + + + + + + + + + + + + + +
 Package      Plugin  
+ + PmWiki   + mimeTeX plugin
+ + Wikimedia   + "mimeTeX alternative"
+ MathWiki   "mimeTeX Parser"
+ PunBB   + mimeTeX plugin
+ + Movable Type   mimeTeX plugin
+ WordPress   + + mimeTeX plugin
+ +

Please note: If you're writing your own plugin for mimeTeX, + please don't write php code using system( ), or any other + shell escape mechanism, just to cache images. Use mimeTeX's +   -DCACHEPATH=\"path/\"   + compile option instead. + system( ) raises security + issues, either real ones if used carelessly, or just in the minds of + system administrators. Either way, I've received many emails from + people unable to use mimeTeX because of unnecessary system( ) + calls prohibited by security-conscious sysadmins. MimeTeX itself poses + minimal risk when used as illustrated above, but you're responsible + for any plugin/wrapper script you write around it.

+

+Alternative solutions...

MimeTeX's benefit over similar math-on-the-web solutions is, as mentioned above, its easy installation. But if that's not a problem for you, and if your site's server already has a LaTeX @@ -321,7 +411,7 @@ SECTION I. INTRODUCTION   turorials are readily available. You may also want to browse Andrew Roberts' - Latex Math I and - Latex Math II, or my own LaTeX math tutorial. @@ -563,7 +653,7 @@ EXAMPLES alt="" border=0 align=middle>         @@ -840,7 +930,8 @@ using \longxxxarrow[] and \begin{array} available with mimeTeX. All symbols and sizes from cmr, cmmi, cmmib (use \mathbf{ }), cmsy, cmex, bbold (use \mathbb{ }), rsfs (use \mathscr{ }), - and stmary should be available, but they're not all shown. + stmary and cyrillic wncyr (use {\cyr  } or + \cyr{ }) should be available, but they're not all shown. And also not shown are various "constructed symbols" like \sqrt, accents, etc. The illustrated font sizes are numbered 4=\Large, 3=\large and 2=\normalsize (not shown are 7=\Huge, 6=\huge, @@ -912,14 +1003,17 @@ to the larger size in \displaystyle mode 1$\rm~117-127:~&\sqcap&\sqsubseteq&\sqsupseteq&\S&\dag&\ddag&\P&\clubsuit& \Diamond&\Heart&\spadesuit}" alt="" border=0 align=middle>

-

a few other cmmi, cmr, and stmary symbols at mimeTeX font size 4

+

a few other cmmi, cmr, stmary and wncyr symbols +at mimeTeX font size 4

@@ -953,17 +1047,23 @@ Indira Gandhi, the late Prime Minister o

To protect your own intellectual property, I recommend Copyright Basics from The Library of Congress, and - similarly, Copyright Basics from The American Bar Association. + target="_top">Copyright Basics from The Library of Congress, + in particular Circular 61, Copyright Registration for + Computer Programs. + Very briefly, download Form TX 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.

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

+ mimetex.zip and then type @@ -1003,7 +1103,7 @@ SECTION II. BUILDING MIMETEX
@@ -1262,6 +1362,11 @@ Ascii dump of bitmap image... \textstyle, \displaystyle, \limits or \nolimits directives in an expression always override the DISPLAYSIZE default. +
-DGAMMA=gammacorrection
+
Applies gammacorrection to antialiased + gif images. Default is 1.25 (rather than the standard 2.2). + Specify 0.0 to turn off gamma correction (1.0 makes no + gamma correction but doesn't actually turn it off).
-DNEWCOMMANDS=\"newcommands.h\"
LaTeX-like \newcommand's are available in mimeTeX, via the following facility to help you define your @@ -1313,6 +1418,10 @@ Ascii dump of bitmap image...
    To see many additional examples, search for the uppercase string NEWCOMMANDS in mimetex.c, and look below that. All the above examples are already there.
+
-DOPAQUE
+
By default, mimeTeX renders gif images with black symbols + on a transparent white background. Defining OPAQUE renders + images on an opaque background instead.
-DPATHPREFIX=\"path/\"
The \input{ } and \counter{ } commands discussed below @@ -1324,7 +1433,33 @@ Ascii dump of bitmap image... defined as path/ if you want input files in some other directory. And make sure your path/ ends with / (or with \ for Windows).
-
-DREFERER=\"domain\" or
+
-DPLUSBLANK       -or-
+ -DPLUSNOTBLANK
+
mimeTeX receives your LaTeX math expression as a url + query string, in which blank spaces are often encoded + as %20 or as plus signs +, and + where actual plus signs are often encoded as %2B. + But these conventions aren't always respected, + and even when they are blank spaces may be either + %20 or +. The only ambiguity for + mimeTeX is whether or not to translate plus signs + + back to blank spaces.
+       If you know how your applications behave, + then define PLUSBLANK to always translate plus signs + + to blank spaces, or define PLUSNOTBLANK to never translate.
+       Otherwise, if you define neither, + mimeTeX applies some common-sense rules to decide whether or + not to translate. These usually work, but can't be guaranteed. + If your query string contains actual blank spaces or + blanks encoded as %20, then plus signs + + aren't translated. Otherwise, if your query string + contains %2B, then plus signs + are + translated. If neither %20 nor %2B, or both + %20 and %2B, occur in your query string, + then the situation is ambiguous. In this case, if mimeTeX + finds two or more plus signs ++ with no intervening + space, then they're translated; otherwise they're not.
+
-DREFERER=\"domain\"       -or-
-DREFERER=\"domain1,domain2,etc\"
Blocks mimeTeX requests from unauthorized domains that are using your mimetex.cgi (hence your server's resources) @@ -1355,7 +1490,7 @@ Ascii dump of bitmap image... could conceivably flood your file system by submitting zillions of \counter{filename} commands to mimeTeX, each with a different filename.
-
-DSMASHMARGIN=n or
+
-DSMASHMARGIN=n       -or-
-DNOSMASH
TeX typically renders an expression like \frac12\int_{a+b+c}^{d+e+f}g(x)dx as @@ -1373,7 +1508,7 @@ Ascii dump of bitmap image... number of pixels between smashed symbols (default is 3), compile with -DSMASHMARGIN=n. See Smash for further discussion.
-
-DWARNINGS=n or
+
-DWARNINGS=n       -or-
-DNOWARNINGS
If an expression submitted to mimeTeX contains an unrecognzied escape sequence, e.g., "y=x+\abc+1", then @@ -1387,7 +1522,8 @@ Ascii dump of bitmap image...
-DWHITE
MimeTeX usually renders black symbols on a white background. This option renders white symbols on - a black background instead.
+ a transparent black background instead (or on an opaque + black background when combined with -DOPAQUE ). @@ -1403,7 +1539,9 @@ Ascii dump of bitmap image... possibly useful functionality from the command line. In particular, you can store a gif (or xbitmap) image of any expression to a file. No syntax checking is applied to command-line arguments, so enter - them carefully.

+ them carefully. (Likewise, plus signs + are never + translated to blank spaces, nor is any other %xx url decoding + performed on command-line arguments.)

The complete command-line syntax for mimeTeX is

@@ -1468,6 +1606,8 @@ Ascii dump of bitmap image...
           display utility,
                ./mimetex  -o -d  "x^2+y^2" | display &
           opens a small window containing the rendered expression.
+          (Note: if you already compiled mimeTeX with -DOPAQUE
+          then  -o  renders images on a transparent background.)
 
      -s fontsize   0-7, font size.  Font size can also be specified
           within the expression by a directive, e.g., \Large f(x)=x^2
@@ -1555,17 +1695,46 @@ SECTION III.  SYNTAX REFERENCE
      As usual, you must explicitly write one of the recognized math
      spaces to put extra visible space in your rendered expressions. 

-

MimeTeX recognizes math spaces \, \: \; as well as - \/ and \quad and \qquad . You may also - write \hspace{10} to insert a 10-pixel (or any other number) - space, scaled by any preceding \unitlength, - as illustrated just above. There are no negative spaces.

+

MimeTeX recognizes math spaces \/ \, \: \; + as well as \quad and \qquad , + and also a backslashed blank   +   + (i.e., a \ followed by a blank). + For example,   + (a\/b\,c\:d\;e\  f\quad  g\qquad  h) +   renders   + . + In mimeTeX, you may also write   \hspace{10}   + to insert a 10-pixel (or any other number) space, scaled by any + preceding \unitlength, as illustrated + just above.

+ +

For negative spaces,   \!   produces a small (two + pixel) negative space, e.g.,   a=b   renders   + +   whereas   a\!=b   renders   + +   and   a\!\!=b   renders   + . + For large negative space,   \hspace{-10}   permits + a negative argument. But it stops at the first pixel to its left + rather than "erasing" pixels. If you don't want to stop, use +   \hspace*{-10}   instead. For example, +   ABC\hspace*{-20}-DEF   renders   + ,   erasing all of the C + and the right half of the B.

+

MimeTeX also supports \hfill{textwidth}, where textwidth is roughly equivalent to LaTeX's @@ -1574,18 +1743,18 @@ SECTION III. SYNTAX REFERENCE expression will span. However, if \hfill{ } appears within a { }-enclosed subexpression, then it applies only to that subexpression. For example,

- {abc \hfill{50} def} \hfill{100} ghi + {abc \hfill{75} def} \hfill{150} ghi     produces    

- The first/inner \hfill{50} inserts exactly enough whitespace so - that subexpression "abc  def" spans 50 pixels. - Then the second/outer \hfill{100} inserts exactly enough - whitespace so that the entire expression spans 100 pixels. + The first/inner \hfill{75} inserts exactly enough whitespace so + that subexpression "abc  def" spans 75 pixels. + Then the second/outer \hfill{150} inserts exactly enough + whitespace so that the entire expression spans 150 pixels. Without explicit { }-nesting, mimeTeX evaluates expressions - left-to-right (sinistrally), e.g., ...\hfill{100}...\hfill{50}... - is exactly equivalent to ...\hfill{100}{...\hfill{50}...}. + left-to-right (sinistrally), e.g., ...\hfill{150}...\hfill{75}... + is exactly equivalent to ...\hfill{150}{...\hfill{75}...}. Notice that, this time, the second/right textwidth argument is necessarily smaller than the first/left.

@@ -1675,14 +1844,20 @@ and some other characters.. defined by the mimeTeX preprocessor, function mimeprep( ) in mimetex.c     Generally speaking, I've tried to encode the cmr10, cmmi10, cmmib10, cmsy10, cmex10, bbold10, rsfs10, - and stmary10 families with "names", e.g., \alpha \beta + stmary10 and wncyr10 families with "names", e.g., \alpha \beta \forall \sqcup, etc, identical to your LaTeX expectations. For example, the calligraphic symbols in cmsy10 are accessed by writing \mathcal{A} \mathcal{B} \mathcal{XYZ}. Similarly, write \mathbf{A} for the cmmib fonts, write \mathscr{A} - for rsfs10, and write \mathbb{R} for bbold10. - And see stmaryrd.dvi or stmaryrd.sty, supplied with most LaTeX - distributions, for the names of the stmary10 symbols.

+ for rsfs10, write \mathbb{R} for bbold10, and write + {\cyr Khrushchev} or \cyr{Khrushchev} to see + . + Most LaTeX distributions supply stmaryrd.dvi and stmaryrd.sty + that both document the names of the stmary10 symbols. + Similarly, amsfndoc.dvi documents the names of the wncyr10 + cyrillic symbols and ligatures.

For example,

anything at all   just produces   .. src="../cgi-bin/mimetex.cgi?\normalsize\textit{anything at all}" alt="" border=0 align=middle>     instead.
+

You don't usually surround mimeTeX expressions with $'s, + but that works in the usual way for \text{ } and + \mbox{ }, rendering the $...$-enclosed + subexpression in mathmode. For example,

+ n=\left\{m/2\text{    if $m$ even} + \\(m+1)/2\text{  if $m$ odd}\right. +   produces   +
+

(IIIc) Delimiters  

@@ -2165,7 +2359,7 @@ and some other characters.. [ ] and \{ \}, limits are default-rendered \displaystyle, which is why \right|\nolimits_a^b was required. --> You can also write \left\sum, \left\prod, - \left\cup, etc, for many of the symbols in CMEX10. + \left\cup, etc, for many of the symbols in CMEX10 and STMARY10. And any symbol that works with \left will also work with \right .