File:
[LON-CAPA] /
loncom /
cgi /
mimeTeX /
mimetex.html
Revision
1.1:
download - view:
text,
annotated -
select for diffs
Mon Feb 28 19:08:11 2005 UTC (19 years, 5 months ago) by
albertel
Branches:
MAIN
CVS tags:
version_2_1_X,
version_2_1_3,
version_2_1_2,
version_2_1_1,
version_2_1_0,
version_2_0_X,
version_2_0_99_1,
version_2_0_2,
version_2_0_1,
version_2_0_0,
version_1_99_3,
version_1_99_2,
version_1_99_1_tmcc,
version_1_99_1,
version_1_99_0_tmcc,
version_1_99_0,
HEAD
- adding tex->image convertor (mimeTeX)
1: <!--
2: ****************************************************************************
3: * Copyright(c) 2002-2005, John Forkosh Associates, Inc. All rights reserved.
4: * ==========================================================================
5: * This file is part of mimeTeX, which is free software. You may redistribute
6: * and/or modify it under the terms of the GNU General Public License,
7: * version 2 or later, as published by the Free Software Foundation.
8: * MimeTeX is distributed in the hope that it will be useful, but
9: * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
10: * See the GNU General Public License for specific details.
11: * By using mimeTeX, you warrant that you have read, understood and
12: * agreed to these terms and conditions, and that you possess the legal
13: * right and ability to enter into this agreement and to use mimeTeX
14: * in accordance with it.
15: * Your mimeTeX distribution should contain a copy of the GNU General
16: * Public License. If not, write to the Free Software Foundation, Inc.,
17: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA,
18: * or point your browser to http://www.gnu.org/licenses/gpl.html
19: ****************************************************************************
20: -->
21: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
22: "http://www.w3.org/TR/html4/loose.dtd">
23: <!-- "http://www.forkosh.dreamhost.com/loose.dtd" -->
24:
25: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26: Preamble
27: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
28: <html>
29: <head>
30: <title> mimeTeX user's manual </title>
31: <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
32: <style type="text/css">
33: body { background-image: none; /* none; or url(); */
34: /*background-repeat: repeat-y;*/
35: /*background-attachment: fixed;*/ /* fixed; or scroll; */
36: background-color: #ffffff; color: #000000;
37: margin-left: 0.5em; margin-right: 0.1em;
38: font-size: large; /* or medium */
39: clear: both }
40: A:active { color: blue/*#0000FF*/; text-decoration: none }
41: A:link { color: blue/*#0000FF*/; text-decoration: none }
42: A:visited { color: blue/*#0000FF*/; text-decoration: none }
43: A:hover { color: red/*#FF0000*/; text-decoration: underline
44: /*font-style: italic; font-weight: bold;*/
45: /*font-size: normal; line-height: normal*/ }
46: h1 { color: maroon; text-decoration: underline;
47: font-style: normal; /* italic oblique */
48: font-size: xx-large;
49: padding-top: 2.0em;
50: letter-spacing: 0.25em }
51: h2 { color: maroon; text-decoration: underline;
52: font-style: normal; /* italic oblique */
53: font-size: x-large;
54: padding-top: 1.0em;
55: letter-spacing: 0.20em }
56: h3 { color: maroon; /*black; text-decoration: underline;*/
57: font-style: normal; /* italic oblique */
58: font-size: large;
59: margin-left: 1em;
60: padding-top: 0.5em;
61: letter-spacing: 0.15em }
62: center { padding-top: -0.1em; padding-bottom: -0.1em; }
63: table { font-size: large }
64: table.medium { font-size: medium }
65: dl { font-size: large;
66: margin-left: 3.0em; margin-right: 2.5em }
67: ol { margin-left: 3.0em; margin-right: 2.5em }
68: ul { margin-left: 3.0em; margin-right: 2.5em;
69: list-style-type: square }
70: ul ul { margin-left: -0.5em; margin-right: 3.5em;
71: list-style-type: disc }
72: pre { margin-left: 3.0em; font-size: medium; font-weight: bold }
73: p { margin-left: 2.0em; margin-right: 1.5em }
74: p:first-letter
75: { font-size: x-large; font-weight: bold;
76: color: maroon }
77: p.continue { margin-left: 2.0em; margin-right: 1.5em;
78: padding-top: -0.1em }
79: p.continue:first-letter
80: { font-size: large; font-weight: normal;
81: color: black }
82: p.warning { color: red } /* defines p class=warning */
83: </style>
84: <script type="text/javascript">
85: <!--
86: // add/clear text to expression
87: function eqntext(eqn)
88: { var eqnSrc = document.getElementById(eqn).src;
89: var texSrc = eqnSrc.substring(eqnSrc.indexOf('?')+1,eqnSrc.length);
90: addtext(texSrc); }
91: function addtext(text)
92: { cleartext();
93: document.expression.formdata.value += unescape(text);
94: document.expression.formdata.focus(); }
95: function cleartext()
96: { document.expression.formdata.value = "";
97: //document.inlineframe.value = "";
98: document.expression.formdata.focus(); }
99: -->
100: </script>
101: </head>
102: <body>
103:
104: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105: Banner across top of page, containing title and two example mimeTeX images.
106: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
107: <br>
108: <hr size=4>
109: <center>
110: <table cellspacing=10>
111: <tr>
112: <td align="center">
113: <a href="#preview"><img id="imageBanr1" onclick="eqntext('imageBanr1')"
114: src="../cgi-bin/mimetex.cgi?\Large f=b_o+\frac{a_1}{b_1+\frac{a_2}
115: {b_2+\frac{a_3}{b_3+a_4}}}" alt="" border=0 align=middle></a> </td>
116: <td align="center" valign="middle">
117: <center> <font color="maroon" size=4>
118: <b><nobr>m i m e T e X m a n u a l</nobr></b> <br>
119: <font size=3>( for mimeTeX version 1.60 )</font> <br>
120: <font size=3> <b>Click for:</b>
121: <!-- <a href="http://www.forkosh.com" target="_top">homepage</a>,
122: <a href="http://www.forkosh.com/resume.html" target="_top">resume</a> -->
123: <a href="http://www.forkosh.com/mimetextutorial.html" target="_top">
124: LaTeX tutorial</a><br>
125: <a href="http://www.forkosh.com/mimetex.html" target="_top">
126: mimeTeX QuickStart</a><br>
127: <!-- jfa <a href="http://www.forkosh.com/mimetex.zip"> -->
128: <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip">
129: <font size=4>download mimeTeX</font></a></font>
130: </font> </center> </td>
131: <td align="center">
132: <a href="#preview"><img id="imageBanr2" onclick="eqntext('imageBanr2')"
133: src="../cgi-bin/mimetex.cgi?\Large\scr{J}^{ij}=\frac12\varepsilon_{ijk}
134: \left[\begin{array}{cc}\sigma_k&0\\0&\sigma_k\end{array}\right]"
135: alt="" border=0 align=middle></a> <br>
136: <a href="#examples">more_examples...</a> </td>
137: </tr>
138: </table>
139: </center>
140: <hr size=4>
141: <center><b><font color="maroon" size=3>
142: Copyright <font size=5>©</font> 2002-2005,
143: <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a> <br>
144: email: <a href="mailto:john@forkosh.com">john@forkosh.com</a>
145: </font></b></center>
146:
147:
148: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
149: Table of Contents
150: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
151: <br><br>
152: <center><b><font color="maroon" size=5>
153: <u> C o n t e n t s </u></font></b>
154: <br>
155: <table cellspacing=0 class="medium">
156: <tr>
157: <td valign="top" align="center" width=150>
158: <b>- - - T u t o r i a l - - -</b> </td>
159: <td valign="top" align="center" colspan=3 width=450>
160: - - - - - - - - - - - - - - R e f e r e n c e - - - - - - - - - - - - - -</td>
161: </tr>
162: <tr>
163: <td valign="top" align="center" width=150> <font size=3>
164: <a href="#introduction"> (I) Introduction </a><br>
165: <a href="#quickstart"> a. Quick Start </a><br>
166: <a href="#examples"> b. Examples </a><br>
167: <a href="#gpl"> c. GPL License </a> </font> </td>
168: <td valign="top" align="center" width=150> <font size=3>
169: <a href="#build"> (II) Building mimeTeX </a><br>
170: <a href="#download"> a. Download </a><br>
171: <a href="#compile"> b. Compile </a><br>
172: <a href="#install"> c. Install </a><br>
173: <a href="#options"> d. Compile Options </a><br>
174: <a href="#cmdline"> e. Command Line </a> </font> </td>
175: <td valign="top" align="center" width=150> <font size=3>
176: <a href="#reference"> (III) Syntax Reference </a><br>
177: <a href="#spaces"> a. Math & White Space </a><br>
178: <a href="#symbols"> b. Symbols, Sizes, Modes </a><br>
179: <a href="#delimiters"> c. Delimiters </a><br>
180: <a href="#accents"> d. Accents, Arrows, etc. </a><br>
181: <a href="#array"> e. \begin{array} </a><br>
182: <a href="#picture"> f. \picture( ){ } </a><br>
183: <a href="#commands"> g. Other Commands </a><br>
184: <a href="#exceptions"> h. Other Exceptions </a> </font> </td>
185: <td valign="top" align="center" width=150> <font size=3>
186: <a href="#appendices"> (IV) Appendices </a><br>
187: <a href="#fonts"> a. Fonts </a><br>
188: <a href="#makeraster"> b. make_raster() </a><br>
189: <a href="#gifsave"> c. gifsave.c </a>
190: <br><a href="#remarks"> Remarks </a> </font> </td>
191: </tr>
192: </table></center>
193:
194:
195: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
196: SECTION I. INTRODUCTION
197: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
198: <h1> <a name="introduction">(I) Introduction</a> </h1>
199:
200: <p> <font color="maroon">MimeTeX, licensed under the
201: <a href="http://www.gnu.org/licenses/gpl.html" target="_top">gpl</a>,
202: lets you easily embed LaTeX math in your html pages.</font>
203: It parses a LaTeX math expression and immediately emits the
204: corresponding gif image, rather than the usual TeX dvi.
205: And mimeTeX is an entirely separate little program that doesn't use
206: TeX or its fonts in any way. It's just one cgi that you put in your
207: site's cgi-bin/ directory, with no other dependencies. So mimeTeX
208: is very easy to <a href="#quickbuild">install</a>. And it's equally
209: easy to use. Just place an html <img> tag in your document
210: wherever you want to see the corresponding LaTeX expression.
211: For example, </p>
212: <pre> <img src="../cgi-bin/mimetex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt"
213: alt="" border=0 align=middle></pre> <p class="continue">immediately
214: generates the corresponding gif image on-the-fly, displaying
215: <a href="#preview"><img id="imageI1" onclick="eqntext('imageI1')"
216: src="../cgi-bin/mimetex.cgi?f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
217: alt="" border=0 align=middle></a> wherever you put that <img> tag.
218: MimeTeX doesn't need intermediate dvi-to-gif conversion, and it doesn't
219: store separate gif files for each converted expression.
220: There's also no inherent need to repeatedly write the cumbersome
221: <img> tag illustrated above. You can write your own custom
222: tags, or write a wrapper script around mimeTeX to simplify the
223: notation. For example,
224: <a href="http://www.pmichaud.com/wiki/PmWiki/PmWiki" target="_top">
225: PmWiki</a> already has a
226: <a href="http://www.pmichaud.com/wiki/Cookbook/MimeTeX" target="_top">
227: mimeTeX plugin</a> that let's you just write
228: <b>{$ f(x)=\int_{-\infty}^xe^{-t^2}dt $}</b>
229: to obtain the same image. </p>
230:
231: <p> MimeTeX's benefit over similar math-on-the-web solutions is, as
232: mentioned above, its easy installation. But if that's not a
233: problem for you, and if your site's server already has a LaTeX
234: distribution installed, and suitable image conversion utilities like
235: <a href="http://www.imagemagick.org" target="_top">ImageMagick</a>,
236: then you may prefer to look at a math rendering script like
237: <a href="http://www.mayer.dial.pipex.com/tex.htm#latexrender"
238: target="_top">latexrender</a>
239: which uses LaTeX to create higher quality images than mimeTeX
240: produces. For comparison,
241: <a href="#preview"><img id="imageI2" onclick="eqntext('imageI2')"
242: src="../cgi-bin/mimetex.cgi?f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
243: alt="" border=0 align=middle></a>, with arbitrary mean
244: <a href="#preview"><img id="imageI3" onclick="eqntext('imageI3')"
245: src="../cgi-bin/mimetex.cgi?\large\mu" alt="" border=0 align=middle></a>
246: and standard deviation
247: <a href="#preview"><img id="imageI4" onclick="eqntext('imageI4')"
248: src="../cgi-bin/mimetex.cgi?\large\sigma" alt="" border=0
249: align=middle></a>, and at mimeTeX's next larger font size, looks like </p>
250: <center>
251: <table>
252: <tr align="center">
253: <td> <font size="4">mimeTeX</font> </td>
254: <td> <img src="../cgi-bin/mimetex.cgi?\hspace{30}"
255: alt="" border=0> </td>
256: <td> <font size="4">latexrender</font> </td>
257: </tr>
258: <tr align="center">
259: <td>
260: <a href="#preview"><img id="imageI5" onclick="eqntext('imageI5')"
261: src="../cgi-bin/mimetex.cgi?\large
262: f(x)={\Large\frac1{\sigma\sqrt{2\pi}}}
263: \int_{\small-\infty}^xe^{\small-\frac{(t-\mu)^2}{2\sigma^2}}dt"
264: alt="" border=0 align=middle></a> </td>
265: <td> </td>
266: <td> <img src="http://www.forkosh.com/lrender.gif"
267: alt="" border=0 align=middle> </td>
268: </tr>
269: </table>
270: </center>
271: <p> Similar LaTeX-based solutions that you may want to look at are
272: <a href="http://www.fourmilab.ch/webtools/textogif/textogif.html"
273: target="_top">textogif</a> and
274: <a href="http://www.math.uio.no/~martingu/gladtex/"
275: target="_top">gladTeX</a>. Additional discussion and several more
276: links are at <a href="http://www.tug.org/interest.html#web"
277: target="_top">www.tug.org/interest.html</a> and in the
278: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=LaTeX2HTML"
279: target="_top">tex-faq</a>. </p>
280:
281: <p> The remainder of this introductory mimeTeX tutorial section contains </p>
282: <ul>
283: <li> First, a concise <a href="#quickstart">Quickstart</a> providing
284: just enough information for you to try rendering your own
285: expressions by <a href="#preview">Submitting Queries</a>
286: right from this page. </li>
287: <li> Then, a variety of additional <a href="#examples">Examples</a>
288: that more fully illustrate mimeTeX's capabilities
289: (later on, Section III comprises a more complete mimeTeX
290: <a href="#reference">Syntax Reference</a>). </li>
291: <li> Finally, the <a href="#gpl">gpl</a> license, whose terms
292: and conditions you must agree to before using mimeTeX.</li>
293: </ul>
294: <p> You may now want to browse the additional <a href="#examples">Examples</a>
295: below before proceeding, to make sure mimeTeX suits your needs before you
296: invest more time learning to use it. </p>
297:
298:
299: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
300: QUICKSTART
301: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
302: <h2> <a name="quickstart"> (Ia) Quick Start </a> </h2>
303:
304: <p> <!-- Unlike MathML, --> MimeTeX is as TeX-like as possible (though
305: not 100% compliant), and you must already be familiar with LaTeX
306: math markup to use it. If you're not, many online LaTeX
307: <a href="http://www.tug.org/begin.html#doc" target="_top">turorials</a>
308: are readily available. You may also want to browse Andrew Roberts'
309: <a href="http://www.comp.leeds.ac.uk/andyr/misc/latex/latextutorial9.html"
310: target="_top">Latex Math I</a> and
311: <a href="http://www.comp.leeds.ac.uk/andyr/misc/latex/latextutorial10.html"
312: target="_top">Latex Math II</a>, or my own
313: <a href="http://www.forkosh.com/mimetextutorial.html" target="_top">
314: LaTeX math tutorial</a>.
315: Then, instead of continuing to read this page, you may prefer to
316: play with mimeTeX yourself. In that case, just Submit any LaTeX
317: math expression you like in the Query Box below. I've started
318: you out with a little example already in the box, or, instead,
319: you can Click any of the <a href="#examples">Examples</a> below
320: to place that corresponding expression in the Query Box. </p>
321:
322: <p> Meanwhile, here are just a few quickstart tips for Submitting
323: your own mimeTeX expressions in the Query Box below: </p>
324: <ul>
325: <li> MimeTeX currently has six font sizes selected by
326: one of the usual declarations
327: <b>\tiny</b> or <b>\small</b> or <b>\normalsize</b> (default),
328: or <b>\large</b> or <b>\Large</b> or <b>\LARGE</b> .
329: For example, <b>\Large \sqrt{x^2+y^2}</b>
330: renders <b>\sqrt{x^2+y^2}</b> two sizes above
331: <b>\normalsize</b>. </li>
332: <!-- <li> At smaller font sizes, try preceding your expression with
333: <b>\light</b> which adjusts mimeTeX's anti-aliasing
334: parameters to produce thinner lines that you may feel are
335: more legible, e.g.,<br>
336: <a href="#preview"><img id="imageIA1" onclick="eqntext('imageIA1')"
337: src="../cgi-bin/mimetex.cgi?\light\small\displaystyle
338: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
339: align=middle> </a>   versus
340: <a href="#preview"><img id="imageIA2" onclick="eqntext('imageIA2')"
341: src="../cgi-bin/mimetex.cgi?\small\displaystyle
342: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
343: align=middle> </a> </li> -->
344: <li> <!-- For displaystyle math mode limits illustrated above,
345: write either
346: <b>\displaystyle e^x=\sum_{n=0}^\infty\frac{x^n}{n!}</b>
347: or <b>e^x=\sum\limits_{n=0}^\infty\frac{x^n}{n!}</b>
348: in the usual way (ditto for <b>\int</b>, <b>\prod</b>,
349: <b>\cup</b>, <b>\cap</b>, etc). --> <!-- MimeTeX also recognizes
350: <b>\Bigint</b>, <b>\Bigsum</b>, <b>\Bigprod</b>, and several
351: similar extra symbols which are a little bigger, and which
352: automatically render displaystyle limits. -->
353: <!-- MimeTeX default-renders limits displaystyle at sizes
354: <b>\large</b> and larger (see the <b>-DDISPLAYSIZE=<i>n</i></b>
355: <a href="#options">compile option</a> below to change the
356: default). <b>\textstyle</b> overrides this default for
357: your entire expression, or <b>\nolimits</b> overrides it
358: for a single operator. -->
359: By default, mimeTeX renders limits textstyle
360: <a href="#preview"> <img id="imageB1" onclick="eqntext('imageB1')"
361: src="../cgi-bin/mimetex.cgi?\normalsize\textstyle
362: \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0 align=middle></a>
363: at sizes <b>\normalsize</b> and smaller,
364: and renders them displaystyle
365: <a href="#preview"> <img id="imageB2" onclick="eqntext('imageB2')"
366: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
367: \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0 align=middle></a>
368: at sizes <b>\large</b> and larger.
369: The LaTeX directives <b>\displaystyle</b> or <b>\textstyle</b>,
370: and <b>\limits</b> or <b>\nolimits</b>, override mimeTeX's default
371: in the usual way. Or see the <b>-DDISPLAYSIZE=<i>n</i></b>
372: <a href="#options">compile option</a> below to change
373: the default. </li>
374: </ul>
375: <p> <a name="forminput"> </a> <a name="preview"> </a>
376: Now enter your own expression, use the sample provided,
377: or Click any of the <a href="#examples">Examples</a>.
378: Then press the Submit button, and mimeTeX's rendering should be
379: displayed in the little window immediately below it. </p>
380: <center>
381: <table border="2" cellpadding="5" cellspacing="0">
382: <tr align="center"><td>
383: <form name="expression" action="../cgi-bin/mimetex.cgi"
384: method="get" target="inlineframe">
385: <table border="0" cellpadding="0" cellspacing="1">
386: <tr align="left"><td>
387: <!-- <font color="#000000" size="+1"><u><b>Enter your
388: Expression in Box below, or Click any Example ...
389: </b></u></font> <br> -->
390: <textarea name="formdata" rows="5" cols="72"
391: >\Large f(x)=\int_{-\infty}^x e^{-t^2}dt</textarea> <br>
392: </td></tr>
393: <tr align="center"><td>
394: <font size="-1"> <input type="button" onClick="cleartext()"
395: value="Clear Expression">
396: <input type="submit" value="Submit Expression"> </font>
397: </td></tr>
398: </table>
399: </form>
400: <iframe name="inlineframe" align="middle" width="85%" height="110">
401: <p>iframe's not supported if you see this.</p>
402: </iframe>
403: </td></tr>
404: </table>
405: </center>
406: <p> You should see
407: <a href="#preview"><img id="imageIA3" onclick="eqntext('imageIA3')"
408: src="../cgi-bin/mimetex.cgi?f(x)=\int\limits_{-\infty}^x e^{-t^2}dt"
409: alt="" border=0 align=middle></a> if you submit the sample expression
410: already in the box. </p>
411:
412: <p> And the <img> tag to embed this same integral anywhere
413: in your own document is </p>
414: <pre> <img src="../cgi-bin/mimetex.cgi?\large f(x)=\int_{-\infty}^xe^{-t^2}dt"
415: alt="" border=0 align=middle></pre>
416:
417: <p> You can see numerous additional examples illustrating html
418: <img> tags using mimeTeX by viewing this page's source.
419: The typical mimeTeX <img> tag has the form </p>
420: <pre> <img src="../cgi-bin/mimetex.cgi?any valid LaTeX/mimeTeX expression"
421: alt="" border=0 align=middle></pre> <p class="continue">
422: where <b>../cgi-bin/mimetex.cgi</b> is the relative path from your html
423: page containing these tags to your compiled mimetex.cgi program, and
424: where <b>any valid LaTeX/mimeTeX expression</b>
425: is pretty much any valid LaTeX math expression: </p> <ul>
426: <li> As discussed in the <a href="#introduction">Introduction</a>,
427: you can replace cumbersome <img> tags with your own custom
428: tags or wrapper scripts. </li>
429: <li> And there are occasional exceptions where I couldn't program
430: mimeTeX to precisely mimic all valid LaTeX syntax.
431: One particular "gotcha" to be aware of is that mimeTeX bindings
432: are pretty much left-to-right. Thus, for example, although
433: mimeTeX correctly interprets <b>\frac12</b> as well as
434: <b>\frac1{x^2}</b>, etc, the legal LaTeX expression
435: <b>x^\frac12</b> must be written <b>x^{\frac12}</b>.
436: Otherwise, mimeTeX interprets it as <b>{x^\frac}12</b>, i.e.,
437: the same way <b>x^\alpha12</b> would be interpreted, which is
438: nonsense for <b>\frac</b>. The same "gotcha" also applies to
439: other combinations of commands, e.g., you must write
440: <b>\sqrt{\frac\alpha\beta}</b>, etc.
441: The <a href="#reference">Syntax Reference</a> section
442: contains much additional information. Or you can just begin
443: playing with mimeTeX for yourself to see if it might have
444: any potential usefulness for you. </li>
445: <li> Besides the occasional exceptions discussed above, mimeTeX
446: also provides various LaTeX extensions, i.e., LaTeX errors
447: permitted by mimetex. For example, font size changing
448: directives like <b>\Large</b> are permitted within mimeTeX
449: math mode expressions. But note well: if you take
450: advantage of mimeTeX extensions, your math mode expressions
451: will no longer be accepted by standard TeX engines. </li> </ul>
452:
453:
454: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
455: EXAMPLES
456: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
457: <h2> <a name="examples"> (Ib) Examples </a> </h2>
458:
459: <p> Here are various additional random examples further demonstrating
460: mimeTeX's features and usage. To see how they're done, Click any
461: one of them to place its corresponding expression in the
462: <a href="#preview">Query Box</a> above. Then press Submit
463: to re-render it, or you can edit the expression first to suit
464: your own purposes. </p>
465:
466: <table cellspacing=15>
467: <!-- first example: taylor series for e^x at various font sizes and colors
468: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
469: <tr>
470: <td>
471: <font size=5><a name="example1">(1)</a></font> </td>
472: <td align="left" colspan=4>
473: <a href="#preview">
474: <img id="example1a" onclick="eqntext('example1a')"
475: src="../cgi-bin/mimetex.cgi?\red\small\displaystyle
476: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
477: alt="" border=0 align=middle></a>    
478: <a href="#preview">
479: <img id="example1b" onclick="eqntext('example1b')"
480: src="../cgi-bin/mimetex.cgi?\green\normalsize\displaystyle
481: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
482: alt="" border=0 align=middle></a>    
483: <a href="#preview">
484: <img id="example1c" onclick="eqntext('example1c')"
485: src="../cgi-bin/mimetex.cgi?\blue\large
486: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
487: alt="" border=0 align=middle></a>    
488: <a href="#preview">
489: <img id="example1d" onclick="eqntext('example1d')"
490: src="../cgi-bin/mimetex.cgi?\reverse\opaque\light
491: \Large e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
492: alt="" border=0 align=middle></a>    
493: <a href="#preview">
494: <img id="example1e" onclick="eqntext('example1e')"
495: src="../cgi-bin/mimetex.cgi?\Large
496: e^x=\lim_{n\to\infty} \left(1+\frac xn\right)^n"
497: alt="" border=0 align=middle></a>
498: </td>
499: </tr>
500:
501: <!-- second example
502: +++++++++++++++++++ -->
503: <tr>
504: <td>
505: <font size=5>(2)</font> </td>
506: <td align="left" colspan=4>
507: <a href="#preview">
508: <img id="example2" onclick="eqntext('example2')"
509: src="../cgi-bin/mimetex.cgi?\Large\frac{dv^m}{ds}=-\Gamma^m_{oo}v^{o^2}
510: =-g^{mn}\Gamma_{noo}v^{o^2}=\frac12g^{mn}g_{oo,n}v^{o^2}"
511: alt="" border=0 align=middle></a> </td>
512: </tr>
513:
514: <!-- third example
515: ++++++++++++++++++ -->
516: <tr>
517: <td>
518: <font size=5>(3)</font> </td>
519: <td align="left" colspan=4>
520: <a href="#preview">
521: <img id="example3" onclick="eqntext('example3')"
522: src="../cgi-bin/mimetex.cgi?\Large\varepsilon=\sum_{i=1}^{n-1}
523: \frac1{\Delta x}\int_{x_i}^{x_{i+1}}\left\{\frac1{\Delta x}\big[
524: (x_{i+1}-x)y_i^\ast+(x-x_i)y_{i+1}^\ast\big]-f(x)\right\}^2dx"
525: alt="" border=0 align=middle></a> </td>
526: </tr>
527:
528: <!-- fourth example: solution to quadratic, definition of derivative
529: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
530: <tr>
531: <td>
532: <font size=5>(4)</font> </td>
533: <td align="left" colspan=4>
534: <table>
535: <tr>
536: <td align="left">
537: <a href="#preview">
538: <img id="example4a" onclick="eqntext('example4a')"
539: src="../cgi-bin/mimetex.cgi?\LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}"
540: alt="" border=0 align=middle></a> </td>
541: <td>
542: solution for quadratic </td>
543: </tr>
544: <tr> <td> <br> </td> </tr>
545: <tr>
546: <td align="left">
547: <a href="#preview">
548: <img id="example4b" onclick="eqntext('example4b')"
549: src="../cgi-bin/mimetex.cgi?\large f^\prime(x)\ =
550: \lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}"
551: alt="" border=0 align=middle></a> </td>
552: <td>
553: definition of derivative </td>
554: </tr>
555: </table> </td>
556: </tr>
557:
558: <!-- fifth example: continued fraction
559: +++++++++++++++++++++++++++++++++++++++ -->
560: <tr>
561: <td>
562: <font size=5>(5)</font> </td>
563: <td align="left">
564: <a href="#preview">
565: <img id="example5" onclick="eqntext('example5')"
566: src="../cgi-bin/mimetex.cgi?\LARGE f=b_o+\frac{a_1}{b_1+
567: \frac{a_2}{b_2+\frac{a_3}{b_3+a_4}}}"
568: alt="" border=0 align=middle></a> </td>
569: <td>
570: illustrating <b>\frac{}{}</b> for continued fraction </td>
571: </tr>
572:
573: <!-- sixth example: demonstrating \left\{ ... \right.
574: +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
575: <tr>
576: <td>
577: <font size=5>(6)</font> </td>
578: <td align="left">
579: <a href="#preview">
580: <img id="example6" onclick="eqntext('example6')"
581: src="../cgi-bin/mimetex.cgi?\LARGE\tilde y=\left\{
582: {\ddot x\text{ if x odd}\atop\hat{\,\bar x+1}\text{ if even}}\right."
583: alt="" border=0 align=middle></a> </td>
584: <td>
585: illustrating <b>\left\{...\right<font size=5>.</font></b>
586: <!-- we may write <b>\{...\.</b> --> <br>
587: and note the accents </td>
588: </tr>
589:
590: <!-- seventh example: demonstrating \overbrace \underbrace
591: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
592: <tr>
593: <td>
594: <font size=5>(7)</font> </td>
595: <td align="center">
596: <a href="#preview">
597: <img id="example7" onclick="eqntext('example7')"
598: src="../cgi-bin/mimetex.cgi?\Large\overbrace{a,...,a}^{\text{k a^,s}},
599: \underbrace{b,...,b}_{\text{l b^,s}}\hspace{10}
600: \normalsize\underbrace{\overbrace{a...a}^{\text{k a^,s}},
601: \overbrace{b...b}^{\text{l b^,s}}}_{\text{k+l elements}}"
602: alt="" border=0 align=middle></a> </td>
603: <td>
604: <b>\overbrace{}^{}</b> and <b>\underbrace{}_{}</b> <br>
605: (TeXbook page 181, Exercise 18.41) </td>
606: </tr>
607:
608: <!-- eighth example: demonstrating \begin{array}
609: +++++++++++++++++++++++++++++++++++++++++++++++++ -->
610: <tr>
611: <td>
612: <font size=5>(8)</font> </td>
613: <td align="left" colspan=4>
614: <table>
615: <tr>
616: <td align="left" colspan=2>
617: <a href="#preview">
618: <img id="example8a" onclick="eqntext('example8a')"
619: src="../cgi-bin/mimetex.cgi?\Large\scr{J}^{i0}=+\frac i2
620: \left[\begin{array}{cc}\sigma_i&0\\0&-\sigma_i\end{array}\right]
621: \hspace{10}\scr{J}^{ij}=\frac12\varepsilon_{ijk}
622: \left[\begin{array}{cc}\sigma_k&0\\0&\sigma_k\end{array}\right]"
623: alt="" border=0 align=middle> </a> </td>
624: </tr>
625: <tr> <td> <br> </td> </tr>
626: <tr>
627: <td align="left">
628: <a href="#preview">
629: <img id="example8b" onclick="eqntext('example8b')"
630: src="../cgi-bin/mimetex.cgi?\Large A\ =\ \large\left(
631: \begin{array}{c.ccc}&1&2&3\\\hdash1&a_{11}&a_{12}&a_{13}\\
632: 2&a_{21}&a_{22}&a_{23}\\3&a_{31}&a_{32}&a_{33}\end{array}\right)"
633: alt="" border=0 align=middle></a> </td>
634: <td>
635: demonstrating <a href="#array">\begin{array}</a>'s dashed lines </td>
636: </tr>
637: </table> </td>
638: </tr>
639:
640: <!-- ninth example: block diagonal form using nested arrays
641: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
642: <tr>
643: <td>
644: <font size=5><a name="example9">(9)</a></font> </td>
645: <td align="left" colspan="2">
646: <a href="#preview">
647: <img id="example9c" onclick="eqntext('example9c')"
648: src="../cgi-bin/mimetex.cgi?\normalsize
649: \left(\large\begin{array}{GC+23}
650: \varepsilon_x\\\varepsilon_y\\\varepsilon_z\\\gamma_{xy}\\
651: \gamma_{xz}\\\gamma_{yz}\end{array}\right)\ {\Large=}
652: \ \left[\begin{array}{CC}
653: \begin{array}\frac1{E_{\fs{+1}x}}
654: &-\frac{\nu_{xy}}{E_{\fs{+1}x}}
655: &-\frac{\nu_{\fs{+1}xz}}{E_{\fs{+1}x}}\\
656: -\frac{\nu_{yx}}{E_y}&\frac1{E_{y}}&-\frac{\nu_{yz}}{E_y}\\
657: -\frac{\nu_{\fs{+1}zx}}{E_{\fs{+1}z}}&
658: -\frac{\nu_{zy}}{E_{\fs{+1}z}}
659: &\frac1{E_{\fs{+1}z}}\end{array} & {\LARGE 0} \\
660: {\LARGE 0} & \begin{array}\frac1{G_{xy}}&&\\
661: &\frac1{G_{\fs{+1}xz}}&\\&&\frac1{G_{yz}}\end{array}
662: \end{array}\right]
663: \ \left(\large\begin{array}
664: \sigma_x\\\sigma_y\\\sigma_z\\\tau_{xy}\\\tau_{xz}\\\tau_{yz}
665: \end{array}\right)"
666: alt="" border=0 align=middle></a> </td>
667: <td align="left">
668: Block diagonal form using nested <b>\begin{array}</b>'s.<br>
669: Also, note rows aligned across all three arrays.
670: </td>
671: </tr>
672:
673: <!-- tenth example: demonstrating \begin{eqnarray} to align equations
674: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
675: <tr>
676: <td>
677: <font size=5>(10)</font> </td>
678: <td align="center">
679: <a href="#preview">
680: <img id="example10" onclick="eqntext('example10')"
681: src="../cgi-bin/mimetex.cgi?\Large\left.\begin{eqnarray}
682: x+y+z&=&3\\2y&=&x+z\\2x+y&=&z\end{eqnarray}\right\}"
683: alt="" border=0 align=middle></a> </td>
684: <td>
685: using <a href="#array">\begin{eqnarray}</a> to align equations </td>
686: </tr>
687:
688: <!-- eleventh example: demonstrating commutative diagram
689: using \longxxxarrow[] and \begin{array}
690: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
691: <tr>
692: <td>
693: <font size=5>(11)</font> </td>
694: <td align="center">
695: <a href="#preview">
696: <img id="example11" onclick="eqntext('example11')"
697: src="../cgi-bin/mimetex.cgi?\Large\begin{array}{rccclBCB}
698: &f&\longrightarrow[75]^{\alpha:{\normalsize f\rightarrow g}}&g\\
699: \large\gamma&\longdownarrow[50]&&\longdownarrow[50]&\large\gamma\\
700: &u&\longrightarrow[75]_\beta&v\end{array}"
701: alt="" border=0 align=middle></a> </td>
702: <td>
703: commutative diagram using <a href="#array">\begin{array}</a> </td>
704: </tr>
705:
706: <!-- twelfth example: demonstrating \picture
707: +++++++++++++++++++++++++++++++++++++++++++++ -->
708: <tr>
709: <td>
710: <font size=5>(12)</font> </td>
711: <td align="left">
712: <a href="#preview">
713: <img id="example12" onclick="eqntext('example12')"
714: src="../cgi-bin/mimetex.cgi?\Large\hspace{5}\unitlength{1}
715: \picture(175,100){ (50,50){\circle(100)}
716: (1,50){\overbrace{\line(46)}^{4$\;\;a}}
717: (52,50){\line(125)} (50,52;115;2){\mid} (52,55){\longleftar[60]}
718: (130,56){\longrightar[35]} (116,58){r} (c85,50;80;2){\bullet}
719: (c85,36){\large-q} (c165,36){\large q}
720: (42,30){\underbrace{\line(32)}_{\small a^2/r\;\;\;}} }"
721: alt="" border=0 align=middle></a> </td>
722: <td valign="middle">
723: mimeTeX <a href="#picture">\picture(size){pic_elems}</a>
724: "environment", illustrating the image charge <b>- q</b>
725: for a grounded conducting sphere of radius <b>a</b> with
726: a charge <b>q</b> at distance <b>r > a</b> outside it. </td>
727: </tr>
728:
729: <!-- thirteenth example: demonstrating \picture
730: +++++++++++++++++++++++++++++++++++++++++++++++++ -->
731: <tr>
732: <td>
733: <font size=5>(13)</font> </td>
734: <td align="left">
735: <a href="#preview">
736: <img id="example13" onclick="eqntext('example13')"
737: src="../cgi-bin/mimetex.cgi?\small\hspace{10}\unitlength{.75}
738: \picture(120,220){ (60,200){\circle(120,40)} (0,20){\line(0,180)}
739: (5,189;0,-30){\pict(110,20){(c20,10;70;2){
740: \pict(40,20){(20,10){\circle(40,20)}(c10,10)+(c30,10)-}} } }
741: (119,20){\line(0,180)} (60,20){\circle(120,40;34)}}"
742: alt="" border=0 align=middle></a> </td>
743: <td valign="middle"> <a href="#picture">\picture</a> "environment"
744: illustrating the surface polarization charge induced by a uniform
745: electric field. Inside the slab of material, the volume polarization
746: charge clearly vanishes. <br><br> The little
747: <img src="../cgi-bin/mimetex.cgi?\small\unitlength{.75} \pict(40,20){(20,10)
748: {\circle(40,20)}(c10,10)+(c30,10)-}" alt="" border=0 align=middle>
749: dipole image is drawn only once, then multiput across two columns, and
750: then that result is further multiput down the rows. MimeTeX \picture's
751: can be used as picture elements in other pictures, nested to any level.
752: The image at left is picture-in-picture-in-picture. </td>
753: </tr>
754: </table>
755: <br><br>
756:
757: <!-- font examples
758: ++++++++++++++++++ -->
759: <p> Finally, illustrated below are some examples of fonts and symbols
760: available with mimeTeX. All symbols and sizes from cmr, cmmi. cmsy,
761: cmex and rsfs should be available, but they're not all shown.
762: Mathbb symbols are also available but not shown.
763: And also not shown are various "constructed symbols" like \sqrt,
764: accents, etc. The illustrated font sizes are numbered 4=\Large,
765: 3=\large and 2=\normalsize (not shown are 5=\LARGE, 1=\small and
766: 0=\tiny). </p>
767:
768: <h3>cmmi latin uppercase, and lowercase</h3>
769: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
770: 2$\rm~size~4:~&4$A&4$B&4$C&4$D,&4$a&4$b&4$c&4$d\\
771: 2$\rm~3:~&3$E&3$F&3$G&3$H&3$I&3$J&3$K&3$L,&3$e&3$f&3$g&3$h&3$i&3$j&3$k&3$l\\
772: 2$\rm~2:~&2$M&2$N&2$O&2$P&2$Q&2$R&2$S&2$T&2$U&2$V&2$W&2$X&2$Y&2$Z,&
773: 2$m&2$n&2$o&2$p&2$q&2$r&2$s&2$t&2$u&2$v&2$w&2$x&2$y&2$z}"
774: alt="" border=0 align=middle> </p>
775:
776: <h3>calligraphic, and rsfs (<b>\cal{A}, \scr{B}, etc</b>)</h3>
777: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
778: 2$\rm~size~4:~&4$\calA&4$\calB&4$\calC&4$\calD&4$\calE&4$\calF&4$\calG,&
779: 4$\scrA&4$\scrB&4$\scrC&4$\scrD&4$\scrE&4$\scrF&4$\scrG\\
780: 2$\rm~3:~&3$\calH&3$\calI&3$\calJ&3$\calK&3$\calL&3$\calM&3$\calN&3$\calO&
781: 3$\calP,&
782: 3$\scrH&3$\scrI&3$\scrJ&3$\scrK&3$\scrL&3$\scrM&3$\scrN&3$\scrO&3$\scrP\\
783: 2$\rm~2:~&2$\calQ&2$\calR&2$\calS&2$\calT&2$\calU&
784: 2$\calV&2$\calW&2$\calX&2$\calY&2$\calZ,&
785: 2$\scrQ&2$\scrR&2$\scrS&2$\scrT&2$\scrU&2$\scrV&2$\scrW&
786: 2$\scrX&2$\scrY&2$\scrZ}"
787: alt="" border=0 align=middle> </p>
788:
789: <h3>cmmi greek uppercase, and \var lowercase</h3>
790: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
791: 2$\rm~size~4:~&4$\Gamma&4$\Delta&4$\Theta&4$\Lambda&4$\Xi&4$\Pi&4$\Sigma&
792: 4$\Upsilon&4$\Phi&4$\Psi&4$\Omega,&4$\rm~~&4$\varepsilon&4$\vartheta&4$\varpi&
793: 4$\varrho&4$\varsigma&4$\varphi\\
794: 2$\rm~3:~&3$\Gamma&3$\Delta&3$\Theta&3$\Lambda&3$\Xi&3$\Pi&3$\Sigma&
795: 3$\Upsilon&3$\Phi&3$\Psi&3$\Omega,&~&3$\varepsilon&3$\vartheta&3$\varpi&
796: 3$\varrho&3$\varsigma&3$\varphi\\
797: 2$\rm~2:~&2$\Gamma&2$\Delta&2$\Theta&2$\Lambda&2$\Xi&2$\Pi&2$\Sigma&
798: 2$\Upsilon&2$\Phi&2$\Psi&2$\Omega,&~&2$\varepsilon&2$\vartheta&2$\varpi&
799: 2$\varrho&2$\varsigma&2$\varphi}"
800: alt="" border=0 align=middle> </p>
801:
802: <h3>cmmi greek lowercase</h3>
803: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
804: 2$\rm~size~4:~&4$\alpha&4$\beta&4$\gamma&4$\delta&4$\epsilon&4$\zeta&
805: 4$\eta&4$\theta&4$\iota&4$\kappa&4$\lambda&4$\mu&4$\nu&4$\xi&4$%%\omicron%%&
806: 4$\pi&4$\rho&4$\sigma&4$\tau&4$\upsilon&4$\phi&4$\chi&4$\psi&4$\omega\\
807: 2$\rm~3:~&3$\alpha&3$\beta&3$\gamma&3$\delta&3$\epsilon&3$\zeta&
808: 3$\eta&3$\theta&3$\iota&3$\kappa&3$\lambda&3$\mu&3$\nu&3$\xi&3$%%\omicron%%&
809: 3$\pi&3$\rho&3$\sigma&3$\tau&3$\upsilon&3$\phi&3$\chi&3$\psi&3$\omega\\
810: 2$\rm~2:~&2$\alpha&2$\beta&2$\gamma&2$\delta&2$\epsilon&2$\zeta&
811: 2$\eta&2$\theta&2$\iota&2$\kappa&2$\lambda&2$\mu&2$\nu&2$\xi&2$%%\omicron%%&
812: 2$\pi&2$\rho&2$\sigma&2$\tau&2$\upsilon&2$\phi&2$\chi&2$\psi&2$\omega}"
813: alt="" border=0 align=middle> </p>
814:
815: <h3>cmsy symbols at mimeTeX font size 3</h3>
816: <p> <img src="../cgi-bin/mimetex.cgi?\array{3,r$1$\rm~chars~\\
817: 1$\rm~0-15:~&-&\cdot&\times&\ast&\div&\diamond&\pm&\mp&
818: \oplus&\ominus&\otimes&\oslash&\odot&\bigcirc&\circ&\bullet\\
819: 1$\rm~16-31:~&\asymp&\equiv&\subseteq&\supseteq&\leq&\geq&\preceq&\succeq&
820: \sim&\approx&\subset&\supset&\ll&\gg&\prec&\succ\\
821: 1$\rm~32-47:~&\leftar&\rightar&\uparr&\downar&\leftrightar&\near&\sear&
822: \simeq&\Leftar&\Rightar&\Upar&\Downar&\Leftrightar&\nwar&\swar&\propto\\
823: 1$\rm~48-63:~&\prime&\infty&\in&\ni&\triangle&\bigtriangledo&/&\'&
824: \forall&\exists&\neg&\emptyset&\Re&\Im&\top&\bot\\
825: 1$\rm~64-100:~&\aleph&&\calA&4$.\,.\,.&\calZ&&\cup&\cap&
826: \uplus&\wedge&\vee&\vdash&\dashv&\lfloor&\rfloor&\lceil\\
827: 1$\rm~101-116:~&\rceil&\lbrace&\rbrace&\langle&\rangle&\mid&\parallel&
828: \updownar&\Updownar&\setminus&\wr&\surd&\amalg&\nabla&\int&\sqcup\\
829: 1$\rm~117-127:~&\sqcap&\sqsubseteq&\sqsupseteq&\S&\dag&\ddag&\P&\clubsuit&
830: \Diamond&\Heart&\spadesuit}" alt="" border=0 align=middle> </p>
831:
832: <h3>a few other cmmi and cmr symbols at mimeTeX font size 4</h3>
833: <p> <img src="../cgi-bin/mimetex.cgi?\array{4,r$
834: 1$\rm~cmmi:~&\leftharpoonup&\leftharpoondo&\rightharpoonup&\rightharpoondo&
835: \triangleright&\triangleleft&\star&\partial&
836: \flat&\natural&\sharp&\smile&\frown&\ell&\imath&\jmath&\wp&\vec\\
837: 1$\rm~cmr:~&\ss&\ae&\oe&\AE&\OE}" alt="" border=0 align=middle> </p>
838:
839:
840: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
841: GPL
842: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
843: <h2> <a name="gpl"> (Ic) GPL License </a> </h2>
844:
845: <font color="black">
846: <b>"</b><i>My grandfather once told me there are two kinds of people:<br>
847:     Those who do the work and those who take the credit.<br>
848:     He told me to try to be in the first group; there was much
849: less competition.</i><b>"</b><br>
850: Indira Gandhi, the late Prime Minister of India</font> <br>
851:
852: <p> MimeTeX's copyright is registered by me with the US Copyright Office,
853: and I hereby license it to you under the terms and conditions of the
854: <a href="http://www.gnu.org/licenses/gpl.html" target="_top">GPL</a>.
855: There is no official support of any kind whatsoever,
856: and you use mimeTeX entirely at your own risk, with no guarantee
857: of any kind, in particular with no warranty of merchantability. </p>
858:
859: <p> By using mimeTeX, you warrant that you have read, understood
860: and agreed to these terms and conditions, and that you <!-- are at least
861: 18 years of age and --> possess the legal right and ability to enter
862: into this agreement and to use mimeTeX in accordance with it. </p>
863:
864: <p> Hopefully, the law and ethics regarding computer programs will
865: evolve to make this kind of obnoxious banter unnecessary.
866: In the meantime, please forgive me my paranoia. </p>
867:
868: <p> To protect your own intellectual property, I recommend
869: <a href="http://lcweb.loc.gov/copyright/circs/circ1.html"
870: target="_top">Copyright Basics</a> from The Library of Congress, and
871: similarly, <a href="http://www.abanet.org/intelprop/comm106/106copy.html"
872: target="_top">Copyright Basics</a> from The American Bar Association.
873: Very briefly, download
874: <a href="http://www.copyright.gov/forms/formtxi.pdf">Form TX</a>
875: and follow the included instructions.
876: In principle, you automatically own the copyright
877: to anything you write the moment it's on paper. In practice,
878: if the matter comes under dispute, the courts look _very_ favorably
879: on you for demonstrating your intent by registering the copyright. </p>
880:
881:
882:
883: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
884: SECTION II. BUILDING MIMETEX
885: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
886: <h1> <a name="build"> (II) Building mimeTeX </a> </h1>
887:
888: <!-- <center> -->
889: <table border="0" cellpadding="0" cellspacing="0">
890: <tr><td><center><hr size="2">Very quickly --- download
891: <!-- jfa <a href="http://www.forkosh.com/mimetex.zip"> -->
892: <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip">
893: mimetex.zip</a> and then type
894: <table border="0" cellpadding="0" cellspacing="0">
895: <tr align="left">
896: <td><img src="../cgi-bin/mimetex.cgi?\hspace{50}" alt="" border=0></td>
897: <td><b>unzip mimetex.zip</b> <br>
898: <b>cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b></td>
899: </tr></table>
900: Now <b>mv</b> mimetex.cgi to your <b>cgi-bin/</b>
901: directory, and you're all done. <br>
902: Read the rest of this section for more detailed
903: information.<hr size="2"></center></td>
904: <td><img src="../cgi-bin/mimetex.cgi?\hspace{150}" alt="" border=0></td>
905: </tr></table>
906: <!-- </center> -->
907:
908: <p> I've built and run mimeTeX under Linux and NetBSD using gcc. The source
909: code is ansi-standard C, and should compile and execute under all
910: environments without any change whatsoever. Build instructions below
911: are for Unix. Modify them as necessary for your particular situation
912: (note the -DWINDOWS switch if applicable). </p>
913:
914: <p> A summary of the steps needed to build mimeTeX is </p>
915: <ul>
916: <li> Download and unzip
917: <!-- jfa <a href="http://www.forkosh.com/mimetex.zip"> -->
918: <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip">
919: mimetex.zip</a> in any convenient working directory. </li>
920: <li> To compile an executable that emits anti-aliased gif images
921: (which is how the page you're viewing is displayed)<br>
922: <b>cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b> </li>
923: <li> or, to emit gif images without anti-aliasing<br>
924: <b>cc -DGIF mimetex.c gifsave.c -lm -o mimetex.cgi</b> </li>
925: <li> Alternatively, to compile an executable that emits mime xbitmaps<br>
926: <b>cc -DXBITMAP mimetex.c -lm -o mimetex.cgi</b> </li>
927: <li> Compile Notes: <ul>
928: <li> If (and only if) you're compiling a Windows executable with
929: the <b>-DAA</b> or <b>-DGIF</b> option (but not -DXBITMAP), then
930: add <b>-DWINDOWS</b> . For example, <br>
931: <b>cc -DAA -DWINDOWS
932: mimetex.c gifsave.c -lm -o mimetex.cgi</b> <br>
933: The above Unix-like syntax works with
934: <a href="http://www.mingw.org" target="_top">MinGW</a> and
935: <a href="http://www.delorie.com/djgpp/" target="_top">djgpp</a>
936: Windows compilers, but probably not with most others,
937: where it's only intended as a "template". </li>
938: <!-- <li> If you're compiling on Sun or VMS, and see about a zillion
939: irritating warnings, try adding <b>-DSIGNEDCHAR</b>
940: (for VMS, that's cc/define=(AA,SIGNEDCHAR) mimetex.c) </li> -->
941: </ul> </li>
942: </ul>
943: <p> And a summary of the steps needed to install mimeTeX is </p>
944: <ul>
945: <li> Just mv mimetex.cgi to your server's <b>cgi-bin/</b>
946: directory, set permissions as necessary, and you're all done. </li>
947: <li> Now, to quickly test your mimetex.cgi, try typing a url into
948: your browser's locator window something like
949: <b>http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?x^2+y^2</b>
950: which should display
951: <img src="../cgi-bin/mimetex.cgi?x^2+y^2" alt="" border=0
952: align=middle> in the upper-left corner of your window. </li>
953: <li> After the preceding test succeeds, you can optionally
954: "regression test" all mimeTeX features as follows:<ul>
955: <li> mv mimetex.html (this file) to your server's <b>htdocs/</b>
956: directory </li>
957: <li> If the relative path from htdocs to cgi-bin isn't
958: <b>../cgi-bin</b> then edit mimetex.html and change the
959: few dozen occurrences as necessary (globally changing
960: <b>../cgi-bin/mimetex.cgi</b> should work). </li>
961: <li> Now visit your page
962: <b>http://www.<i>yourdomain</i>.com/mimetex.html</b> </li>
963: <li> Once mimetex.html displays properly, you can assume
964: everything is working, and can begin authoring html documents
965: using mimetex.cgi to render your own math. </li> </ul>
966: </ul>
967: <p> Any problems with the above?
968: Read the more detailed instructions below. </p>
969:
970:
971: <h2> <a name="download"> (IIa) Download </a> </h2>
972:
973: <p> Download
974: <!-- jfa <a href="http://www.forkosh.com/mimetex.zip"> -->
975: <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip">
976: mimetex.zip</a> and unzip it in any convenient working directory.
977: Your working directory should now contain </p> <center>
978: <table cellpadding=0 cellspacing=0>
979: <tr><td width=100>README</td> <td>mimeTeX release notes</td></tr>
980: <tr><td>LICENSE</td> <td>GPL license, under which you may use
981: mimeTeX</td></tr>
982: <tr><td>mimetex.c</td> <td>mimeTeX source program and all required
983: functions</td></tr>
984: <tr><td>mimetex.h</td> <td>header file for mimetex.c (and for
985: gfuntype.c)</td></tr>
986: <tr><td>gfuntype.c</td> <td>parses output from <b>gftype -i</b>
987: and writes bitmap data</td></tr>
988: <tr><td>texfonts.h</td> <td>output from several <b>gfuntype</b> runs,
989: needed by mimetex.c</td></tr>
990: <tr><td>gifsave.c</td> <td>gif library by Sverre H. Huseby
991: <a href="http://shh.thathost.com">
992: http://shh.thathost.com</a></td></tr>
993: <tr><td>mimetex.html</td> <td>this file, mimeTeX tutorial and
994: user's manual</td></tr>
995: </table></center>
996: <p> Note: all files use Unix line termination, i.e., linefeeds
997: (without carriage returns) signal line endings. Conversion for
998: Windows PC's, Macs, VMS, etc, can usually be accomplished by
999: unzip's -a option, i.e., unzip -a mimetex.zip </p>
1000:
1001:
1002: <h2> <a name="compile"> (IIb) Compile </a> </h2>
1003:
1004: <p> To compile a mimeTeX executable that emits anti-aliased gif images
1005: (which is recommended for most uses) issue the command </p>
1006: <center><b>cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b>
1007: </center>
1008:
1009: <p> Or, for an executable that emits gif images without anti-aliasing,
1010: issue the command </p>
1011: <center><b>cc -DGIF mimetex.c gifsave.c -lm -o mimetex.cgi</b>
1012: </center>
1013:
1014: <p> Alternatively, to compile a mimeTeX executable that emits
1015: mime xbitmaps, just issue the command </p>
1016: <center><b>cc -DXBITMAP mimetex.c -lm -o mimetex.cgi</b>
1017: </center>
1018:
1019: <p> Compile Notes: </p> <ul>
1020: <li> If (and only if) you're compiling a Windows executable with
1021: the <b>-DAA</b> or <b>-DGIF</b> option (but not -DXBITMAP), then
1022: add <b>-DWINDOWS</b> . For example, <br>
1023: <b>cc -DAA -DWINDOWS
1024: mimetex.c gifsave.c -lm -o mimetex.cgi</b> <br>
1025: The above Unix-like syntax works with
1026: <a href="http://www.mingw.org" target="_top">MinGW</a> and
1027: <a href="http://www.delorie.com/djgpp/" target="_top">djgpp</a>
1028: Windows compilers, but probably not with most others,
1029: where it's only intended as a "template". <br>
1030: Explanation: mimeTeX writes gif bytes directly to
1031: stdout, as usual for cgi's. But Windows treats
1032: stdout as a character stream, interpreting any hex 0A byte
1033: as an <lf>, and automatically preceding it with
1034: a spurious hex 0D <cr> byte. The -DWINDOWS switch
1035: compiles in a non-portable, Windows-specific _setmode()
1036: call that sets stdout to binary mode. </li>
1037: </ul>
1038:
1039: <p> Several other optional compile-line <a href="#options">options</a>
1040: available for mimetex.c are discussed below. </p>
1041:
1042: <p> The gfuntype program is only needed if you plan to change the
1043: font information in texfonts.h, as explained in
1044: <a href="#fonts">Appendix IVa</a> below.
1045: In that case, compile gfuntype with the command </p>
1046: <center><b>cc gfuntype.c mimetex.c -lm -o gfuntype</b></center>
1047:
1048: <p> That's all there is to building mimeTeX. You can now test your
1049: mimetex.cgi executable from the Unix command line by typing, e.g.,
1050: <b>./mimetex.cgi "x^2+y^2"</b> which should emit two ascii
1051: rasters something like the following </p> <pre>
1052: Ascii dump of bitmap image... Hex dump of colormap indexes...
1053: ...........**....................**... ..........1**1...................1**1..
1054: ..........*..*......*...........*..*.. ..........*23*......*............*23*..
1055: .............*......*..............*.. .............*......*...............*..
1056: ....****.....*......*.....*..*.....*.. ...1****....2*......*.....2*..*....2*..
1057: ...*.*.*....*.......*....**..*....*... ...*.*.*...1*.......*.....**..*...1*...
1058: .....*.....*.*..********..*..*...*.*.. ....1*1...2*.*..********..3*..*..2*.*..
1059: .....*....****......*.....*..*..****.. ....2*2...****......*......*12*..****..
1060: ..*.*.*.............*.....*.*......... ..*.*.*.............*......*.*2........
1061: ...****.............*.....***......... ..1****.............*......***.........
1062: ....................*.......*......... ....................*........*.........
1063: .........................*.*.......... ..........................*.*1.........
1064: .........................**........... ..........................**1..........
1065: The 5 colormap indexes denote rgb vals...
1066: .-->255 1-->196 2-->186 3-->177 *-->0</pre>
1067: <p class="continue"> <b>(</b>The right-hand illustration shows asterisks
1068: in the same positions as the left-hand one, along with anti-aliased
1069: grayscale colormap indexes assigned to neighboring pixels, and with
1070: the rgb value for each index.<b>)</b> Just typing <b>./mimetex.cgi</b>
1071: without an argument should produce ascii rasters for the default
1072: expression <b>f(x)=x^2</b>. If you see the two ascii rasters then your
1073: binary's good, so mv it to your server's <b>cgi-bin/</b> directory and
1074: set permissions as necessary. </p>
1075:
1076: <h2> <a name="install"> (IIc) Install </a> </h2>
1077:
1078: <p> Once mimetex.cgi is working, mv it to your server's <b>cgi-bin/</b>
1079: directory (wherever cgi programs are expected), and chmod/chown it
1080: if necessary. Then mv mimetex.html to your server's <b>htdocs/</b>
1081: directory. Now point your browser to www.yourdomain.com/mimetex.html ,
1082: and you should see a page identical to this one. </p>
1083:
1084: <p> Note: the two directories are typically of the form
1085: somewhere/www/cgi-bin/ and somewhere/www/htdocs/ , so I set up
1086: mimtex.html to get mimetex.cgi from the relative path <b>../cgi-bin/</b>.
1087: If your directories are non-conforming, you may have to edit the
1088: few dozen occurrences of <b>../cgi-bin/mimetex.cgi</b> in mimetex.html .
1089: Sometimes a suitable symlink works; if not, you'll have to edit.
1090: Globally changing <b>../cgi-bin/mimetex.cgi</b> often works. </p>
1091:
1092: <p> Either way, once mimetex.html displays properly, you can assume
1093: everything is working, and can begin authoring html documents using
1094: mimetex.cgi to render your own math. </p>
1095:
1096:
1097: <h2> <a name="options"> (IId) Additional Compile-Line Options </a></h2>
1098:
1099: <p> In addition to -DAA or -DGIF or -DXBITMAP (along with -DWINDOWS
1100: when necessary) on the mimetex.c compile line, as discussed above,
1101: you may also optionally include the following -D switches,
1102: whose functionality is discussed below. </p>
1103: <dl>
1104: <dt> <b>-DAA</b> </dt>
1105: <dd> As already discussed, -DAA turns on anti-aliasing.
1106: It also sets default values for individual anti-aliasing
1107: parameters discussed below. If you specify -DAA
1108: then you needn't specify the individual parameters unless
1109: you want to override the defaults. <br>
1110: Anti-aliasing can't be applied to mime
1111: xbitmaps, so don't specify -DAA if you also specify -DXBITMAP. <br>
1112: And mimeTeX's anti-aliasing only works
1113: well on white (or light gray) backgrounds. Your html file
1114: probably contains a <body> tag of the form
1115: <body bgcolor="#ffffff" text="#000000">
1116: which specifies black text on a pure white background.
1117: The background can be grayed down to maybe bgcolor="#e7e7e7",
1118: but much darker will begin to show white rings around
1119: mimeTeX's anti-aliased characters. This page is displayed
1120: using bgcolor="#ffffff". </dd>
1121: <dt> <b>-DCENTERWT=<i>n</i> <br>
1122: -DADJACENTWT=<i>j</i> <br>
1123: -DCORNERWT=<i>k</i></b> </dt>
1124: <dd> MimeTeX currently provides a lowpass filtering
1125: algorithm for anti-aliasing, which is applied to the
1126: existing set of bitmap fonts. This lowpass filter applies
1127: weights <img src="../cgi-bin/mimetex.cgi?
1128: \tiny\begin{pmatrix}1&3&1\\3&\,32\,&3\\1&3&1\end{pmatrix}"
1129: alt="" border=0 align=middle> to neighboring pixels. The defaults
1130: weights are CENTERWT=32, ADJACENTWT=3 and CORNERWT=1,
1131: which you can adjust to control anti-aliasing. </dd>
1132: <dt> <b>-DCACHEPATH=\"<i>path/</i>\"</b> </dt>
1133: <dd> This option saves each rendered image to a file in directory
1134: <b><i>path/</i></b>, which mimeTeX reads rather than
1135: re-rendering the same image every time it's given
1136: the same LaTeX expression. Sometimes mimeTeX disables caching,
1137: e.g., expressions containing <b>\input{ }</b> are
1138: re-rendered since the contents of the inputted file may have
1139: changed. If compiled without <b>-DCACHEPATH=\"<i>path/</i>\"</b>
1140: mimeTeX always re-renders expressions. This usually isn't too
1141: cpu intensive, but if you have unusually high hit rates then
1142: image caching may be helpful. The <b><i>path/</i></b>
1143: is relative to mimetex.cgi, and must be writable by it.
1144: Files created under <b><i>path/</i></b> are named
1145: <b><i>filename</i>.gif</b>, where <b><i>filename</i></b>
1146: is the 32-character MD5 hash of the LaTeX expression. <br>
1147: When caching a new image, mimeTeX also
1148: updates the file <b><i>path/</i>mimetex.log</b> containing
1149: a timestamp, filename and LaTeX expression for each new file
1150: created. A sample entry looks like
1151: <pre>---------------------------------------------------------------------
1152: 2004-08-07:09:00:53am f8ccc8dd93c8eeb1d9c40b353ef781e0.gif
1153: \LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
1154: ---------------------------------------------------------------------</pre></dd>
1155: <dt><b>-DDISPLAYSIZE=<i>n</i></b> </dt>
1156: <dd> By default, operator limits like <b>\int_a^b</b> are rendered
1157: <b>\textstyle</b> <a href="#preview">
1158: <img id="displaysize1" onclick="eqntext('displaysize1')"
1159: src="../cgi-bin/mimetex.cgi?\normalsize\int_a^b"
1160: alt="" border=0 align=middle></a> at font sizes <b>\normalsize</b>
1161: and smaller, and rendered <b>\displaystyle</b> <a href="#preview">
1162: <img id="displaysize2" onclick="eqntext('displaysize2')"
1163: src="../cgi-bin/mimetex.cgi?\large\int_a^b"
1164: alt="" border=0 align=middle></a> at font sizes <b>\large</b> and
1165: larger. This default corresponds to <b>-DDISPLAYSIZE=3</b>,
1166: which you can adjust; e.g., <b>-DDISPLAYSIZE=0</b> always defaults
1167: to <b>\displaystyle</b>, and <b>99</b> (or any large number)
1168: always defaults to <b>\textstyle</b>. Note that explicit
1169: <b>\textstyle</b>, <b>\displaystyle</b>, <b>\limits</b> or
1170: <b>\nolimits</b> directives in an expression always override
1171: the <b>DISPLAYSIZE</b> default. </dd>
1172: <dt><b>-DNEWCOMMANDS=<i>newcommands.h</i></b> </dt>
1173: <dd> LaTeX-like <b>\newcommand</b>'s are available in mimeTeX,
1174: via the following facility to help you define your
1175: own "new commands" during compilation. Edit a file named
1176: newcommands.h (or any filename you specify with the
1177: <b>-DNEWCOMMANDS</b> switch). For newcommands _without_
1178: arguments, your file should contain one or more lines
1179: like the following examples:
1180: <pre>{ "\\iint", NULL, "{\\int\\int}" },
1181: { "\\rightleftharpoons",NULL,"{\\rightharpoonup\\atop\\leftharpoondown}" },
1182: { "\\ldots", NULL, "{\\Large.\\hspace1.\\hspace1.}" },
1183: { "\\cr", NULL, "\\\\" },
1184: { "\\neq", NULL, "{\\not=}" },</pre>
1185: For newcommands _without_ arguments, as illustrated above,
1186: the general form of each line in your file should be
1187: <b>{ "\\<i>command</i>", NULL, "{<i>replacement</i>}" },</b>
1188: Don't forget a comma at the end of every line,
1189: and write a double backslash <b>\\</b>
1190: between quotes <b>"...\\..."</b> wherever you actually
1191: want a single backslash <b>\</b>. The only effect
1192: of the above examples (without arguments) is simple string
1193: substitution, i.e., every occurrence of <b>\<i>command</i></b>
1194: is replaced by <b>{<i>replacement</i>}</b>. Note that the
1195: <b>{ }</b>'s surrounding <b><i>replacement</i></b>
1196: aren't required, but are usually a good idea (the case
1197: of <b>\cr</b> illustrated above is one exception, where
1198: <b>{ }</b>'s would defeat the purpose).
1199: <br> To define newcommands _with_ arguments,
1200: change the <b>NULL</b> after the <b>\\<i>command</i></b>
1201: to define your command's arguments as illustrated by the
1202: following example:
1203: <pre>{ "\\lvec", "2n", "#2_1,\\cdots,#2_{#1}" },</pre>
1204: In this case the <b>NULL</b> has been replaced by <b>"2n"</b>
1205: (note the mandatory surrounding quotes <b>"..."</b>). This
1206: example corresponds to the similar one discussed in TLC2 on
1207: page 845. The first character inside the <b>"..."</b>s is
1208: <b>2</b> indicating the number of arguments,
1209: which may be <b>1</b> thru <b>9</b>. If there are no
1210: subsequent characters followng this one, then all arguments are
1211: mandatory, enclosed in <b>{ }</b>'s as usual. Otherwise,
1212: any subsequent characters signal that the first argument
1213: is optional, enclosed in <b>[ ]</b>'s if given. And
1214: these subsequent characters comprise the first argument's
1215: default value if it's not explicitly given. The illustrated
1216: example's first argument is optional with default value
1217: <b>n</b> as shown. In this case that's just a single
1218: character, but you can write any length default you like.
1219: <br> To see many additional examples, search for the
1220: uppercase string NEWCOMMANDS in mimetex.c, and look below that.
1221: All the above examples are already there. </dd>
1222: <dt><b>-DNORMALSIZE=<i>n</i></b> </dt>
1223: <dd> MimeTeX currently has six font sizes numbered 0-5,
1224: and always starts out in NORMALSIZE, whose default value is 2.
1225: Specify -DNORMALSIZE=3 on the compile line if you prefer
1226: mimeTeX to start in default size 3, etc. </dd>
1227: <dt> <b>-DPATHPREFIX=\"<i>path/</i>\"</b> </dt>
1228: <dd> The <a href="#input">\input{ }</a> and
1229: <a href="#counter">\counter{ }</a> commands discussed below
1230: require filename arguments which, by default, point to files
1231: residing in the same cgi-bin/ directory as your mimetex.cgi.
1232: Moreover, for security, absolute paths with leading <b>/</b>'s
1233: or <b>\</b>'s, and paths with <b>../</b>'s or <b>..\</b>'s,
1234: are not permitted. Instead, compile mimetex with PATHPREFIX
1235: defined as <i>path</i><b>/</b> if you want input files in some
1236: other directory. And make sure your <i>path</i><b>/</b> ends
1237: with <b>/</b> (or with <b>\</b> for Windows). </dd>
1238: <dt> <b>-DREFERER=\"<i>domain</i>\" or <br>
1239: -DREFERER=\"<i>domain1,domain2,etc</i>\"</b> </dt>
1240: <dd> Blocks mimeTeX requests from unauthorized domains that
1241: are using your mimetex.cgi (hence your server's resources)
1242: without permission. <br>
1243: If REFERER is defined, mimeTeX
1244: performs a case-insensitive test of the environment variable
1245: HTTP_REFERER to verify that it contains the authorized 'domain'
1246: as a substring. <br>
1247: If given several 'domain's (second form)
1248: then HTTP_REFERER must contain either 'domain1' or
1249: 'domain2', or etc, as a (case-insensitive) substring. <br>
1250: If HTTP_REFERER doesn't contain a substring
1251: matching any of these domain(s), then mimeTeX emits an error
1252: message image instead of the requested image. You can manually
1253: modify invalid_referer_msg, defined in function main(),
1254: to personalize the error message for your own site. <br>
1255: Finally, if HTTP_REFERER is not found as
1256: an environment variable, then mimeTeX correctly generates the
1257: requested image instead of generating an error. </dd>
1258: <dt><b>-DSECURITY=<i>n</i></b> </dt>
1259: <dd> This is essentially a "paranoid" setting that defaults
1260: to a high value 999, which inhibits some optional logging
1261: activity. <b>-DCACHEPATH=<i>path</i>/</b> isn't affected,
1262: since you're explicitly supplying a <b><i>path</i>/</b>
1263: you want files written to. But, for example, you must set
1264: <b>-DSECURITY=5</b> (or less) to permit the <b>\counter</b>
1265: command to create a new counter file. A malicious user
1266: could conceivably flood your file system by submitting
1267: zillions of <b>\counter{<i>filename</i>}</b> commands
1268: to mimeTeX, each with a different <b><i>filename</i></b>. </dd>
1269: <dt><b>-DSQUASHMARGIN=<i>n</i> or <br>
1270: -DNOSQUASH</b> </dt>
1271: <dd> TeX typically renders an expression like
1272: <b>\frac12\int_{a+b+c}^{d+e+f}g(x)dx</b> as <a href="#preview">
1273: <img id="nosquash1" onclick="eqntext('nosquash1')"
1274: src="../cgi-bin/mimetex.cgi?\displaystyle
1275: \nosquash\frac12\int_{a+b+c}^{d+e+f}g(x)dx"
1276: alt="" border=0 align=middle></a>. MimeTeX tries to remove extra
1277: whitespace, rendering the same expression as <a href="#preview">
1278: <img id="nosquash2" onclick="eqntext('nosquash2')"
1279: src="../cgi-bin/mimetex.cgi?\displaystyle
1280: \squash\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
1281: alt="" border=0 align=middle></a> instead.
1282: Compile with <b>-DNOSQUASH</b> if you prefer the typical TeX
1283: behavior as mimeTeX's default. Or, to adjust the minimum
1284: number of pixels between squashed symbols (default is 3),
1285: compile with <b>-DSQUASHMARGIN=<i>n</i></b>.
1286: See <a href="#squash">Squash</a> for further discussion. </dd>
1287: <dt> <b>-DWARNINGS=<i>n</i> or <br>
1288: -DNOWARNINGS</b> </dt>
1289: <dd> If an expression submitted to mimeTeX contains an
1290: unrecognzied escape sequence, e.g., "y=x+\abc+1", then
1291: mimeTeX generates a gif image containing an embedded
1292: warning in the form "y=x+[\abc?]+1". Or, if an expression
1293: contains an unrecognized character, i.e., one for which mimeTeX
1294: has no corresponding bitmap, then the embedded warning is [?].
1295: If you want these warnings suppressed, either <b>-DWARNINGS=0</b>
1296: or <b>-DNOWARNINGS</b> on the compile line tells mimeTeX to treat
1297: unrecognized/undisplayable input as white space. </dd>
1298: <dt> <b>-DWHITE</b> </dt>
1299: <dd> MimeTeX usually renders black symbols on a white
1300: background. This option renders white symbols on
1301: a black background instead. </dd>
1302: </dl>
1303:
1304:
1305: <h2> <a name="cmdline"> (IIe) Command Line Features </a> </h2>
1306:
1307: <p> MimeTeX usually runs from a browser, obtaining its input expression
1308: from a query_string. But you can also run mimeTeX from your Unix
1309: shell, supplying all input from the command line. This was briefly
1310: illustrated above, where you were advised to test your newly-compiled
1311: mimeTeX executable from the command line before installing it. </p>
1312:
1313: <p> In addition to such simple testing, mimeTeX also provides some
1314: possibly useful functionality from the command line. In particular,
1315: you can store a gif (or xbitmap) image of any expression to a file.
1316: No syntax checking is applied to command-line arguments, so enter
1317: them carefully. </p>
1318:
1319: <p> The complete command-line syntax for mimeTeX is </p>
1320: <pre>
1321: ./mimetex [ -d ] dump gif image on stdout,
1322: [ -e export_file ] or write gif image to export_file
1323: [ expression expression, e.g., "x^2+y^2",
1324: | -f input_file ] or read expression from input_file
1325: [ -m msglevel ] verbosity of debugging output
1326: [ -o ] render image with opaque background
1327: [ -s fontsize ] default fontsize, 0-5
1328:
1329: -d Rather than printing ascii debugging output, mimeTeX
1330: dumps the actual gif (or xbitmap) to stdout, e.g.,
1331: ./mimetex -d "x^2+y^2" > expression.gif
1332: creates expression.gif containing an image of x^2+y^2
1333:
1334: -e Like -d but writes the actual gif (or xbitmap) directly
1335: to export_file, e.g.,
1336: ./mimetex -e expression.gif "x^2+y^2"
1337: also creates expression.gif containing an image of x^2+y^2
1338:
1339: expression Place LaTeX expression directly on command
1340: line, with no -switch preceding it, as in the example
1341: immediately above, or...
1342:
1343: -f Read expression from input_file (and automatically
1344: assume -d switch). The input_file may contain the
1345: expression on one line or spread out over many lines.
1346: MimeTeX will concatanate all lines from input_file
1347: to construct one long expression. Blanks, tabs, and
1348: newlines are just ignored.
1349:
1350: -m 0-99, controls verbosity level for debugging output
1351: (usually used only while testing code).
1352:
1353: -o Rather than the default transparent gif background,
1354: the rendered image will contain black symbols on an
1355: opaque white background (or vice versa if compiled
1356: with -DWHITE). For example, if you have ImageMagick's
1357: display utility,
1358: ./mimetex -o -d "x^2+y^2" | display &
1359: opens a small window containing the rendered expression.
1360:
1361: -s 0-5, font size. As usual, the font size can also
1362: be specified within the expression by a directive,
1363: e.g., \large f(x)=x^2 displays f(x)=x^2 at font size 3,
1364: overriding -s. Default font size is 2.
1365: </pre>
1366:
1367:
1368:
1369: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1370: SECTION III. SYNTAX REFERENCE
1371: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1372: <h1> <a name="reference"> (III) Syntax Reference </a> </h1>
1373:
1374: <p> Since mimeTeX's syntax is as TeX-like as possible, we'll mostly discuss
1375: the occasional exceptions (which exist only to simplify my programming
1376: task, not to impose any syntactic aesthetics of mine on you). This
1377: section contains short paragraphs that each discuss some aspect of
1378: mimeTeX where your LaTeX experience might not be precisely relevant. </p>
1379:
1380: <p> Anything not discussed here that still doesn't behave like you expect
1381: is probably just not implemented. That includes (La)TeX packages
1382: (though a few ams commands like \begin{gather} and \begin{pmatrix}
1383: are recognized), non-standard fonts, etc. You can try out any
1384: questionable syntax by <a href="#forminput">Submit</a>ting a query
1385: to quickly see whether or not it works. And you might want to
1386: occasionally re-browse the <a href="#examples">Examples</a> above,
1387: which may better illustrate implemented features. </p>
1388:
1389:
1390: <h2> <a name="spaces"> (IIIa) \unitlength{ }, Math Spaces and Whitespace
1391: </a> </h2>
1392:
1393: <h3> <a name="unitlength">\unitlength<font size=5>...</font></a> </h3>
1394:
1395: <p> Lengths in mimeTeX are all ultimately expressed in number of pixels.
1396: Various commands discussed below require length arguments, including </p>
1397: <ul>
1398: <li> <a href="#mathspace">\hspace{ }</a> </li>
1399: <li> <a href="#mathspace">\hfill{ }</a> </li>
1400: <li> <a href="#raiserotate">\raisebox{ }{ }</a> </li>
1401: <li> <a href="#circleline">\line( , )</a> and
1402: <a href="#circleline">\circle( , )</a> </li>
1403: <li> <a href="#arrows">\longrightarrow[ ]</a> </li>
1404: </ul> <p class="continue">
1405: (the \long<i>xxx</i>arrow [ ]-arguments are optional mimeTeX
1406: extensions to LaTeX) MimeTeX's length-type arguments never
1407: take units, e.g., {10pt} and {1cm} are both invalid. Lengths always
1408: refer to number of pixels, optionally scaled by a user-specified
1409: <b>\unitlength</b>. </p>
1410:
1411: <p> MimeTeX's <b>\unitlength{ }</b> command lets you specify
1412: the number of pixels per "length unit", e.g.,
1413: <b>\unitlength{10} \hspace{2.5}</b> renders a 25-pixel space.
1414: Both <b>\unitlength{ }</b> and <b>\hspace{ }</b>'s
1415: length arguments may be integers or may contain decimal points.
1416: Ditto for all other mimeTeX commands that take length arguments.
1417: The default <b>\unitlength</b> is, you guessed it, <b>1</b>. </p>
1418:
1419: <p> A specified <b>\unitlength</b> applies to all subsequent terms,
1420: i.e., everything to its right. And several <b>\unitlength</b>'s
1421: may be specified in the same expression, each one overriding
1422: those to its left. But if one or more <b>\unitlength</b>'s
1423: appear within a <b>{ }</b>-enclosed subexpression, then terms
1424: following its closing right <b>}</b> revert to the <b>\unitlength</b>
1425: in effect before its opening left <b>{</b>. For example, </p> <center>
1426: <b>A\hspace{10} {\unitlength{2.5}B\hspace{10}C} \hspace{10}D</b>
1427: produces
1428: <a href="#preview"><img id="unitlength1" onclick="eqntext('unitlength1')"
1429: src="../cgi-bin/mimetex.cgi?\large A\hspace{10}
1430: {\unitlength{2.5}B\hspace{10}C}\hspace{10}D"
1431: alt="" border=0 align=middle></a> </center> <p class="continue">
1432: which has a 10-pixel space between <b>A</b> and <b>B</b>, then
1433: 25 pixels between <b>B</b> and <b>C</b>, and finally
1434: another 10 pixels between <b>C</b> and <b>D</b>. </p>
1435:
1436: <h3> <a name="mathspace">Math Spaces<font size=5>...</font></a> </h3>
1437:
1438: <p> Except inside <a href="#textboxes">text boxes</a>,
1439: unescaped blanks, tildes (a <b>~</b>), and all other usual
1440: <a href="#whitespace">whitespace</a> characters are completely
1441: ignored by mimeTeX, just like they are in LaTeX math mode.
1442: As usual, you must explicitly write one of the recognized math
1443: spaces to put extra visible space in your rendered expressions. </p>
1444:
1445: <p> MimeTeX recognizes math spaces <b>\, \: \;</b> as well as
1446: <b>\/</b> and <b>\quad</b> and <b>\qquad</b> . You may also
1447: write <b>\hspace{10}</b> to insert a 10-pixel (or any other number)
1448: space, scaled by any preceding <a href="#unitlength">\unitlength</a>,
1449: as illustrated just above. There are no negative spaces. </p>
1450:
1451: <p> Although some browsers occasionally misinterpret typed blank spaces
1452: inside html query_string's, mimeTeX also recognizes escaped blanks
1453: <img src="../cgi-bin/mimetex.cgi?1$\backsl\raise{-5}{\rotate{-90}]}"
1454: alt="" border=0 align=middle> (a <b>\</b> followed by a blank) as math
1455: spaces, just in case you can safely use them. </p>
1456:
1457: <p> MimeTeX also supports <b>\hfill{<i>textwidth</i>}</b>, where
1458: <b><i>textwidth</i></b> is roughly equivalent to LaTeX's
1459: <b>\textwidth</b>, i.e., it's the total number of pixels, scaled by
1460: <a href="#unitlength">\unitlength</a>, that your entire rendered
1461: expression will span. However, if <b>\hfill{ }</b> appears
1462: within a <b>{ }</b>-enclosed subexpression, then it applies
1463: only to that subexpression. For example, </p> <center>
1464: <b>{abc \hfill{50} def} \hfill{100} ghi</b>
1465: produces
1466: <a href="#preview"><img id="mathspace1" onclick="eqntext('mathspace1')"
1467: src="../cgi-bin/mimetex.cgi?3${abc\hfill{50}def}\hfill{100}ghi"
1468: alt="" border=0 align=middle></a> </center> <p class="continue">
1469: The first/inner <b>\hfill{50}</b> inserts exactly enough whitespace so
1470: that subexpression "<b><i>abc def</i></b>" spans 50 pixels.
1471: Then the second/outer <b>\hfill{100}</b> inserts exactly enough
1472: whitespace so that the entire expression spans 100 pixels.
1473: Without explicit <b>{ }</b>-nesting, mimeTeX evaluates expressions
1474: left-to-right (sinistrally), e.g., <b>...\hfill{100}...\hfill{50}...</b>
1475: is exactly equivalent to <b>...\hfill{100}{...\hfill{50}...}</b>.
1476: Notice that, this time, the second/right <b><i>textwidth</i></b>
1477: argument is necessarily smaller than the first/left. </p>
1478:
1479: <p> Finally, mimeTeX begins a new line whenever you write <b>\\</b> .
1480: And you may optionally write <b>\\[10]</b> to put a 10-pixel (or any
1481: other number) vertical space, scaled by
1482: <a href="#unitlength">\unitlength</a>, between lines.
1483: <a href="#array">\begin{eqnarray}</a> also splits long
1484: equations over several lines, as illustrated by
1485: <a href="#example10">Example 10</a> above.
1486: But when that's not the best solution, you can also write,
1487: for example, </p> <center>
1488: <b>y=a+b+c+d\\\hspace{50}+e+f+g+h</b>
1489: to produce
1490: <a href="#preview"><img id="mathspace2" onclick="eqntext('mathspace2')"
1491: src="../cgi-bin/mimetex.cgi?3$y=a+b+c+d\\\hspace{50}+e+f+g+h"
1492: alt="" border=0 align=middle></a> </center>
1493:
1494: <p> However, mimeTeX can't correctly handle automatically-sized delimiters
1495: across linebreaks, e.g., </p> <center>
1496: <b>y=\left\{a+b+c+d\\\hspace{50}+e+f+g+h\right\}</b>
1497: produces
1498: <a href="#preview"><img id="mathspace3" onclick="eqntext('mathspace3')"
1499: src="../cgi-bin/mimetex.cgi?3$y=\{a+b+c+d\\\hspace{50}+e+f+g+h\}"
1500: alt="" border=0 align=middle></a> <br>
1501: whereas you probably wanted
1502: <a href="#preview"><img id="mathspace4" onclick="eqntext('mathspace4')"
1503: src="../cgi-bin/mimetex.cgi?3$y=\big{a+b+c+d\\\hspace{50}+e+f+g+h\big}"
1504: alt="" border=0 align=middle></a> </center> <p class="continue">
1505: which I produced using <b>\big{...\\...\big}</b> instead
1506: of <b>\left\{...\\...\right\}</b>. Expressions of the
1507: form <b>\left...\right \\ \left...\right</b> should all be
1508: rendered properly. It's only <b>\left...\\...\right</b> that will
1509: look odd. </p>
1510:
1511: <h3> <a name="whitespace">Whitespace, Comments,
1512: and some other characters<font size=5>...</font></a> </h3>
1513:
1514: <p> Some browsers occasionally misinterpret typed blank spaces
1515: inside html query_string's. In that case, you can write
1516: tildes (a <b>~</b>) wherever blanks are required or desired,
1517: e.g., <b>\alpha~w</b> instead of <b>\alpha w</b>, or
1518: <b>\frac~xy</b> or <b>\sqrt~z</b>, etc. MimeTeX correctly
1519: interprets both blanks and <b>~</b>'s, and all
1520: other usual whitespace characters. So use whatever's convenient
1521: as long as it's correctly interpreted inside query_string's by your
1522: browser. </p>
1523:
1524: <p> Similarly, some browsers occasionally misinterpret linebreaks/newlines
1525: inside the middle of long html query_string's.
1526: For example, </p>
1527: <pre><img src="../cgi-bin/mimetex.cgi?f(x)=\frac1{\sigma\sqrt{2\pi}}
1528: \int\limits_{-\infty}^xe^{-\frac{(t-\mu)^2}{2\sig^2}}dt"
1529: alt="" border=0 align=middle> </pre><p class="continue">
1530: breaks a long query_string over two lines. If your browser interprets
1531: this correctly, then mimeTeX will render it correctly, too. Otherwise,
1532: you'll have to enter long expressions on one big long line. </p>
1533:
1534: <p> If you can break long query_string's over several lines, then you may
1535: find mimeTeX's <b>%%comments%%</b> feature useful, too. Note that
1536: comments must be preceded <i>and followed</i> by two <b>%</b>'s
1537: rather than LaTeX's usual one. The above example could be written </p>
1538: <pre><img src="../cgi-bin/mimetex.cgi?f(x)=\frac1{\sigma\sqrt{2\pi}} %%normalization%%
1539: \int\limits_{-\infty}^xe^{-\frac{(t-\mu)^2}{2\sig^2}}dt %%integral%%"
1540: alt="" border=0 align=middle> </pre>
1541:
1542: <p> Besides whitespace, browsers may misinterpret embedded apostrophes,
1543: and especially quotes, within query strings. The <b>a's</b> and
1544: <b>b's</b> in <a href="#example7">Example 7</a> above actually use
1545: superscripted commas for apostrophes, i.e., <b>a^,s</b> and <b>b^,s</b>,
1546: and you can also use LaTeX <b>\prime</b>'s, as in <b>a^\prime s</b>.
1547: For quotes, you can use <b>^{,,}</b> since <b>"</b> almost certainly
1548: won't work. To help make things easier, in addition to the usual
1549: LaTeX <b>\prime</b>, mimeTeX also recognizes <b>\apostrophe</b> and
1550: <b>\quote</b> and <b>\percent</b>, all with the obvious meanings. </p>
1551:
1552:
1553: <h2> <a name="symbols"> (IIIb) Math Symbols, Sizes, and Modes </a></h2>
1554:
1555: <h3> <a name="characters">Character Sets<font size=5>...</font></a> </h3>
1556:
1557: <p> For complete information about the characters and math symbols
1558: available in mimeTeX, you'll need to browse through the bottom
1559: 500-or-so lines of <b>mimetex.h</b>. And several additional
1560: symbols like <b>\ldots</b> and <b>\AA</b> and <b>\hbar</b> are
1561: defined by the mimeTeX preprocessor, function <b>mimeprep( )</b>
1562: in <b>mimetex.c</b> Generally speaking, I've tried
1563: to encode the cmmi10, cmsy10, cmr10, cmex10, rsfs10 and bbold10
1564: families with "names", e.g., <b>\alpha \beta \forall \sqcup</b>, etc,
1565: identical to your LaTeX expectations. For example, the
1566: calligraphic symbols in cmsy10 are accessed by writing
1567: <b>\mathcal{A} \mathcal{B} \mathcal{XYZ}</b>. Similarly, write
1568: <b>\mathscr{A}</b> for the rsfs10 fonts, and write <b>\mathbb{R}</b>
1569: for bbold10. </p>
1570: <!-- But there are various additions and omissions and exceptions
1571: vis-a-vis LaTeX. For example, </p>
1572: <ul>
1573: <li> "Large" operators like \int are often also available as
1574: \Bigint, and similarly for \sum \prod \cup \cap, etc.
1575: If you find a \Bigxxx in mimetex.h then you'll also find the
1576: corresponding \xxx. \Bigxxx operators are somewhat larger
1577: than their \xxx counterparts, and they automatically render
1578: super/subscripts in <a href="#modes">displaystyle</a>. </li>
1579: </ul> -->
1580: <p> I haven't exhaustively checked all the name-number matchings for
1581: the hundreds of symbols in mimetex.h. You can eaily correct
1582: any minor mistake you find in what I hope is an obvious manner.
1583: The fonts <a href="#fonts">Appendix IVa</a> below provides
1584: additional information. </p>
1585:
1586: <p> In addition to extra LaTeX symbols like <b>\ldots</b>, <b>\AA</b>
1587: and <b>\hbar</b>, mentioned above, the mimeTeX preprocessor
1588: <b>mimeprep( )</b> also recognizes various html special
1589: characters like <b>&lt;</b>, <b>&gt;</b>, <b>&nbsp;</b>,
1590: <b>&quot;</b>, <b>&amp;</b>, etc. Some web tools apparently
1591: translate characters like, e.g., <b>></b> to <b>&gt;</b>,
1592: even inside quoted query_string's, so mimeTeX's preprocessor
1593: translates them back to LaTeX symbols for you. </p>
1594:
1595: <h3> <a name="sizes">Font Sizes<font size=5>...</font></a> </h3>
1596:
1597: <p> MimeTeX currently has six font sizes, numbered 0-5, with default 2.
1598: This font size numbering corresponds to the usual LaTeX declarations
1599: <b>\tiny</b>, <b>\small</b>, <b>\normalsize</b>
1600: (default), <b>\large</b>, <b>\Large</b> and <b>\LARGE</b>.
1601: These declarations can be placed anywhere in a mimeTeX expression,
1602: and they change font size from that point forwards. However, as usual,
1603: a font size change inside a <b>{ }</b>-subexpression remains
1604: in effect only within that subexpression. </p>
1605:
1606: <p> In mimeTeX you may also write <b>\fontsize{0}...\fontsize{5}</b> or
1607: the shorter <b>\fs{0},...,\fs{5}</b> for <b>\tiny,...,\LARGE</b>.
1608: And since these arguments are all single digits, the even shorter
1609: form <b>\fs0,...,\fs5</b> works equally well. For example, </p>
1610: <center> <table cellpadding=0>
1611: <tr align=center>
1612: <td> <img src="../cgi-bin/mimetex.cgi?<b></b>f(x)=x^2"> </td>
1613: <td> produces </td>
1614: <td> <a href="#preview"><img id="sizes1" onclick="eqntext('sizes1')"
1615: src="../cgi-bin/mimetex.cgi?f(x)=x^2"
1616: alt="" border=0 align=middle></a> </td>
1617: </tr>
1618: <tr align=center>
1619: <td> <img src="../cgi-bin/mimetex.cgi?<b>\large</b> f(x)=x^2"> </td>
1620: <td> </td>
1621: <td> <a href="#preview"><img id="sizes2" onclick="eqntext('sizes2')"
1622: src="../cgi-bin/mimetex.cgi?\large f(x)=x^2"
1623: alt="" border=0 align=middle></a> </td>
1624: </tr>
1625: <tr align=center>
1626: <td> <img src="../cgi-bin/mimetex.cgi?<b>\fs4</b>f(x)=x^2"> </td>
1627: <td> </td>
1628: <td> <a href="#preview"><img id="sizes3" onclick="eqntext('sizes3')"
1629: src="../cgi-bin/mimetex.cgi?\fs4f(x)=x^2"
1630: alt="" border=0 align=middle></a> </td>
1631: </tr>
1632: </table> </center> <p class="continue">
1633: rendering <b>f(x)=x^2</b> in mimeTeX font sizes <b>2</b>
1634: (default \normalsize), <b>3</b> (\large or \fs3), and
1635: <b>4</b> (\fs4 or \Large). </p>
1636:
1637: <p> You'll soon notice that exponents and \frac's and \atop's
1638: are automatically rendered one size smaller than their base
1639: expressions. For example, </p> <center>
1640: <b>\Large y=e^{x^2}</b> produces
1641: <a href="#preview"><img id="sizes4" onclick="eqntext('sizes4')"
1642: src="../cgi-bin/mimetex.cgi?\Large y=e^{x^2}"
1643: alt="" border=0 align=middle></a> </center> <p class="continue">
1644: rendering the <b>"y=e"</b> in font size 4 (\Large), the <b>"x"</b> in
1645: font size 3 (\large), and the <b>"2"</b> in font size 2 (\normalsize).
1646: If you get below font size 0, the font size remains 0. </p>
1647:
1648: <p> Explicit size declarations override mimeTeX's default sizing behavior.
1649: You can rewrite the preceding example as, say, </p> <center>
1650: <b>\Large y=e^{\normalsize x^{\tiny2}}</b> which now produces
1651: <a href="#preview"><img id="sizes5" onclick="eqntext('sizes5')"
1652: src="../cgi-bin/mimetex.cgi?\Large y=e^{\normalsize x^{\tiny2}}"
1653: alt="" border=0 align=middle></a> </center> <p class="continue">
1654: rendering the <b>"y=e"</b> in font size 4 (\Large unchanged),
1655: the <b>"x"</b> in font size 2 (\normalsize), and the <b>"2"</b>
1656: in font size 0 (\tiny). </p>
1657:
1658: <p> Preceding an <b>\fs{ }</b> size argument with <b>+</b> or
1659: <b>-</b> specifies "relative" sizing. For example,
1660: <b>\large\text{abc{\fs{-2}def}ghi}</b> produces
1661: <a href="#preview"><img id="sizes6" onclick="eqntext('sizes6')"
1662: src="../cgi-bin/mimetex.cgi?\large\text{abc{\fs{-2}def}ghi}"
1663: alt="" border=0 align=middle></a>, rendering the <b>"def"</b>
1664: in font size 1 (two sizes smaller than \large). Note that
1665: <b>\fs{-2}</b> affects only the subexpression in which it appears,
1666: and that its braces are no longer optional since <b>-2</b> contains
1667: two characters. For exponents (or any other size-changing commands
1668: like \frac), </p> <center>
1669: <b>\Large y=e^{\fs{-1}x^2}</b> produces
1670: <a href="#preview"><img id="sizes7" onclick="eqntext('sizes7')"
1671: src="../cgi-bin/mimetex.cgi?\Large y=e^{\fs{-1}x^2}"
1672: alt="" border=0 align=middle></a> </center> <p class="continue">
1673: rendering the <b>"y=e"</b> in font size 4 (\Large), as usual.
1674: The <b>"x"</b> would usually be rendered one size smaller,
1675: in font size 3, and your <b>\fs{-1}</b> is applied to that,
1676: resulting in font size 2. And the final <b>"2"</b> is rendered,
1677: by the usual rules, one size smaller than the <b>"x"</b>,
1678: in font size 1. </p>
1679:
1680: <h3> <a name="modes">Modes<font size=5>...</font></a> </h3>
1681:
1682: <p> MimeTeX is always in a math-like mode, so you needn't surround
1683: expressions with <b>$...$</b>'s for <b>\textstyle</b>,
1684: or <b>$$...$$</b>'s for <b>\displaystyle</b>.
1685: <!-- or <b>\[...\]</b>'s, etc. In fact, mimeTeX interprets <b>$</b>
1686: as a "preamble" terminator (e.g., see <a href="#array">\array</a>
1687: below), and interprets <b>\[...\]</b> as an abbreviation for
1688: <b>\left[...\right]</b>. -->
1689: By default, operator limits like <b>\int_a^b</b> are rendered
1690: <b>\textstyle</b> <a href="#preview">
1691: <img id="modes99a" onclick="eqntext('modes99a')"
1692: src="../cgi-bin/mimetex.cgi?\normalsize\int_a^b"
1693: alt="" border=0 align=middle></a> at font sizes <b>\normalsize</b>
1694: and smaller, and rendered <b>\displaystyle</b> <a href="#preview">
1695: <img id="modes99b" onclick="eqntext('modes99b')"
1696: src="../cgi-bin/mimetex.cgi?\large\int_a^b"
1697: alt="" border=0 align=middle></a> at font sizes <b>\large</b> and
1698: larger (see the <b>-DDISPLAYSIZE</b>
1699: <a href="#options">compile option</a> to change this default).
1700: And when <b>\displaystyle</b> is invoked (either implicitly at font size
1701: <b>\large</b> or larger, or if you explicitly write <b>\displaystyle</b>
1702: at any font size), then operators <b>\int</b>, <b>\sum</b>,
1703: <b>\prod</b>, etc, are automatically promoted to larger sizes.
1704: <!-- their <a href="#characters">\Bigxxx</a> counterparts. -->
1705: <!-- Conversely, <b>\displaystyle</b> is applied to all
1706: <a href="#characters">\Bigxxx</a> operators regardless of font size. -->
1707: <!-- i.e., super/subscripts are placed directly above/below
1708: <b>\Bigsum</b>, but "alongside" <b>\sum</b>. -->
1709: For example, </p> <center>
1710: <!-- <b>\Bigsum_{i=1}^ni=\frac{n(n+1)}2</b> produces
1711: <a href="#preview"><img id="modes1a" onclick="eqntext('modes1a')"
1712: src="../cgi-bin/mimetex.cgi?\Bigsum_{i=1}^ni=\frac{n(n+1)}2"
1713: alt="" border=0 align=middle></a>, <br> -->
1714: <b>\sum_{i=1}^ni=\frac{n(n+1)}2</b>
1715: produces
1716: <a href="#preview"><img id="modes2a" onclick="eqntext('modes2a')"
1717: src="../cgi-bin/mimetex.cgi?\sum_{i=1}^ni=\frac{n(n+1)}2"
1718: alt="" border=0 align=middle></a>, whereas <br>
1719: <b>\displaystyle \sum_{i=1}^ni=\frac{n(n+1)}2</b> produces
1720: <a href="#preview"><img id="modes1b" onclick="eqntext('modes1b')"
1721: src="../cgi-bin/mimetex.cgi?\displaystyle\sum_{i=1}^ni=\frac{n(n+1)}2"
1722: alt="" border=0 align=middle></a>, </center>
1723: <p class=continue> and <!-- replacing <b>\Bigsum</b> with the smaller
1724: <b>\sum</b> symbol, --> </p> <center>
1725: <b>\large \sum_{i=1}^ni=\frac{n(n+1)}2</b> produces
1726: <a href="#preview"><img id="modes1b" onclick="eqntext('modes1b')"
1727: src="../cgi-bin/mimetex.cgi?\large\sum_{i=1}^ni=\frac{n(n+1)}2"
1728: alt="" border=0 align=middle></a>, whereas <br>
1729: <b>\textstyle \large \sum_{i=1}^ni=\frac{n(n+1)}2</b>
1730: produces
1731: <a href="#preview"><img id="modes2b" onclick="eqntext('modes2b')"
1732: src="../cgi-bin/mimetex.cgi?\textstyle\large
1733: \sum_{i=1}^ni=\frac{n(n+1)}2" alt="" border=0 align=middle></a>.
1734: <!-- instead. --> </center>
1735:
1736: <p> As usual, <b>\nolimits</b> turns displaystyle off (or textstyle on)
1737: for the operator immediately preceding it. For example, </p> <center>
1738: <b>\large\sum\nolimits_{i=1}^ni=\frac{n(n+1)}2</b>
1739: produces
1740: <a href="#preview"><img id="modes3" onclick="eqntext('modes3')"
1741: src="../cgi-bin/mimetex.cgi?
1742: \large\sum\nolimits_{i=1}^ni=\frac{n(n+1)}2"
1743: alt="" border=0 align=middle></a></center> <p class="continue">
1744: and likewise, <b>\limits</b> turns displaystyle on for the operator
1745: immediately preceding it. For example, </p> <center>
1746: <b>\sum\limits_{i=1}^ni=\frac{n(n+1)}2</b> produces
1747: <a href="#preview"><img id="modes4" onclick="eqntext('modes4')"
1748: src="../cgi-bin/mimetex.cgi?\sum\limits_{i=1}^ni=\frac{n(n+1)}2"
1749: alt="" border=0 align=middle></a> </center>
1750:
1751: <p> By the way, <b>\limits</b> affects <i><b>_any_</b></i> character
1752: or subexpression immediately preceding it. For example, </p> <center>
1753: <b>A^i_j</b> produces
1754: <a href="#preview"><img id="modes5" onclick="eqntext('modes5')"
1755: src="../cgi-bin/mimetex.cgi?3$A^i_j"
1756: alt="" border=0 align=middle></a> as usual, whereas <br>
1757: <b>A\limits^i_j</b> produces
1758: <a href="#preview"><img id="modes6" onclick="eqntext('modes6')"
1759: src="../cgi-bin/mimetex.cgi?\large A\limits^i_j"
1760: alt="" border=0 align=middle></a> instead. </center>
1761: <p class="continue">Likewise, for subexpressions, </p> <center>
1762: <b>\widehat{xyz}\limits^a</b> produces
1763: <a href="#preview"><img id="modes7" onclick="eqntext('modes7')"
1764: src="../cgi-bin/mimetex.cgi?\large\widehat{xyz}\limits^a"
1765: alt="" border=0 align=middle></a> </center> <p class="continue">
1766: This side effect may occasionally be useful. For example, </p> <center>
1767: <b>x\rightarrow\limits^gy</b> produces
1768: <a href="#preview"><img id="modes8" onclick="eqntext('modes8')"
1769: src="../cgi-bin/mimetex.cgi?\large x\rightarrow\limits^gy"
1770: alt="" border=0 align=middle></a> </center> <p class="continue">
1771: (mimeTeX automatically centers super/subscripts above/below
1772: the long and Long <a href="#arrows">arrow</a> forms) </p>
1773:
1774: <p> The <b>\displaystyle</b> command turns on displaystyle math mode for
1775: the entire expression (or <b>{ }</b>-enclosed subexpression),
1776: affecting <b><i>_all_</i></b> super/subscripts to the right
1777: of the \displaystyle, except for character classes Ordinary and
1778: Variable (TeXbook page 154). Similarly, <b>\textstyle</b> turns
1779: off displaystyle math mode. For example, </p> <center>
1780: <b>\sum_1^n {\displaystyle\sum_1^k\sum_1^lx_i^j} \sum_1^m</b>
1781: produces
1782: <a href="#preview"><img id="modes9" onclick="eqntext('modes9')"
1783: src="../cgi-bin/mimetex.cgi?\normalsize\sum_1^n
1784: {\displaystyle\sum_1^k\sum_1^lx_i^j}\sum_1^m"
1785: alt="" border=0 align=middle></a> </center> <p class="continue">
1786: Note that <b>\sum</b>'s within the subexpression are all affected by
1787: the beginning <b>\displaystyle</b>, but not the Variable <b>x_i^j</b>.
1788: An explicit <b>x\limits_i^j</b> always affects any preceding term. </p>
1789:
1790: <h3> <a name="textboxes">text boxes<font size=5>...</font></a> </h3>
1791:
1792: <p> Finally, mimeTeX also has a text-like/roman mode
1793: entered by writing either <b>\text{anything at all}</b>
1794: or the equivalent LaTeX-2.09-like command
1795: <b>{\rm anything at all}</b>, both of which render
1796: <b>anything at all</b> in roman (font family cmr10).
1797: <b>\mbox{ }</b> and several similar LaTeX commands are
1798: recognized by mimeTeX as synonyms for <b>\text{ }</b>.
1799: For italic, write <b>\textit{anything at all}</b> or
1800: <b>{\it anything at all}</b>, both of which render
1801: <b>anything at all</b> in italic (font family cmmi10).
1802: All four forms respect spaces between words, except that the
1803: first/required space after <b>{\rm etc}</b> and
1804: <b>{\it etc}</b> is still ignored. For example, </p> <center>
1805: <b>anything at all</b> just produces
1806: <a href="#preview"><img id="textboxes1" onclick="eqntext('textboxes1')"
1807: src="../cgi-bin/mimetex.cgi?anything at all"
1808: alt="" border=0 align=middle></a> whereas <br> <br>
1809: <b>\text{anything at all}</b> produces
1810: <a href="#preview"><img id="textboxes2" onclick="eqntext('textboxes2')"
1811: src="../cgi-bin/mimetex.cgi?\text{anything at all}"
1812: alt="" border=0 align=middle></a> and <br> <br>
1813: <b>\textit{anything at all}</b> produces
1814: <a href="#preview"><img id="textboxes3" onclick="eqntext('textboxes3')"
1815: src="../cgi-bin/mimetex.cgi?\textit{anything at all}" alt=""
1816: border=0 align=middle></a> instead. </center>
1817:
1818:
1819: <h2> <a name="delimiters"> (IIIc) Delimiters </a> </h2>
1820:
1821: <h3> <a name="parens">Parentheses and Braces
1822: (delimiters)<font size=5>...</font></a> </h3>
1823:
1824: <p> LaTeX's <b>\left(</b> and <b>\right)</b> may be written exactly
1825: like that, or may be abbreviated <b>\(</b> and <b>\)</b> in mimeTeX.
1826: Not all <b>\left</b> and <b>\right</b> LaTeX delimiters are currently
1827: available in mimeTeX, but those that are can be written in the usual
1828: way, or can be abbreviated as described above. One exception is
1829: that <b>\left\|...\right\|</b> must instead be abbreviated
1830: <b>\=...\=</b> or can be written in full <b>\left\|...\right\|</b>
1831: as usual. Also, <b>\left\langle...\right\rangle</b> is abbreviated
1832: <b>\<...\></b> . </p>
1833: <p> Mixing abbreviated and unabbreviated delimiters within a matching
1834: pair is not allowed, e.g., \left(...\) <b>_won't_</b> work. But you
1835: can mix nested pairs, e.g., <b>\left(...\(...\)...\right)</b> will
1836: work as long as the matching delimiters comprising each pair are
1837: either both abbreviated or both unabbreviated. </p>
1838: <p> The complete list of automatically sized delimiters
1839: available in mimeTeX is </p> <center>
1840: <!-- <table cellpadding=3 cellspacing=0 border=1> -->
1841: <table cellspacing=0 cellpadding=2 border=1>
1842: <tr align=center>
1843: <td> <b>LaTeX or <br> mimeTeX</b> </td>
1844: <td> <b>or mimeTeX <br> abbreviation</b> </td>
1845: <td> <b>example...</b> </td>
1846: <td> <b>...renders</b> </td>
1847: </tr>
1848: <tr align=center>
1849: <td> \left( ... \right) </td>
1850: <td> \( ... \) </td>
1851: <td> \left( \frac1{1-x^2} \right)^2 </td>
1852: <td> <a href="#preview"><img id="parens1" onclick="eqntext('parens1')"
1853: src="../cgi-bin/mimetex.cgi?\Large\left(\frac1{1-x^2}\right)^2"
1854: alt="" border=0 align=middle></a> </td>
1855: </tr>
1856: <tr align=center>
1857: <td> \left[ ... \right] </td>
1858: <td> \[ ... \] </td>
1859: <td> \left[ 1+\frac xn \right]^n </td>
1860: <td> <a href="#preview"><img id="parens2" onclick="eqntext('parens2')"
1861: src="../cgi-bin/mimetex.cgi?\Large\left[1+\frac xn\right]^n"
1862: alt="" border=0 align=middle></a> </td>
1863: </tr>
1864: <tr align=center>
1865: <td> \left\{ ... \right\} </td>
1866: <td> \{ ... \} </td>
1867: <td> \left\{ 1^2,2^2,3^2,\ldots \right\} </td>
1868: <td> <a href="#preview"><img id="parens3" onclick="eqntext('parens3')"
1869: src="../cgi-bin/mimetex.cgi?
1870: \large\left\{1^2,2^2,3^2,\ldots\right\}"
1871: alt="" border=0 align=middle></a> </td>
1872: </tr>
1873: <tr align=center>
1874: <td> \left\langle ...<br>
1875: ... \right\rangle </td>
1876: <td> \< ... \> </td>
1877: <td> \left\langle \varphi |\hat H|<br>
1878: \phi \right\rangle </td>
1879: <td> <a href="#preview"><img id="parens4" onclick="eqntext('parens4')"
1880: src="../cgi-bin/mimetex.cgi?
1881: \Large\left\langle\varphi|\hat H|\phi\right\rangle"
1882: alt="" border=0 align=middle></a> </td>
1883: </tr>
1884: <tr align=center>
1885: <td> \left| ... \right| </td>
1886: <td> \| ... \| </td>
1887: <td> \det \left| \begin{array}{cc} 1&2\\<br>
1888: 3&4 \end{array} \right|</td>
1889: <td> <a href="#preview"><img id="parens5" onclick="eqntext('parens5')"
1890: src="../cgi-bin/mimetex.cgi?
1891: \large\det\left|\begin{array}{cc}1&2\\3&4\end{array}\right|"
1892: alt="" border=0 align=middle></a> </td>
1893: </tr>
1894: <tr align=center>
1895: <td> \left\| ... \right\| </td>
1896: <td> \= ... \= </td>
1897: <td> \left\|x^2-y^2\right\| </td>
1898: <td> <a href="#preview"><img id="parens6" onclick="eqntext('parens6')"
1899: src="../cgi-bin/mimetex.cgi?\large\left\|x^2-y^2\right\|"
1900: alt="" border=0 align=middle></a> </td>
1901: </tr>
1902: <tr align=center>
1903: <td> \left\{ ... \right<b>.</b> </td>
1904: <td> \{ ... \<b>.</b> </td>
1905: <td> y=\left\{ \text{this\atop that} \right<b>.</b> </td>
1906: <td> <a href="#preview"><img id="parens7" onclick="eqntext('parens7')"
1907: src="../cgi-bin/mimetex.cgi?
1908: \large y=\left\{\text{this\atop that}\right."
1909: alt="" border=0 align=middle></a> </td>
1910: </tr>
1911: <tr align=center>
1912: <td> \left<b>.</b> ... \right\} </td>
1913: <td> \<b>.</b> ... \} </td>
1914: <td> \left<b>.</b> \text{this\atop that} \right\}=y </td>
1915: <td> <a href="#preview"><img id="parens8" onclick="eqntext('parens8')"
1916: src="../cgi-bin/mimetex.cgi?
1917: \large\left.\text{this\atop that}\right\}=y"
1918: alt="" border=0 align=middle></a> </td>
1919: </tr>
1920: </table> </center>
1921: <p> <b><u>Notes... </u></b> </p>
1922: <ol compact type=1>
1923: <li> The other LaTeX delimiters, i.e., floor's, ceil's,
1924: arrows, etc, can't yet be sized to fit. </li>
1925: <li> <a href="#sizes">Size declarations</a> inside any of the
1926: above delimiter pairs affect only the enclosed subexpression,
1927: e.g., <b>\Large w=\left(\small x+y\right)+z</b> produces
1928: <a href="#preview"><img id="parens9" onclick="eqntext('parens9')"
1929: src="../cgi-bin/mimetex.cgi?\Large w=\left(\small x+y\right)+z"
1930: alt="" border=0 align=middle></a> </li>
1931: <li> An abbreviated left delimiter must be paired with the same
1932: "type" of matching right delimiter, e.g., <b>\[...\]</b> works
1933: whereas <b>\[...\)</b> doesn't work. To render an "unmatched"
1934: pair of delimiters you must use the unabbreviated form, e.g.,
1935: <b>\left[...\right)</b> works fine. </li>
1936: <li> Similarly, "unusual" delimiter abbreviations like <b>\)...\(</b>
1937: also don't work in mimeTeX. That is,
1938: <b>(, [, <, {,</b> etc, must always be "left"
1939: in mimeTeX, and <b>), ], >, },</b> etc,
1940: must always be "right". To render "unusual" delimiter pairs you
1941: must use the unabbreviated form, e.g., <b>\left)...\right[</b>
1942: works fine. </li>
1943: <li> <b>\right.</b> may be paired with any of the automatically
1944: sized delimiters, and may optionally be abbreviated as <b>\.</b>
1945: The same <b>\.</b> also serves as an abbreviation
1946: for <b>\left.</b> MimeTeX correctly interprets your
1947: intention if you correctly balance delimiters. For example,
1948: either <b>y=\left\{{this\atop that}\right.</b> or
1949: <b>y=\{{this\atop that}\.</b> renders the usual useful
1950: construction
1951: <a href="#preview"><img id="parens10" onclick="eqntext('parens10')"
1952: src="../cgi-bin/mimetex.cgi?y=\{\text{this\atop that}\."
1953: alt="" border=0 align=middle></a> illustrated above. </li>
1954: <li> However, abbreviated <b>\.</b>'s cannot be nested in mimeTeX,
1955: e.g., <b>\[\(...\.\.</b> doesn't work. Instead, unabbreviated
1956: <b>\left.</b> and <b>\right.</b> may be nested, e.g.,
1957: <b>\left[\left(...\right.\right.</b> works fine. </li>
1958: <li> Simply nested abbreviations like <b>\[\(...\)\]</b> work fine in
1959: mimeTeX. But abbreviated delimiters like <b>\|...\|</b>
1960: and <b>\=...\=</b>, whose left and right forms are
1961: identical, cannot be nested. To nest these delimiters you
1962: must use the corresponding unabbreviated <b>\left|..\right|</b>
1963: and <b>\left\|...\right\|</b>. </li>
1964: <li> All <b>\left(...\right)</b>'s (and abbreviated <b>\(...\)</b>'s),
1965: etc, must be correctly balanced, which may include being matched
1966: with <b>\left.</b> or <b>\right.</b> (or abbreviated <b>\.</b>).
1967: And, to repeat, you may <b>_not_</b> mix
1968: abbreviated and unabbreviated \(...\right), etc, within a
1969: matching pair. </li>
1970: </ol>
1971:
1972: <p> Besides the <b>\left...\right</b> delimiters discussed above,
1973: mimeTeX also supports constructions like
1974: <b>\left\int_a^b...\right<b>.</b></b> , which automatically
1975: sizes the <b>\left\int</b> to accommodate everything between it
1976: and its matching <b>\right<b>.</b></b> delimiter.
1977: The <b>\right</b> delimiter needn't necessarily be
1978: the <b>\right<b>.</b></b> illustrated, e.g.,
1979: <b>\left\int_a^b x^2dx =\frac{x^3}3\right|\nolimits_a^b</b>
1980: produces
1981: <a href="#preview"><img id="parens11" onclick="eqntext('parens11')"
1982: src="../cgi-bin/mimetex.cgi?\large
1983: \left\int_a^bx^2dx=\frac{x^3}3\right|\nolimits_a^b" border=0 alt=""
1984: align=middle></a>. Except for Opening (TeX class 4) and
1985: Closing (class 5) delimiter characters like <b>( )</b> and
1986: <b>[ ]</b> and <b>\{ \}</b>, limits are default-rendered
1987: \displaystyle, which is why <b>\right|\nolimits_a^b</b> was required.
1988: You can also write <b>\left\sum</b>, <b>\left\prod</b>,
1989: <b>\left\cup</b>, etc, for many of the symbols in CMEX10.
1990: And any symbol that works with <b>\left</b> will also work
1991: with <b>\right</b> . But mimeTeX abbreviations like
1992: <b>\(...\)</b> for <b>\left(...\right)</b>
1993: won't work with any of these CMEX10 symbols. You'll have to write
1994: the usual unabbreviated <b>\left...\right</b> form. </p>
1995:
1996: <p> Unescaped <b>( )</b>'s and <b>[ ]</b>'s and <b>| |</b>'s
1997: and <b>< ></b>'s don't need to be balanced since mimeTeX just
1998: displays them like ordinary characters without any special significance.
1999: Ditto for the usual four <b>\big(</b> and <b>\Big(</b> and <b>\bigg(</b>
2000: and <b>\Bigg(</b>, and for their four right <b>)</b> counterparts, which
2001: just display <b>(...)</b>'s at fixed larger sizes, and also have no
2002: special significance. All four big <b>[ ]</b>'s and
2003: <b>< ></b>'s and <b>{ }</b>'s are also available
2004: as ordinary characters. </p>
2005:
2006: <p> As usual, unescaped <b>{...}</b>'s aren't displayed at all,
2007: must be balanced, and have the usual special LaTeX significance.
2008: MimeTeX interprets escaped <b>\{...\}</b>'s as abbreviations
2009: for <b>\left\{...\right\}</b> and therefore always sizes them to fit.
2010: If you need displayed but unsized <b>{...}</b>'s, write
2011: <b>\lbrace...\rbrace</b> or any of the four <b>\big{...\big}</b>'s. </p>
2012:
2013:
2014: <h2> <a name="accents"> (IIId) Accents, Functions, Arrows,
2015: Raise and rotate, Compose, Abbreviations, etc. </a> </h2>
2016:
2017: <h3> Accents<font size=5>...</font> </h3>
2018:
2019: <p class="continue">
2020: <b>\vec{ } \hat{ } \bar{ } \tilde{ } \dot{ }</b>
2021: and <b>\ddot{ }</b> are the only accents currently supported,
2022: and they're all "wide". You can write <b>\widehat{ }</b> if you
2023: like, but there's absolutely no difference either way.
2024: <b>\bar{ }</b> and <b>\overline{ }</b> are identical. <p>
2025:
2026: <h3> <a name="functions">Function names<font size=5>...</font></a> </h3>
2027:
2028: <p> All 32 usual LaTeX function names <b>\arccos</b>,...,<b>\tanh</b>
2029: are recognized by mimeTeX and treated in the usual way. MimeTeX
2030: also recognizes <b>\tr</b> for the trace, and also <b>\bmod</b>
2031: and <b>\pmod</b>. And those functions that normally take "limits"
2032: also behave as expected, e.g., </p> <center>
2033: <b>\lim_{n\to\infty}S_n=S</b> produces
2034: <a href="#preview"><img id="functions1" onclick="eqntext('functions1')"
2035: src="../cgi-bin/mimetex.cgi?3$\lim_{n\to\infty}S_n=S"
2036: alt="" border=0 align=middle></a> </center>
2037:
2038: <h3> <a name="arrows">long Arrows<font size=5>...</font></a> </h3>
2039:
2040: <p> All mimeTeX \long and \Long arrows take an optional [width] argument
2041: that explicitly sets the arrow's width in pixels, scaled by
2042: <a href="#unitlength">\unitlength</a>. For example,
2043: <b>\longrightarrow[50]</b> draws a 50-pixel wide arrow
2044: <a href="#preview"><img id="arrows1" onclick="eqntext('arrows1')"
2045: src="../cgi-bin/mimetex.cgi?\longrightarrow[50]" alt="" border=0
2046: align=middle></a>, whereas just <b>\longrightarrow</b> calculates
2047: a default width
2048: <a href="#preview"><img id="arrows2" onclick="eqntext('arrows2')"
2049: src="../cgi-bin/mimetex.cgi?\longrightarrow" alt="" border=0
2050: align=middle></a>, as usual. And, in addition to the usual
2051: right, left and leftright arrows, there are also \long (and \Long) up,
2052: down and updown arrows that take an optional [height] argument, also
2053: scaled by any preceding <a href="#unitlength">\unitlength</a>. </p>
2054:
2055: <p> In the event that you actually want to place an []-enclosed expression
2056: immediately following an "unsized" long arrow, just place a <b>~</b> or
2057: any white space after the arrow, e.g., <b>f:x\longrightarrow~[0,1]</b>
2058: produces
2059: <a href="#preview"><img id="arrows3" onclick="eqntext('arrows3')"
2060: src="../cgi-bin/mimetex.cgi?f:x\longrightarrow~[0,1]"
2061: alt="" border=0 align=middle></a>. Without any intervening white space,
2062: mimeTeX would have "eaten" the [0,1]. </p>
2063:
2064: <p> Super/subscripts immediately following all long/Long left/right arrows
2065: are displayed the same way <a href="#modes">\limits</a> displays them,
2066: e.g., </p> <center>
2067: <b>x\longrightarrow^gy</b> produces
2068: <a href="#preview"><img id="arrows4" onclick="eqntext('arrows4')"
2069: src="../cgi-bin/mimetex.cgi?\large x\longrightarrow^gy"
2070: alt="" border=0 align=middle></a> <br>
2071: <b>x\longrightarrow[50]^gy</b> produces
2072: <a href="#preview"><img id="arrows5" onclick="eqntext('arrows5')"
2073: src="../cgi-bin/mimetex.cgi?\large x\longrightarrow[50]^gy"
2074: alt="" border=0 align=middle></a> </center> <p class="continue">
2075: Subscripted long arrows can occasionally be useful, too, as in
2076: <a href="#example11">Example 11</a> above, e.g., </p> <center>
2077: <b>u\longrightarrow[50]_\beta v</b> produces
2078: <a href="#preview"><img id="arrows6" onclick="eqntext('arrows6')"
2079: src="../cgi-bin/mimetex.cgi?\large u\longrightarrow[50]_\beta^{\,}v"
2080: alt="" border=0 align=middle></a> </center> <p class="continue">
2081: To defeat this default behavior, e.g., <b>\longrightarrow\nolimits^g</b>
2082: displays super/subscripts in the usual way. </p>
2083:
2084: <p> Super/subscripts immediately following all long/Long up/down arrows
2085: are treated correspondingly, i.e., superscripts are vertically
2086: centered to the arrow's left, and subscripts to its right.
2087: For example, </p> <center>
2088: <b>\longuparrow[30]^\gamma</b> produces
2089: <a href="#preview"><img id="arrows7" onclick="eqntext('arrows7')"
2090: src="../cgi-bin/mimetex.cgi?\large\longuparrow[30]^\gamma"
2091: alt="" border=0 align=middle></a> <br>
2092: <b>\longdownarrow[30]_\gamma</b> produces
2093: <a href="#preview"><img id="arrows8" onclick="eqntext('arrows8')"
2094: src="../cgi-bin/mimetex.cgi?\large\longdownarrow[30]_\gamma"
2095: alt="" border=0 align=middle></a> </center> <p class="continue">
2096: whose occasional usefulness is also illustrated by
2097: <a href="#example11">Example 11</a>. And as before, to defeat
2098: this default behavior, e.g., <b>\longuparrow\nolimits^\gamma</b>
2099: displays super/subscripts in the usual way. </p>
2100:
2101: <h3> <a name="raiserotate">\raisebox{ }{ } and
2102: \rotatebox{ }{ }<font size=5>...</font></a> </h3>
2103:
2104: <p> The <b>\raisebox{<i>height</i>}{<i>expression</i>}</b>
2105: and <b>\rotatebox{<i>angle</i>}{<i>expression</i>}</b>
2106: commands help you fine-tune and manipulate mimeTeX renderings.
2107: The <b><i>height</i></b> argument is number of pixels, scaled by
2108: <a href="#unitlength">\unitlength</a>, and can be positive
2109: or negative. The <b><i>angle</i></b> argument is number of degrees,
2110: and can also be positive (for clockwise) or negative, but must be a
2111: multiple of 90. Finally, the <b><i>expression</i></b> can be any
2112: valid LaTeX/mimeTeX expression. For example, mimeTeX's preprocessor
2113: defines the LaTeX <b>?`</b> symbol, an upside-down question
2114: mark, like </p> <center>
2115: <b>abc\raisebox{-2}{\rotatebox{180}?}def</b> produces
2116: <a href="#preview"><img id="raiserot1" onclick="eqntext('raiserot1')"
2117: src="../cgi-bin/mimetex.cgi?
2118: \large\rm abc\raiseb{-2}{\rotateb{180}{\LARGE?}}def"
2119: alt="" border=0 align=middle></a> </center>
2120:
2121: <h3> <a name="compose">\compose{ }{ }<font size=5>...</font></a></h3>
2122:
2123: <p class="continue">
2124: <b>\compose[<i>offset</i>]{<i>base</i>}{<i>overlay</i>}</b>
2125: superimposes the <b><i>overlay</i></b> expression on top of the
2126: <b><i>base</i></b> expression, displaying the result.
2127: Optionally, the overlay is horizontally <b><i>offset</i></b>
2128: by the specified number of pixels (positive offsets to the right,
2129: negative to the left). For example, </p> <center>
2130: <b>\compose{\LARGE O}{\normalsize c}</b> produces
2131: <a href="#preview"><img id="compose1" onclick="eqntext('compose1')"
2132: src="../cgi-bin/mimetex.cgi?\compose{\LARGE O}{\normalsize c}"
2133: alt="" border=0 align=middle></a> </center>
2134:
2135: <p> Separately or in some judicious combination, <b>\compose</b> and
2136: <b>\raisebox</b> and <b>\rotatebox</b> should help you construct
2137: special symbols not "natively" available with mimeTeX's limited
2138: set of built-in font families. This can be especially useful
2139: in conjunction with the <b>-DNEWCOMMANDS</b> compile-time
2140: <a href="#options">option</a> discussed above. </p>
2141:
2142: <h3> <a name="abbreviations">Abbreviations<font size=5>...</font></a> </h3>
2143:
2144: <p class="continue">
2145: <b>\ga</b> displays <b>\gamma</b>, but just <b>\g</b> displays
2146: <b>\gg</b> (<b>>></b>). That is, mimeTeX selects the
2147: shortest symbol or command which begins with whatever you type.
2148: This feature can help shorten an otherwise very long line,
2149: but it may be a bit dangerous. </p>
2150:
2151: <p> The mimeTeX <a href="#symbols">preprocessor</a>, briefly mentioned
2152: above, is responsible for recognizing several LaTeX symbols like
2153: <b>\ldots</b> and several commands like <b>\atop</b> .
2154: These symbols and commands cannot be abbreviated. The special
2155: html characters like <b>&nbsp;</b> are also recognized by
2156: the preprocessor and cannot be abbreviated. </p>
2157:
2158: <h3> <a name="colors">Colors<font size=5>...</font></a> </h3>
2159:
2160: <p> Rudimentary color commands are provided by mimeTeX. You can write
2161: <b>\color{red}</b> or <b>\color{green}</b> or<b>\color{blue}</b>
2162: (which may be abbreviated <b>\red</b> or <b>\green</b> or
2163: <b>\blue</b>) anywhere in an expression to render the entire
2164: expression in the specified color. That is,
2165: <b>abc{\red def}ghi</b> renders the entire expression red,
2166: not just the <b>def</b> part. Also, note that mimeTeX's "green"
2167: is actually color <b>#00FF00</b>, which the html standard more
2168: accurately calls "lime". For example, </p> <center>
2169: <b>\blue e^x=\sum_{n=0}^\infty\frac{x^n}{n!}</b> produces
2170: <a href="#preview"><img id="colors1" onclick="eqntext('colors1')"
2171: src="../cgi-bin/mimetex.cgi?
2172: \Large\color{blue} e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
2173: alt="" border=0 align=middle></a> </center>
2174:
2175: <h3> <a name="squash">"Squash"<font size=5>...</font></a> </h3>
2176:
2177: <p> TeX represents characters by boxes, with no idea how ink will be
2178: distributed inside. So an expression like
2179: <b>\frac12\int_{a+b+c}^{d+e+f}g(x)dx</b> is typically rendered as
2180: <a href="#preview"><img id="squash1" onclick="eqntext('squash1')"
2181: src="../cgi-bin/mimetex.cgi?\displaystyle
2182: \nosquash\frac12\int_{a+b+c}^{d+e+f}{g(x)dx}"
2183: alt="" border=0 align=middle></a>.
2184: But mimeTeX knows the character shapes of its fonts, and therefore tries
2185: to remove extra whitespace, rendering the same expression as
2186: <a href="#preview"><img id="squash2" onclick="eqntext('squash2')"
2187: src="../cgi-bin/mimetex.cgi?\displaystyle
2188: \squash\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
2189: alt="" border=0 align=middle></a> instead. </p>
2190:
2191: <p> Precede any expression with the mimeTeX directive <b>\nosquash</b>
2192: to render it without "squashing". Or compile mimetex.c with the
2193: <b>-DNOSQUASH</b> <a href="#options">option</a> if you prefer
2194: the typical TeX behavior as mimeTeX's default. In this case,
2195: precede any expression with <b>\squash</b> to render it "squashed".
2196: And note that explicit space like <b>\hspace{10}</b>
2197: or <b>\;</b> , etc, is never squashed. </p>
2198:
2199: <p> The scope of <b>\squash</b> and <b>\nosquash</b> is the
2200: <b>{ }</b>-enclosed subexpression in which the directive occurs.
2201: For example, if you want the <b><i>g(x)</i></b> part of the
2202: preceding example squashed, but not the <b>1/2</b> part,
2203: then the expression
2204: <b>\nosquash\frac12{\squash\int_{a+b+c}^{d+e+f}g(x)dx}</b>
2205: renders as
2206: <a href="#preview"><img id="squash3" onclick="eqntext('squash3')"
2207: src="../cgi-bin/mimetex.cgi?\displaystyle
2208: \nosquash\frac12{\squash\int_{a+b+c}^{d+e+f}{g(x)dx}}"
2209: alt="" border=0 align=middle></a>.
2210: <!-- Moreover, explicit space like
2211: <b>\hspace{10}</b> or <b>\;</b>, etc, is never squashed.
2212: So <b>{\frac12\;\;}\int_{a+b+c}^{d+e+f}g(x)dx</b> renders as
2213: <a href="#preview"><img id="squash4" onclick="eqntext('squash4')"
2214: src="../cgi-bin/mimetex.cgi?\displaystyle
2215: {\frac12\;\;}\int_{a+b+c}^{d+e+f}{g(x)dx}"
2216: alt="" border=0 align=middle></a>. --> </p>
2217:
2218: <p> For finer-grained control, note that <b>\squash</b> is shorthand
2219: for the default <b>\squashmargin{+3}</b> (and <b>\nosquash</b> is
2220: shorthand for <b>\squashmargin{0}</b>). <b>\squashmargin</b>'s value
2221: is the minimum number of pixels between squashed symbols. The leading
2222: <b>+</b> is optional. If present, the font size (\tiny=0,...,\LARGE=5)
2223: is added to the specified minimum. Compile mimetex.c with the
2224: <b>-DSQUASHMARGIN=<i>n</i></b> <a href="#options">option</a> to change
2225: the default from <b>3</b> to <b><i>n</i></b>. Compare the preceding
2226: example with the over-squashed <b>\squashmargin{1}</b>
2227: <a href="#preview"><img id="squash5" onclick="eqntext('squash5')"
2228: src="../cgi-bin/mimetex.cgi?\displaystyle
2229: \squashmargin1\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
2230: alt="" border=0 align=middle></a> instead. </p>
2231:
2232: <p> Squashing is in "alpha testing" and some expressions still don't look
2233: quite right when squashed, e.g., <b>1^2,2^2,3^2,\ldots</b> renders as
2234: <a href="#preview"><img id="squash6" onclick="eqntext('squash6')"
2235: src="../cgi-bin/mimetex.cgi?\Large1^2,2^2,3^2,\ldots"
2236: alt="" border=0 align=middle></a>. Just compile with <b>-DNOSQUASH</b>
2237: if you come across numerous annoying situations. </p>
2238:
2239: <h3> <a name="not">\not and \Not and \sout<font size=5>...</font></a> </h3>
2240:
2241: <p> The usual LaTeX <b>\not</b> "slashes" the single symbol
2242: following it, e.g., <b>i\not\partial\equiv i\not\nabla</b>
2243: produces <a href="#preview">
2244: <img id="not1" onclick="eqntext('not1')"
2245: src="../cgi-bin/mimetex.cgi?i\not\partial\equiv i\not\nabla"
2246: alt="" border=0 align=middle></a>. </p>
2247:
2248: <p> For arbitrary expressions, mimeTeX provides <b>\Not</b>
2249: which draws a line from the upper-right to lower-left corner of its
2250: argument, e.g., <b>a\Not{x^2}=bx^{\not3}</b> produces
2251: <a href="#preview"><img id="not2" onclick="eqntext('not2')"
2252: src="../cgi-bin/mimetex.cgi?\large a\Not{x^2}=bx^{\not3}"
2253: alt="" border=0 align=bottom></a>. </p>
2254:
2255: <p> Finally, similar to the <b>ulem.sty</b> package, <b>\sout</b>
2256: draws a horizontal strikeout line through its argument,
2257: e.g., <b>\sout{abcdefg}</b> produces <a href="#preview">
2258: <img id="not3" onclick="eqntext('not3')"
2259: src="../cgi-bin/mimetex.cgi?\sout{abcdefg}"
2260: alt="" border=0 align=middle></a>. MimeTeX's <b>\sout</b> also
2261: takes an optional argument that adjusts the vertical position of its
2262: strikeout line by the specified number of pixels, e.g.,
2263: <b>\sout[+2]{abcdefg}</b> produces <a href="#preview">
2264: <img id="not4" onclick="eqntext('not4')"
2265: src="../cgi-bin/mimetex.cgi?\sout[+2]{abcdefg}"
2266: alt="" border=0 align=middle></a> and
2267: <b>\sout[-2]{abcdefg}</b> produces
2268: <a href="#preview"><img id="not5" onclick="eqntext('not5')"
2269: src="../cgi-bin/mimetex.cgi?\sout[-2]{abcdefg}"
2270: alt="" border=0 align=middle></a>. </p>
2271:
2272:
2273: <h2> <a name="array"> (IIIe) \begin{array}{lcr}...\end{array} Environment
2274: </a> </h2>
2275:
2276: <p> Rendering vectors and matrices, aligning equations, etc, is all done
2277: using the customary LaTeX environment
2278: <b>\begin{array}{lcr} a&b&c\\d&e&f\\etc \end{array}</b>
2279: which you can write in exactly that form. MimeTeX also
2280: recognizes the following array-like environments </p>
2281: <center> <table cellpadding="1" cellspacing="1">
2282: <tr> <td align="left"> <b>\begin{array}{lcr}</b> </td>
2283: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2284: <td align="left"> <b>\end{array}</b> </td> </tr>
2285: <tr> <td align="left"> <b>\begin{matrix}</b> </td>
2286: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2287: <td align="left"> <b>\end{matrix}</b> </td> </tr>
2288: <tr> <td align="left"> <b>\begin{pmatrix}</b> </td>
2289: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2290: <td align="left"> <b>\end{pmatrix}</b> </td> </tr>
2291: <tr> <td align="left"> <b>\begin{bmatrix}</b> </td>
2292: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2293: <td align="left"> <b>\end{bmatrix}</b> </td> </tr>
2294: <tr> <td align="left"> <b>\begin{Bmatrix}</b> </td>
2295: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2296: <td align="left"> <b>\end{Bmatrix}</b> </td> </tr>
2297: <tr> <td align="left"> <b>\begin{vmatrix}</b> </td>
2298: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2299: <td align="left"> <b>\end{vmatrix}</b> </td> </tr>
2300: <tr> <td align="left"> <b>\begin{Vmatrix}</b> </td>
2301: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
2302: <td align="left"> <b>\end{Vmatrix}</b> </td> </tr>
2303: <tr> <td align="left"> <b>\begin{eqnarray}</b> </td>
2304: <td align="center"> <b>a&=&b \\ c&=&d \\ etc</b> </td>
2305: <td align="left"> <b>\end{eqnarray}</b> </td> </tr>
2306: <tr> <td align="left"> <b>\begin{align}</b> </td>
2307: <td align="center"> <b>a&=b \\ c&=d \\ etc</b> </td>
2308: <td align="left"> <b>\end{align}</b> </td> </tr>
2309: <tr> <td align="left"> <b>\begin{gather}</b> </td>
2310: <td align="center"> <b>a \\ b \\ etc</b> </td>
2311: <td align="left"> <b>\end{gather}</b> </td> </tr>
2312: </table> </center> <p class="continue">
2313: There's a built-in maximum of 64 columns and 64 rows. Nested
2314: array environments, e.g.,
2315: <b>\begin{pmatrix}a&\begin{matrix}1&2\\3&4\end{matrix}\\c&d\end{pmatrix}</b>,
2316: are permitted. </p>
2317:
2318: <p> MimeTeX also provides the abbreviation
2319: <b>\array{lcr$a&b&c\\d&e&f\\etc}</b>
2320: which has exactly the same effect as
2321: <b>\begin{array}{lcr} a&b&c\\d&e&f\\etc \end{array}</b>.
2322: And the <b>lcr$</b> "preamble" in <b>\array{lcr$etc}</b> is optional.
2323: In that case, <b>\array{a&b&c\\d&e&f\\etc}</b>
2324: has exactly the same effect as
2325: <b>\begin{matrix} a&b&c\\d&e&f\\etc \end{matrix}</b>.
2326: You can also write <b>\(\array{etc}\)</b> to "manually abbreviate"
2327: the pmatrix environment, or <b>\array{rcl$etc}</b> to abbreviate
2328: eqnarray, but mimeTeX has no explicit abbreviations for these
2329: other environments. For example, </p> <center>
2330: <b>\begin{matrix}a_1&a_2&a_3\\b_1&b_2&b_3\\c_1&c_2&c_3\end{matrix}</b>
2331: produces
2332: <a href="#preview"><img id="array1" onclick="eqntext('array1')"
2333: src="../cgi-bin/mimetex.cgi?\large\begin{matrix}a_1&a_2&a_3\\
2334: b_1&b_2&b_3\\c_1&c_2&c_3\end{matrix}"
2335: alt="" border=0 align=middle></a> </center>
2336:
2337: <p> Solid <b>\hline</b>'s (but not \cline's) and vertical <b>l|c|r</b> bars
2338: are available, as usual. For dashed lines and bars,
2339: <b>\begin{array}</b> provides the additional features <b>\hdash</b>
2340: and <b>l.c.r</b> . <b>\hline</b> and <b>\hdash</b> may not be
2341: abbreviated. For example, </p> <center>
2342: <b>\begin{array}{c.c|c} a_1&a_2&a_3 \\\hdash b_1&b_2&b_3 <br>
2343: \\\hline c_1&c_2&c_3 \end{array}</b> produces <br>
2344: <a href="#preview"> <img id="array22" onclick="eqntext('array22')"
2345: src="../cgi-bin/mimetex.cgi?\large\begin{array}{c.c|c}
2346: a_1&a_2&a_3\\\hdash b_1&b_2&b_3\\\hline c_1&c_2&c_3\end{array}"
2347: alt="" border="0" align="middle"> </a> </center>
2348:
2349: <p> The default font size is unchanged by <b>\array{ }</b>, but you
2350: can explicitly control it in the usual way, e.g.,
2351: <b>{\large\begin{matrix}...\end{matrix}}</b> renders the entire array
2352: in font size 3. In addition, any <b>&...&</b> cell may contain font
2353: size declarations which are always local to that cell,
2354: e.g., <b>&\fs{-1}...&</b> renders that one cell one font size smaller
2355: than current. </p>
2356:
2357: <p> The <b>{lcr}</b> in <b>\begin{array}{lcr}</b> sets left,center,right
2358: <i>"horizontal justification"</i> down columns of an array,
2359: as usual. And "vertical justification" across rows defaults
2360: to what we'll call <b><i>baseline</i></b>, i.e., aligned equations,
2361: as in <a href="#example10">Example 10</a> above, display properly.
2362: But the down arrows (for
2363: <a href="#preview"><img id="array3" onclick="eqntext('array3')"
2364: src="../cgi-bin/mimetex.cgi?\small\array{C$\gamma&\Large\downarr}"
2365: alt="" border=0 align=middle></a> and for
2366: <a href="#preview"><img id="array4" onclick="eqntext('array4')"
2367: src="../cgi-bin/mimetex.cgi?\small\array{C$\Large\downarr&\beta}"
2368: alt="" border=0 align=middle></a>)
2369: in <a href="#example11">Example 11</a> require
2370: <i>"vertical centering"</i> across the middle row of that
2371: array. So, in addition to lowercase <b>lcr</b>, mimeTeX's <b>{lcr}</b>
2372: in <b>\begin{array}{lcr}</b> may also contain uppercase <b>BC</b> to
2373: set "<b>B</b>"aseline or "<b>C</b>"enter vertical justification across
2374: the corresponding rows. For example, <b>\begin{array}{rccclBCB}</b>
2375: sets baseline justification for the first and third rows, and center
2376: justification for the second row. Without any <b>BC</b>'s,
2377: all rows default to the usual <b>B</b> baseline justification. </p>
2378:
2379: <p> MimeTeX has no <b>\arraycolsep</b> or <b>\arraystretch</b> parameters.
2380: Instead, <b>\begin{array}{lc25rB35C}</b> sets the absolute width
2381: of the second column to 25 pixels, and the absolute height of the
2382: first row to 35 pixels, as illustrated by
2383: <a href="#example9">Example 9</a>. Any number following
2384: an <b>lcrBC</b> specification sets the width of that one column
2385: (for <b>lcr</b>), or the height of that one row (for <b>BC</b>). <br>
2386: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
2387: You can optionally precede the number with a <b>+</b> sign,
2388: which "propagates" that value forward to all subsequent columns for
2389: <b>lcr</b>, or all subsequent rows for <b>BC</b>. For example,
2390: <b>\begin{array}{lc+25rB+35C}</b> sets the absolute width of
2391: column 2 and all subsequent columns to 25 pixels,
2392: and the absolute height of row 1 and all subsequent rows
2393: to 35 pixels. After absolute sizing has been set, the special
2394: value <b>0</b> reverts to automatic sizing for that one row or
2395: column, and <b>+0</b> reverts to automatic sizing for all subsequent
2396: rows or columns. For example, <b>\begin{array}{c+25ccc+35ccc+0}</b>
2397: sets the absolute widths of columns 1-3 to 25 pixels,
2398: columns 4-6 to 35 pixels, and then reverts to automatic
2399: sizing for columns 7 and all subsequent columns. <br>
2400: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
2401: The "propagation" introduced by <b>+</b> is local to the
2402: <b>\begin{array}</b> in which it occurs. So you have to repeat
2403: the same specifications if you want rows aligned across several
2404: arrays on the same line (or columns aligned on several lines
2405: separated by <b>\\</b>). Instead, a lowercase <b>g</b> globally
2406: copies your column specifications to all subsequent arrays,
2407: and an uppercase <b>G</b> globally copies your row specifications.
2408: And <b>gG</b> copies both column and row specifications. For example,
2409: <b>\begin{array}{GC+25}</b> sets the height of all rows in this
2410: array to 25 pixels, and ditto for all subsequent arrays to its right.
2411: Explicit specifications in subsequent arrays override previous global
2412: values. <br>
2413: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
2414: Click one of the following examples to see illustrations
2415: of the above discussion: </p> <center>
2416: <a href="#preview"> <img id="array31" onclick="eqntext('array31')"
2417: src="../cgi-bin/mimetex.cgi?\large
2418: \left( \begin{array}{GC+30}
2419: \cos\frac\theta2 & i\,\sin\frac\theta2\\
2420: i\,\sin\frac\theta2 & \cos\frac\theta2 \end{array} \right)
2421: \left( \begin{array}
2422: z & x_{\tiny-} \\ x_{\tiny+} & -z \end{array} \right)
2423: \hfill{300}\text{\normalsize Example 1}"
2424: alt="" border="0" align="middle"> </a> <br>
2425: <a href="#preview"> <img id="array32" onclick="eqntext('array32')"
2426: src="../cgi-bin/mimetex.cgi?\large
2427: \left( \begin{array}{GC+30gc+40}
2428: \cos\frac\theta2 & i\,\sin\frac\theta2 \\
2429: i\,\sin\frac\theta2 & \cos\frac\theta2 \end{array} \right)
2430: \left( \begin{array}
2431: z & x_{\tiny-} \\ x_{\tiny+} & -z \end{array} \right)
2432: \hfill{300}\text{\normalsize Example 2}"
2433: alt="" border="0" align="middle"> </a> </center>
2434:
2435: <p> See <a href="#example8">Examples 8-11</a> above for several
2436: additional <b>\begin{array}{lcr}</b> applications. </p>
2437:
2438:
2439: <h2> <a name="picture"> (IIIf) \picture( ){ } "Environment",
2440: including \line( ){ } and \circle( ) </a> </h2>
2441:
2442: <p> Besides <b>\begin{array}{lcr}</b>, mimeTeX also tries to emulate the
2443: familiar LaTeX picture environment with the somewhat similar<br>
2444: <b> \picture(width[,height])
2445: { (loc1){pic_elem1} (loc2){pic_elem2} ... }</b><br>
2446: as illustrated by <a href="#example12">Examples 12-13</a> above.
2447: Arguments surrounded by <b>[ ]</b>'s are optional.
2448: If the optional <b>[,height]</b> is omitted, then <b>height=width</b>
2449: is assumed. Locations <b>(loc1)</b> and <b>(loc2) ...</b> each
2450: denote either a <b>\put(loc)</b> or a <b>\multiput(loc)</b>,
2451: and each location is of the form <b>([c]x,y[;xinc,yinc[;num]])</b>. </p>
2452:
2453: <p> A <b>\put(loc)</b> is denoted by a location of the form <b>([c]x,y)</b>
2454: where <b>x,y</b> denotes the coordinate where the lower-left corner
2455: of the subsequent picture_element will be placed, unless the letter
2456: <b>c</b> precedes the <b>x</b>-number, in which case <b>cx,y</b>
2457: denotes the center point instead. The very lower-left corner of the
2458: entire picture is always <b>0,0</b>, and the upper-right corner is
2459: <b>width-1,height-1</b>. Note, for example, that you'd never want
2460: to specify location <b>c0,0</b> since the picture_element would be
2461: mostly out-of-bounds (only its upper-right quadrant would be
2462: in-bounds). </p>
2463:
2464: <p> A <b>\multiput(loc)</b> starts like a <b>\put(loc)</b>, but location
2465: <b>[c]x,y</b> is followed by <b>;xinc,yinc[;num]</b> indicating the
2466: <b>x,y-inc</b>rements applied to each of <b>num</b> repetitions
2467: of picture_element. If <b>;num</b> is omitted, repetitions continue
2468: until the picture_element goes out-of-bounds of the specified
2469: <b>width[,height]</b>. Note that <b>x,y</b> are always positive or
2470: zero, but <b>xinc,yinc</b> may be postive, zero or negative. </p>
2471:
2472: <p> The <b>\picture(,){...}</b> parameters <b>width, height, x, y, xinc,
2473: yinc</b> may be either integer or may contain a decimal point,
2474: and they're all scaled by <a href="#unitlength">\unitlength</a>.
2475: The <b>num</b> parameter must be integer. </p>
2476:
2477: <p> Picture_element's <b>{pic_elem1}</b> and <b>{pic_elem2} ...</b>
2478: may be any expressions recognized by mimeTeX, even including other
2479: <b>\picture</b>'s nested to any level. </p>
2480:
2481: <h3> <a name="circleline">\line( ){ } and
2482: \circle( )<font size=5>...</font></a> </h3>
2483:
2484: <p> To help draw useful picture_element's, mimeTeX provides several
2485: drawing commands, <b>\line(xinc,yinc)[{xlen}]</b> and
2486: <b>\circle(xdiam[,ydiam][;arc])</b>. Although primarily intended
2487: for use in <b>\picture</b>'s, you can use them in any mimeTeX
2488: expression, e.g., <b>abc\circle(20)def</b> produces
2489: <a href="#preview"><img id="circleline1" onclick="eqntext('circleline1')"
2490: src="../cgi-bin/mimetex.cgi?\large abc\circle(20)def"
2491: alt="" border="0" align="middle"></a>. </p>
2492:
2493: <p> Without its optional <b>{xlen}</b> parameter, the expression
2494: <b>(x,y){\line(xinc,yinc)}</b> draws a straight line from point
2495: <b>x,y</b> to point <b>x+xinc,y+yinc</b>. The <b>inc</b>'s
2496: can be positive, zero or negative. Don't prefix location <b>x,y</b>
2497: with a leading <b>c</b> for <b>\line</b>'s; the intended "corner"
2498: is determined by the signs of <b>xinc</b> and <b>yinc</b>.
2499: If given, the optional <b>{xlen}</b> parameter rescales the length
2500: of the line so its x-projection is <b>xlen</b> and its slope is
2501: unchanged. </p>
2502:
2503: <p> Without optional <b>,ydiam</b> and <b>;arc</b>, the expression
2504: <b>(x,y){\circle(xdiam)}</b> draws a circle of diameter <b>xdiam</b>
2505: centered at <b>x,y</b>. Don't prefix location <b>x,y</b> with a
2506: leading <b>c</b> for <b>\circle</b>'s; centering is assumed.
2507: If <b>,ydiam</b> is also given, then <b>(x,y){\circle(xdiam,ydiam)}</b>
2508: draws the ellipse inscribed in a rectangle of width <b>xdiam</b>
2509: and height <b>ydiam</b> centered at <b>x,y</b>. <br>
2510: Finally, <b>;arc</b> specifies the arc to be
2511: drawn, in one of two ways. An <b>;arc</b> argument given in the
2512: form <b>;1234</b> interprets each digit as a quadrant to be drawn,
2513: with <b>1</b> the upper-right quadrant and then proceeding
2514: counterclockwise, e.g., <b>\circle(12;34)</b> specifies the
2515: lower half of a circle whose diameter is twelve. <br>
2516: Alternatively, an <b>;arc</b> argument given in
2517: the form <b>45,180</b> or <b>-60,120</b> specifies the endpoints of
2518: the desired arc in degrees, with <b>0</b> the positive x-axis and
2519: then proceeding counterclockwise. The first number must always
2520: be smaller than the second (negative numbers are allowed), and the
2521: arc is drawn counterclockwise starting from the smaller number. </p>
2522:
2523: <p> Besides <a href="#example12">Examples 12-13</a> above,
2524: it's hard to resist illustrating<br>
2525: <font size=4><b>
2526: \unitlength{.6} \picture(100) {<br>
2527:
2528: (50,50){\circle(99)} %%head%%<br>
2529:
2530: (20,55;50,0;2){\fs{+1}\hat\bullet} %%eyes%%<br>
2531:
2532: (50,40){\bullet} %%nose%%<br>
2533:
2534: (50,35){\circle(50,25;34)} %%upper lip%%<br>
2535:
2536: (50,35){\circle(50,45;34)} %%lower lip%% }</b></font></p>
2537: <center>
2538: <a href="#preview"><img id="circleline2" onclick="eqntext('circleline2')"
2539: src="../cgi-bin/mimetex.cgi?\unitlength{.6}\picture(100){
2540: (50,50){\circle(99)} (20,55;50,0;2){\fs{+1}\hat\bullet} (50,40){\bullet}
2541: (50,35){\circle(50,25;34)} (50,35){\circle(50,45;34)}}"
2542: alt="" border=0 align=middle></a><br>Have a nice day!</center>
2543:
2544:
2545: <h2> <a name="commands"> (IIIg) Other mimeTeX Commands </a> </h2>
2546:
2547: <p> Various and sundry other LaTeX-like commands are also provided
2548: by mimeTeX. In addition to features explicitly discussed below,
2549: mimeTeX supports the usual sub<b>_</b>scripts and super<b>^</b>scripts,
2550: and most of the typical LaTeX commands, many already discussed
2551: above, including </p>
2552: <ul>
2553: <li> <b>\frac{ }{ }</b> and <b>{ \over }</b> </li>
2554: <li> <b>{ \atop }</b> and <b>{ \choose }</b> </li>
2555: <li> <b>\sqrt{ }</b> </li>
2556: <li> <b>\lim_{ }</b> and all the usual LaTeX function names </li>
2557: <li> <b>\hat{ }</b> and <b>\widehat{ }</b>
2558: and many of the usual LaTeX accents </li>
2559: <li> <b>\overbrace{ }^{ }</b> and
2560: <b>\underbrace{ }_{ }</b> </li>
2561: <li> <b>\overline{ }</b> and <b>\underline{ }</b> </li>
2562: </ul> <p class="continue">
2563: All these typical commands should behave as they usually do
2564: in LaTeX, and won't be discussed further. Short discussions
2565: of some other commands follow. </p>
2566:
2567: <h3> <a name="stackrel">\stackrel{ }{ } and
2568: \relstack{ }{ }<font size=5>...</font></a> </h3>
2569:
2570: <p class="continue">
2571: <b>\stackrel{ }{ }</b> behaves as usual in LaTeX,
2572: rendering its first argument one font size smaller and centered above
2573: its second. And the amsmath-style <b>\overset{ }{ }</b> is
2574: identical. For example, </p> <center>
2575: <b>"\vec x\stackrel{\rm def}=(x_1\ldots x_n)"</b>
2576: produces
2577: <a href="#preview"><img id="stackrel1" onclick="eqntext('stackrel1')"
2578: src="../cgi-bin/mimetex.cgi?
2579: \Large\vec x\,\stackrel{\small\rm def}=
2580: \,(x_1\ldots x_n)" alt="" border=0 align=middle></a> </center>
2581:
2582: <p> "Conversely" to <b>\stackrel{ }{ }</b>, mimeTeX provides
2583: <b>\relstack{ }{ }</b>, which renders its second argument
2584: one font size smaller and centered below its first.
2585: And the amsmath-style <b>\underset{ }{ }</b> renders its
2586: first argument one font size smaller and centered below its second.
2587: For example, the <b>\log</b> function name doesn't treat
2588: limits like <b>\lim_</b>, but you can write, for example, </p> <center>
2589: <b>"\relstack{\log}{\rm base 2}32=5"</b> to render
2590: <a href="#preview"><img id="stackrel2" onclick="eqntext('stackrel2')"
2591: src="../cgi-bin/mimetex.cgi?
2592: \Large\relstack\log{\small\rm base 2}32\,=\,5"
2593: alt="" border=0 align=middle></a> </center>
2594:
2595: <p> MimeTeX's <b>\limits</b> provides an easier but non-standard
2596: alternative to achieve the same effect. For example, </p> <center>
2597: <b>"\vec x =\limits^{\rm def} (x_1\ldots x_n)"</b>
2598: produces
2599: <a href="#preview"><img id="stackrel3" onclick="eqntext('stackrel3')"
2600: src="../cgi-bin/mimetex.cgi?\Large\vec x\,=\limits^{\small\rm def}
2601: \,(x_1\ldots x_n)" alt="" border=0 align=middle></a> <br><br>
2602: and <b>"\log\limits_{\rm base 2}32=5"</b>
2603: produces
2604: <a href="#preview"><img id="stackrel4" onclick="eqntext('stackrel4')"
2605: src="../cgi-bin/mimetex.cgi?
2606: \Large\log\limits_{\small\rm base 2}32\,=\,5"
2607: alt="" border=0 align=middle></a> </center>
2608:
2609: <h3> <a name="fbox">\fbox{ }<font size=5>...</font></a> </h3>
2610:
2611: <p> In case html border attributes aren't suitable, mimeTeX provides
2612: the usual <b>\fbox{<i>expression</i>}</b> command, e.g., </p> <center>
2613: <b>"\fbox{x=\frac12}"</b> produces
2614: <a href="#preview"><img id="fbox1" onclick="eqntext('fbox1')"
2615: src="../cgi-bin/mimetex.cgi?4$\fbox{x=\frac12}"
2616: alt="" border=0 align=middle></a> </center>
2617:
2618: <p> You can also write <b>\fbox[<i>width</i>]{<i>expression</i>}</b>
2619: to explicitly set the box's width, or you can write
2620: <b>\fbox[<i>width</i>][<i>height</i>]{<i>expression</i>}</b>
2621: to explicitly set both width and height. </p>
2622:
2623: <h3> <a name="input">\input{ }<font size=5>...</font></a> </h3>
2624:
2625: <p class="continue">
2626: <b>\input{<i>filename</i>}</b> behaves just like the corresponding
2627: LaTeX command, reading the entire contents of <b><i>filename</i></b>
2628: into your expression at the point where the <b>\input</b> command
2629: occurs. By default, <b><i>filename</i></b> resides in the same
2630: directory as mimetex.cgi. Moreover, for security, absolute paths
2631: with leading <b>/</b>'s or <b>\</b>'s, and paths with <b>../</b>'s
2632: or <b>..\</b>'s, are not permitted. See the <b>-DPATHPREFIX</b>
2633: <a href="#options">compile option</a>, discussed above,
2634: if you want <b>\input</b> files in some other directory.
2635: In any case, if <b><i>filename</i></b> isn't found, then
2636: <b>\input</b> tries to read <b><i>filename</i>.tex</b> instead.</p>
2637:
2638: <p> MimeTeX also supports the optional form
2639: <b>\input{<i>filename:tag</i>}</b>. In this case,
2640: <b><i>filename</i></b> is read as before, but only those characters
2641: between <b><<i>tag</i>>...</<i>tag</i>></b> are placed
2642: into your expression. This permits you to have one file containing
2643: many different <b><<i>tag</i>></b>'s, e.g., one file containing
2644: all the questions and/or answers to a homework assignment or a quiz,
2645: etc. </p>
2646:
2647: <h3> <a name="counter">\counter[ ]{ }
2648: <font size=5>...</font></a> </h3>
2649:
2650: <p> The bottom-right corner of this page contains a page hit counter
2651: that's maintained using mimeTeX's
2652: <b>\counter[<i>logfile</i>]{<i>counterfile</i>:<i>tag</i>}</b>
2653: command. As with <b>\input</b>, described immediately above,
2654: both the required <b><i>counterfile</i></b> and the optional
2655: <b><i>logfile</i></b> are the names of files that reside in the
2656: same directory as your mimetex.cgi executable, unless you compiled
2657: mimetex with the <b>-DPATHPREFIX</b>
2658: <a href="#options">compile option</a>. Before using
2659: the <b>\counter</b> command, Unix "touch" and "chmod" those files
2660: so they're mimeTeX readable and writable. </p>
2661:
2662: <p> If <b><i>counterfile</i></b> isn't readable and writable,
2663: then the <b>\counter</b> command always displays
2664: <b>1<sup><u>st</u></sup></b>. Otherwise, it maintains a
2665: line in <b><i>counterfile</i></b> of the form
2666: <b><<i>tag</i>> <i>value</i> </<i>tag</i>></b>
2667: where <b><i>value</i></b> is initialized as <b>1_</b> if the
2668: specified <b><<i>tag</i>></b> line doesn't already exist,
2669: and then incremented on each subsequent call. That trailing
2670: underscore on the value in the file, e.g., <b>99_</b>, tells
2671: mimeTeX to display <b>99<sup><u>th</u></sup></b> with an
2672: ordinal suffix. Edit the value in the file and remove the
2673: underscore if you don't want the ordinal suffix displayed.
2674: Finally, mimeTeX makes no effort to lock files or
2675: records (tags), so be careful using <b>\counter</b>
2676: if your hit rates are high enough so that frequent collisions
2677: are likely. </p>
2678:
2679: <p> The same <b><i>counterfile</i></b> can contain as many different
2680: <b><<i>tag</i>></b> lines as you like, so counters for
2681: all the pages on your site can be maintained in one file.
2682: MimeTeX also maintains a special <b><timestamp></b> tag
2683: in <b><i>counterfile</i></b> that logs the the date/time and
2684: name of the most recently updated tag. </p>
2685:
2686: <p> Somewhat more detailed log information can be accumulated in
2687: the optional <b><i>logfile</i></b>. If you provide that
2688: filename, mimeTeX writes a line to it of the form
2689: <b>2004-09-20:12:59:33pm <<i>tag</i>>=99 192.168.1.1 <i>http_referer</i></b>
2690: containing a timestamp, the counter tag and its current value,
2691: and the user's IP address and http_referer page if they're
2692: available. </p>
2693:
2694: <p> The page hit counter displayed at the bottom-right corner
2695: of this page is maintained by the command
2696: <b>\counter[counters.log]{counters.txt:mimetex.html}</b>.
2697: After compiling and installing your
2698: own mimetex.cgi and your own copy of this page, that counter will
2699: continually show <b>1<sup><u>st</u></sup></b>'s
2700: unless/until you "touch" and "chmod" counters.txt (and, optionally,
2701: counters.log) in your mimetex.cgi directory. </p>
2702:
2703:
2704: <h2> <a name="exceptions"> (IIIh) Other Exceptions
2705: to LaTeX Syntax </a> </h2>
2706:
2707: <h3> Binding Exceptions<font size=5>...</font> </h3>
2708:
2709: <p> MimeTeX's bindings are pretty much left-to-right. For example,
2710: although mimeTeX correctly interprets <b>\frac12</b> as well as
2711: <b>\frac{1}{2}</b>, etc, the legal LaTeX expression <b>x^\frac12</b>
2712: must be written <b>x^{\frac12}</b>. Otherwise, mimeTeX interprets
2713: it as <b>{x^\frac}12</b>, i.e., the same way <b>x^\alpha12</b>
2714: would be interpreted, which is entirely wrong for <b>\frac</b>.
2715: The same requirement also applies to other combinations of commands,
2716: e.g., you must write <b>\sqrt{\frac\alpha\beta}</b>, etc. </p>
2717:
2718:
2719: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2720: SECTION IV. APPENDICES
2721: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
2722: <h1> <a name="appendices"> (IV) Appendices </a> </h1>
2723:
2724: <p> Programming information to help you modify mimeTeX's behavior,
2725: and to use its functionality in your own programs, is provided
2726: by these appendices. The currently available appendices discuss
2727: (a)how to modify or extend mimeTeX's fonts, (b)how to use
2728: mimeTeX's principal function, make_raster(), and (c)how to use
2729: <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
2730: gifsave.c library. </p>
2731:
2732:
2733: <h2> <a name="fonts"> (IVa) mimeTeX Fonts </a> </h2>
2734:
2735: <p> The font information mimeTeX uses to render characters is
2736: derived from .gf font files (usually generated by <b>metafont</b>
2737: running against .mf files), which are then run through
2738: <b>gftype -i</b> and finally through my <b>gfuntype</b> program
2739: (supplied with your mimeTeX distribution). </p>
2740:
2741: <p> The final output from each such sequence of three runs
2742: (metafont > gftype -i > gfuntype) gives mimeTeX the information
2743: it needs to render one particular font family at one particular
2744: size. The file <b>texfonts.h</b> supplied with your mimeTeX
2745: distribution collects the output from 36 such (sequences of)
2746: runs, representing six font families at six sizes each. </p>
2747:
2748: <p> This collection of information in texfonts.h is
2749: "wired" into mimeTeX through tables maintained in <b>mimetex.h</b>.
2750: To change mimeTeX's fonts, you'll have to first modify (or totally
2751: replace) texfonts.h using your own gfuntype output, and then
2752: change mimetex.h to reflect your texfonts.h modifications. </p>
2753:
2754: <p> This appendix provides a brief description of the above
2755: process, though you'll probably need at least some previous
2756: C programming experience to confidently accomplish it.
2757: Your motivation might be to add more fonts to mimeTeX,
2758: to change the font sizes I chose, or to add more
2759: font sizes, etc. MimeTeX's design permits all this to be
2760: easily done once you understand the process. </p>
2761:
2762: <p> Running <b>metafont</b> to generate a <b>.gf</b> file from <b>.mf</b>
2763: source will usually be your very first step. A typical such run
2764: might be </p>
2765: <center><b>mf '\mode=onetz; mag=magstep(.5); input cmmi10'</b></center>
2766: <p class="continue"> which in this case generates output file
2767: <b>cmmi10.131gf</b> (which is mimeTeX's font size 3 for the
2768: cmmi family). </p>
2769:
2770: <p> Given the cmmi10.131gf file from this metafont run
2771: (or substitute any other .gf file you like), next run </p>
2772: <center><b>gftype -i cmmi10.131gf > typeout</b></center>
2773: <p class="continue"> where <b>typeout</b> can be any temporary
2774: filename you like. </p>
2775:
2776: <p> Finally, run <b>gfuntype</b> against the typeout file
2777: you just generated with the command </p>
2778: <center><b>gfuntype -n cmmi131 typeout cmmi131.h</b></center>
2779: <p class="continue"> to generate the final output file <b>cmmi131.h</b>
2780: (or any filename you supply as the last arg). This
2781: contains the cmmi data in an array whose name is taken
2782: from the <b>-n</b> arg you supplied to gfuntype. </p>
2783:
2784: <p> The above sequence of three runs resulted in output file
2785: <b>cmmi131.h</b>, containing the font information mimeTeX needs
2786: for one font family (cmmi) at one font size (3). Repeat this
2787: sequence of three runs for each font size and each font family.
2788: Then pull all the output files into one big <b>texfonts.h</b> file
2789: (or write a small texfonts.h which just #include's them all). </p>
2790:
2791: <p> For your information, the 36 sequences of runs represented
2792: in the texfonts.h file supplied with your mimeTeX distribution
2793: correspond to the following six inital metafont runs for cmr10 </p>
2794: <pre> size=0 (.83gf) mf '\mode=eighthre; input cmr10'
2795: 1 (.100gf) mf '\mode=nextscrn; input cmr10'
2796: 2 (.118gf) mf '\mode=lview; input cmr10'
2797: 3 (.131gf) mf '\mode=onetz; mag=magstep(.5); input cmr10'
2798: 4 (.160gf) mf '\mode=itoh; input cmr10'
2799: 5 (.180gf) mf '\mode=lqlores; input cmr10'</pre>
2800: <p class="continue">
2801: Then ditto for the five other font families cmmi10, cmsy10, cmex10,
2802: rsfs10, bbold10. All the subsequent gftype and gfuntype runs just
2803: follow the usual format described above. </p>
2804:
2805: <p> To incorporate all this font information you just generated into
2806: mimeTeX, edit your <b>mimetex.h</b> file and find the table that looks
2807: something like </p><pre> static fontfamily aafonttable[] =
2808: { /* -------------------------------------------------------------
2809: family size=0, 1, 2, 3, 4, 5
2810: ------------------------------------------------------------- */
2811: { CMR10, { cmr83, cmr100, cmr118, cmr131, cmr160, cmr180 } },
2812: { CMMI10, { cmmi83, cmmi100, cmmi118, cmmi131, cmmi160, cmmi180 } },
2813: { CMSY10, { cmsy83, cmsy100, cmsy118, cmsy131, cmsy160, cmsy180 } },
2814: { CMEX10, { cmex83, cmex100, cmex118, cmex131, cmex160, cmex180 } },
2815: { RSFS10, { rsfs83, rsfs100, rsfs118, rsfs131, rsfs160, rsfs180 } },
2816: {BBOLD10, {bbold83,bbold100,bbold118,bbold131,bbold160,bbold180 } },
2817: { -999, { NULL, NULL, NULL, NULL, NULL, NULL } }
2818: } ; /* --- end-of-fonttable[] --- */</pre><p class="continue">
2819: Note the 36 names <b>cmr83...bbold180</b> in the table. These must
2820: correspond to (or must be changed to) the names following the <b>-n</b>
2821: switch you specified for your gfuntype runs. </p>
2822:
2823: <p> If you want more than six font sizes, first build up texfonts.h
2824: with all the necessary information. Then change LARGESTSIZE (and
2825: probably NORMALSIZE) in mimetex.h, and finally edit the above aafonttable[]
2826: by extending the columns in each row up to your largest size. </p>
2827:
2828: <p> You can also add new rows by #define'ing a new family,
2829: and then adding a whole lot of character definitions at the bottom
2830: of mimetex.h, all in the obvious way (i.e., it should become obvious
2831: after reviewing mimetex.h). A new row would be required,
2832: for example, to make another font available in mimeTeX. </p>
2833:
2834:
2835: <h2> <a name="makeraster"> (IVb) mimeTeX's make_raster()
2836: function </a> </h2>
2837:
2838: <p> MimeTeX converts an input LaTeX math expression to a corresponding GIF
2839: image in two steps. First, it converts the input LaTeX expression to a
2840: corresponding bitmap raster. Then <a href="http://shh.thathost.com"
2841: target="_top">Sverre Huseby's</a> gifsave library, discussed
2842: <a href="#gifsave">below</a>, converts that bitmap to the emitted gif.
2843: Though you never explicitly see that bitmap, it's mimeTeX's principal
2844: result. MimeTeX is written so any program can easily use its
2845: expression-to-bitmap conversion capability with just a single line of code.
2846: The following complete program demonstrates the simplest such use. </p>
2847:
2848: <pre> #include <stdio.h>
2849: #include "mimetex.h"
2850: int main ( int argc, char *argv[] )
2851: {
2852: raster *rp = make_raster(argv[1],NORMALSIZE);
2853: type_raster(rp,stdout); /* display ascii image of raster */
2854: }</pre>
2855:
2856: <p> Cut-and-paste the above sample code from this file to, say,
2857: mimedemo.c (and fix the brackets around stdio.h). Then compile <br>
2858: cc mimedemo.c mimetex.c -lm -o mimedemo <br>
2859: and run it from your unix shell command line like <br>
2860: ./mimedemo "x^2+y^2" </p>
2861:
2862: <p> MimeTeX's expression-to-bitmap conversion is accomplished by the
2863: make_raster() call, whose first argument is just a pointer to a
2864: (null-terminated) string containing any mimeTeX-compliant LaTeX
2865: expression, and whose second argument is the mimeTeX font size
2866: to use (overridden if your expression contains a preamble).
2867: The ascii display of the bitmap raster returned by make_raster()
2868: results from the subsequent call to type_raster(). That's all
2869: this program does, but you could use make_raster()'s returned bitmap
2870: for any other purpose you have in mind. </p>
2871:
2872: <p> MimeTeX's primary purpose is to emit either xbitmaps or gif images
2873: rather than ascii displays. And mimeTeX has anti-aliasing and various
2874: other options that further complicate its main() function compared to
2875: the simple example above. The example below demonstrates mimeTeX
2876: usage in the slightly more realistic situation where an input expression
2877: is converted to a gif, without anti-aliasing, and emitted on stdout. </p>
2878:
2879: <pre> #include <stdio.h>
2880: #include <stdlib.h>
2881: #include "mimetex.h"
2882:
2883: /* --- global needed by callback function, below, for gifsave.c --- */
2884: static raster *rp = NULL; /* 0/1 bitmap raster image */
2885:
2886: /* --- callback function to return pixel value at col x, row y --- */
2887: int GetPixel ( int x, int y ) /* pixel value will be 0 or 1 */
2888: { return (int)getpixel(rp,y,x); } /* just use getpixel() macro */
2889:
2890: /* --- main() entry point --- */
2891: int main ( int argc, char *argv[] )
2892: {
2893: /* --- get LaTeX expression from either browser query or command-line --- */
2894: char *query = getenv("QUERY_STRING"), /* check for query string */
2895: *expression = (query!=NULL? query : /* input either from query */
2896: (argc>1? argv[1] : "f(x)=x^2")); /* or from command line */
2897: /* ---- mimeTeX converts expression to bitmap raster ---- */
2898: rp = make_raster(expression,NORMALSIZE); /* mimeTeX rasterizes expression */
2899: /* ---- convert returned bitmap raster to gif, and emit it on stdout ---- */
2900: if ( query != NULL ) /* Content-type line for browser */
2901: fprintf( stdout, "Content-type: image/gif\n\n" );
2902: /* --- initialize gifsave library and colors, and set transparent bg --- */
2903: GIF_Create(NULL, rp->width, rp->height, 2, 8); /* init for black/white */
2904: GIF_SetColor(0, 255, 255, 255); /* always set background white */
2905: GIF_SetColor(1, 0, 0, 0); /* and foreground black */
2906: GIF_SetTransparent(0); /* and set transparent background */
2907: /* --- finally, emit compressed gif image (to stdout) --- */
2908: GIF_CompressImage(0, 0, -1, -1, GetPixel);
2909: GIF_Close();
2910: }</pre>
2911:
2912: <p> Cut-and-paste as before, compile like <br>
2913: cc mimedemo.c mimetex.c gifsave.c
2914: -lm -o mimedemo <br>
2915: and run it like the first example, but this time you may want to redirect
2916: stdout <br>
2917: ./mimedemo "x^2+y^2"
2918: <b>></b> mimedemo.gif <br>
2919: since output is now a gif image consisting of mostly unprintable bytes.
2920: Input is typically from the command line as illustrated, but this example
2921: checks for a browser query string too. That means you could actually
2922: replace mimetex.cgi with this executable, though anti-aliasing wouldn't
2923: be available. </p>
2924:
2925: <p> Of course, this example's intent isn't to replace the mimetex.cgi
2926: executable, but rather to illustrate GIFSAVE library usage, documented
2927: in detail below. And this example also illustrates usage of several
2928: mimeTeX raster structure elements, like rp->width and rp->height.
2929: So you'll probably also want to refer to mimetex.h, which contains those
2930: raster structures and other relevant definitions. For instance, the
2931: example's GetPixel() callback function illustrates usage of the getpixel()
2932: macro in mimetex.h, to retrieve individual pixels by their x,y-coordinates.
2933: And there's a similar setpixel() macro in mimetex.h to store pixels.
2934: After completing all this reading, you'll be prepared to begin using
2935: mimeTeX functions in your own code. </p>
2936:
2937:
2938:
2939: <h2> <a name="gifsave">
2940: (IVc)</a> <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
2941: gifsave.c library </h2>
2942:
2943: <p> The information below is taken from the README file accompanying
2944: <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
2945: distribution of GIFSAVE. I've made a few small editorial modifications,
2946: including descriptions of the several minor changes necessary
2947: to support mimeTeX. And the mimeTeX example program immediately above
2948: uses GIFSAVE in a very straightforward way that should help clarify
2949: any questions which may remain after reading the documentation below. </p>
2950:
2951: <pre>
2952: INTRODUCTION
2953: ============
2954:
2955: The GIFSAVE functions make it possible to save GIF images from
2956: your own C programs.
2957:
2958: GIFSAVE creates simple GIF files following the GIF87a standard.
2959: Interlaced images cannot be created. There should only be
2960: one image per file.
2961:
2962: GIFSAVE consists of five functions, all returning type int,
2963: and no separate header file is required.
2964:
2965: The functions should be called in the order listed below
2966: for each GIF-file. One file must be closed before a new one
2967: can be created.
2968:
2969: GIF_Create() creates new GIF-files. It takes parameters
2970: specifying filename, screen size, number of colors,
2971: and color resolution.
2972:
2973: GIF_SetColor() sets up red, green, blue color components.
2974: It should be called once for each possible color.
2975:
2976: GIF_SetTransparent() is optional. If called, it sets the
2977: color number of the color that should be transparent,
2978: i.e., the background color shows through this one.
2979:
2980: GIF_CompressImage() performs the compression of the image.
2981: It accepts parameters describing the position and size
2982: of the image on screen, and a user defined callback
2983: function that is supposed to fetch the pixel values.
2984:
2985: GIF_Close() terminates and closes the file.
2986:
2987: To use these functions, you must also write a callback
2988: function that returns the pixel values for each point
2989: in the image.
2990:
2991:
2992: THE FUNCTIONS
2993: =============
2994:
2995: GIF_Create()
2996: ------------
2997: Function Creates a new GIF-file, and stores info on
2998: the screen.
2999:
3000: Syntax int GIF_Create(
3001: char *filename,
3002: int width, int height,
3003: int numcolors, int colorres
3004: );
3005:
3006: Remarks Creates a new (or overwrites an existing)
3007: GIF-file with the given filename. No
3008: .GIF-extension is added.
3009:
3010: If filename is passed as a NULL pointer,
3011: output is directed to stdout.
3012:
3013: The width- and height- parameters specify
3014: the size of the image in pixels.
3015:
3016: numcolors is the number of colors used in
3017: the image.
3018:
3019: colorres is number of bits used to encode a
3020: primary color (red, green or blue).
3021: In GIF-files, colors are built by combining
3022: given amounts of each primary color.
3023: On VGA-cards, each color is built by
3024: combining red, green and blue values in
3025: the range [0, 63]. Encoding the number 63
3026: would require 6 bits, so colorres would be
3027: set to 6.
3028:
3029: Return value GIF_OK - OK
3030: GIF_ERRCREATE - Error creating file
3031: GIF_ERRWRITE - Error writing to file
3032: GIF_OUTMEM - Out of memory
3033:
3034:
3035: GIF_SetColor()
3036: --------------
3037: Function Specifies the primary color component of a
3038: color used in the image.
3039:
3040: Syntax void GIF_SetColor(
3041: int colornum,
3042: int red, int green, int blue
3043: );
3044:
3045: Remarks This function updates the colortable-values
3046: for color number colornum in the image.
3047:
3048: Should be called for each color in the range
3049: [0, numcolors]
3050:
3051: with red, green and blue components in the
3052: range [0, (2^colorres)-1]
3053:
3054: colorres and colornum are values previousely
3055: given to the function GIF_Create().
3056:
3057: Return value None
3058:
3059:
3060: GIF_SetTransparent()
3061: --------------------
3062: Function Specifies the color number of the color
3063: that should be considered transparent.
3064:
3065: Syntax void GIF_SetTransparent(
3066: int colornum
3067: );
3068:
3069: Remarks Need not be called at all. But if called,
3070: should be called only once with colornum in
3071: the range [0, numcolors] i.e., colornum
3072: must be one of the values previously
3073: given to GIF_SetColor().
3074:
3075: Return value None
3076:
3077:
3078: GIF_CompressImage()
3079: -------------------
3080: Function Compresses an image and stores it in the
3081: current file.
3082:
3083: Syntax int GIF_CompressImage(
3084: int left, int top,
3085: int width, int height,
3086: int (*getpixel)(int x, int y)
3087: );
3088:
3089: Remarks The left- and top- parameters indicate the
3090: image offset from the upper left corner of
3091: the screen. They also give the start values
3092: for calls to the userdefined callback
3093: function.
3094:
3095: width and height give the size of the image.
3096: A value of -1 indicates the equivalent screen
3097: size given in the call to GIF_Create().
3098:
3099: If the image is supposed to cover the entire
3100: screen, values 0, 0, -1, -1 should be given.
3101:
3102: GIF_CompressImage() obtains the pixel values
3103: by calling a user specified function. This
3104: function is passed in the parameter getpixel.
3105: See "callback()" further down for a
3106: description of this function.
3107:
3108: Return value GIF_OK - OK
3109: GIF_ERRWRITE - Error writing to file
3110: GIF_OUTMEM - Out of memory
3111:
3112:
3113: GIF_Close()
3114: -----------
3115: Function Closes the GIF-file.
3116:
3117: Syntax int GIF_Close(void);
3118:
3119: Remarks This function writes a terminating descriptor
3120: to the file, and then closes it. Also frees
3121: memory used by the other functions of GIFSAVE.
3122:
3123: Return value GIF_OK - OK
3124: GIF_ERRWRITE - Error writing to file
3125:
3126:
3127: THE CALLBACK FUNCTION
3128: =====================
3129:
3130: callback()
3131: ----------
3132: Function Obtains pixel-values for the
3133: GIF_CompressImage() -function.
3134:
3135: Syntax int callback(int x, int y);
3136:
3137: Remarks This function must be written by the
3138: programmer. It should accept two integer
3139: parameters specifying a point in the image,
3140: and return the pixel value at this point.
3141:
3142: The ranges for these parameters are as
3143: follows
3144: x : [img_left, img_left + img_width - 1]
3145: y : [img_top, img_top + img_height - 1]
3146:
3147: where img_left, img_top, img_width and
3148: img_height are the values left, top, width
3149: and height passed to GIF_CompressImage().
3150:
3151: An example; if the screen has width 640 and
3152: height 350, and the image covers the entire
3153: screen, x will be in the range [0, 639]
3154: and y in the range [0, 349].
3155:
3156: callback() need not get its values from the
3157: screen. The values can be fetched from a
3158: memory array, they can be calculated for
3159: each point requested, etc.
3160:
3161: The function is passed as a parameter to
3162: GIF_CompressImage(), and can thus have any
3163: name, not only callback().
3164:
3165: Return value Pixel value at the point requested. Should
3166: be in the range [0, numcolors-1] where
3167: numcolors is as specified to GIF_Create().
3168: </pre>
3169:
3170:
3171:
3172: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3173: CONCLUDING REMARKS
3174: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
3175: <h1 id="remarks"> Concluding Remarks </h1>
3176:
3177: <p> I hope you find mimeTeX useful. If so, a contribution to your
3178: country's <a href="http://www.tug.org" target="_top">TeX Users Group</a>,
3179: or to the <a href="http://www.gnu.org" target="_top">GNU</a> project, is
3180: suggested, especially if you're a company that's currently profitable. </p>
3181:
3182: <!--
3183: <p> If you also like mimeTeX's source, I'm an independent contractor
3184: incorporated in the US as John Forkosh Associates, Inc.
3185: A <a href="http://www.forkosh.com/resume.html" target="_top">resume</a>
3186: is at <a href="http://www.forkosh.com" target="_top">www.forkosh.com</a>
3187: or email
3188: <a href="mailto:john@forkosh.com">john@forkosh.com</a> </p>
3189: -->
3190:
3191: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3192: Footer across bottom of page
3193: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
3194: <hr size=4>
3195: <table> <tr>
3196: <td> <font size=3 color="maroon"> <b>
3197: <nobr>Copyright <font size=5>©</font> 2002-2005,
3198: <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a>
3199: </nobr><br>
3200: email: <a href="mailto:john@forkosh.com">john@forkosh.com</a>
3201: </b> </font> </td>
3202: <td> <img src="../cgi-bin/mimetex.cgi?\hspace{100}" alt="" border=0> </td>
3203: <td> <img src="../cgi-bin/mimetex.cgi?\blue{\small\rm You're the }
3204: \Large\counter[counters.log]{counters.txt:mimetex.html}\\[0]
3205: {\small\rm visitor to this page." alt="" border=0 align=bottom> </td>
3206: </tr> </table>
3207: </body>
3208: </html>
3209: <!-- end-of-file mimetex.html -->
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>