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