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