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