Annotation of loncom/cgi/mimeTeX/mimetex.html, revision 1.5
1.1 albertel 1: <!--
2: ****************************************************************************
1.5 ! raeburn 3: * Copyright(c) 2002-2012, John Forkosh Associates, Inc. All rights reserved.
1.4 riegler 4: * http://www.forkosh.com mailto: john@forkosh.com
1.1 albertel 5: * ==========================================================================
6: * This file is part of mimeTeX, which is free software. You may redistribute
7: * and/or modify it under the terms of the GNU General Public License,
1.4 riegler 8: * version 3 or later, as published by the Free Software Foundation.
1.1 albertel 9: * MimeTeX is distributed in the hope that it will be useful, but
10: * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
11: * See the GNU General Public License for specific details.
12: * By using mimeTeX, you warrant that you have read, understood and
13: * agreed to these terms and conditions, and that you possess the legal
14: * right and ability to enter into this agreement and to use mimeTeX
15: * in accordance with it.
1.4 riegler 16: * Your mimetex.zip distribution file should contain the file COPYING,
17: * an ascii text copy of the GNU General Public License, version 3.
18: * If not, point your browser to http://www.gnu.org/licenses/
19: * or write to the Free Software Foundation, Inc.,
20: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
1.1 albertel 21: ****************************************************************************
22: -->
23: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
24: "http://www.w3.org/TR/html4/loose.dtd">
1.5 ! raeburn 25: <!-- "http://www.forkosh.com/loose.dtd" -->
1.1 albertel 26:
27: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
28: Preamble
29: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
30: <html>
31: <head>
32: <title> mimeTeX user's manual </title>
33: <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
34: <style type="text/css">
35: body { background-image: none; /* none; or url(); */
36: /*background-repeat: repeat-y;*/
37: /*background-attachment: fixed;*/ /* fixed; or scroll; */
38: background-color: #ffffff; color: #000000;
39: margin-left: 0.5em; margin-right: 0.1em;
40: font-size: large; /* or medium */
41: clear: both }
42: A:active { color: blue/*#0000FF*/; text-decoration: none }
43: A:link { color: blue/*#0000FF*/; text-decoration: none }
44: A:visited { color: blue/*#0000FF*/; text-decoration: none }
45: A:hover { color: red/*#FF0000*/; text-decoration: underline
46: /*font-style: italic; font-weight: bold;*/
47: /*font-size: normal; line-height: normal*/ }
48: h1 { color: maroon; text-decoration: underline;
49: font-style: normal; /* italic oblique */
50: font-size: xx-large;
51: padding-top: 2.0em;
52: letter-spacing: 0.25em }
53: h2 { color: maroon; text-decoration: underline;
54: font-style: normal; /* italic oblique */
55: font-size: x-large;
56: padding-top: 1.0em;
57: letter-spacing: 0.20em }
58: h3 { color: maroon; /*black; text-decoration: underline;*/
59: font-style: normal; /* italic oblique */
60: font-size: large;
61: margin-left: 1em;
62: padding-top: 0.5em;
63: letter-spacing: 0.15em }
64: center { padding-top: -0.1em; padding-bottom: -0.1em; }
65: table { font-size: large }
66: table.medium { font-size: medium }
67: dl { font-size: large;
68: margin-left: 3.0em; margin-right: 2.5em }
69: ol { margin-left: 3.0em; margin-right: 2.5em }
70: ul { margin-left: 3.0em; margin-right: 2.5em;
71: list-style-type: square }
72: ul ul { margin-left: -0.5em; margin-right: 3.5em;
73: list-style-type: disc }
74: pre { margin-left: 3.0em; font-size: medium; font-weight: bold }
1.2 albertel 75: pre.nobold { margin-left:3.0em; font-size:medium; font-weight:normal }
1.1 albertel 76: p { margin-left: 2.0em; margin-right: 1.5em }
77: p:first-letter
78: { font-size: x-large; font-weight: bold;
79: color: maroon }
80: p.continue { margin-left: 2.0em; margin-right: 1.5em;
81: padding-top: -0.1em }
82: p.continue:first-letter
83: { font-size: large; font-weight: normal;
84: color: black }
85: p.warning { color: red } /* defines p class=warning */
86: </style>
1.5 ! raeburn 87: <style type="text/css">
! 88: a.info{
! 89: position:relative;
! 90: z-index:24;
! 91: /*background-color:#8692A5;*/
! 92: visibility: inherit;
! 93: text-decoration: none; }
! 94: a.info:hover{
! 95: z-index:25;
! 96: /*background-color:#999999;
! 97: color: #FFFF00;*/
! 98: text-decoration: none; }
! 99: a.info span{
! 100: display: none;
! 101: /*color: #FFFF00;*/ }
! 102: a.info:hover span{
! 103: display:block;
! 104: position:absolute;
! 105: top:2em;
! 106: left:2em;
! 107: /*width:15em;*/
! 108: border:1px solid #330066;
! 109: background-color:#FFFF99;
! 110: color:#660000;
! 111: text-align: left;
! 112: font-size: 13px;
! 113: font-weight: normal;
! 114: margin: 3px;
! 115: padding: 6px; }
! 116: a.info:link {
! 117: text-decoration: none;
! 118: /*color: #FFFF00;*/ /*themecolour1%0;*/ }
! 119: a.info:visited {
! 120: text-decoration: none;
! 121: /*color: #FFFF00;*/ /*themecolour1%0;*/ }
! 122: </style>
! 123: <script type="text/javascript">
! 124: <!--
! 125: // add/clear text to expression
! 126: function eqntext(eqn)
! 127: { var eqnSrc = document.getElementById(eqn).src;
! 128: var texSrc = eqnSrc.substring(eqnSrc.indexOf('?')+1,eqnSrc.length);
! 129: addtext(texSrc); }
! 130: function addtext(text)
! 131: { cleartext();
! 132: document.expression.formdata.value += unescape(text);
! 133: document.expression.formdata.focus(); }
! 134: function cleartext()
! 135: { document.expression.formdata.value = "";
! 136: //document.inlineframe.value = "";
! 137: document.expression.formdata.focus(); }
! 138: -->
! 139: </script>
! 140:
! 141: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! 142: + php functions to use Vertical-Align: info from mimetex
! 143: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
! 144: <?php
! 145: //$mimetexurl = "../cgi-bin/mimetex.cgi?";
! 146: $mimetexurl = "http://www.forkosh.com/mimetex.cgi?";
! 147: //$mimetexurl = "http://psi2star/cgi-bin/mimetex.cgi?";
! 148: function verticalalign( $expression ) {
! 149: global $mimetexurl;
! 150: // note: curl_init() stops at the first whitespace char in $url argument
! 151: $expression = ereg_replace(" ","~",$expression); // remove whitespace
! 152: $url = $mimetexurl . "\depth~" . $expression;
! 153: $valign = "0";
! 154: $options = array(
! 155: CURLOPT_RETURNTRANSFER => true, // return web page
! 156: CURLOPT_HEADER => true); // return headers
! 157: $ch = curl_init( $url );
! 158: //curl_setopt_array( $ch, $options );
! 159: curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
! 160: curl_setopt( $ch, CURLOPT_HEADER, true );
! 161: $gif = curl_exec( $ch );
! 162: $errno = curl_errno( $ch );
! 163: $error = curl_error( $ch );
! 164: //$info = curl_getinfo( $ch );
! 165: curl_close( $ch );
! 166: //echo '<br> url= ',$url,'<br>',"\n";
! 167: //echo '<br> gif=<br>',$gif,'<br>',"\n";
! 168: if ( $errno == 0 ) {
! 169: $fields = explode("Vertical-Align:",$gif);
! 170: $vfield = trim($fields[1]);
! 171: $fldlen = strspn($vfield,"+-0123456789");
! 172: $valign = substr($vfield,0,$fldlen); }
! 173: else {
! 174: echo 'verticalalign> errno ',$errno,' = ',$error,'<br><br>',"\n"; }
! 175: return $valign;
! 176: }
! 177: function mimetextag( $label, $expression ) {
! 178: global $mimetexurl;
! 179: $valign = verticalalign($expression);
! 180: $url = $mimetexurl . $expression;
! 181: //echo ' valign=',$valign,' ',"\n";
! 182: echo '<a href="#preview" class="info"><img id="',$label,'" ';
! 183: echo ' onclick="eqntext(',"'",$label,"'",')" ';
! 184: echo ' src="',$url,'" ';
! 185: echo ' style="Vertical-Align:',$valign,'px" ';
! 186: echo ' alt="" border=0>';
! 187: echo '<span>',$expression,'</span>';
! 188: echo '</a>', "\n";
! 189: }
! 190: ?>
! 191:
! 192: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! 193: + javascript from mathtran.org to render <img alt="tex:math expression">
! 194: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
! 195: <!-- script type="text/javascript"
! 196: src="http://www.mathtran.org/js/mathtran_img.js"></script -->
1.1 albertel 197: </head>
198: <body>
199:
200: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
201: Banner across top of page, containing title and two example mimeTeX images.
202: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
203: <br>
204: <hr size=4>
205: <center>
206: <table cellspacing=10>
207: <tr>
208: <td align="center">
209: <a href="#preview"><img id="imageBanr1" onclick="eqntext('imageBanr1')"
210: src="../cgi-bin/mimetex.cgi?\Large f=b_o+\frac{a_1}{b_1+\frac{a_2}
211: {b_2+\frac{a_3}{b_3+a_4}}}" alt="" border=0 align=middle></a> </td>
212: <td align="center" valign="middle">
213: <center> <font color="maroon" size=4>
214: <b><nobr>m i m e T e X m a n u a l</nobr></b> <br>
1.5 ! raeburn 215: <font size=3>( for mimeTeX version
! 216: <a href="#preview"><img id="imageVer1" onclick="eqntext('imageVer1')"
! 217: src="../cgi-bin/mimetex.cgi?\small\versionnumber"
! 218: alt="" border=0 align=bottom></a> )</font> <br>
1.1 albertel 219: <font size=3> <b>Click for:</b>
220: <!-- <a href="http://www.forkosh.com" target="_top">homepage</a>,
221: <a href="http://www.forkosh.com/resume.html" target="_top">resume</a> -->
222: <a href="http://www.forkosh.com/mimetextutorial.html" target="_top">
223: LaTeX tutorial</a><br>
224: <a href="http://www.forkosh.com/mimetex.html" target="_top">
225: mimeTeX QuickStart</a><br>
1.5 ! raeburn 226:
! 227: <a href="http://www.forkosh.com/cgi-bin/weblist.cgi?-t=weblist
! 228: &-f=sources/weblistemplate.html&files=@sources/sourcecode/mimetex.lis
! 229: ©right=2002-2011&counter=mimetex
! 230: &title=mimetex&description=m i m e T e X S o u r c e L i s t i n g"
! 231: target="_top">mimeTeX Source Listing</a><br>
1.2 albertel 232: <a href="http://www.forkosh.com/mimetex.zip">
1.3 albertel 233: <!-- jfa <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip"></a> -->
1.1 albertel 234: <font size=4>download mimeTeX</font></a></font>
235: </font> </center> </td>
236: <td align="center">
237: <a href="#preview"><img id="imageBanr2" onclick="eqntext('imageBanr2')"
238: src="../cgi-bin/mimetex.cgi?\Large\scr{J}^{ij}=\frac12\varepsilon_{ijk}
239: \left[\begin{array}{cc}\sigma_k&0\\0&\sigma_k\end{array}\right]"
240: alt="" border=0 align=middle></a> <br>
241: <a href="#examples">more_examples...</a> </td>
242: </tr>
1.5 ! raeburn 243: <tr> <td align="center" colspan="3">
! 244: This page discusses mimeTeX, a program that displays math on the web.<br>
! 245: (<font size=3>See
! 246: <a href="http://www.americanscientist.org/issues/pub/2009/3/writing-math-on-the-web/1"
! 247: target="_top">Writing Math on the Web</a>
! 248: for a more general discussion.</font>)
! 249: </td> </tr>
1.1 albertel 250: </table>
251: </center>
252: <hr size=4>
253: <center><b><font color="maroon" size=3>
1.5 ! raeburn 254: Copyright <font size=5>©</font> 2002-2012,
1.1 albertel 255: <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a> <br>
256: email: <a href="mailto:john@forkosh.com">john@forkosh.com</a>
1.2 albertel 257: </font></b> <br><br>
258: <a href="#preview"><img id="timestamp1" onclick="eqntext('timestamp1')"
259: src="../cgi-bin/mimetex.cgi?\normalsize\blue\begin{matrix}
260: \large\today\\\normalsize\today[3]\end{matrix}"
261: alt="" border=0 align=middle></a> </center>
1.1 albertel 262:
263:
264: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
265: Table of Contents
266: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1.2 albertel 267: <br> <center><b><font color="maroon" size=6>
268: <u> C o n t e n t s
269: </u></font></b> <br>
1.1 albertel 270: <table cellspacing=0 class="medium">
271: <tr>
272: <td valign="top" align="center" width=150>
1.2 albertel 273: <font size=3><b>- - - T u t o r i a l - - -</b></font> </td>
274: <td valign="top" align="center" colspan=3 width=450><font size=3><b>
275: - - - - - - - - - - - - - - R e f e r e n c e - - - - - - - - - - - - - -
276: </b></font></td>
1.1 albertel 277: </tr>
278: <tr>
279: <td valign="top" align="center" width=150> <font size=3>
280: <a href="#introduction"> (I) Introduction </a><br>
281: <a href="#quickstart"> a. Quick Start </a><br>
282: <a href="#examples"> b. Examples </a><br>
1.5 ! raeburn 283: <a href="#scripts"> c. Scripts&Plugins </a><br>
! 284: <a href="#gpl"> d. GPL License </a> </font> </td>
1.1 albertel 285: <td valign="top" align="center" width=150> <font size=3>
286: <a href="#build"> (II) Building mimeTeX </a><br>
1.2 albertel 287: <a href="#compile"> a. Compile </a><br>
288: <a href="#install"> b. Install </a><br>
289: <a href="#options"> c. Compile Options </a><br>
290: <a href="#cmdline"> d. Command Line </a> </font> </td>
1.1 albertel 291: <td valign="top" align="center" width=150> <font size=3>
292: <a href="#reference"> (III) Syntax Reference </a><br>
293: <a href="#spaces"> a. Math & White Space </a><br>
294: <a href="#symbols"> b. Symbols, Sizes, Modes </a><br>
295: <a href="#delimiters"> c. Delimiters </a><br>
296: <a href="#accents"> d. Accents, Arrows, etc. </a><br>
297: <a href="#array"> e. \begin{array} </a><br>
298: <a href="#picture"> f. \picture( ){ } </a><br>
299: <a href="#commands"> g. Other Commands </a><br>
1.5 ! raeburn 300: <a href="#exceptions"> h. Other Exceptions </a><br>
! 301: <a href="#messages"> i. Errors and Messages </a> </font> </td>
1.1 albertel 302: <td valign="top" align="center" width=150> <font size=3>
303: <a href="#appendices"> (IV) Appendices </a><br>
304: <a href="#fonts"> a. Fonts </a><br>
305: <a href="#makeraster"> b. make_raster() </a><br>
306: <a href="#gifsave"> c. gifsave.c </a>
307: <br><a href="#remarks"> Remarks </a> </font> </td>
308: </tr>
1.2 albertel 309: </table>
1.5 ! raeburn 310: </center>
! 311:
! 312: <!-- br -->
! 313: <p style="margin-left:3em;margin-right:3em;">
! 314: <font color="blue" size=3> This page contains more information
! 315: than you'll probably need to read. If you follow the
! 316: <font color="maroon">Installation and Usage Summary</font>
! 317: below, try installing mimeTeX immediately. <!-- If you need
! 318: more information, --> Or continue reading until you feel comfortable
! 319: trying to install mimeTeX. <!-- Return to this page as needed. -->
! 320: Prerequisites are: some knowledge of your OS's shell,
! 321: of installing cgi's, of LaTeX. </font>
! 322: <font color="maroon" size=3> <br>
! 323:
! 324: <b>"</b><i>Computers are like Old Testament gods<b>:</b>
! 325: lots of rules and no mercy.</i><b>"</b><br>
! 326:
! 327: <b>––</b> Joseph Campbell, The Power of Myth
! 328: (Doubleday 1988, page 18) </font> </p>
1.2 albertel 329:
330: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
331: + Installation and Usage Summary
332: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1.5 ! raeburn 333: <!-- br -->
! 334: <center>
1.2 albertel 335: <table border="0">
336: <tr> <!-- banner -->
337: <td align="left">
338: <!-- <b><font color="maroon" size=4>
339: <u> I n s t a l l a t i o n
340: a n d U s a g e S u m m a r y
341: </u></font></b> -->
342: <font size=4 color="maroon"><b>- - - - - - I n s t a l l a t i o n
343: a n d U s a g e S u m m a r y - - - - - -</b></font>
344: </td> </tr>
345: <tr>
346: <td valign="top"> <!-- summary -->
347: <table border="0" cellpadding="0" cellspacing="0" hspace="0" vspace="0">
348: <tr><td align="right" valign="top">
349: <a href="#build">Installation</a>: </td>
350: <td><font size=4> Download <a href="http://www.forkosh.com/mimetex.zip">
351: mimetex.zip</a> and then type <br>
352: <b> unzip mimetex.zip</b> <br>
353: <b> cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b>
354: <br>Now just <b>mv</b> mimetex.cgi to your <b>cgi-bin/</b>
1.3 albertel 355: directory, <br> set permissions as necessary, and you're all done.
356: </font></td></tr>
1.2 albertel 357: <tr><td colspan="2"> <font size="2"> </font> </td></tr>
358: <tr><td align="right" valign="top">
359: <a href="#introduction">Usage</a>: </td>
360: <td><font size=4> To see the image <br>
361: <a href="#preview"><img id="summary1" onclick="eqntext('summary1')"
362: src="../cgi-bin/mimetex.cgi?x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}"
363: alt="" border=0 align=middle></a> <br>
364: just write the tag <br>
365: <b> <img src="/cgi-bin/mimetex.cgi?<br>
366: x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}"></b>
367: </font></td></tr>
368: </table>
369: </td>
370: </tr>
371: </table>
372: </center>
1.1 albertel 373:
374:
375: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
376: SECTION I. INTRODUCTION
377: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
378: <h1> <a name="introduction">(I) Introduction</a> </h1>
379:
380: <p> <font color="maroon">MimeTeX, licensed under the
381: <a href="http://www.gnu.org/licenses/gpl.html" target="_top">gpl</a>,
382: lets you easily embed LaTeX math in your html pages.</font>
383: It parses a LaTeX math expression and immediately emits the
384: corresponding gif image, rather than the usual TeX dvi.
385: And mimeTeX is an entirely separate little program that doesn't use
386: TeX or its fonts in any way. It's just one cgi that you put in your
387: site's cgi-bin/ directory, with no other dependencies. So mimeTeX
1.5 ! raeburn 388: is very easy to <a href="#build">install</a>. <br>
! 389: <nobr>
! 390: Just download <a href="http://www.forkosh.com/mimetex.zip">
! 391: mimetex.zip</a> and then type </nobr> <br>
! 392: <nobr><b>
! 393: unzip mimetex.zip</b></nobr> <br>
! 394: <nobr><b>
! 395: cc –DAA mimetex.c gifsave.c
! 396: –lm –o mimetex.cgi</b></nobr> <br>
! 397: <nobr>
! 398: Now just <b>mv</b> mimetex.cgi to your <b>cgi-bin/</b>
! 399: directory, </nobr> <br>
! 400: <nobr>
! 401: set permissions as necessary, and you're all done. </nobr> <br>
! 402: <br>
! 403: And mimeTeX is equally easy to <a href="#quickstart">use</a><b>:</b>
! 404: just place an html <img> tag in your document
! 405: wherever you want to see the corresponding LaTeX expression. <br>
! 406: <nobr>
! 407: For example, the <img> tag </nobr> <br>
! 408: <nobr><b>
! 409: <img
! 410: src="../cgi-bin/mimetex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt" ></b></nobr><br>
! 411: <nobr>
! 412: immediately generates the corresponding gif image on-the-fly,</nobr><br>
! 413: <nobr>
! 414: displaying
! 415: <?php mimetextag('imageI1',
! 416: '\normalsize f(x)=\int\limits_{-\infty}^xe^{-t^2}dt'); ?>
! 417: wherever you put that tag.</nobr><br>
! 418: <br>
1.1 albertel 419: MimeTeX doesn't need intermediate dvi-to-gif conversion, and it doesn't
1.3 albertel 420: create separate gif files for each converted expression.
421: (But you can enable image caching with mimeTeX's
422: <b>-DCACHEPATH=\"<i>path/</i>\"</b>
1.5 ! raeburn 423: <a href="#options">compile option</a>.)
! 424: And there's no inherent need to repeatedly write the
! 425: cumbersome <img> tag illustrated above.
! 426: You can write your own
! 427: <a href="#scripts">wrapper scripts</a>,
! 428: discussed below, around mimeTeX to simplify the notation. </p>
1.4 riegler 429:
1.3 albertel 430: <h3> <a name="alternatives">
431: Alternative solutions<font size=5>...</font></a> </h3>
1.1 albertel 432: <p> MimeTeX's benefit over similar math-on-the-web solutions is, as
433: mentioned above, its easy installation. But if that's not a
434: problem for you, and if your site's server already has a LaTeX
435: distribution installed, and suitable image conversion utilities like
436: <a href="http://www.imagemagick.org" target="_top">ImageMagick</a>,
437: then you may prefer to look at a math rendering script like
438: <a href="http://www.mayer.dial.pipex.com/tex.htm#latexrender"
439: target="_top">latexrender</a>
440: which uses LaTeX to create higher quality images than mimeTeX
441: produces. For comparison,
1.5 ! raeburn 442: <?php mimetextag('imageI2',
! 443: '\small f(x)=\int\limits_{-\infty}^xe^{-t^2}dt'); ?>,
1.4 riegler 444: with arbitrary mean
1.5 ! raeburn 445: <?php mimetextag('imageI3','\normalsize\mu'); ?> and standard deviation
! 446: <?php mimetextag('imageI4','\normalsize\sigma'); ?>,
1.4 riegler 447: and at mimeTeX's next larger font size, looks like </p>
1.1 albertel 448: <center>
449: <table>
450: <tr align="center">
1.4 riegler 451: <td> <font size="4">latexrender</font> </td>
1.1 albertel 452: <td> <img src="../cgi-bin/mimetex.cgi?\hspace{30}"
453: alt="" border=0> </td>
1.4 riegler 454: <td> <font size="4">mimeTeX</font> </td>
1.1 albertel 455: </tr>
456: <tr align="center">
1.4 riegler 457: <td> <img src="http://www.forkosh.com/lrender.gif"
458: alt="" border=0 align=middle> </td>
459: <td> </td>
1.1 albertel 460: <td>
1.5 ! raeburn 461: <?php mimetextag('imageI5',
! 462: '\normalsize f(x)={\Large\frac1{\sigma\sqrt{2\pi}}}
! 463: \int_{\small-\infty}^xe^{-\small\frac{(t-\mu)^2}{2\sigma^2}}dt'); ?>
! 464: </td>
1.1 albertel 465: </tr>
466: </table>
467: </center>
468: <p> Similar LaTeX-based solutions that you may want to look at are
1.4 riegler 469: <a href="http://www.mathtran.org" target="_top">mathtran</a>,
1.1 albertel 470: <a href="http://www.fourmilab.ch/webtools/textogif/textogif.html"
471: target="_top">textogif</a> and
472: <a href="http://www.math.uio.no/~martingu/gladtex/"
473: target="_top">gladTeX</a>. Additional discussion and several more
474: links are at <a href="http://www.tug.org/interest.html#web"
475: target="_top">www.tug.org/interest.html</a> and in the
476: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=LaTeX2HTML"
477: target="_top">tex-faq</a>. </p>
1.4 riegler 478:
479: <p> For example, <a href="http://www.mathtran.org" target="_top">mathtran</a>
480: is a public LaTeX web service that's
481: particularly easy to use by following these simple
482: <a href="http://www.mathtran.org/wiki/index.php/TeX_image"
483: target="_top">instructions</a>. In the <head> of your
484: html page, place the tag <br>
485:
486: <script type="text/javascript" <br>
487:
488: src="http://www.mathtran.org/js/mathtran_img.js"></script><br>
489: and in the <body>, wherever you want to see latex images,
490: place tags like <br>
491:
492: <img alt=<b>"</b>tex:<i>any latex math expression</i><b>"</b>><br>
493: For comparison, <br>
494:
495: <img alt="tex: f(x) = \frac1{\sigma\sqrt{2\pi}} <br>
496:
497: \int_{-\infty}^x e^{-\frac{(t-\mu)^2}{2\sigma^2}}dt"> <br>
498: looks like </p>
499: <center>
500: <table>
501: <tr align="center">
502: <td> <font size="4">mathtran</font> </td>
503: <td> <img src="../cgi-bin/mimetex.cgi?\hspace{30}"
504: alt="" border=0> </td>
505: <td> <font size="4">mimeTeX</font> </td>
506: </tr>
507: <tr align="center">
1.5 ! raeburn 508: <td> unavailable
! 509: <!-- img alt="tex:\displaystyle f(x) = \frac1{\sigma\sqrt{2\pi}}
! 510: \int_{-\infty}^x e^{-\frac{(t-\mu)^2}{2\sigma^2}}dt" --> <br> </td>
1.4 riegler 511: <td> </td>
512: <td>
513: <a href="#preview"><img id="imageP3" onclick="eqntext('imageP3')"
514: src="../cgi-bin/mimetex.cgi?\large
515: f(x)={\Large\frac1{\sigma\sqrt{2\pi}}}
516: \int_{\small-\infty}^xe^{-\small\frac{(t-\mu)^2}{2\sigma^2}}dt"
517: alt="" border=0 align=middle></a> </td>
518: </tr>
519: </table>
520: </center>
521:
1.2 albertel 522: <!--
1.1 albertel 523: <p> The remainder of this introductory mimeTeX tutorial section contains </p>
524: <ul>
525: <li> First, a concise <a href="#quickstart">Quickstart</a> providing
526: just enough information for you to try rendering your own
527: expressions by <a href="#preview">Submitting Queries</a>
528: right from this page. </li>
529: <li> Then, a variety of additional <a href="#examples">Examples</a>
530: that more fully illustrate mimeTeX's capabilities
531: (later on, Section III comprises a more complete mimeTeX
532: <a href="#reference">Syntax Reference</a>). </li>
533: <li> Finally, the <a href="#gpl">gpl</a> license, whose terms
534: and conditions you must agree to before using mimeTeX.</li>
535: </ul>
1.2 albertel 536: -->
1.1 albertel 537: <p> You may now want to browse the additional <a href="#examples">Examples</a>
538: below before proceeding, to make sure mimeTeX suits your needs before you
1.2 albertel 539: spend more time learning to use it. </p>
1.1 albertel 540:
541:
542: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
543: QUICKSTART
544: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
545: <h2> <a name="quickstart"> (Ia) Quick Start </a> </h2>
546:
547: <p> <!-- Unlike MathML, --> MimeTeX is as TeX-like as possible (though
548: not 100% compliant), and you must already be familiar with LaTeX
549: math markup to use it. If you're not, many online LaTeX
550: <a href="http://www.tug.org/begin.html#doc" target="_top">turorials</a>
551: are readily available. You may also want to browse Andrew Roberts'
1.3 albertel 552: <a href="http://www.andy-roberts.net/misc/latex/latextutorial9.html"
1.1 albertel 553: target="_top">Latex Math I</a> and
1.3 albertel 554: <a href="http://www.andy-roberts.net/misc/latex/latextutorial10.html"
1.1 albertel 555: target="_top">Latex Math II</a>, or my own
556: <a href="http://www.forkosh.com/mimetextutorial.html" target="_top">
557: LaTeX math tutorial</a>.
1.2 albertel 558: Then, instead of continuing to read this page, you can <!-- may prefer
559: to play with mimeTeX yourself. In that case, --> just Submit any LaTeX
1.1 albertel 560: math expression you like in the Query Box below. I've started
1.2 albertel 561: you out with a little example already in the box, or <!-- , instead, -->
1.1 albertel 562: you can Click any of the <a href="#examples">Examples</a> below
563: to place that corresponding expression in the Query Box. </p>
564:
565: <p> Meanwhile, here are just a few quickstart tips for Submitting
566: your own mimeTeX expressions in the Query Box below: </p>
567: <ul>
1.2 albertel 568: <li> MimeTeX currently has eight font sizes selected by
569: one of the usual directives <b>\tiny</b>
570: or <b>\small</b> or <b>\normalsize</b> ,
571: or <b>\large</b> (default) or <b>\Large</b>
572: or <b>\LARGE</b> , or <b>\huge</b> or <b>\Huge</b> .
573: Unlike standard LaTeX, font size directives may
574: appear within math mode expressions. They affect everything
575: to their right, except that their scope will be limited to any
576: <b>{ }</b>-enclosed subexpression in which they occur.
577: For example, "<b>a+\small b+c</b>"
578: renders
579: <a href="#preview"> <img id="imageBu" onclick="eqntext('imageBu')"
580: src="../cgi-bin/mimetex.cgi?\large a+\small b+c"
1.4 riegler 581: alt="" border=0 style="Vertical-Align:-2px"></a>,
582: whereas "<b>\small a+{\Large b+}c</b>"
583: renders
1.2 albertel 584: <a href="#preview"> <img id="imageBv" onclick="eqntext('imageBv')"
585: src="../cgi-bin/mimetex.cgi?\small a+{\Large b+}c"
1.4 riegler 586: alt="" border=0 style="Vertical-Align:-2px"></a>. </li>
1.1 albertel 587: <!-- <li> At smaller font sizes, try preceding your expression with
588: <b>\light</b> which adjusts mimeTeX's anti-aliasing
589: parameters to produce thinner lines that you may feel are
590: more legible, e.g.,<br>
591: <a href="#preview"><img id="imageIA1" onclick="eqntext('imageIA1')"
592: src="../cgi-bin/mimetex.cgi?\light\small\displaystyle
593: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
594: align=middle> </a>   versus
595: <a href="#preview"><img id="imageIA2" onclick="eqntext('imageIA2')"
596: src="../cgi-bin/mimetex.cgi?\small\displaystyle
597: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
598: align=middle> </a> </li> -->
599: <li> <!-- For displaystyle math mode limits illustrated above,
600: write either
601: <b>\displaystyle e^x=\sum_{n=0}^\infty\frac{x^n}{n!}</b>
602: or <b>e^x=\sum\limits_{n=0}^\infty\frac{x^n}{n!}</b>
603: in the usual way (ditto for <b>\int</b>, <b>\prod</b>,
604: <b>\cup</b>, <b>\cap</b>, etc). --> <!-- MimeTeX also recognizes
605: <b>\Bigint</b>, <b>\Bigsum</b>, <b>\Bigprod</b>, and several
606: similar extra symbols which are a little bigger, and which
607: automatically render displaystyle limits. -->
608: <!-- MimeTeX default-renders limits displaystyle at sizes
609: <b>\large</b> and larger (see the <b>-DDISPLAYSIZE=<i>n</i></b>
610: <a href="#options">compile option</a> below to change the
611: default). <b>\textstyle</b> overrides this default for
612: your entire expression, or <b>\nolimits</b> overrides it
613: for a single operator. -->
614: By default, mimeTeX renders limits textstyle
615: <a href="#preview"> <img id="imageB1" onclick="eqntext('imageB1')"
616: src="../cgi-bin/mimetex.cgi?\normalsize\textstyle
1.4 riegler 617: \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
618: style="Vertical-Align:-5px"></a>
619: at sizes <b>\normalsize</b> and smaller,
1.1 albertel 620: and renders them displaystyle
621: <a href="#preview"> <img id="imageB2" onclick="eqntext('imageB2')"
622: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
1.4 riegler 623: \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
624: style="Vertical-Align:-15px"></a>
625: at sizes <b>\large</b> and larger.
1.1 albertel 626: The LaTeX directives <b>\displaystyle</b> or <b>\textstyle</b>,
627: and <b>\limits</b> or <b>\nolimits</b>, override mimeTeX's default
628: in the usual way. Or see the <b>-DDISPLAYSIZE=<i>n</i></b>
629: <a href="#options">compile option</a> below to change
630: the default. </li>
1.5 ! raeburn 631: <!-- <li> As discussed in the <a href="#introduction">Introduction</a>,
! 632: you can replace cumbersome <img> tags with your own custom
! 633: tags or wrapper scripts. </li> -->
! 634: <li> <!-- And --> There are occasional exceptions where I couldn't
! 635: program mimeTeX to recognize valid LaTeX syntax.
! 636: One particular "gotcha" is that mimeTeX bindings
! 637: are pretty much left-to-right. Thus, for example, although
! 638: mimeTeX correctly interprets <b>\frac12</b> as well as
! 639: <b>\frac1{x^2}</b>, etc, the legal LaTeX expression
! 640: <b>x^\frac12</b> must be written <b>x^{\frac12}</b>.
! 641: Otherwise, mimeTeX interprets it as <b>{x^\frac}12</b>, i.e.,
! 642: the same way <b>x^\alpha12</b> would be interpreted, which is
! 643: nonsense for <b>\frac</b>. The same "gotcha" also applies to
! 644: other combinations of commands, e.g., you must write
! 645: <b>\sqrt{\frac\alpha\beta}</b>, or
! 646: <b>\frac\alpha{\sqrt\beta}</b>, etc.
! 647: The <a href="#reference">Syntax Reference</a> section
! 648: contains much additional information. <!-- Or you can just begin
! 649: playing with mimeTeX for yourself to see if it might have
! 650: any potential usefulness for you. --> </li>
! 651: <li> And there are various additional syntactic and cosmetic
! 652: differences between LaTeX and mimeTeX. For example,
! 653: bounding boxes for mimeTeX's character bitmaps don't
! 654: accommodate italic corrections. Therefore, an expression
! 655: like <b>\int\nolimits_a^b</b> renders
! 656: <a href="#preview"><img id="gotcha1" onclick="eqntext('gotcha1')"
! 657: src="../cgi-bin/mimetex.cgi?
! 658: \normalsize\displaystyle\int\nolimits_a^b"
! 659: alt="" border=0 align=middle></a> rather than
! 660: <a href="#preview"><img id="gotcha2" onclick="eqntext('gotcha2')"
! 661: src="../cgi-bin/mimetex.cgi?
! 662: \normalsize\displaystyle\smashmargin{2}{\int\nolimits_a}^b"
! 663: alt="" border=0 align=middle></a><b>.</b>
! 664: To render the latter image you have to write the somewhat
! 665: cumbersome expression <b>{\smashmargin2{\int\nolimits_a}^b}</b>
! 666: instead (see <a href="#smash">smash</a> below). </li>
! 667: <li> Besides such exceptions, mimeTeX
! 668: also provides various LaTeX extensions <!-- , i.e., LaTeX errors
! 669: permitted by mimetex. --> (such as font size
! 670: directives like <b>\Large</b> permitted within mimeTeX
! 671: math mode expressions, as discussed above).
! 672: <!-- , but flagged as errors by LaTeX. -->
! 673: <!-- But note well: if you take advantage of mimeTeX extensions,
! 674: your math mode expressions will no longer be accepted by
! 675: standard TeX engines. --> </li>
1.1 albertel 676: </ul>
677: <p> <a name="forminput"> </a> <a name="preview"> </a>
1.2 albertel 678: Now enter your own LaTeX expression, use the sample provided,
1.1 albertel 679: or Click any of the <a href="#examples">Examples</a>.
680: Then press the Submit button, and mimeTeX's rendering should be
681: displayed in the little window immediately below it. </p>
682: <center>
683: <table border="2" cellpadding="5" cellspacing="0">
684: <tr align="center"><td>
685: <form name="expression" action="../cgi-bin/mimetex.cgi"
686: method="get" target="inlineframe">
687: <table border="0" cellpadding="0" cellspacing="1">
1.2 albertel 688: <tr align="left"><td align="center">
689: <b>First enter your own LaTeX expression,
690: or Click any example...</b> <br>
1.1 albertel 691: <textarea name="formdata" rows="5" cols="72"
692: >\Large f(x)=\int_{-\infty}^x e^{-t^2}dt</textarea> <br>
693: </td></tr>
694: <tr align="center"><td>
695: <font size="-1"> <input type="button" onClick="cleartext()"
696: value="Clear Expression">
697: <input type="submit" value="Submit Expression"> </font>
698: </td></tr>
699: </table>
1.2 albertel 700: </form> </td></tr> <tr align="left"><td align="center">
701: <b>Now click Submit to see it rendered below...</b> <br>
1.1 albertel 702: <iframe name="inlineframe" align="middle" width="85%" height="110">
703: <p>iframe's not supported if you see this.</p>
704: </iframe>
705: </td></tr>
706: </table>
707: </center>
708: <p> You should see
709: <a href="#preview"><img id="imageIA3" onclick="eqntext('imageIA3')"
1.2 albertel 710: src="../cgi-bin/mimetex.cgi?\normalsize
711: f(x)=\int\limits_{-\infty}^x e^{-t^2}dt"
1.4 riegler 712: alt="" border=0 style="Vertical-Align:-11px"></a>
1.5 ! raeburn 713: if you submit the sample expression already in the box.
! 714: Or see <a href="#messages">error messages</a> whenever an
! 715: unexpected image is displayed instead. And (as discussed
! 716: above) the <img> tag to embed this same integral anywhere
! 717: in your own document is <br>
! 718: <nobr><b>
! 719: <img
! 720: src="../cgi-bin/mimetex.cgi?f(x)=\int_{-\infty}^xe^{-t^2}dt" ></b></nobr><br>
! 721: </p>
! 722: <!-- p class="continue">
! 723: And recall that the typical mimeTeX <img> tag has the form </p>
1.1 albertel 724: <pre> <img src="../cgi-bin/mimetex.cgi?any valid LaTeX/mimeTeX expression"
725: alt="" border=0 align=middle></pre> <p class="continue">
726: where <b>../cgi-bin/mimetex.cgi</b> is the relative path from your html
727: page containing these tags to your compiled mimetex.cgi program, and
728: where <b>any valid LaTeX/mimeTeX expression</b>
1.5 ! raeburn 729: is pretty much any valid LaTeX math expression: </p -->
! 730:
! 731: <!-- ++++++++
! 732: <h3> <a name="errormessages">
! 733: Error messages<font size=5>...</font></a> </h3>
! 734: <p> Any (La)TeX error is typically also a mimeTeX error.
! 735: However, mimeTeX has no command line interface or
! 736: <b>.</b>log file for reporting errors. Its only
! 737: communication with you is through the mimeTeX image
! 738: rendered by your browser. So error messages are embedded
! 739: in that image whenever feasible. For example,
! 740: suppose you want to see
! 741: <a href="#preview"><img id="messages1" onclick="eqntext('messages1')"
! 742: src="../cgi-bin/mimetex.cgi?\normalsize\alpha\beta\gamma\delta"
! 743: alt="" border=0 align="bottom"></a>
! 744: but you mistakenly type <b>\alpha\bethe\gamma\delta</b>
! 745: instead. Then the image rendered is
! 746: <a href="#preview"><img id="messages2" onclick="eqntext('messages2')"
! 747: src="../cgi-bin/mimetex.cgi?\normalsize\alpha\bethe\gamma\delta"
! 748: alt="" border=0 align="bottom"></a>
! 749: indicating the unrecognized <b>[\bethe?]</b> where you wanted to type
! 750: <b>\beta</b> and had hoped to see
! 751: <a href="#preview"><img id="messages3" onclick="eqntext('messages3')"
! 752: src="../cgi-bin/mimetex.cgi?\normalsize\bf\beta"
! 753: alt="" border=0 align="bottom"></a><b>.</b>
! 754: If your expression contains some unprintable character
! 755: (meaning any character mimeTeX has no bitmap for),
! 756: then just
! 757: <a href="#preview"><img id="messages4" onclick="eqntext('messages4')"
! 758: src="../cgi-bin/mimetex.cgi?\small\bf[?]"
! 759: alt="" border=0 align="bottom"></a>
! 760: is displayed in the corresponding position. </p>
! 761:
! 762: <p> The preceding example illustrates a pretty trivial error.
! 763: Any non-trivial errors in your expression are likely to
! 764: go unrecognized and unreported by mimeTeX, and to render
! 765: unexpected images. While checking your input expression
! 766: for syntax errors, keep in mind the following points
! 767: about mimeTeX's behavior: </p>
! 768: <ul>
! 769: <li> An unmatched left brace <b>{</b> is matched
! 770: by mimeTeX with a "phantom" right brace <b>}</b>
! 771: that's imagined to be at the end of your expression. </li>
! 772: <li> Likewise, an unmatched <b>\left(</b>,
! 773: or <b>\left\{</b> or <b>\left\</b><i>anything</i>,
! 774: is matched by mimeTeX with a "phantom" <b>\right.</b>
! 775: at the end of your expression. </li>
! 776: <li> On the other hand, an unmatched right brace <b>}</b>
! 777: is displayed in place, as if you had typed \rbrace. </li>
! 778: <li> But an unmatched <b>\right\</b><i>anything</i>
! 779: is interpreted as an
! 780: <a href="http://www.forkosh.com/mimetexmanual.html?abbreviations"
! 781: target="_top">abbreviation</a> for <b>\</b>rightarrow
! 782: followed by <b>\</b><i>anything</i>. For example,
! 783: <b>\leff( abc \right) def</b> renders
! 784: <a href="#preview"><img id="messages5"
! 785: onclick="eqntext('messages5')"
! 786: src="../cgi-bin/mimetex.cgi?\small\leff(abc\right)def"
! 787: alt="" border=0 align="bottom"></a>.
! 788: </li>
! 789: </ul>
! 790: ++++++++ -->
! 791:
! 792: <!-- ++++++++
! 793: <h3> <a name="infomessages">
! 794: Informational messages<font size=5>...</font></a> </h3>
! 795: <p> The latest release of mimeTeX is version
! 796: <a href="#preview"><img id="messages11" onclick="eqntext('messages11')"
! 797: src="../cgi-bin/mimetex.cgi?\small\versionnumber"
! 798: alt="" border=0 align="bottom"></a>
! 799: which was last revised
! 800: <a href="#preview"><img id="messages12" onclick="eqntext('messages12')"
! 801: src="../cgi-bin/mimetex.cgi?\small\revisiondate"
! 802: alt="" border=0 align="bottom"></a>.
! 803: The special mimeTeX directive <b>\version</b>
! 804: displays that same information, </p>
! 805: <center>
! 806: <a href="#preview"><img id="messages13" onclick="eqntext('messages13')"
! 807: src="../cgi-bin/mimetex.cgi?\version"
! 808: alt="" border=0 align=middle></a>
! 809: </center>
! 810: <p> To check that your own release of mimeTeX is current,
! 811: type a url into your browser's locator window something like <br>
! 812:
! 813: <b>http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?\version</b> <br>
! 814: which will display the version and revision date of
! 815: mimeTeX installed on your server. </p>
! 816: ++++++++ -->
1.1 albertel 817:
818:
819: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
820: EXAMPLES
821: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
822: <h2> <a name="examples"> (Ib) Examples </a> </h2>
823:
1.5 ! raeburn 824: <p> Here are various additional random examples further illustrating
1.1 albertel 825: mimeTeX's features and usage. To see how they're done, Click any
826: one of them to place its corresponding expression in the
827: <a href="#preview">Query Box</a> above. Then press Submit
828: to re-render it, or you can edit the expression first to suit
829: your own purposes. </p>
830:
831: <table cellspacing=15>
832: <!-- first example: taylor series for e^x at various font sizes and colors
833: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
834: <tr>
835: <td>
836: <font size=5><a name="example1">(1)</a></font> </td>
837: <td align="left" colspan=4>
838: <a href="#preview">
839: <img id="example1a" onclick="eqntext('example1a')"
1.2 albertel 840: src="../cgi-bin/mimetex.cgi?\red\normalsize\displaystyle
1.1 albertel 841: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
842: alt="" border=0 align=middle></a>    
843: <a href="#preview">
844: <img id="example1b" onclick="eqntext('example1b')"
1.2 albertel 845: src="../cgi-bin/mimetex.cgi?\green\large\displaystyle
1.1 albertel 846: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
847: alt="" border=0 align=middle></a>    
848: <a href="#preview">
849: <img id="example1c" onclick="eqntext('example1c')"
1.2 albertel 850: src="../cgi-bin/mimetex.cgi?\blue\Large
1.1 albertel 851: e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
852: alt="" border=0 align=middle></a>    
853: <a href="#preview">
854: <img id="example1d" onclick="eqntext('example1d')"
1.3 albertel 855: src="../cgi-bin/mimetex.cgi?\reverse\opaque
1.2 albertel 856: \LARGE e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
1.1 albertel 857: alt="" border=0 align=middle></a>    
858: <a href="#preview">
859: <img id="example1e" onclick="eqntext('example1e')"
1.2 albertel 860: src="../cgi-bin/mimetex.cgi?\LARGE
1.1 albertel 861: e^x=\lim_{n\to\infty} \left(1+\frac xn\right)^n"
862: alt="" border=0 align=middle></a>
863: </td>
864: </tr>
865:
866: <!-- second example
867: +++++++++++++++++++ -->
868: <tr>
869: <td>
870: <font size=5>(2)</font> </td>
871: <td align="left" colspan=4>
872: <a href="#preview">
873: <img id="example2" onclick="eqntext('example2')"
874: src="../cgi-bin/mimetex.cgi?\Large\frac{dv^m}{ds}=-\Gamma^m_{oo}v^{o^2}
875: =-g^{mn}\Gamma_{noo}v^{o^2}=\frac12g^{mn}g_{oo,n}v^{o^2}"
876: alt="" border=0 align=middle></a> </td>
877: </tr>
878:
879: <!-- third example
880: ++++++++++++++++++ -->
881: <tr>
882: <td>
883: <font size=5>(3)</font> </td>
884: <td align="left" colspan=4>
885: <a href="#preview">
886: <img id="example3" onclick="eqntext('example3')"
887: src="../cgi-bin/mimetex.cgi?\Large\varepsilon=\sum_{i=1}^{n-1}
888: \frac1{\Delta x}\int_{x_i}^{x_{i+1}}\left\{\frac1{\Delta x}\big[
889: (x_{i+1}-x)y_i^\ast+(x-x_i)y_{i+1}^\ast\big]-f(x)\right\}^2dx"
890: alt="" border=0 align=middle></a> </td>
891: </tr>
892:
893: <!-- fourth example: solution to quadratic, definition of derivative
894: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
895: <tr>
896: <td>
897: <font size=5>(4)</font> </td>
898: <td align="left" colspan=4>
899: <table>
900: <tr>
901: <td align="left">
902: <a href="#preview">
903: <img id="example4a" onclick="eqntext('example4a')"
904: src="../cgi-bin/mimetex.cgi?\LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}"
905: alt="" border=0 align=middle></a> </td>
906: <td>
907: solution for quadratic </td>
908: </tr>
909: <tr> <td> <br> </td> </tr>
910: <tr>
911: <td align="left">
912: <a href="#preview">
913: <img id="example4b" onclick="eqntext('example4b')"
914: src="../cgi-bin/mimetex.cgi?\large f^\prime(x)\ =
915: \lim_{\Delta x\to0}\frac{f(x+\Delta x)-f(x)}{\Delta x}"
916: alt="" border=0 align=middle></a> </td>
917: <td>
918: definition of derivative </td>
919: </tr>
920: </table> </td>
921: </tr>
922:
923: <!-- fifth example: continued fraction
924: +++++++++++++++++++++++++++++++++++++++ -->
925: <tr>
926: <td>
927: <font size=5>(5)</font> </td>
928: <td align="left">
929: <a href="#preview">
930: <img id="example5" onclick="eqntext('example5')"
931: src="../cgi-bin/mimetex.cgi?\LARGE f=b_o+\frac{a_1}{b_1+
932: \frac{a_2}{b_2+\frac{a_3}{b_3+a_4}}}"
933: alt="" border=0 align=middle></a> </td>
934: <td>
935: illustrating <b>\frac{}{}</b> for continued fraction </td>
936: </tr>
937:
938: <!-- sixth example: demonstrating \left\{ ... \right.
939: +++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
940: <tr>
941: <td>
942: <font size=5>(6)</font> </td>
943: <td align="left">
944: <a href="#preview">
945: <img id="example6" onclick="eqntext('example6')"
946: src="../cgi-bin/mimetex.cgi?\LARGE\tilde y=\left\{
1.2 albertel 947: {\ddot x\text{ if \vec x odd}\atop\hat{\,\bar x+1}\text{ if even}}\right."
1.1 albertel 948: alt="" border=0 align=middle></a> </td>
949: <td>
950: illustrating <b>\left\{...\right<font size=5>.</font></b>
951: <!-- we may write <b>\{...\.</b> --> <br>
952: and note the accents </td>
953: </tr>
954:
955: <!-- seventh example: demonstrating \overbrace \underbrace
956: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
957: <tr>
958: <td>
959: <font size=5>(7)</font> </td>
960: <td align="center">
961: <a href="#preview">
962: <img id="example7" onclick="eqntext('example7')"
1.5 ! raeburn 963: src="../cgi-bin/mimetex.cgi?\large\overbrace{a,...,a}^{\text{k a^,s}},
1.1 albertel 964: \underbrace{b,...,b}_{\text{l b^,s}}\hspace{10}
1.5 ! raeburn 965: \normalsize\underbrace{\overbrace{a...a}^{\text{k a^,s}},
1.1 albertel 966: \overbrace{b...b}^{\text{l b^,s}}}_{\text{k+l elements}}"
967: alt="" border=0 align=middle></a> </td>
968: <td>
969: <b>\overbrace{}^{}</b> and <b>\underbrace{}_{}</b> <br>
970: (TeXbook page 181, Exercise 18.41) </td>
971: </tr>
972:
973: <!-- eighth example: demonstrating \begin{array}
974: +++++++++++++++++++++++++++++++++++++++++++++++++ -->
975: <tr>
976: <td>
977: <font size=5>(8)</font> </td>
1.2 albertel 978: <td align="left" colspan=3>
1.1 albertel 979: <table>
980: <tr>
981: <td align="left" colspan=2>
982: <a href="#preview">
983: <img id="example8a" onclick="eqntext('example8a')"
1.5 ! raeburn 984: src="../cgi-bin/mimetex.cgi?\large\scr{J}^{i0}=+\frac i2
1.1 albertel 985: \left[\begin{array}{cc}\sigma_i&0\\0&-\sigma_i\end{array}\right]
986: \hspace{10}\scr{J}^{ij}=\frac12\varepsilon_{ijk}
987: \left[\begin{array}{cc}\sigma_k&0\\0&\sigma_k\end{array}\right]"
988: alt="" border=0 align=middle> </a> </td>
989: </tr>
990: <tr> <td> <br> </td> </tr>
991: <tr>
992: <td align="left">
993: <a href="#preview">
994: <img id="example8b" onclick="eqntext('example8b')"
1.5 ! raeburn 995: src="../cgi-bin/mimetex.cgi?\large A\ =\ \normalsize\left(
1.2 albertel 996: \begin{array}{c.cccc}&1&2&\cdots&n\\
997: \hdash1&a_{11}&a_{12}&\cdots&a_{1n}\\
998: 2&a_{21}&a_{22}&\cdots&a_{2n}\\
999: \vdots&\vdots&\vdots&\ddots&\vdots\\
1000: n&a_{n1}&a_{n2}&\cdots&a_{nn}\end{array}\right)"
1.1 albertel 1001: alt="" border=0 align=middle></a> </td>
1002: <td>
1003: demonstrating <a href="#array">\begin{array}</a>'s dashed lines </td>
1004: </tr>
1005: </table> </td>
1006: </tr>
1007:
1008: <!-- ninth example: block diagonal form using nested arrays
1009: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1010: <tr>
1011: <td>
1012: <font size=5><a name="example9">(9)</a></font> </td>
1013: <td align="left" colspan="2">
1014: <a href="#preview">
1015: <img id="example9c" onclick="eqntext('example9c')"
1.5 ! raeburn 1016: src="../cgi-bin/mimetex.cgi?\large
! 1017: \left(\large\begin{array}{GC+45}
1.1 albertel 1018: \varepsilon_x\\\varepsilon_y\\\varepsilon_z\\\gamma_{xy}\\
1.5 ! raeburn 1019: \gamma_{xz}\\\gamma_{yz}\end{array}\right)\ {\large=}
1.1 albertel 1020: \ \left[\begin{array}{CC}
1021: \begin{array}\frac1{E_{\fs{+1}x}}
1022: &-\frac{\nu_{xy}}{E_{\fs{+1}x}}
1023: &-\frac{\nu_{\fs{+1}xz}}{E_{\fs{+1}x}}\\
1024: -\frac{\nu_{yx}}{E_y}&\frac1{E_{y}}&-\frac{\nu_{yz}}{E_y}\\
1025: -\frac{\nu_{\fs{+1}zx}}{E_{\fs{+1}z}}&
1026: -\frac{\nu_{zy}}{E_{\fs{+1}z}}
1027: &\frac1{E_{\fs{+1}z}}\end{array} & {\LARGE 0} \\
1028: {\LARGE 0} & \begin{array}\frac1{G_{xy}}&&\\
1029: &\frac1{G_{\fs{+1}xz}}&\\&&\frac1{G_{yz}}\end{array}
1030: \end{array}\right]
1031: \ \left(\large\begin{array}
1032: \sigma_x\\\sigma_y\\\sigma_z\\\tau_{xy}\\\tau_{xz}\\\tau_{yz}
1033: \end{array}\right)"
1034: alt="" border=0 align=middle></a> </td>
1035: <td align="left">
1036: Block diagonal form using nested <b>\begin{array}</b>'s.<br>
1037: Also, note rows aligned across all three arrays.
1038: </td>
1039: </tr>
1040:
1041: <!-- tenth example: demonstrating \begin{eqnarray} to align equations
1042: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1043: <tr>
1044: <td>
1045: <font size=5>(10)</font> </td>
1046: <td align="center">
1047: <a href="#preview">
1048: <img id="example10" onclick="eqntext('example10')"
1.5 ! raeburn 1049: src="../cgi-bin/mimetex.cgi?\large\left.\begin{eqnarray}
1.1 albertel 1050: x+y+z&=&3\\2y&=&x+z\\2x+y&=&z\end{eqnarray}\right\}"
1051: alt="" border=0 align=middle></a> </td>
1052: <td>
1053: using <a href="#array">\begin{eqnarray}</a> to align equations </td>
1054: </tr>
1055:
1056: <!-- eleventh example: demonstrating commutative diagram
1057: using \longxxxarrow[] and \begin{array}
1058: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1059: <tr>
1060: <td>
1061: <font size=5>(11)</font> </td>
1062: <td align="center">
1063: <a href="#preview">
1064: <img id="example11" onclick="eqntext('example11')"
1065: src="../cgi-bin/mimetex.cgi?\Large\begin{array}{rccclBCB}
1066: &f&\longrightarrow[75]^{\alpha:{\normalsize f\rightarrow g}}&g\\
1067: \large\gamma&\longdownarrow[50]&&\longdownarrow[50]&\large\gamma\\
1068: &u&\longrightarrow[75]_\beta&v\end{array}"
1069: alt="" border=0 align=middle></a> </td>
1070: <td>
1071: commutative diagram using <a href="#array">\begin{array}</a> </td>
1072: </tr>
1073:
1074: <!-- twelfth example: demonstrating \picture
1075: +++++++++++++++++++++++++++++++++++++++++++++ -->
1076: <tr>
1077: <td>
1078: <font size=5>(12)</font> </td>
1079: <td align="left">
1080: <a href="#preview">
1081: <img id="example12" onclick="eqntext('example12')"
1.5 ! raeburn 1082: src="../cgi-bin/mimetex.cgi?\large\hspace{5}\unitlength{1}
1.1 albertel 1083: \picture(175,100){ (50,50){\circle(100)}
1.5 ! raeburn 1084: (1,50){\overbrace{\line(46)}^{3$\;\;a}}
1.1 albertel 1085: (52,50){\line(125)} (50,52;115;2){\mid} (52,55){\longleftar[60]}
1.5 ! raeburn 1086: (130,56){\longrightar[35]} (116,58){\small r}
! 1087: (c85,50;80;2){\small\bullet} (c85,36){\small -q} (c165,36){\small q}
! 1088: (42,29){\underbrace{\line(32)}_{\scriptsize a^2/r\;\;\;}} }"
1.1 albertel 1089: alt="" border=0 align=middle></a> </td>
1090: <td valign="middle">
1091: mimeTeX <a href="#picture">\picture(size){pic_elems}</a>
1092: "environment", illustrating the image charge <b>- q</b>
1093: for a grounded conducting sphere of radius <b>a</b> with
1094: a charge <b>q</b> at distance <b>r > a</b> outside it. </td>
1095: </tr>
1096:
1097: <!-- thirteenth example: demonstrating \picture
1098: +++++++++++++++++++++++++++++++++++++++++++++++++ -->
1099: <tr>
1100: <td>
1101: <font size=5>(13)</font> </td>
1102: <td align="left">
1103: <a href="#preview">
1104: <img id="example13" onclick="eqntext('example13')"
1105: src="../cgi-bin/mimetex.cgi?\small\hspace{10}\unitlength{.75}
1106: \picture(120,220){ (60,200){\circle(120,40)} (0,20){\line(0,180)}
1107: (5,189;0,-30){\pict(110,20){(c20,10;70;2){
1108: \pict(40,20){(20,10){\circle(40,20)}(c10,10)+(c30,10)-}} } }
1109: (119,20){\line(0,180)} (60,20){\circle(120,40;34)}}"
1110: alt="" border=0 align=middle></a> </td>
1111: <td valign="middle"> <a href="#picture">\picture</a> "environment"
1112: illustrating the surface polarization charge induced by a uniform
1113: electric field. Inside the slab of material, the volume polarization
1114: charge clearly vanishes. <br><br> The little
1115: <img src="../cgi-bin/mimetex.cgi?\small\unitlength{.75} \pict(40,20){(20,10)
1116: {\circle(40,20)}(c10,10)+(c30,10)-}" alt="" border=0 align=middle>
1117: dipole image is drawn only once, then multiput across two columns, and
1118: then that result is further multiput down the rows. MimeTeX \picture's
1119: can be used as picture elements in other pictures, nested to any level.
1120: The image at left is picture-in-picture-in-picture. </td>
1121: </tr>
1122: </table>
1123:
1124: <!-- font examples
1125: ++++++++++++++++++ -->
1.5 ! raeburn 1126: <!-- font-size-examples-commented-out ---
! 1127: <br><br>
1.2 albertel 1128: <h3> Some font examples <font size=5>...</font></a> </h3>
1.1 albertel 1129: <p> Finally, illustrated below are some examples of fonts and symbols
1.2 albertel 1130: available with mimeTeX. All symbols and sizes from cmr, cmmi,
1131: cmmib (use <b>\mathbf{ }</b>), cmsy, cmex, bbold (use
1132: <b>\mathbb{ }</b>), rsfs (use <b>\mathscr{ }</b>),
1.3 albertel 1133: stmary and cyrillic wncyr (use <b>{\cyr }</b> or
1134: <b>\cyr{ }</b>) should be available, but they're not all shown.
1.1 albertel 1135: And also not shown are various "constructed symbols" like \sqrt,
1136: accents, etc. The illustrated font sizes are numbered 4=\Large,
1.2 albertel 1137: 3=\large and 2=\normalsize (not shown are 7=\Huge, 6=\huge,
1.5 ! raeburn 1138: 5=\LARGE, 1=\small and 0=\tiny). </p>
! 1139:
! 1140: <h3>cmmi latin uppercase, and lowercase</h3>
! 1141: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
! 1142: 2$\rm~size~4:~&4$A&4$B&4$C&4$D,&4$a&4$b&4$c&4$d\\
! 1143: 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\\
! 1144: 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,&
! 1145: 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}"
! 1146: alt="" border=0 align=middle> </p>
! 1147:
! 1148: <h3>calligraphic, and rsfs (<b>\cal{A}, \scr{B}, etc</b>)</h3>
! 1149: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
! 1150: 2$\rm~size~4:~&4$\calA&4$\calB&4$\calC&4$\calD&4$\calE&4$\calF&4$\calG,&
! 1151: 4$\scrA&4$\scrB&4$\scrC&4$\scrD&4$\scrE&4$\scrF&4$\scrG\\
! 1152: 2$\rm~3:~&3$\calH&3$\calI&3$\calJ&3$\calK&3$\calL&3$\calM&3$\calN&3$\calO&
! 1153: 3$\calP,&
! 1154: 3$\scrH&3$\scrI&3$\scrJ&3$\scrK&3$\scrL&3$\scrM&3$\scrN&3$\scrO&3$\scrP\\
! 1155: 2$\rm~2:~&2$\calQ&2$\calR&2$\calS&2$\calT&2$\calU&
! 1156: 2$\calV&2$\calW&2$\calX&2$\calY&2$\calZ,&
! 1157: 2$\scrQ&2$\scrR&2$\scrS&2$\scrT&2$\scrU&2$\scrV&2$\scrW&
! 1158: 2$\scrX&2$\scrY&2$\scrZ}"
! 1159: alt="" border=0 align=middle> </p>
! 1160:
! 1161: <h3>cmmi greek uppercase, and \var lowercase</h3>
! 1162: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
! 1163: 2$\rm~size~4:~&4$\Gamma&4$\Delta&4$\Theta&4$\Lambda&4$\Xi&4$\Pi&4$\Sigma&
! 1164: 4$\Upsilon&4$\Phi&4$\Psi&4$\Omega,&4$\rm~~&4$\varepsilon&4$\vartheta&4$\varpi&
! 1165: 4$\varrho&4$\varsigma&4$\varphi\\
! 1166: 2$\rm~3:~&3$\Gamma&3$\Delta&3$\Theta&3$\Lambda&3$\Xi&3$\Pi&3$\Sigma&
! 1167: 3$\Upsilon&3$\Phi&3$\Psi&3$\Omega,&~&3$\varepsilon&3$\vartheta&3$\varpi&
! 1168: 3$\varrho&3$\varsigma&3$\varphi\\
! 1169: 2$\rm~2:~&2$\Gamma&2$\Delta&2$\Theta&2$\Lambda&2$\Xi&2$\Pi&2$\Sigma&
! 1170: 2$\Upsilon&2$\Phi&2$\Psi&2$\Omega,&~&2$\varepsilon&2$\vartheta&2$\varpi&
! 1171: 2$\varrho&2$\varsigma&2$\varphi}"
! 1172: alt="" border=0 align=middle> </p>
! 1173:
! 1174: <h3>cmmi greek lowercase</h3>
! 1175: <p> <img src="../cgi-bin/mimetex.cgi?\array{r$
! 1176: 2$\rm~size~4:~&4$\alpha&4$\beta&4$\gamma&4$\delta&4$\epsilon&4$\zeta&
! 1177: 4$\eta&4$\theta&4$\iota&4$\kappa&4$\lambda&4$\mu&4$\nu&4$\xi&4$%%\omicron%%&
! 1178: 4$\pi&4$\rho&4$\sigma&4$\tau&4$\upsilon&4$\phi&4$\chi&4$\psi&4$\omega\\
! 1179: 2$\rm~3:~&3$\alpha&3$\beta&3$\gamma&3$\delta&3$\epsilon&3$\zeta&
! 1180: 3$\eta&3$\theta&3$\iota&3$\kappa&3$\lambda&3$\mu&3$\nu&3$\xi&3$%%\omicron%%&
! 1181: 3$\pi&3$\rho&3$\sigma&3$\tau&3$\upsilon&3$\phi&3$\chi&3$\psi&3$\omega\\
! 1182: 2$\rm~2:~&2$\alpha&2$\beta&2$\gamma&2$\delta&2$\epsilon&2$\zeta&
! 1183: 2$\eta&2$\theta&2$\iota&2$\kappa&2$\lambda&2$\mu&2$\nu&2$\xi&2$%%\omicron%%&
! 1184: 2$\pi&2$\rho&2$\sigma&2$\tau&2$\upsilon&2$\phi&2$\chi&2$\psi&2$\omega}"
! 1185: alt="" border=0 align=middle> </p>
! 1186:
! 1187: <h3>cmsy symbols at mimeTeX font size 3<br>
! 1188: <font size="3">(operators shown large are automatically "promoted"<br>
! 1189: to the larger size in \displaystyle mode)</font> </h3>
! 1190: <p> <img src="../cgi-bin/mimetex.cgi?\array{3,r$1$\rm~chars~\\
! 1191: 1$\rm~0-15:~&-&\cdot&\times&\ast&\div&\diamond&\pm&\mp&
! 1192: \oplus&\ominus&\otimes&\oslash&\odot&\bigcirc&\circ&\bullet\\
! 1193: 1$\rm~16-31:~&\asymp&\equiv&\subseteq&\supseteq&\leq&\geq&\preceq&\succeq&
! 1194: \sim&\approx&\subset&\supset&\ll&\gg&\prec&\succ\\
! 1195: 1$\rm~32-47:~&\leftar&\rightar&\uparr&\downar&\leftrightar&\near&\sear&
! 1196: \simeq&\Leftar&\Rightar&\Upar&\Downar&\Leftrightar&\nwar&\swar&\propto\\
! 1197: 1$\rm~48-63:~&\prime&\infty&\in&\ni&\triangle&\bigtriangledo&/&\'&
! 1198: \forall&\exists&\neg&\emptyset&\Re&\Im&\top&\bot\\
! 1199: 1$\rm~64-100:~&\aleph&&\calA&4$.\,.\,.&\calZ&&\cup&\cap&
! 1200: \uplus&\wedge&\vee&\vdash&\dashv&\lfloor&\rfloor&\lceil\\
! 1201: 1$\rm~101-116:~&\rceil&\lbrace&\rbrace&\langle&\rangle&\mid&\parallel&
! 1202: \updownar&\Updownar&\setminus&\wr&\surd&\amalg&\nabla&\int&\sqcup\\
! 1203: 1$\rm~117-127:~&\sqcap&\sqsubseteq&\sqsupseteq&\S&\dag&\ddag&\P&\clubsuit&
! 1204: \Diamond&\Heart&\spadesuit}" alt="" border=0 align=middle> </p>
! 1205:
! 1206: <h3>a few other cmmi, cmr, stmary and wncyr symbols
! 1207: at mimeTeX font size 4</h3>
! 1208: <p> <img src="../cgi-bin/mimetex.cgi?\array{4,r$
! 1209: 1$\rm~cmmi:~&\leftharpoonup&\leftharpoondo&\rightharpoonup&\rightharpoondo&
! 1210: \triangleright&\triangleleft&\star&\partial&
! 1211: \flat&\natural&\sharp&\smile&\frown&\ell&\imath&\jmath&\wp&\vec\\
! 1212: 1$\rm~cmr:~&\ss&\ae&\oe&\AE&\OE \\
! 1213: 1$\rm~stmary:~&\moo&\Lbag&\Rbag&\lightning&\llbracket&\rrbracket&
! 1214: \subsetpluseq&\supsetpluseq&\Yup&\Ydown\\
! 1215: 1$\rm~wncyr:~&\cyr A&\cyr a&\cyr B&\cyr b&\cyr V&\cyr v&\cyr G&\cyr g&
! 1216: \cyr D&\cyr d&\cyr Dj&\cyr dj&\cyr\=E&\cyr\=e&\cyr Zh&\cyr zh}"
! 1217: alt="" border=0 align=middle> </p>
! 1218: --- end-of-font-size-examples-commented-out -->
! 1219:
! 1220: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
! 1221: SCRIPTS & PLUGINS
! 1222: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
! 1223: <h2> <a name="scripts"> (Ic) Scripts & Plugins </a> </h2>
! 1224:
! 1225: <p> Some useful scripts that automatically construct
! 1226: mimeTeX <img> tags for you are illustrated below.
! 1227: And you can also write your own scripts to simplify
! 1228: the HTML notation required to incorporate mimeTeX
! 1229: math images in your pages. </p>
! 1230:
! 1231: <h3> <a name="plugins">
! 1232: mimeTeX plugins<font size=5>...</font></a> </h3>
! 1233: <!-- p> There's no inherent need to repeatedly write the cumbersome
! 1234: <img> tag illustrated above. You can write your own <a href=
! 1235: "http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro9.html#wp73314"
! 1236: target="_top">custom tags</a>,
! 1237: or write a wrapper script around mimeTeX to simplify the
! 1238: notation. </p -->
! 1239:
! 1240: <p style="margin-bottom:0"> <!-- For example, -->
! 1241: The following javascript snippet (based on
! 1242: <a href="http://www.mathtran.org" target="_top">mathtran</a>'s
! 1243: <a href="http://www.mathtran.org/js/mathtran_img.js"
! 1244: target="_top">mathtran_img.js</a>) lets you just write
! 1245: <b><img alt="mimetex:c=\sqrt{a^2+b^2}"></b>
! 1246: wherever you want to see <a href="#preview"><img id="imageJS1"
! 1247: onclick="eqntext('imageJS1')" src="../cgi-bin/mimetex.cgi?
! 1248: \normalsize c=\sqrt{a^2+b^2}" alt="" border=0
! 1249: style="Vertical-Align:-1px"></a> </p>
! 1250: <pre class="medium" style="margin-top:0;margin-bottom:0"
! 1251: > <script type="text/javascript">
! 1252: <!--
! 1253: // Create a namespace to hold variables and functions
! 1254: mimetex = new Object();
! 1255: // Change this to use your server
! 1256: mimetex.imgSrc = "http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?";
! 1257: // Transform the whole document: add src to each img with
! 1258: // alt text starting with "mimetex:", unless img already has a src.
! 1259: mimetex.init = function () {
! 1260: if (! document.getElementsByTagName) return;
! 1261: var objs = document.getElementsByTagName("img");
! 1262: var len = objs.length;
! 1263: for (i=0; i<len; i++) {
! 1264: var img = objs[i];
! 1265: if (img.alt.substring(0,8) == 'mimetex:')
! 1266: if (!img.src) {
! 1267: var tex_src = img.alt.substring(8);
! 1268: img.src = mimetex.imgSrc + encodeURIComponent(tex_src);
! 1269: // Append TEX to the class of the IMG.
! 1270: img.className +=' tex'; }
! 1271: }
! 1272: mimetex.hideElementById("mimetex.error"); }
! 1273: // Utility function
! 1274: mimetex.hideElementById = function (id) {
! 1275: var obj = document.getElementById(id);
! 1276: if (obj) obj.style.display = 'none'; }
! 1277: // resolve a cross-browser issue (see <a href="http://scottandrew.com/weblog/articles/cbs-events" target="_top">CBS events</a>)
! 1278: mimetex.addEvent = function (obj, evType, fn, useCapture) {
! 1279: if (obj.addEventListener) { //For Mozilla.
! 1280: obj.addEventListener(evType, fn, useCapture);
! 1281: return true; }
! 1282: else if (obj.attachEvent) { //For Internet Explorer.
! 1283: var r = obj.attachEvent("on"+evType, fn);
! 1284: return r; }
! 1285: }
! 1286: // Initialize after entire document is loaded
! 1287: mimetex.addEvent(window, 'load', mimetex.init, false);
! 1288: -->
! 1289: </script></pre>
! 1290:
! 1291: <p style="margin-bottom:0">
! 1292: Bulletin boards, wikis, etc, can also incorporate mimeTeX images
! 1293: with short scripts. For example, if you're using
! 1294: <a href="http://www.phpbb.com" target="_top">phpBB2</a>, then
! 1295: <a href="http://www.themathforum.com/" target="_top">Jameson</a>
! 1296: contributed the following typical one-line mod that lets you write
! 1297: <b>[tex] c=\sqrt{a^2+b^2} [/tex]</b> to obtain the
! 1298: same <a href="#preview"><img id="imageJS2"
! 1299: onclick="eqntext('imageJS2')" src="../cgi-bin/mimetex.cgi?
! 1300: \normalsize c=\sqrt{a^2+b^2}" alt="" border=0
! 1301: style="Vertical-Align:-1px"></a> image illustrated above </p>
! 1302: <pre class="medium" style="margin-top:0;margin-bottom:0"
! 1303: > #--------[open]-----------------------------------------------------
! 1304: /includes/bbcode.php
! 1305: #--------[find]-----------------------------------------------------
! 1306: // Remove our padding from the string..
! 1307: #--------[before, add]----------------------------------------------
! 1308: $text = preg_replace('/\[tex\](.*?)\[\/tex\]/ie',
! 1309: "'<img src=\"/cgi-bin/mimetex.cgi?'.rawurlencode('$1').'\" align=\"middle\" />'",
! 1310: $text);</pre>
! 1311: <p class="continue" style="margin-top:0"> If you're using
! 1312: <a href="http://www.phpbb.com" target="_top">phpBB3</a>,
! 1313: then no mod is even needed.
! 1314: Just click Postings from the Administrator Control Panel,
! 1315: and add the custom BBCode <b>[tex]{TEXT}[/tex]</b>
! 1316: with the HTML replacement
! 1317: <b><img src="/cgi-bin/mimetex.cgi?{TEXT}" align=middle></b></p>
! 1318:
! 1319: <p> Similarly, <a href="http://www.pmwiki.org/" target="_top">PmWiki</a>
! 1320: also has a
! 1321: <a href="http://www.pmwiki.org/wiki/Cookbook/MimeTeX" target="_top">
! 1322: mimeTeX plugin</a> that lets you just write
! 1323: <b>{$ f(x)=\int_{-\infty}^xe^{-t^2}dt $}</b>
! 1324: to obtain that same image. Several other packages
! 1325: also have similar mimeTeX plugins: </p>
! 1326: <center><table>
! 1327: <tr> <td align=center> <u> <b>Package</b> </u> </td>
! 1328: <td> </td>
! 1329: <td align=center> <u> <b>Plugin</b> </u> </td>
! 1330: </tr>
! 1331: <tr> <td align=center>
! 1332: <a href="http://www.pmwiki.org" target="_top">
! 1333: PmWiki</a> </td> <td> </td>
! 1334: <td align=center>
! 1335: <a href="http://www.pmwiki.org/wiki/Cookbook/MimeTeX"
! 1336: target="_top">mimeTeX plugin</a> </td> </tr>
! 1337: <tr> <td align=center>
! 1338: <!-- a href="http://www.wikimedia.org/wiki/Main_Page" -->
! 1339: <!-- a href="http://www.wikimediafoundation.org/wiki/Main_Page" -->
! 1340: <a href="http://www.mediawiki.org/wiki/MediaWiki"
! 1341: target="_top">MediaWiki</a> </td>
! 1342: <td align=center> </td>
! 1343: <td align=center>
! 1344: <!-- a href="http://meta.wikimedia.org/wiki/Mimetex_alternative" -->
! 1345: <a href="http://www.mediawiki.org/wiki/Mimetex_alternative"
! 1346: target="_top">"mimeTeX alternative"</a> </td> </tr>
! 1347: <!-- ***redirect loop***
! 1348: <tr> <td align=center>
! 1349: <a href="http://www.unitorganizer.com/mathwiki/index.php/Main_Page"
! 1350: target="_top">MathWiki</a> </td> <td> </td>
! 1351: <td align=center> <a href=
! 1352: "http://www.unitorganizer.com/mathwiki/index.php/MimetexParser"
! 1353: target="_top">"mimeTeX Parser"</a> </td> </tr>
! 1354: -->
! 1355: <tr> <td align=center>
! 1356: <a href="http://forums.punbb.org/" target="_top">PunBB</a> </td>
! 1357: <td> </td> <td align=center>
! 1358: <a href="http://www.math-linux.com/spip.php?article44"
! 1359: target="_top">mimeTeX plugin</a> </td> </tr>
! 1360: <tr> <td align=center>
! 1361: <!-- a href="http://www.sixapart.com/movabletype/" -->
! 1362: <a href="http://www.movabletype.com/"
! 1363: target="_top">Movable Type</a> </td> <td> </td>
! 1364: <td align=center> <a href=
! 1365: "http://www.unitorganizer.com/myblog/2006/08/creating_equations_in_movable.html"
! 1366: target="_top">mimeTeX plugin</a> </td> </tr>
! 1367: <tr> <td align=center>
! 1368: <a href="http://wordpress.org/" target="_top">WordPress</a> </td>
! 1369: <td> </td> <td align=center> <a href=
! 1370: "http://www.anlak.com/?page_id=66" target="_top">
! 1371: <!-- "http://sixthform.info/steve/wordpress/index.php?p=13&page=2" -->
! 1372: mimeTeX plugin</a> <!-- (see item 9) --> </td> </tr>
! 1373: <tr> <td align=center>
! 1374: <a href="http://www.joomla.org/"
! 1375: target="_top">Joomla</a> </td> <td> </td>
! 1376: <td align=center> <a href=
! 1377: "http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,5932/Itemid,35/"
! 1378: target="_top">mimeTeX plugin</a> </td> </tr>
! 1379: <tr> <td align=center>
! 1380: <a href="http://mambo-foundation.org/"
! 1381: target="_top">Mambo</a> </td> <td> </td>
! 1382: <td align=center> <a href=
! 1383: "http://webscripts.softpedia.com/script/Modules/Joomla-Mambo-Modules/MimeTeX-Bot-9250.html"
! 1384: target="_top">"mimeTeX bot"</a> </td> </tr>
! 1385: <!--- dead links --->
! 1386: <!-- tr> <td align=center>
! 1387: <a href="http://www.phpbb.com" target="_top">phpBB</a> </td>
! 1388: <td> </td> <td align=center>
! 1389: <a href=
! 1390: "http://www.themathforum.com/math/showthread.php?p=621#post621"
! 1391: target="_top">mimeTeX plugin</a> </td> </tr -->
! 1392: <!-- tr> <td align=center>
! 1393: <a href="http://www.mamboserver.com/" target="_top">Mambo</a> </td>
! 1394: <td> </td> <td align=center>
! 1395: <a href="http://mamboxchange.com/projects/mimetexbot/"
! 1396: target="_top">"mimeTeX bot"</a> </td> </tr -->
! 1397: </table></center>
! 1398:
! 1399: <p> <b>Please note:</b> If you're writing your own plugin for mimeTeX,
! 1400: please don't write php code using <b>system( )</b>, or any other
! 1401: shell escape mechanism, just to cache images. Use mimeTeX's
! 1402: <b>-DCACHEPATH=\"<i>path/</i>\"</b>
! 1403: <a href="#options">compile option</a> instead.
! 1404: <b>system( )</b> raises security
! 1405: issues, either real ones if used carelessly, or just in the minds of
! 1406: system administrators. Either way, I've received many emails from
! 1407: people unable to use mimeTeX because of unnecessary <b>system( )</b>
! 1408: calls prohibited by security-conscious sysadmins. MimeTeX itself poses
! 1409: minimal risk when used as illustrated above, but you're responsible
! 1410: for any plugin/wrapper script you write around it. </p>
1.1 albertel 1411:
1.5 ! raeburn 1412: <h3> <a name="valignment">
! 1413: Vertical alignment<font size=5>...</font></a> </h3>
! 1414: <p> An image like
! 1415: <a href="#preview"><img id="imageAV1" onclick="eqntext('imageAV1')"
! 1416: src="../cgi-bin/mimetex.cgi?
! 1417: \normalsize f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
! 1418: alt="" border=0 align=middle></a>
! 1419: doesn't look as good as the same image
! 1420: <a href="#preview"><img id="imageAV2" onclick="eqntext('imageAV2')"
! 1421: src="../cgi-bin/mimetex.cgi?
! 1422: \normalsize f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
! 1423: alt="" border=0 style="Vertical-Align:-26px"></a>
! 1424: that's vertically aligned with your surrounding text.
! 1425: Along with several standard
! 1426: <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">
! 1427: HTTP header fields</a>, mimeTeX also emits a special
! 1428: <b>Vertical-Align: –<i>nn</i></b>
! 1429: header, where <b>–<i>nn</i></b> is the number of pixels
! 1430: (usually negative as illustrated) needed for a
! 1431: <b>style="Vertical-Align: –<i>nn</i> px"</b>
! 1432: attribute in the <b><img></b> tag used to
! 1433: render your expression. This Vertical-Align: header
! 1434: is obtained by placing the directive <b>\depth</b>
! 1435: anywhere in your expression. </p>
1.1 albertel 1436:
1.5 ! raeburn 1437: <p> But mimeTeX's special Vertical-Align: header
! 1438: is unrecognized and ignored by your browser. You have to get the
! 1439: header, interpret it, and write the corresponding <img> tag.
! 1440: The only feasible way to do all this is using a scripting language,
! 1441: as illustrated by the following, rather naive, php code </p>
! 1442: <pre class="medium" style="margin-top:.5em;margin-bottom:.5em"
! 1443: > <?php
! 1444: $mimetexurl = "http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?";
! 1445: function verticalalign( $expression ) {
! 1446: global $mimetexurl;
! 1447: // note: curl_init() stops at the first whitespace char in $url argument
! 1448: $expression = ereg_replace(" ","~",$expression); // so remove whitespace
! 1449: $url = $mimetexurl . "\depth~" . $expression;
! 1450: $valign = "0";
! 1451: $ch = curl_init( $url );
! 1452: curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
! 1453: curl_setopt( $ch, CURLOPT_HEADER, true );
! 1454: $gif = curl_exec( $ch );
! 1455: $errno = curl_errno( $ch );
! 1456: curl_close( $ch );
! 1457: if ( $errno == 0 ) {
! 1458: $fields = explode("Vertical-Align:",$gif);
! 1459: $vfield = trim($fields[1]);
! 1460: $fldlen = strspn($vfield,"+-0123456789");
! 1461: $valign = substr($vfield,0,$fldlen); }
! 1462: return $valign;
! 1463: }
! 1464: function mimetextag( $expression ) {
! 1465: global $mimetexurl;
! 1466: $valign = verticalalign($expression);
! 1467: $url = $mimetexurl . "\depth~" . $expression;
! 1468: echo ' <img src="',$url,'" ';
! 1469: echo ' style="Vertical-Align:',$valign,'px" ';
! 1470: echo ' alt="" border=0>', "\n";
! 1471: }
! 1472: ?></pre>
1.1 albertel 1473:
1.5 ! raeburn 1474: <p> Now you can write
! 1475: <?php mimetextag('\frac12\left(a^2+b^2\right)'); ?>
! 1476: wherever you want to see
! 1477: <a href="#preview"><img id="imageAV5" onclick="eqntext('imageAV5')"
! 1478: src="../cgi-bin/mimetex.cgi?
! 1479: \normalsize\frac12\left(a^2+b^2\right)"
! 1480: alt="" border=0 style="Vertical-Align:-7px"></a>
! 1481: correctly aligned. Note that the php code automatically
! 1482: prepends <b>\depth</b> to your expression for you.
! 1483: <!-- Besides making you escape backslashes
! 1484: (each \ must be written \\), -->
! 1485: (Also note that this code calls mimeTeX twice to render each
! 1486: expression, once to get the Vertical-Align: header and build
! 1487: an <img> tag, and then again to render that tag.
! 1488: If you're a good php programmer and write better code,
! 1489: please email me a copy.) </p>
1.1 albertel 1490:
1.5 ! raeburn 1491: <p> If you're using mimeTeX's
! 1492: <b>-DCACHEPATH=\"<i>path</i>/\"</b>
! 1493: <a href="#options">compile option</a>, you can request
! 1494: that all images be cached with Vertical-Align: headers,
! 1495: whether or not they contain the \depth directive. Prefix your
! 1496: <b><i>path</i>/</b> with a leading <b>%</b> and write
! 1497: <b>-DCACHEPATH=\"%<i>path</i>/\"</b> instead.
! 1498: That leading <b>%</b> won't become part of your cache
! 1499: directory's <b><i>path</i>/</b>, but it will signal mimeTeX
! 1500: to cache headers along with each image. (In this case,
! 1501: the directive <b>\nodepth</b> suppresses
! 1502: mimeTeX's header caching for that image.)
! 1503: <!-- Otherwise, the Vertical-Align: information is lost,
! 1504: and attempts to align cached images will fail. --> </p>
1.1 albertel 1505:
1506:
1507: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1508: GPL
1509: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1.5 ! raeburn 1510: <h2> <a name="gpl"> (Id) GPL License </a> </h2>
1.1 albertel 1511:
1512: <font color="black">
1513: <b>"</b><i>My grandfather once told me there are two kinds of people:<br>
1514:     Those who do the work and those who take the credit.<br>
1515:     He told me to try to be in the first group; there was much
1516: less competition.</i><b>"</b><br>
1517: Indira Gandhi, the late Prime Minister of India</font> <br>
1518:
1519: <p> MimeTeX's copyright is registered by me with the US Copyright Office,
1520: and I hereby license it to you under the terms and conditions of the
1521: <a href="http://www.gnu.org/licenses/gpl.html" target="_top">GPL</a>.
1522: There is no official support of any kind whatsoever,
1523: and you use mimeTeX entirely at your own risk, with no guarantee
1524: of any kind, in particular with no warranty of merchantability. </p>
1525:
1526: <p> By using mimeTeX, you warrant that you have read, understood
1527: and agreed to these terms and conditions, and that you <!-- are at least
1528: 18 years of age and --> possess the legal right and ability to enter
1529: into this agreement and to use mimeTeX in accordance with it. </p>
1530:
1531: <p> Hopefully, the law and ethics regarding computer programs will
1532: evolve to make this kind of obnoxious banter unnecessary.
1533: In the meantime, please forgive me my paranoia. </p>
1534:
1.5 ! raeburn 1535: <p> To protect your own intellectual property, I recommend (both are pdf)
! 1536: <a href="http://www.copyright.gov/circs/circ01.pdf"
1.3 albertel 1537: target="_top">Copyright Basics</a> from The Library of Congress,
1.5 ! raeburn 1538: in particular <a href="http://www.copyright.gov/circs/circ61.pdf"
1.3 albertel 1539: target="_top">Circular 61</a>, Copyright Registration for
1540: Computer Programs.
1541: <!-- and similarly,
1542: <a href="http://www.abanet.org/intelprop/comm106/106copy.html"
1543: target="_top">Copyright Basics</a> from The American Bar Association. -->
1.1 albertel 1544: Very briefly, download
1545: <a href="http://www.copyright.gov/forms/formtxi.pdf">Form TX</a>
1546: and follow the included instructions.
1547: In principle, you automatically own the copyright
1548: to anything you write the moment it's on paper. In practice,
1549: if the matter comes under dispute, the courts look _very_ favorably
1.3 albertel 1550: on you for demonstrating your intent by registering the copyright.
1.5 ! raeburn 1551: <!-- For example, courts will stop unauthorized use of unregistered
1.3 albertel 1552: material, but monetary damages are awarded _only_ if you
1.5 ! raeburn 1553: register the copyright before infringement occurs. --> </p>
1.1 albertel 1554:
1555:
1556: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1557: SECTION II. BUILDING MIMETEX
1558: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
1559: <h1> <a name="build"> (II) Building mimeTeX </a> </h1>
1560:
1561: <!-- <center> -->
1562: <table border="0" cellpadding="0" cellspacing="0">
1563: <tr><td><center><hr size="2">Very quickly --- download
1.2 albertel 1564: <a href="http://www.forkosh.com/mimetex.zip">
1.3 albertel 1565: <!-- jfa <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip"></a> -->
1.1 albertel 1566: mimetex.zip</a> and then type
1567: <table border="0" cellpadding="0" cellspacing="0">
1568: <tr align="left">
1569: <td><img src="../cgi-bin/mimetex.cgi?\hspace{50}" alt="" border=0></td>
1570: <td><b>unzip mimetex.zip</b> <br>
1571: <b>cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b></td>
1572: </tr></table>
1573: Now <b>mv</b> mimetex.cgi to your <b>cgi-bin/</b>
1574: directory, and you're all done. <br>
1575: Read the rest of this section for more detailed
1576: information.<hr size="2"></center></td>
1577: <td><img src="../cgi-bin/mimetex.cgi?\hspace{150}" alt="" border=0></td>
1578: </tr></table>
1579: <!-- </center> -->
1580:
1581: <p> I've built and run mimeTeX under Linux and NetBSD using gcc. The source
1.2 albertel 1582: code is ansi-standard C, and should compile and run under all
1583: environments without change. Instructions below
1.1 albertel 1584: are for Unix. Modify them as necessary for your particular situation
1585: (note the -DWINDOWS switch if applicable). </p>
1586:
1.2 albertel 1587: <h2> <a name="compile"> (IIa) Download and Compile </a> </h2>
1588:
1589: <p> The steps needed to download and compile mimeTeX are </p>
1.1 albertel 1590: <ul>
1591: <li> Download and unzip
1.2 albertel 1592: <a href="http://www.forkosh.com/mimetex.zip">
1.3 albertel 1593: <!-- jfa <a href="ftp://ftp.tex.ac.uk/tex-archive/support/mimetex/mimetex.zip"></a> -->
1.2 albertel 1594: mimetex.zip</a> in any convenient working directory.
1595: Your working directory should now contain <center>
1596: <table cellpadding=0 cellspacing=0>
1597: <tr><td width=100>README</td> <td>mimeTeX release notes</td></tr>
1.4 riegler 1598: <tr><td>COPYING</td> <td>GPL license, under which you may use
1.2 albertel 1599: mimeTeX</td></tr>
1600: <tr><td>mimetex.c</td> <td>mimeTeX source program and all required
1601: functions</td></tr>
1602: <tr><td>mimetex.h</td> <td>header file for mimetex.c (and for
1603: gfuntype.c)</td></tr>
1604: <tr><td>gfuntype.c</td> <td>parses output from <b>gftype -i</b>
1605: and writes bitmap data</td></tr>
1606: <tr><td>texfonts.h</td> <td>output from several <b>gfuntype</b> runs,
1607: needed by mimetex.c</td></tr>
1608: <tr><td>gifsave.c</td> <td>gif library by Sverre H. Huseby
1609: <a href="http://shh.thathost.com"
1610: target="_top">http://shh.thathost.com</a>
1611: </td></tr>
1612: <tr><td>mimetex.html</td> <td>this file, the mimeTeX
1613: user's manual</td></tr>
1614: </table></center>
1615:
1616: Note: all files use Unix line termination, i.e., linefeeds
1617: (without carriage returns) signal line endings. Conversion for
1618: Windows PC's, Macs, VMS, etc, can usually be accomplished by
1619: unzip's -a option, i.e., unzip -a mimetex.zip
1620: <br> <br> </li>
1.1 albertel 1621: <li> To compile an executable that emits anti-aliased gif images
1.2 albertel 1622: (which is recommended for most uses), just type the following
1623: command from the Unix shell <br>
1624:
1625: <b>cc -DAA mimetex.c gifsave.c -lm -o mimetex.cgi</b> </li>
1626: <li> Or, to compile an executable that emit gif images
1627: without anti-aliasing <br>
1628:
1629: <b>cc -DGIF mimetex.c gifsave.c -lm -o mimetex.cgi</b> </li>
1.1 albertel 1630: <li> Alternatively, to compile an executable that emits mime xbitmaps<br>
1.2 albertel 1631:
1632: <b>cc -DXBITMAP mimetex.c -lm -o mimetex.cgi</b> </li>
1.1 albertel 1633: <li> Compile Notes: <ul>
1634: <li> If (and only if) you're compiling a Windows executable with
1635: the <b>-DAA</b> or <b>-DGIF</b> option (but not -DXBITMAP), then
1636: add <b>-DWINDOWS</b> . For example, <br>
1.2 albertel 1637: <nobr> <b>gcc -DAA -DWINDOWS
1638: mimetex.c gifsave.c -lm -o mimetex.exe</b> </nobr> <br>
1.1 albertel 1639: The above Unix-like syntax works with
1640: <a href="http://www.mingw.org" target="_top">MinGW</a> and
1641: <a href="http://www.delorie.com/djgpp/" target="_top">djgpp</a>
1642: Windows compilers, but probably not with most others,
1.2 albertel 1643: where it's only intended as a "template". <br>
1644:
1645: Explanation: mimeTeX writes gif bytes directly to stdout, as usual
1646: for cgi's. But Windows treats stdout as a character stream,
1647: interpreting any hex 0A byte as an <lf>, and automatically
1648: preceding it with a spurious hex 0D <cr> byte. The
1649: -DWINDOWS switch compiles in a non-portable, Windows-specific
1650: _setmode() call that sets stdout to binary mode. </li>
1651: <li> If you're compiling for Windows and would prefer
1652: to install mimeTeX as a Win32 DLL, see the
1653: <a href="http://www.codeproject.com/dotnet/Eq2Img.asp">
1654: Code Project</a> developed by
1655: <a href="http://www.shitalshah.com">Shital Shah</a>, and
1656: download <a href="http://www.shitalshah.com/dev/eq2img_all.zip">
1657: eq2img_all.zip</a> containing Shital's latest code. </li>
1.5 ! raeburn 1658: <li> If you install mimeTeX on one server and try to use it
! 1659: from another, you may instead see messages like <br>
! 1660: <img src="../cgi-bin/mimetex.cgi?\message{3}"
! 1661: alt="" align="middle" border=0> <br>
! 1662: In this case, compile mimetex.cgi with the -DNOREFCHECK switch,
! 1663: <i>e.g.</i>,<br>
! 1664: <nobr> <b>cc -DAA -DNOREFCHECK
! 1665: mimetex.c gifsave.c -lm -o mimetex.cgi</b> </nobr> <br>
! 1666: and read the -DREFLEVELS=<i>n</i> discussion under
! 1667: <a href="#options">compile options</a> below. </li>
1.1 albertel 1668: <!-- <li> If you're compiling on Sun or VMS, and see about a zillion
1669: irritating warnings, try adding <b>-DSIGNEDCHAR</b>
1670: (for VMS, that's cc/define=(AA,SIGNEDCHAR) mimetex.c) </li> -->
1.2 albertel 1671: </ul> <br> </li>
1672: <li> The gfuntype program is only needed if you plan to change the
1673: font information in texfonts.h, as explained in
1674: <a href="#fonts">Appendix IVa</a> below.
1675: In that case, compile gfuntype with the command <br>
1676:
1677: <b>cc gfuntype.c mimetex.c -lm -o gfuntype</b> </li>
1.1 albertel 1678: </ul>
1.2 albertel 1679: <p> That's all there is to compiling mimeTeX.
1680: Several other optional compile-line <a href="#options">options</a>
1.1 albertel 1681: available for mimetex.c are discussed below. </p>
1682:
1.2 albertel 1683: <p> Immediately after compiling mimeTeX, test your new executable
1684: by typing <b>./mimetex.cgi "x^2+y^2"</b>
1685: from the Unix shell (or <b>mimetex "x^2+y^2"</b>
1686: from the Windows Command Prompt), which should emit
1687: two "ascii rasters" something like the following </p> <pre>
1.1 albertel 1688: Ascii dump of bitmap image... Hex dump of colormap indexes...
1689: ...........**....................**... ..........1**1...................1**1..
1690: ..........*..*......*...........*..*.. ..........*23*......*............*23*..
1691: .............*......*..............*.. .............*......*...............*..
1692: ....****.....*......*.....*..*.....*.. ...1****....2*......*.....2*..*....2*..
1693: ...*.*.*....*.......*....**..*....*... ...*.*.*...1*.......*.....**..*...1*...
1694: .....*.....*.*..********..*..*...*.*.. ....1*1...2*.*..********..3*..*..2*.*..
1695: .....*....****......*.....*..*..****.. ....2*2...****......*......*12*..****..
1696: ..*.*.*.............*.....*.*......... ..*.*.*.............*......*.*2........
1697: ...****.............*.....***......... ..1****.............*......***.........
1698: ....................*.......*......... ....................*........*.........
1699: .........................*.*.......... ..........................*.*1.........
1700: .........................**........... ..........................**1..........
1701: The 5 colormap indexes denote rgb vals...
1702: .-->255 1-->196 2-->186 3-->177 *-->0</pre>
1703: <p class="continue"> <b>(</b>The right-hand illustration shows asterisks
1704: in the same positions as the left-hand one, along with anti-aliased
1705: grayscale colormap indexes assigned to neighboring pixels, and with
1706: the rgb value for each index.<b>)</b> Just typing <b>./mimetex.cgi</b>
1707: without an argument should produce ascii rasters for the default
1.2 albertel 1708: expression <b>f(x)=x^2</b>. If you see these two ascii rasters then
1709: your binary's good. Otherwise, you must find and fix the problem
1710: before proceeding. </p>
1711:
1.1 albertel 1712:
1.2 albertel 1713: <h2> <a name="install"> (IIb) Install </a> </h2>
1.1 albertel 1714:
1.2 albertel 1715: <p> Once you've successfully tested mimetex.cgi from the Unix shell
1716: (or mimetex.exe from the Windows Command Prompt),
1717: the steps needed to install mimeTeX are </p>
1718: <ul>
1719: <li> <b>mv</b> mimetex.cgi (or <b>move</b> mimetex.exe)
1720: to your server's <b>cgi-bin/</b> directory, wherever cgi
1721: programs are expected. </li>
1722: <li> Now you may need to <b>chmod 755 mimetex.cgi</b>
1723: and/or <b>chown</b> it, too, depending on your server's
1724: requirements. Contact your system administrator or ISP
1725: if you're not already familiar with this information. </li>
1726: <li> Once mimetex.cgi is moved to your server's <b>cgi-bin/</b>
1727: directory, with permissions and owner set as necessary,
1728: you're all done. </li>
1729: </ul>
1730:
1731: <p> Immediately after installing mimeTeX, test your new mimetex.cgi
1732: by typing a url into your browser's locator window something like <br>
1733:
1734: <b>http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?x^2+y^2</b> <br>
1735: which should display
1736: <img src="../cgi-bin/mimetex.cgi?\normalsize x^2+y^2" alt="" border=0
1.4 riegler 1737: style="Vertical-Align:-3px">
1738: in the upper-left corner of your window,
1.2 albertel 1739: just like clicking this link does, which tests my mimetex.cgi, <br>
1740:
1741: <a href="http://www.forkosh.com/cgi-bin/mimetex.cgi?x^2+y^2"
1742: target="_top">http://www.forkosh.com/cgi-bin/mimetex.cgi?x^2+y^2</a><br>
1743: If you see the same <img src="../cgi-bin/mimetex.cgi?
1.4 riegler 1744: \normalsize x^2+y^2" alt="" border=0 style="Vertical-Align:-3px">
1745: image from the <b><i>yourdomain</i></b> link, then you've completed
1.2 albertel 1746: a successful mimeTeX installation. </p>
1747:
1748: <p> If you don't see the image, then your installation failed.
1749: If your earlier post-compilation "ascii raster" test
1750: succeeeded, then the problem is probably some server-specific
1751: installation requirement. First make sure you installed mimetex.cgi
1752: in the correct <b>cgi-bin/</b> directory, set the correct <b>chmod</b>
1753: permissions, and typed the correct url into your browser's locator
1754: window. Then contact your system administrator or ISP,
1755: and ask how to install cgi programs on your server. </p>
1756:
1757: <p> After you've successfully installed mimeTeX, and both preceeding tests
1758: have succeeded, you can optionally "regression test"
1759: all mimeTeX features as follows: </p>
1760: <ul>
1761: <li> <b>mv</b> mimetex.html (this file) to your server's
1762: <b>htdocs/</b> directory </li>
1763: <li> Paths to <b>cgi-bin/</b> and <b>htdocs/</b> directories
1764: are typically <b><i>path</i>/www/cgi-bin/</b> and
1765: <b><i>path</i>/www/htdocs/</b>, so I set up mimtex.html
1766: to access mimetex.cgi from the relative path <b>../cgi-bin/</b>.
1767: If your directories are non-conforming, you may have to edit
1768: the few dozen occurrences of <b>../cgi-bin/mimetex.cgi</b>
1769: in your mimetex.html page. Sometimes a suitable symlink works;
1770: if not, you'll have to edit. Globally changing
1771: <b>../cgi-bin/mimetex.cgi</b> usually works. </li>
1772: <li> Now visit your page
1773: <b>http://www.<i>yourdomain</i>.com/mimetex.html</b> </li>
1774: <li> Once your mimetex.html displays properly, you can assume
1775: everything is working, and can begin authoring html documents
1776: using mimetex.cgi to render your own math. </li>
1777: </ul>
1778:
1779: <p> That's all there is to installing mimeTeX. </p>.
1780:
1781:
1782: <h2> <a name="options"> (IIc) Additional Compile-Line Options </a></h2>
1.1 albertel 1783:
1784: <p> In addition to -DAA or -DGIF or -DXBITMAP (along with -DWINDOWS
1785: when necessary) on the mimetex.c compile line, as discussed above,
1786: you may also optionally include the following -D switches,
1787: whose functionality is discussed below. </p>
1788: <dl>
1789: <dt> <b>-DAA</b> </dt>
1790: <dd> As already discussed, -DAA turns on anti-aliasing.
1791: It also sets default values for individual anti-aliasing
1792: parameters discussed below. If you specify -DAA
1793: then you needn't specify the individual parameters unless
1794: you want to override the defaults. <br>
1795: Anti-aliasing can't be applied to mime
1796: xbitmaps, so don't specify -DAA if you also specify -DXBITMAP. <br>
1797: And mimeTeX's anti-aliasing only works
1798: well on white (or light gray) backgrounds. Your html file
1799: probably contains a <body> tag of the form
1800: <body bgcolor="#ffffff" text="#000000">
1801: which specifies black text on a pure white background.
1802: The background can be grayed down to maybe bgcolor="#e7e7e7",
1803: but much darker will begin to show white rings around
1804: mimeTeX's anti-aliased characters. This page is displayed
1805: using bgcolor="#ffffff". </dd>
1806: <dt> <b>-DCENTERWT=<i>n</i> <br>
1807: -DADJACENTWT=<i>j</i> <br>
1808: -DCORNERWT=<i>k</i></b> </dt>
1809: <dd> MimeTeX currently provides a lowpass filtering
1810: algorithm for anti-aliasing, which is applied to the
1811: existing set of bitmap fonts. This lowpass filter applies
1812: weights <img src="../cgi-bin/mimetex.cgi?
1.2 albertel 1813: \tiny\begin{pmatrix}1&2&1\\2&\,8\,&2\\1&2&1\end{pmatrix}"
1.1 albertel 1814: alt="" border=0 align=middle> to neighboring pixels. The defaults
1.2 albertel 1815: weights are CENTERWT=8, ADJACENTWT=2 and CORNERWT=1,
1.1 albertel 1816: which you can adjust to control anti-aliasing. </dd>
1817: <dt> <b>-DCACHEPATH=\"<i>path/</i>\"</b> </dt>
1818: <dd> This option saves each rendered image to a file in directory
1819: <b><i>path/</i></b>, which mimeTeX reads rather than
1820: re-rendering the same image every time it's given
1821: the same LaTeX expression. Sometimes mimeTeX disables caching,
1822: e.g., expressions containing <b>\input{ }</b> are
1823: re-rendered since the contents of the inputted file may have
1824: changed. If compiled without <b>-DCACHEPATH=\"<i>path/</i>\"</b>
1825: mimeTeX always re-renders expressions. This usually isn't too
1826: cpu intensive, but if you have unusually high hit rates then
1827: image caching may be helpful. The <b><i>path/</i></b>
1828: is relative to mimetex.cgi, and must be writable by it.
1829: Files created under <b><i>path/</i></b> are named
1830: <b><i>filename</i>.gif</b>, where <b><i>filename</i></b>
1.4 riegler 1831: is the 32-character MD5 hash of your LaTeX expression. <br>
1832: If you're also using mimeTeX's
1833: <a href="#valignment">Vertical-Align:</a> feature, prefix your
1834: <b><i>path</i>/</b> with a leading <b>%</b> and write
1835: <b>-DCACHEPATH=\"%<i>path</i>/\"</b>
1836: instead. That leading <b>%</b> won't become part of
1837: your cache directory's <b><i>path</i>/</b>, but it will signal
1838: mimeTeX to cache headers along with each image.
1839: Otherwise, the Vertical-Align: information is lost,
1840: and attempts to align cached images will fail. <br>
1841: When caching a new image, mimeTeX also
1.1 albertel 1842: updates the file <b><i>path/</i>mimetex.log</b> containing
1843: a timestamp, filename and LaTeX expression for each new file
1844: created. A sample entry looks like
1845: <pre>---------------------------------------------------------------------
1.4 riegler 1846: 2008-09-07:11:29:53am f8ccc8dd93c8eeb1d9c40b353ef781e0.gif
1.1 albertel 1847: \LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
1848: ---------------------------------------------------------------------</pre></dd>
1.2 albertel 1849: <dt><b>-DDEFAULTSIZE=<i>n</i></b> </dt>
1850: <dd> MimeTeX currently has eight font sizes numbered 0-7,
1851: and always starts out in DEFAULTSIZE, whose default value is 3.
1852: Specify -DDEFAULTSIZE=2 on the compile line if you prefer
1853: mimeTeX to start in default size 2, etc. </dd>
1.1 albertel 1854: <dt><b>-DDISPLAYSIZE=<i>n</i></b> </dt>
1855: <dd> By default, operator limits like <b>\int_a^b</b> are rendered
1856: <b>\textstyle</b> <a href="#preview">
1857: <img id="displaysize1" onclick="eqntext('displaysize1')"
1.2 albertel 1858: src="../cgi-bin/mimetex.cgi?
1.5 ! raeburn 1859: \normalsize\displaystyle\smashmargin{2}{\int\nolimits_a}^b"
1.1 albertel 1860: alt="" border=0 align=middle></a> at font sizes <b>\normalsize</b>
1861: and smaller, and rendered <b>\displaystyle</b> <a href="#preview">
1862: <img id="displaysize2" onclick="eqntext('displaysize2')"
1863: src="../cgi-bin/mimetex.cgi?\large\int_a^b"
1864: alt="" border=0 align=middle></a> at font sizes <b>\large</b> and
1865: larger. This default corresponds to <b>-DDISPLAYSIZE=3</b>,
1866: which you can adjust; e.g., <b>-DDISPLAYSIZE=0</b> always defaults
1867: to <b>\displaystyle</b>, and <b>99</b> (or any large number)
1868: always defaults to <b>\textstyle</b>. Note that explicit
1869: <b>\textstyle</b>, <b>\displaystyle</b>, <b>\limits</b> or
1870: <b>\nolimits</b> directives in an expression always override
1871: the <b>DISPLAYSIZE</b> default. </dd>
1.3 albertel 1872: <dt><b>-DGAMMA=<i>gammacorrection</i></b> </dt>
1873: <dd> Applies <b><i>gammacorrection</i></b> to antialiased
1874: gif images. Default is 1.25 (rather than the standard 2.2).
1875: Specify 0.0 to turn off gamma correction (1.0 makes no
1876: gamma correction but doesn't actually turn it off). </dd>
1.5 ! raeburn 1877: <dt><b>-DINPUTOK</b> </dt>
! 1878: <dd> To enhance mimeTeX's security, the
! 1879: <a href="#input">\input{ }</a> command is disabled
! 1880: by default when you compile mimeTeX. Note that the
! 1881: <a href="#counter">\counter</a> and
! 1882: <a href="#environment">\environment</a> commands are
! 1883: also disabled by default, and <b>-DINPUTOK</b> enables
! 1884: all three commands simultaneously. (Compile mimeTeX with
! 1885: <b>-DCOUNTEROK</b> to enable only \counter, or with
! 1886: <b>-DENVIRONOK</b> to enable only \environment.) <br>
! 1887: Compiling mimeTeX with the
! 1888: <b>-DINPUTOK</b> switch enables \input{ } for all users,
! 1889: subject only to your <b>-DPATHPREFIX</b> restrictions,
! 1890: discussed below. And the following two switches give you
! 1891: additional control over \input{ }'s usage... </dd>
! 1892: <dt> <b>-DINPUTPATH=\"<i>path</i>\" <i>-or-</i><br>
! 1893: -DINPUTPATH=\"<i>path1,path2,etc</i>\"</b> </dt>
! 1894: <dd> Permits <b>\input{<i>filename</i>}</b> for specific
! 1895: <i>filename</i>'s, even when the \input{ } command
! 1896: is otherwise disabled (for security). <br>
! 1897: If INPUTPATH is defined, mimeTeX
! 1898: performs a case-insensitive test of \input{ }'s
! 1899: <i>filename</i> argument, to verify that it contains
! 1900: the authorized 'path' as a substring. <br>
! 1901: If given several 'path's (second form)
! 1902: then <i>filename</i> must contain either 'path1' or
! 1903: 'path2', or etc, as a (case-insensitive) substring. <br>
! 1904: If <i>filename</i> doesn't contain
! 1905: a substring matching any of these path(s), then mimeTeX emits
! 1906: an error message image instead of reading <i>filename</i>. </dd>
! 1907: <dt> <b>-DINPUTREFERER=\"<i>domain</i>\" <i>-or-</i><br>
! 1908: -DINPUTREFERER=\"<i>domain1,domain2,etc</i>\"</b> </dt>
! 1909: <dd> Permits <b>\input{ }</b> for users from specific
! 1910: <i>domain</i>'s, even when the \input{ } command
! 1911: is otherwise disabled (for security). <br>
! 1912: If INPUTREFERER is defined
! 1913: but INPUTOK is not defined, then mimeTeX
! 1914: performs a case-insensitive test of the user's
! 1915: HTTP_REFERER environment variable, to verify that it contains
! 1916: the authorized 'domain' as a substring. <br>
! 1917: If given several 'domain's (second form)
! 1918: then HTTP_REFERER must contain either 'domain1' or
! 1919: 'domain2', or etc, as a (case-insensitive) substring. <br>
! 1920: If HTTP_REFERER doesn't contain
! 1921: a substring matching any of these domain(s), then mimeTeX renders
! 1922: an error message image instead of reading <i>filename</i>. <br>
! 1923: Finally, if HTTP_REFERER is not found as
! 1924: an environment variable, then mimeTeX renders the
! 1925: same error message image. </dd>
! 1926: <dt><b><a id="newcommands">-DNEWCOMMANDS=\"<i>newcommands.h</i>\"</a>
! 1927: </b> </dt>
1.1 albertel 1928: <dd> LaTeX-like <b>\newcommand</b>'s are available in mimeTeX,
1929: via the following facility to help you define your
1930: own "new commands" during compilation. Edit a file named
1.2 albertel 1931: newcommands.h (or any filename you specify between
1932: <b>\"...\"</b>'s with the <b>-DNEWCOMMANDS=\"<i>filename</i>\"</b>
1933: switch). For newcommands _without_
1.1 albertel 1934: arguments, your file should contain one or more lines
1935: like the following examples:
1936: <pre>{ "\\iint", NULL, "{\\int\\int}" },
1937: { "\\rightleftharpoons",NULL,"{\\rightharpoonup\\atop\\leftharpoondown}" },
1938: { "\\ldots", NULL, "{\\Large.\\hspace1.\\hspace1.}" },
1939: { "\\cr", NULL, "\\\\" },
1940: { "\\neq", NULL, "{\\not=}" },</pre>
1941: For newcommands _without_ arguments, as illustrated above,
1942: the general form of each line in your file should be
1943: <b>{ "\\<i>command</i>", NULL, "{<i>replacement</i>}" },</b>
1944: Don't forget a comma at the end of every line,
1945: and write a double backslash <b>\\</b>
1946: between quotes <b>"...\\..."</b> wherever you actually
1947: want a single backslash <b>\</b>. The only effect
1948: of the above examples (without arguments) is simple string
1949: substitution, i.e., every occurrence of <b>\<i>command</i></b>
1950: is replaced by <b>{<i>replacement</i>}</b>. Note that the
1951: <b>{ }</b>'s surrounding <b><i>replacement</i></b>
1952: aren't required, but are usually a good idea (the case
1953: of <b>\cr</b> illustrated above is one exception, where
1954: <b>{ }</b>'s would defeat the purpose).
1955: <br> To define newcommands _with_ arguments,
1956: change the <b>NULL</b> after the <b>\\<i>command</i></b>
1957: to define your command's arguments as illustrated by the
1958: following example:
1959: <pre>{ "\\lvec", "2n", "#2_1,\\cdots,#2_{#1}" },</pre>
1960: In this case the <b>NULL</b> has been replaced by <b>"2n"</b>
1961: (note the mandatory surrounding quotes <b>"..."</b>). This
1962: example corresponds to the similar one discussed in TLC2 on
1963: page 845. The first character inside the <b>"..."</b>s is
1964: <b>2</b> indicating the number of arguments,
1965: which may be <b>1</b> thru <b>9</b>. If there are no
1966: subsequent characters followng this one, then all arguments are
1967: mandatory, enclosed in <b>{ }</b>'s as usual. Otherwise,
1968: any subsequent characters signal that the first argument
1969: is optional, enclosed in <b>[ ]</b>'s if given. And
1970: these subsequent characters comprise the first argument's
1971: default value if it's not explicitly given. The illustrated
1972: example's first argument is optional with default value
1973: <b>n</b> as shown. In this case that's just a single
1974: character, but you can write any length default you like.
1975: <br> To see many additional examples, search for the
1976: uppercase string NEWCOMMANDS in mimetex.c, and look below that.
1977: All the above examples are already there. </dd>
1.5 ! raeburn 1978: <dt> <b>-DNOREFMAXLEN=<i>n</i></b> </dt>
! 1979: <dd> The environment variable HTTP_REFERER identifies the
! 1980: domain a request originates from. If HTTP_REFERER is not
! 1981: defined, then NOREFMAXLEN is the maximum length query string
! 1982: permitted from unidentified domains. It defaults to 9999,
! 1983: i.e., any query string is permitted, since
! 1984: mail and various other legitimate programs often don't
! 1985: supply an HTTP_REFERER. See -DREFERER and -DREFLEVELS
! 1986: below for further discussion, and also see -DNOREFSAFELEN
! 1987: immediately below. </dd>
! 1988: <dt> <b>-DNOREFSAFELEN=<i>n</i></b> </dt>
! 1989: <dd> If you compile mimeTeX with either the -DREFERER or
! 1990: -DREFLEVELS switch (discussed below), then the default
! 1991: NOREFMAXLEN value 9999 is replaced by the (usually much
! 1992: shorter) NOREFSAFELEN value whose default is 24. </dd>
1.3 albertel 1993: <dt> <b>-DOPAQUE</b> </dt>
1994: <dd> By default, mimeTeX renders gif images with black symbols
1995: on a transparent white background. Defining OPAQUE renders
1996: images on an opaque background instead. </dd>
1.1 albertel 1997: <dt> <b>-DPATHPREFIX=\"<i>path/</i>\"</b> </dt>
1998: <dd> The <a href="#input">\input{ }</a> and
1999: <a href="#counter">\counter{ }</a> commands discussed below
2000: require filename arguments which, by default, point to files
2001: residing in the same cgi-bin/ directory as your mimetex.cgi.
2002: Moreover, for security, absolute paths with leading <b>/</b>'s
2003: or <b>\</b>'s, and paths with <b>../</b>'s or <b>..\</b>'s,
2004: are not permitted. Instead, compile mimetex with PATHPREFIX
2005: defined as <i>path</i><b>/</b> if you want input files in some
2006: other directory. And make sure your <i>path</i><b>/</b> ends
2007: with <b>/</b> (or with <b>\</b> for Windows). </dd>
1.3 albertel 2008: <dt> <b>-DPLUSBLANK <i>-or-</i><br>
2009: -DPLUSNOTBLANK</b> </dt>
2010: <dd> mimeTeX receives your LaTeX math expression as a url
2011: query string, in which blank spaces are often encoded
2012: as <b>%20</b> or as plus signs <b>+</b>, and
2013: where actual plus signs are often encoded as <b>%2B</b>.
2014: But these conventions aren't always respected,
2015: and even when they are blank spaces may be either
2016: <b>%20</b> or <b>+</b>. The only ambiguity for
2017: mimeTeX is whether or not to translate plus signs <b>+</b>
2018: back to blank spaces. <br>
2019: If you know how your applications behave,
2020: then define PLUSBLANK to always translate plus signs <b>+</b>
2021: to blank spaces, or define PLUSNOTBLANK to never translate. <br>
2022: Otherwise, if you define neither,
2023: mimeTeX applies some common-sense rules to decide whether or
2024: not to translate. These usually work, but can't be guaranteed.
2025: If your query string contains actual blank spaces or
2026: blanks encoded as <b>%20</b>, then plus signs <b>+</b>
2027: aren't translated. Otherwise, if your query string
2028: contains <b>%2B</b>, then plus signs <b>+</b> are
2029: translated. If neither <b>%20</b> nor <b>%2B</b>, or both
2030: <b>%20</b> and <b>%2B</b>, occur in your query string,
2031: then the situation is ambiguous. In this case, if mimeTeX
2032: finds two or more plus signs <b>++</b> with no intervening
2033: space, then they're translated; otherwise they're not. </dd>
2034: <dt> <b>-DREFERER=\"<i>domain</i>\" <i>-or-</i><br>
1.1 albertel 2035: -DREFERER=\"<i>domain1,domain2,etc</i>\"</b> </dt>
2036: <dd> Blocks mimeTeX requests from unauthorized domains that
2037: are using your mimetex.cgi (hence your server's resources)
2038: without permission. <br>
1.5 ! raeburn 2039: If compiled with -DREFERER, then mimeTeX
1.1 albertel 2040: performs a case-insensitive test of the environment variable
2041: HTTP_REFERER to verify that it contains the authorized 'domain'
1.5 ! raeburn 2042: as a substring. For example, if -DREFERER=\"\",<br>
1.1 albertel 2043: If given several 'domain's (second form)
2044: then HTTP_REFERER must contain either 'domain1' or
2045: 'domain2', or etc, as a (case-insensitive) substring. <br>
2046: If HTTP_REFERER doesn't contain a substring
1.5 ! raeburn 2047: matching any of these domain(s), then mimeTeX emits the error
! 2048: message image<br>
! 2049: <img src="../cgi-bin/mimetex.cgi?\message{0}"
! 2050: alt="" align="middle" border=0> <br>
! 2051: instead of the requested image. You can manually
! 2052: modify this invalid_referer_msg, which is msgtable[0]
! 2053: defined immediately above function main(),
! 2054: to personalize the error message displayed for your own site. <br>
! 2055: Finally, if you specify <b>-DREFERER</b>
! 2056: (or -DREFLEVELS discussed immediately below) but HTTP_REFERER
! 2057: is not found as an environment variable, then
! 2058: mimeTeX correctly generates images whose QUERY_STRING's
! 2059: contain 24 or fewer characters. For 25 or more
! 2060: characters, mimeTeX generates an error.
! 2061: See -DNOREFMAXLEN and -DNOREFSAFELEN above to change
! 2062: the 24 limit. </dd>
! 2063: <dt><b>-DREFLEVELS=<i>n</i></b> <i>-or-</i><br>
! 2064: <b>-DNOREFCHECK</b> </dt>
! 2065: <dd> Besides <b>-DREFERER</b> discussed immediately above,
! 2066: mimeTeX can block requests from HTTP_REFERER's that
! 2067: don't match your HTTP_HOST, <i>i.e.</i>, from pages on
! 2068: different servers than your mimetex.cgi image. <br>
! 2069: The default value of REFLEVELS is 3,
! 2070: meaning the topmost three levels of HTTP_REFERER and
! 2071: HTTP_HOST must match. For example, phy.cam.ac.uk matches
! 2072: math.cam.ac.uk because they share the same topmost three
! 2073: levels cam.ac.uk. So a page installed at the physics
! 2074: department can use a mimetex.cgi installed at the math
! 2075: department. If you always want a complete match, compile
! 2076: mimeTeX with <b>-DREFLEVELS=99</b> or any large number.
! 2077: If HTTP_REFERER is not found, then the same 24
! 2078: character limit discussed immediately above remains in effect. <br>
! 2079: To completely disable the REFLEVELS check,
! 2080: compile mimeTeX with <b>-DNOREFCHECK</b> (or with
! 2081: <b>-DREFLEVELS=0</b>). Or, if you supply a specific
! 2082: <b>-DREFERER</b> list of authorized domains, as discussed
! 2083: immediately above, then the REFLEVELS check is automatically
! 2084: disabled. </dd>
1.1 albertel 2085: <dt><b>-DSECURITY=<i>n</i></b> </dt>
2086: <dd> This is essentially a "paranoid" setting that defaults
2087: to a high value 999, which inhibits some optional logging
2088: activity. <b>-DCACHEPATH=<i>path</i>/</b> isn't affected,
2089: since you're explicitly supplying a <b><i>path</i>/</b>
2090: you want files written to. But, for example, you must set
2091: <b>-DSECURITY=5</b> (or less) to permit the <b>\counter</b>
2092: command to create a new counter file. A malicious user
2093: could conceivably flood your file system by submitting
2094: zillions of <b>\counter{<i>filename</i>}</b> commands
2095: to mimeTeX, each with a different <b><i>filename</i></b>. </dd>
1.3 albertel 2096: <dt><b>-DSMASHMARGIN=<i>n</i> <i>-or-</i><br>
1.2 albertel 2097: -DNOSMASH</b> </dt>
1.1 albertel 2098: <dd> TeX typically renders an expression like
2099: <b>\frac12\int_{a+b+c}^{d+e+f}g(x)dx</b> as <a href="#preview">
1.2 albertel 2100: <img id="nosmash1" onclick="eqntext('nosmash1')"
2101: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
2102: \nosmash\frac12\int_{a+b+c}^{d+e+f}g(x)dx"
1.1 albertel 2103: alt="" border=0 align=middle></a>. MimeTeX tries to remove extra
2104: whitespace, rendering the same expression as <a href="#preview">
1.2 albertel 2105: <img id="nosmash2" onclick="eqntext('nosmash2')"
2106: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
2107: \smash\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
1.1 albertel 2108: alt="" border=0 align=middle></a> instead.
1.2 albertel 2109: Compile with <b>-DNOSMASH</b> if you prefer the typical TeX
1.1 albertel 2110: behavior as mimeTeX's default. Or, to adjust the minimum
1.2 albertel 2111: number of pixels between smashed symbols (default is 3),
2112: compile with <b>-DSMASHMARGIN=<i>n</i></b>.
2113: See <a href="#smash">Smash</a> for further discussion. </dd>
1.3 albertel 2114: <dt> <b>-DWARNINGS=<i>n</i> <i>-or-</i> <br>
1.1 albertel 2115: -DNOWARNINGS</b> </dt>
2116: <dd> If an expression submitted to mimeTeX contains an
2117: unrecognzied escape sequence, e.g., "y=x+\abc+1", then
2118: mimeTeX generates a gif image containing an embedded
2119: warning in the form "y=x+[\abc?]+1". Or, if an expression
2120: contains an unrecognized character, i.e., one for which mimeTeX
2121: has no corresponding bitmap, then the embedded warning is [?].
2122: If you want these warnings suppressed, either <b>-DWARNINGS=0</b>
2123: or <b>-DNOWARNINGS</b> on the compile line tells mimeTeX to treat
2124: unrecognized/undisplayable input as white space. </dd>
2125: <dt> <b>-DWHITE</b> </dt>
2126: <dd> MimeTeX usually renders black symbols on a white
2127: background. This option renders white symbols on
1.3 albertel 2128: a transparent black background instead (or on an opaque
2129: black background when combined with <b>-DOPAQUE</b> ). </dd>
1.5 ! raeburn 2130:
! 2131: <dt> <a name="adswitches"> </a> <font color="black" size="5">
! 2132: <br> <b>Advertising switches</b><font size=5>...</font></font>
! 2133: <br> </dt>
! 2134: <dd style="margin-left:0em;"> The next three switches
! 2135: set up a mimeTeX web service that embeds advertising messages
! 2136: along with rendered images.
! 2137: <!-- See <a href="#webservice">mimeTeX web service</a>
! 2138: above for further discussion. --> <br> <br> </dd>
! 2139:
! 2140: <dt> <a name="adfrequencyswitch"> </a>
! 2141: <b>–DADFREQUENCY=0</b> </dt>
! 2142: <dd> If ADFREQUENCY is defined as a positive number <b><i>n</i></b>,
! 2143: then one request out of every <b><i>n</i></b> submitted to mimeTeX
! 2144: is randomly selected to be displayed along with a pre-defined
! 2145: "advertisement". For example, if your expression is
! 2146: <b>\large\int_0^xe^{-x^2}dx</b>, then the default
! 2147: advertisement displays <br>
! 2148:
! 2149: <a href="#preview"><img id="adswitch1" onclick="eqntext('adswitch1')"
! 2150: src="../cgi-bin/mimetex.cgi?\large\advertisement
! 2151: \int_0^xe^{-x^2}dx" alt="" align="middle" border=0></a>
! 2152: instead of just
! 2153: <a href="#preview"><img id="adswitch2" onclick="eqntext('adswitch2')"
! 2154: src="../cgi-bin/mimetex.cgi?\large
! 2155: \int_0^xe^{-x^2}dx" alt="" align="middle" border=0></a> <br>
! 2156: See the <b>–DADVERTISEMENT</b> switch <!-- immediately -->
! 2157: below for instructions to define your own advertisement replacing
! 2158: my default. </dd>
! 2159:
! 2160: <dt> <a name="adhostswitch"> </a>
! 2161: <b>–DHOST_SHOWAD=\"\\000\"</b> </dt>
! 2162: <dd> Advertisement messages are usually displayed randomly,
! 2163: in one request to mimeTeX out of every <b><i>n</i></b>,
! 2164: as defined by the <b>–DADFREQUENCY</b> switch above.
! 2165: But if a HOST_SHOWAD string is also defined,
! 2166: then advertisements are only displayed when mimeTeX is running
! 2167: on a host whose HTTP_HOST (or SERVER_NAME) environment variable
! 2168: contains that string. For example,
! 2169: <b>–DHOST_SHOWAD=\"mathsite\"</b> displays advertisements
! 2170: on www.mathsite.com but never on www.mathhouse.com .
! 2171: The default HOST_SHOWAD value is an empty string,
! 2172: which displays advertisements on any host. </dd>
! 2173:
! 2174: <dt> <a name="advertisementswitch"> </a>
! 2175: <b>–DADVERTISEMENT=\"</b><i>filename</i><b>\"</b> </dt>
! 2176: <dd> To define your own advertisement, replacing my default
! 2177: illustrated immediately above, edit a file containing lines
! 2178: of the form <br>
! 2179: <nobr> <b>"\\</b>begin{gather}{\\small\\text<b>"</b></nobr><br>
! 2180: <nobr> <b>"</b>{\\fbox{\\begin{gather}<b>"</b></nobr><br>
! 2181: <nobr> <b>"</b>mime\\TeX rendering courtesy of\\\\<b>"</b></nobr><br>
! 2182: <nobr> <b>"</b>http://www.forkosh.com/mimetex.html \\end{gather}}}\\\\<b>"</b></nobr><br>
! 2183: <nobr> <b>"</b> %%expression%%<b>"</b></nobr><br>
! 2184: <nobr> <b>"\\</b>end{gather}<b>"</b></nobr><br>
! 2185: Every line in your file must be enclosed in <b>"</b>quotes<b>"</b>,
! 2186: and all backslashes written as double-backslashes <b>\\</b>.
! 2187: Note <b>\\\\</b> at the end of the third and fourth lines,
! 2188: which LaTeX sees as <b>\\</b>. The entire example shows how my
! 2189: default advertisement is defined. <br>
! 2190: Your advertisement may consist of any valid
! 2191: mimeTeX commands you like. But it must somewhere contain the line <br>
! 2192: <nobr> <b>"</b> %%expression%% <b>"</b></nobr><br>
! 2193: which is replaced by the user's expression. <br>
! 2194: Once mimeTeX is compiled with your advertisement,
! 2195: test it by submitting an expression like
! 2196: <b>\advertisement x^2+y^2</b> containing the special
! 2197: mimeTeX \advertisement directive, which forces that
! 2198: expression to be rendered with your advertisement. In this case
! 2199: (and with my default advertisement message) we see <br>
! 2200:
! 2201: <a href="#preview"><img id="adswitch3" onclick="eqntext('adswitch3')"
! 2202: src="../cgi-bin/mimetex.cgi?\advertisement x^2+y^2"
! 2203: alt="" align="middle" border=0></a> instead of
! 2204: just
! 2205: <a href="#preview"><img id="adswitch4" onclick="eqntext('adswitch4')"
! 2206: src="../cgi-bin/mimetex.cgi?x^2+y^2" alt="" border=0></a> <br>
! 2207: regardless of your ADFREQUENCY value. </dd>
1.1 albertel 2208: </dl>
2209:
2210:
1.2 albertel 2211: <h2> <a name="cmdline"> (IId) Command Line Features </a> </h2>
1.1 albertel 2212:
2213: <p> MimeTeX usually runs from a browser, obtaining its input expression
2214: from a query_string. But you can also run mimeTeX from your Unix
2215: shell, supplying all input from the command line. This was briefly
2216: illustrated above, where you were advised to test your newly-compiled
2217: mimeTeX executable from the command line before installing it. </p>
2218:
2219: <p> In addition to such simple testing, mimeTeX also provides some
2220: possibly useful functionality from the command line. In particular,
2221: you can store a gif (or xbitmap) image of any expression to a file.
2222: No syntax checking is applied to command-line arguments, so enter
1.3 albertel 2223: them carefully. (Likewise, plus signs <b>+</b> are never
2224: translated to blank spaces, nor is any other <b>%xx</b> url decoding
2225: performed on command-line arguments.) </p>
1.1 albertel 2226:
2227: <p> The complete command-line syntax for mimeTeX is </p>
2228: <pre>
2229: ./mimetex [ -d ] dump gif image on stdout,
2230: [ -e export_file ] or write gif image to export_file
2231: [ expression expression, e.g., "x^2+y^2",
2232: | -f input_file ] or read expression from input_file
1.2 albertel 2233: [ -g1 -d ] dump .pbm-formatted image on stdout
2234: [ -g1 -e export_file ] or write .pbm image to export_file
2235: [ -g2 -d ] dump anti-aliased .pgm image on stdout
2236: [ -g2 -e export_file ] or write .pgm image to export_file
1.1 albertel 2237: [ -m msglevel ] verbosity of debugging output
2238: [ -o ] render image with opaque background
2239: [ -s fontsize ] default fontsize, 0-5
2240:
2241: -d Rather than printing ascii debugging output, mimeTeX
2242: dumps the actual gif (or xbitmap) to stdout, e.g.,
2243: ./mimetex -d "x^2+y^2" > expression.gif
2244: creates expression.gif containing an image of x^2+y^2
2245:
1.2 albertel 2246: -e export_file Like -d but writes the actual gif
2247: (or xbitmap) directly to export_file, e.g.,
1.1 albertel 2248: ./mimetex -e expression.gif "x^2+y^2"
1.2 albertel 2249: creates file expression.gif containing an image of x^2+y^2
1.1 albertel 2250:
2251: expression Place LaTeX expression directly on command
2252: line, with no -switch preceding it, as in the example
1.2 albertel 2253: immediately above, or.....
1.1 albertel 2254:
1.2 albertel 2255: -f input_file .....read expression from input_file
2256: (and automatically assume -d switch). The input_file
2257: may contain the expression on one line or spread out
2258: over many lines. MimeTeX will concatanate all lines
2259: from input_file to construct one long expression.
2260: Blanks, tabs, and newlines are just ignored.
2261:
2262: -g1 -d dumps a .pbm-formatted portable bitmap image to stdout.
2263: Note that this is the bitmap image _before_ anti-aliasing.
2264:
2265: -g1 -e export_file Like -g1 -d but writes the .pbm-formatted
2266: portable bitmap directly to export_file, e.g.,
2267: ./mimetex -g1 -e expression.pbm "x^2+y^2"
2268: creates file expression.pbm containing a bitmap image
2269: of x^2+y^2 before anti-aliasing.
2270:
2271: -g2 -d dumps a .pgm-formatted portable graphic image to stdout.
2272: Note that this is the bytemap image _after_ anti-aliasing.
2273:
2274: -g2 -e export_file Like -g2 -d but writes the .pgm-formatted
2275: portable graphic image directly to export_file, e.g.,
2276: ./mimetex -g3 -e expression.pgm "x^2+y^2"
2277: creates file expression.pgm containing a bytemap image
2278: of x^2+y^2 after anti-aliasing.
1.1 albertel 2279:
1.2 albertel 2280: -m msglevel 0-99, controls verbosity/message level for
2281: debugging output (usually used only while testing code).
1.1 albertel 2282:
2283: -o Rather than the default transparent gif background,
2284: the rendered image will contain black symbols on an
2285: opaque white background (or vice versa if compiled
2286: with -DWHITE). For example, if you have ImageMagick's
2287: display utility,
2288: ./mimetex -o -d "x^2+y^2" | display &
2289: opens a small window containing the rendered expression.
1.3 albertel 2290: (Note: if you already compiled mimeTeX with -DOPAQUE
2291: then -o renders images on a transparent background.)
1.1 albertel 2292:
1.2 albertel 2293: -s fontsize 0-7, font size. Font size can also be specified
2294: within the expression by a directive, e.g., \Large f(x)=x^2
2295: displays f(x)=x^2 at font size 4, overriding -s.
2296: Default font size is 3.
1.1 albertel 2297: </pre>
2298:
2299:
2300:
2301: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2302: SECTION III. SYNTAX REFERENCE
2303: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
2304: <h1> <a name="reference"> (III) Syntax Reference </a> </h1>
2305:
2306: <p> Since mimeTeX's syntax is as TeX-like as possible, we'll mostly discuss
1.2 albertel 2307: the occasional differences.
2308: <!-- (which exist only to simplify my programming
2309: task, not to impose any syntactic aesthetics of mine on you). -->
2310: This section contains short paragraphs that each discuss some aspect
2311: of mimeTeX where your LaTeX experience might not be precisely
2312: duplicated. </p>
1.1 albertel 2313:
2314: <p> Anything not discussed here that still doesn't behave like you expect
2315: is probably just not implemented. That includes (La)TeX packages
2316: (though a few ams commands like \begin{gather} and \begin{pmatrix}
2317: are recognized), non-standard fonts, etc. You can try out any
2318: questionable syntax by <a href="#forminput">Submit</a>ting a query
2319: to quickly see whether or not it works. And you might want to
2320: occasionally re-browse the <a href="#examples">Examples</a> above,
2321: which may better illustrate implemented features. </p>
2322:
2323:
2324: <h2> <a name="spaces"> (IIIa) \unitlength{ }, Math Spaces and Whitespace
2325: </a> </h2>
2326:
2327: <h3> <a name="unitlength">\unitlength<font size=5>...</font></a> </h3>
2328:
2329: <p> Lengths in mimeTeX are all ultimately expressed in number of pixels.
2330: Various commands discussed below require length arguments, including </p>
2331: <ul>
2332: <li> <a href="#mathspace">\hspace{ }</a> </li>
2333: <li> <a href="#mathspace">\hfill{ }</a> </li>
2334: <li> <a href="#raiserotate">\raisebox{ }{ }</a> </li>
2335: <li> <a href="#circleline">\line( , )</a> and
2336: <a href="#circleline">\circle( , )</a> </li>
2337: <li> <a href="#arrows">\longrightarrow[ ]</a> </li>
2338: </ul> <p class="continue">
2339: (the \long<i>xxx</i>arrow [ ]-arguments are optional mimeTeX
2340: extensions to LaTeX) MimeTeX's length-type arguments never
2341: take units, e.g., {10pt} and {1cm} are both invalid. Lengths always
2342: refer to number of pixels, optionally scaled by a user-specified
2343: <b>\unitlength</b>. </p>
2344:
2345: <p> MimeTeX's <b>\unitlength{ }</b> command lets you specify
2346: the number of pixels per "length unit", e.g.,
2347: <b>\unitlength{10} \hspace{2.5}</b> renders a 25-pixel space.
2348: Both <b>\unitlength{ }</b> and <b>\hspace{ }</b>'s
2349: length arguments may be integers or may contain decimal points.
2350: Ditto for all other mimeTeX commands that take length arguments.
2351: The default <b>\unitlength</b> is, you guessed it, <b>1</b>. </p>
2352:
2353: <p> A specified <b>\unitlength</b> applies to all subsequent terms,
2354: i.e., everything to its right. And several <b>\unitlength</b>'s
2355: may be specified in the same expression, each one overriding
2356: those to its left. But if one or more <b>\unitlength</b>'s
2357: appear within a <b>{ }</b>-enclosed subexpression, then terms
2358: following its closing right <b>}</b> revert to the <b>\unitlength</b>
2359: in effect before its opening left <b>{</b>. For example, </p> <center>
2360: <b>A\hspace{10} {\unitlength{2.5}B\hspace{10}C} \hspace{10}D</b>
2361: produces
2362: <a href="#preview"><img id="unitlength1" onclick="eqntext('unitlength1')"
2363: src="../cgi-bin/mimetex.cgi?\large A\hspace{10}
2364: {\unitlength{2.5}B\hspace{10}C}\hspace{10}D"
2365: alt="" border=0 align=middle></a> </center> <p class="continue">
2366: which has a 10-pixel space between <b>A</b> and <b>B</b>, then
2367: 25 pixels between <b>B</b> and <b>C</b>, and finally
2368: another 10 pixels between <b>C</b> and <b>D</b>. </p>
2369:
2370: <h3> <a name="mathspace">Math Spaces<font size=5>...</font></a> </h3>
2371:
2372: <p> Except inside <a href="#textboxes">text boxes</a>,
2373: unescaped blanks, tildes (a <b>~</b>), and all other usual
2374: <a href="#whitespace">whitespace</a> characters are completely
2375: ignored by mimeTeX, just like they are in LaTeX math mode.
2376: As usual, you must explicitly write one of the recognized math
2377: spaces to put extra visible space in your rendered expressions. </p>
2378:
1.3 albertel 2379: <p> MimeTeX recognizes math spaces <b>\/ \, \: \;</b>
2380: as well as <b>\quad</b> and <b>\qquad</b> ,
2381: and also a backslashed blank
2382: <img src="../cgi-bin/mimetex.cgi?1$\backsl\raise{-5}{\rotate{-90}]}"
2383: alt="" border=0 align=middle>
2384: (i.e., a <b>\</b> followed by a blank).
2385: For example,
2386: <b>(a\/b\,c\:d\;e\ f\quad g\qquad h)</b>
2387:   renders
2388: <a href="#preview"><img id="spacing2" onclick="eqntext('spacing2')"
2389: src="../cgi-bin/mimetex.cgi?(a\/b\,c\:d\;e\ f\quad g\qquad h)"
2390: alt="" border=0 align="middle"></a>.
2391: In mimeTeX, you may also write <b>\hspace{10}</b>
2392: to insert a 10-pixel (or any other number) space, scaled by any
2393: preceding <a href="#unitlength">\unitlength</a>, as illustrated
2394: just above. </p>
2395:
2396: <p> For negative spaces, <b>\!</b> produces a small (two
2397: pixel) negative space, e.g., <b>a=b</b> renders
2398: <img src="../cgi-bin/mimetex.cgi?a=b"alt="" border=0 align="bottom">
2399: whereas <b>a\!=b</b> renders
2400: <img src="../cgi-bin/mimetex.cgi?a\!=b"alt="" border=0 align="bottom">
2401: and <b>a\!\!=b</b> renders
2402: <img src="../cgi-bin/mimetex.cgi?a\!\!=b"alt="" border=0 align="bottom">.
2403: For large negative space, <b>\hspace{-10}</b> permits
2404: a negative argument. But it stops at the first pixel to its left
2405: rather than "erasing" pixels. If you don't want to stop, use
2406: <b>\hspace*{-10}</b> instead. For example,
2407: <b>ABC\hspace*{-20}-DEF</b> renders
2408: <img src="../cgi-bin/mimetex.cgi?ABC\hspace*{-20}-DEF"
2409: alt="" border=0 align="bottom">, erasing all of the <b>C</b>
2410: and the right half of the <b>B</b>. </p>
1.1 albertel 2411:
1.3 albertel 2412: <!--
1.1 albertel 2413: <p> Although some browsers occasionally misinterpret typed blank spaces
2414: inside html query_string's, mimeTeX also recognizes escaped blanks
1.2 albertel 2415: <img src="../cgi-bin/mimetex.cgi?\small\backsl\raise{-5}{\rotate{-90}]}"
1.1 albertel 2416: alt="" border=0 align=middle> (a <b>\</b> followed by a blank) as math
2417: spaces, just in case you can safely use them. </p>
1.3 albertel 2418: -->
1.1 albertel 2419:
2420: <p> MimeTeX also supports <b>\hfill{<i>textwidth</i>}</b>, where
2421: <b><i>textwidth</i></b> is roughly equivalent to LaTeX's
2422: <b>\textwidth</b>, i.e., it's the total number of pixels, scaled by
2423: <a href="#unitlength">\unitlength</a>, that your entire rendered
2424: expression will span. However, if <b>\hfill{ }</b> appears
2425: within a <b>{ }</b>-enclosed subexpression, then it applies
2426: only to that subexpression. For example, </p> <center>
1.3 albertel 2427: <b>{abc \hfill{75} def} \hfill{150} ghi</b>
1.1 albertel 2428: produces
2429: <a href="#preview"><img id="mathspace1" onclick="eqntext('mathspace1')"
1.3 albertel 2430: src="../cgi-bin/mimetex.cgi?\large{abc\hfill{75}def}\hfill{150}ghi"
1.1 albertel 2431: alt="" border=0 align=middle></a> </center> <p class="continue">
1.3 albertel 2432: The first/inner <b>\hfill{75}</b> inserts exactly enough whitespace so
2433: that subexpression "<b><i>abc def</i></b>" spans 75 pixels.
2434: Then the second/outer <b>\hfill{150}</b> inserts exactly enough
2435: whitespace so that the entire expression spans 150 pixels.
1.1 albertel 2436: Without explicit <b>{ }</b>-nesting, mimeTeX evaluates expressions
1.3 albertel 2437: left-to-right (sinistrally), e.g., <b>...\hfill{150}...\hfill{75}...</b>
2438: is exactly equivalent to <b>...\hfill{150}{...\hfill{75}...}</b>.
1.1 albertel 2439: Notice that, this time, the second/right <b><i>textwidth</i></b>
2440: argument is necessarily smaller than the first/left. </p>
2441:
2442: <p> Finally, mimeTeX begins a new line whenever you write <b>\\</b> .
2443: And you may optionally write <b>\\[10]</b> to put a 10-pixel (or any
2444: other number) vertical space, scaled by
2445: <a href="#unitlength">\unitlength</a>, between lines.
2446: <a href="#array">\begin{eqnarray}</a> also splits long
2447: equations over several lines, as illustrated by
2448: <a href="#example10">Example 10</a> above.
2449: But when that's not the best solution, you can also write,
2450: for example, </p> <center>
2451: <b>y=a+b+c+d\\\hspace{50}+e+f+g+h</b>
2452: to produce
2453: <a href="#preview"><img id="mathspace2" onclick="eqntext('mathspace2')"
1.2 albertel 2454: src="../cgi-bin/mimetex.cgi?\large y=a+b+c+d\\\hspace{50}+e+f+g+h"
1.1 albertel 2455: alt="" border=0 align=middle></a> </center>
2456:
2457: <p> However, mimeTeX can't correctly handle automatically-sized delimiters
2458: across linebreaks, e.g., </p> <center>
2459: <b>y=\left\{a+b+c+d\\\hspace{50}+e+f+g+h\right\}</b>
2460: produces
2461: <a href="#preview"><img id="mathspace3" onclick="eqntext('mathspace3')"
1.2 albertel 2462: src="../cgi-bin/mimetex.cgi?\large y=\{a+b+c+d\\
2463: \hspace{50}+e+f+g+h\}" alt="" border=0 align=middle></a> <br>
1.1 albertel 2464: whereas you probably wanted
2465: <a href="#preview"><img id="mathspace4" onclick="eqntext('mathspace4')"
1.2 albertel 2466: src="../cgi-bin/mimetex.cgi?\large y=\big{a+b+c+d\\
2467: \hspace{50}+e+f+g+h\big}" alt="" border=0 align=middle></a>
2468: </center> <p class="continue">
1.1 albertel 2469: which I produced using <b>\big{...\\...\big}</b> instead
2470: of <b>\left\{...\\...\right\}</b>. Expressions of the
2471: form <b>\left...\right \\ \left...\right</b> should all be
2472: rendered properly. It's only <b>\left...\\...\right</b> that will
2473: look odd. </p>
2474:
2475: <h3> <a name="whitespace">Whitespace, Comments,
2476: and some other characters<font size=5>...</font></a> </h3>
2477:
2478: <p> Some browsers occasionally misinterpret typed blank spaces
2479: inside html query_string's. In that case, you can write
2480: tildes (a <b>~</b>) wherever blanks are required or desired,
2481: e.g., <b>\alpha~w</b> instead of <b>\alpha w</b>, or
2482: <b>\frac~xy</b> or <b>\sqrt~z</b>, etc. MimeTeX correctly
2483: interprets both blanks and <b>~</b>'s, and all
2484: other usual whitespace characters. So use whatever's convenient
2485: as long as it's correctly interpreted inside query_string's by your
2486: browser. </p>
2487:
2488: <p> Similarly, some browsers occasionally misinterpret linebreaks/newlines
2489: inside the middle of long html query_string's.
2490: For example, </p>
2491: <pre><img src="../cgi-bin/mimetex.cgi?f(x)=\frac1{\sigma\sqrt{2\pi}}
2492: \int\limits_{-\infty}^xe^{-\frac{(t-\mu)^2}{2\sig^2}}dt"
2493: alt="" border=0 align=middle> </pre><p class="continue">
2494: breaks a long query_string over two lines. If your browser interprets
2495: this correctly, then mimeTeX will render it correctly, too. Otherwise,
2496: you'll have to enter long expressions on one big long line. </p>
2497:
2498: <p> If you can break long query_string's over several lines, then you may
2499: find mimeTeX's <b>%%comments%%</b> feature useful, too. Note that
2500: comments must be preceded <i>and followed</i> by two <b>%</b>'s
2501: rather than LaTeX's usual one. The above example could be written </p>
2502: <pre><img src="../cgi-bin/mimetex.cgi?f(x)=\frac1{\sigma\sqrt{2\pi}} %%normalization%%
2503: \int\limits_{-\infty}^xe^{-\frac{(t-\mu)^2}{2\sig^2}}dt %%integral%%"
2504: alt="" border=0 align=middle> </pre>
2505:
2506: <p> Besides whitespace, browsers may misinterpret embedded apostrophes,
2507: and especially quotes, within query strings. The <b>a's</b> and
2508: <b>b's</b> in <a href="#example7">Example 7</a> above actually use
2509: superscripted commas for apostrophes, i.e., <b>a^,s</b> and <b>b^,s</b>,
2510: and you can also use LaTeX <b>\prime</b>'s, as in <b>a^\prime s</b>.
2511: For quotes, you can use <b>^{,,}</b> since <b>"</b> almost certainly
2512: won't work. To help make things easier, in addition to the usual
2513: LaTeX <b>\prime</b>, mimeTeX also recognizes <b>\apostrophe</b> and
2514: <b>\quote</b> and <b>\percent</b>, all with the obvious meanings. </p>
2515:
2516:
2517: <h2> <a name="symbols"> (IIIb) Math Symbols, Sizes, and Modes </a></h2>
2518:
2519: <h3> <a name="characters">Character Sets<font size=5>...</font></a> </h3>
2520:
1.5 ! raeburn 2521: <p> The <a href="http://www.ctan.org/tex-archive/info/symbols/comprehensive/"
! 2522: target="_top"> Comprehensive LaTeX Symbol List </a>
! 2523: illustrates some 6,000 symbols supported by LaTeX. For complete
! 2524: information about the subset of these characters and math symbols
1.1 albertel 2525: available in mimeTeX, you'll need to browse through the bottom
1.5 ! raeburn 2526: 1500-or-so lines of <b>mimetex.h</b>. And several additional
1.1 albertel 2527: symbols like <b>\ldots</b> and <b>\AA</b> and <b>\hbar</b> are
2528: defined by the mimeTeX preprocessor, function <b>mimeprep( )</b>
1.5 ! raeburn 2529: in <b>mimetex.c</b> <br>
! 2530:
! 2531: I haven't exhaustively checked all the name-number matchings for
! 2532: the thousand-or-so symbols in mimetex.h. You can eaily correct
! 2533: any minor mistake you find in what I hope is an obvious manner.
! 2534: The fonts <a href="#fonts">Appendix IVa</a> below provides
! 2535: additional information. </p>
! 2536:
! 2537: <p> Generally speaking, I've tried to
1.2 albertel 2538: encode the cmr10, cmmi10, cmmib10, cmsy10, cmex10, bbold10, rsfs10,
1.3 albertel 2539: stmary10 and wncyr10 families with "names", e.g., <b>\alpha \beta
1.2 albertel 2540: \forall \sqcup</b>, etc, identical to your LaTeX expectations.
2541: For example, the calligraphic symbols in cmsy10 are accessed by
2542: writing <b>\mathcal{A} \mathcal{B} \mathcal{XYZ}</b>. Similarly,
2543: write <b>\mathbf{A}</b> for the cmmib fonts, write <b>\mathscr{A}</b>
1.3 albertel 2544: for rsfs10, write <b>\mathbb{R}</b> for bbold10, and write
2545: <b>{\cyr Khrushchev}</b> or <b>\cyr{Khrushchev}</b> to see
2546: <a href="#preview"><img id="cyrillic1" onclick="eqntext('cyrillic1')"
2547: src="../cgi-bin/mimetex.cgi?\large\cyr Khrushchev"
1.5 ! raeburn 2548: alt="" border=0 align="middle"></a>.
1.3 albertel 2549: Most LaTeX distributions supply stmaryrd.dvi and stmaryrd.sty
2550: that both document the names of the stmary10 symbols.
2551: Similarly, amsfndoc.dvi documents the names of the wncyr10
2552: cyrillic symbols and ligatures. </p>
1.5 ! raeburn 2553:
1.1 albertel 2554: <!-- But there are various additions and omissions and exceptions
2555: vis-a-vis LaTeX. For example, </p>
2556: <ul>
2557: <li> "Large" operators like \int are often also available as
2558: \Bigint, and similarly for \sum \prod \cup \cap, etc.
2559: If you find a \Bigxxx in mimetex.h then you'll also find the
2560: corresponding \xxx. \Bigxxx operators are somewhat larger
2561: than their \xxx counterparts, and they automatically render
2562: super/subscripts in <a href="#modes">displaystyle</a>. </li>
2563: </ul> -->
1.5 ! raeburn 2564:
1.1 albertel 2565:
2566: <p> In addition to extra LaTeX symbols like <b>\ldots</b>, <b>\AA</b>
2567: and <b>\hbar</b>, mentioned above, the mimeTeX preprocessor
2568: <b>mimeprep( )</b> also recognizes various html special
2569: characters like <b>&lt;</b>, <b>&gt;</b>, <b>&nbsp;</b>,
2570: <b>&quot;</b>, <b>&amp;</b>, etc. Some web tools apparently
2571: translate characters like, e.g., <b>></b> to <b>&gt;</b>,
2572: even inside quoted query_string's, so mimeTeX's preprocessor
1.3 albertel 2573: translates them back to LaTeX symbols for you. Moreover, html
2574: misinterprets quotes <b>"</b> inside a quoted
2575: query string as the end of the query string. So, for example,
2576: the cyrillic ligature <b>\"E</b> has to be written in the
2577: even more cumbersome form <b>\&quot;E</b> inside a query
2578: string. </p>
1.1 albertel 2579:
1.5 ! raeburn 2580: <p> Illustrated below are some of the character sets and math symbols
! 2581: supported by mimeTeX, starting with several roman character fonts.
! 2582: The blackboard bold font contains many characters besides
! 2583: <b>a-z,A-Z</b>. Calligraphic and script fonts contain
! 2584: uppercase <b>A-Z</b> only. </p>
! 2585:
! 2586: <center><a href="#preview"><img id="roman8" onclick="eqntext('roman8')"
! 2587: src="../cgi-bin/mimetex.cgi?\large
! 2588: \begin{array}{|c+57|c|c|c0|c|c|c|c|c| C25 C+15} \hline
! 2589: \large \textrm{a-z} & \small \backslash\textrm{text} &
! 2590: \small \backslash\textrm{mathbb} & &
! 2591: \large \textrm{A-Z} & \small \backslash\textrm{text} &
! 2592: \small \backslash\textrm{mathbb} & \small \backslash\textrm{mathcal} &
! 2593: \small \backslash\textrm{mathscr} \\ \hline
! 2594: a&\text{a}&\mathbb{a}& &A&\text{A}&\mathbb{A}&\mathcal{A}&\mathscr{A}\\
! 2595: b&\text{b}&\mathbb{b}& &B&\text{B}&\mathbb{B}&\mathcal{B}&\mathscr{B}\\
! 2596: c&\text{c}&\mathbb{c}& &C&\text{C}&\mathbb{C}&\mathcal{C}&\mathscr{C}\\
! 2597: d&\text{d}&\mathbb{d}& &D&\text{D}&\mathbb{D}&\mathcal{D}&\mathscr{D}\\
! 2598: e&\text{e}&\mathbb{e}& &E&\text{E}&\mathbb{E}&\mathcal{E}&\mathscr{E}\\
! 2599: f&\text{f}&\mathbb{f}& &F&\text{F}&\mathbb{F}&\mathcal{F}&\mathscr{F}\\
! 2600: g&\text{g}&\mathbb{g}& &G&\text{G}&\mathbb{G}&\mathcal{G}&\mathscr{G}\\
! 2601: h&\text{h}&\mathbb{h}& &H&\text{H}&\mathbb{H}&\mathcal{H}&\mathscr{H}\\
! 2602: i&\text{i}&\mathbb{i}& &I&\text{I}&\mathbb{I}&\mathcal{I}&\mathscr{I}\\
! 2603: j&\text{j}&\mathbb{j}& &J&\text{J}&\mathbb{J}&\mathcal{J}&\mathscr{J}\\
! 2604: k&\text{k}&\mathbb{k}& &K&\text{K}&\mathbb{K}&\mathcal{K}&\mathscr{K}\\
! 2605: l&\text{l}&\mathbb{l}& &L&\text{L}&\mathbb{L}&\mathcal{L}&\mathscr{L}\\
! 2606: m&\text{m}&\mathbb{m}& &M&\text{M}&\mathbb{M}&\mathcal{M}&\mathscr{M}\\
! 2607: n&\text{n}&\mathbb{n}& &N&\text{N}&\mathbb{N}&\mathcal{N}&\mathscr{N}\\
! 2608: o&\text{o}&\mathbb{o}& &O&\text{O}&\mathbb{O}&\mathcal{O}&\mathscr{O}\\
! 2609: p&\text{p}&\mathbb{p}& &P&\text{P}&\mathbb{P}&\mathcal{P}&\mathscr{P}\\
! 2610: q&\text{q}&\mathbb{q}& &Q&\text{Q}&\mathbb{Q}&\mathcal{Q}&\mathscr{Q}\\
! 2611: r&\text{r}&\mathbb{r}& &R&\text{R}&\mathbb{R}&\mathcal{R}&\mathscr{R}\\
! 2612: s&\text{s}&\mathbb{s}& &S&\text{S}&\mathbb{S}&\mathcal{S}&\mathscr{S}\\
! 2613: t&\text{t}&\mathbb{t}& &T&\text{T}&\mathbb{T}&\mathcal{T}&\mathscr{T}\\
! 2614: u&\text{u}&\mathbb{u}& &U&\text{U}&\mathbb{U}&\mathcal{U}&\mathscr{U}\\
! 2615: v&\text{v}&\mathbb{v}& &V&\text{V}&\mathbb{V}&\mathcal{V}&\mathscr{V}\\
! 2616: w&\text{w}&\mathbb{w}& &W&\text{W}&\mathbb{W}&\mathcal{W}&\mathscr{W}\\
! 2617: x&\text{x}&\mathbb{x}& &X&\text{X}&\mathbb{X}&\mathcal{X}&\mathscr{X}\\
! 2618: y&\text{y}&\mathbb{y}& &Y&\text{Y}&\mathbb{Y}&\mathcal{Y}&\mathscr{Y}\\
! 2619: z&\text{z}&\mathbb{z}& &Z&\text{Z}&\mathbb{Z}&\mathcal{Z}&\mathscr{Z}\\
! 2620: \hline \end{array}"
! 2621: alt="" border=0 align="middle"></a></center>
! 2622:
! 2623: <p> Characters from the Greek alphabet supported by mimeTeX,
! 2624: along with <b>\mathbb{ }</b> versions, are
! 2625: illustrated next. For example, <b>\mathbb{\lambda}</b>
! 2626: renders
! 2627: <a href="#preview"><img id="bblambda" onclick="eqntext('bblambda')"
! 2628: src="../cgi-bin/mimetex.cgi?\large\mathbb{\lambda}"
! 2629: alt="" border=0 align="bottom"></a>. </p>
! 2630:
! 2631: <center><a href="#preview"><img id="greek2" onclick="eqntext('greek2')"
! 2632: src="../cgi-bin/mimetex.cgi?\large
! 2633: \begin{array}{|l98c28c28|l98c28c28|l98c28c28|}
! 2634: \hline \; \\
! 2635: \hspace{10}\backslash\textrm{Gamma} & \Gamma & \mathbb{\Gamma} &
! 2636: \hspace{10}\backslash\textrm{Delta} & \Delta & \mathbb{\Delta} &
! 2637: \hspace{10}\backslash\textrm{Theta} & \Theta & \mathbb{\Theta} \\
! 2638: \hspace{10}\backslash\textrm{Lambda} & \Lambda & \mathbb{\Lambda} &
! 2639: \hspace{10}\backslash\textrm{Xi} & \Xi & \mathbb{\Xi} &
! 2640: \hspace{10}\backslash\textrm{Pi} & \Pi & \mathbb{\Pi} \\
! 2641: \hspace{10}\backslash\textrm{Sigma} & \Sigma & \mathbb{\Sigma} &
! 2642: \hspace{10}\backslash\textrm{Upsilon} & \Upsilon & \mathbb{\Upsilon}&
! 2643: \hspace{10}\backslash\textrm{Phi} & \Phi & \mathbb{\Phi} \\
! 2644: \hspace{10}\backslash\textrm{Psi} & \Psi & \mathbb{\Psi} &
! 2645: \hspace{10}\backslash\textrm{Omega} & \Omega & \mathbb{\Omega} \\
! 2646: \; \\ \hline \; \\
! 2647: \hspace{10}\backslash\textrm{alpha} & \alpha & \mathbb{\alpha} &
! 2648: \hspace{10}\backslash\textrm{beta} & \beta & \mathbb{\beta} &
! 2649: \hspace{10}\backslash\textrm{gamma} & \gamma & \mathbb{\gamma} \\
! 2650: \hspace{10}\backslash\textrm{delta} & \delta & \mathbb{\delta} &
! 2651: \hspace{10}\backslash\textrm{epsilon} & \epsilon & \mathbb{\epsilon}&
! 2652: \hspace{10}\backslash\textrm{zeta} & \zeta & \mathbb{\zeta} \\
! 2653: \hspace{10}\backslash\textrm{eta} & \eta & \mathbb{\eta} &
! 2654: \hspace{10}\backslash\textrm{theta} & \theta & \mathbb{\theta} &
! 2655: \hspace{10}\backslash\textrm{iota} & \iota & \mathbb{\iota} \\
! 2656: \hspace{10}\backslash\textrm{kappa} & \kappa & \mathbb{\kappa} &
! 2657: \hspace{10}\backslash\textrm{lambda} & \lambda & \mathbb{\lambda} &
! 2658: \hspace{10}\backslash\textrm{mu} & \mu & \mathbb{\mu} \\
! 2659: \hspace{10}\backslash\textrm{nu} & \nu & \mathbb{\nu} &
! 2660: \hspace{10}\backslash\textrm{xi} & \xi & \mathbb{\xi} &
! 2661: \hspace{10}\backslash\textrm{pi} & \pi & \mathbb{\pi} \\
! 2662: \hspace{10}\backslash\textrm{rho} & \rho & \mathbb{\rho} &
! 2663: \hspace{10}\backslash\textrm{sigma} & \sigma & \mathbb{\sigma} &
! 2664: \hspace{10}\backslash\textrm{tau} & \tau & \mathbb{\tau} \\
! 2665: \hspace{10}\backslash\textrm{upsilon} & \upsilon & \mathbb{\upsilon}&
! 2666: \hspace{10}\backslash\textrm{phi} & \phi & \mathbb{\phi} &
! 2667: \hspace{10}\backslash\textrm{chi} & \chi & \mathbb{\chi} \\
! 2668: \hspace{10}\backslash\textrm{psi} & \psi & \mathbb{\psi} &
! 2669: \hspace{10}\backslash\textrm{omega} & \omega & \mathbb{\omega} \\
! 2670: \; \\ \hline \; \\
! 2671: \hspace{10}\backslash\textrm{varepsilon} & \varepsilon & &
! 2672: \hspace{10}\backslash\textrm{vartheta} & \vartheta & &
! 2673: \hspace{10}\backslash\textrm{varpi} & \varpi & \\
! 2674: \hspace{10}\backslash\textrm{varrho} & \varrho & &
! 2675: \hspace{10}\backslash\textrm{varsigma} & \varsigma & &
! 2676: \hspace{10}\backslash\textrm{varphi} & \varphi & \\
! 2677: \; \\ \hline
! 2678: \end{array}"
! 2679: alt="" border=0 align="middle"></a></center>
! 2680:
! 2681: <p> Finally, some of the math symbols supported by mimeTeX are illustrated
! 2682: below. Operators shown in two sizes are automatically
! 2683: "promoted" to the larger size in   <b>\displaystyle</b>
! 2684: mode. For example,
! 2685: <b>f(x)=\int_{-\infty}^x e^{-t^2}dt</b> renders
! 2686: <a href="#preview"><img id="mathsy1" onclick="eqntext('mathsy1')"
! 2687: src="../cgi-bin/mimetex.cgi?\textstyle f(x)=\int_{-\infty}^x e^{-t^2}dt"
! 2688: alt="" border=0 align="middle"></a>
! 2689: whereas
! 2690: <b>\displaystyle f(x)=\int_{-\infty}^x e^{-t^2}dt</b>
! 2691: renders
! 2692: <a href="#preview"><img id="mathsy2" onclick="eqntext('mathsy2')"
! 2693: src="../cgi-bin/mimetex.cgi?\displaystyle
! 2694: f(x)=\int_{-\infty}^x e^{-t^2}dt" alt="" border=0 align="middle"></a>
! 2695: </p>
! 2696:
! 2697: <center><a href="#preview"><img id="mthtbl1" onclick="eqntext('mthtbl1')"
! 2698: src="../cgi-bin/mimetex.cgi?\large\textstyle
! 2699: \begin{array}{|l98c28c28|l98c28c28|l98c28c28|}
! 2700: \hline \; \\
! 2701: \hspace{10}\backslash\textrm{cdot} & \cdot & &
! 2702: \hspace{10}\backslash\textrm{times} & \times & &
! 2703: \hspace{10}\backslash\textrm{ast} & \ast & \\
! 2704: \hspace{10}\backslash\textrm{div} & \div & &
! 2705: \hspace{10}\backslash\textrm{diamond} & \diamond & &
! 2706: \hspace{10}\backslash\textrm{pm} & \pm & \\
! 2707: \hspace{10}\backslash\textrm{mp} & \mp & &
! 2708: \hspace{10}\backslash\textrm{oplus} & \oplus & \Bigoplus &
! 2709: \hspace{10}\backslash\textrm{ominus} & \ominus & \\
! 2710: \hspace{10}\backslash\textrm{otimes} & \otimes & \Bigotimes &
! 2711: \hspace{10}\backslash\textrm{oslash} & \oslash & &
! 2712: \hspace{10}\backslash\textrm{odot} & \odot & \Bigodot \\
! 2713: \hspace{10}\backslash\textrm{bigcirc} & \bigcirc & &
! 2714: \hspace{10}\backslash\textrm{circ} & \circ & &
! 2715: \hspace{10}\backslash\textrm{bullet} & \bullet & \\
! 2716: \hspace{10}\backslash\textrm{asymp} & \asymp & &
! 2717: \hspace{10}\backslash\textrm{equiv} & \equiv & &
! 2718: \hspace{10}\backslash\textrm{subseteq} & \subseteq & \\
! 2719: \hspace{10}\backslash\textrm{supseteq} & \supseteq & &
! 2720: \hspace{10}\backslash\textrm{leq} & \leq & &
! 2721: \hspace{10}\backslash\textrm{geq} & \geq & \\
! 2722: \hspace{10}\backslash\textrm{preceq} & \preceq & &
! 2723: \hspace{10}\backslash\textrm{succeq} & \succeq & &
! 2724: \hspace{10}\backslash\textrm{sim} & \sim & \\
! 2725: \hspace{10}\backslash\textrm{approx} & \approx & &
! 2726: \hspace{10}\backslash\textrm{subset} & \subset & &
! 2727: \hspace{10}\backslash\textrm{supset} & \supset & \\
! 2728: \hspace{10}\backslash\textrm{ll} & \ll & &
! 2729: \hspace{10}\backslash\textrm{gg} & \gg & &
! 2730: \hspace{10}\backslash\textrm{prec} & \prec & \\
! 2731: \hspace{10}\backslash\textrm{succ} & \succ & &
! 2732: \hspace{10}\normalsize\backslash\textrm{leftarrow} & \leftarrow & &
! 2733: \hspace{10}\normalsize\backslash\textrm{rightarrow} & \rightarrow & \\
! 2734: \hspace{10}\normalsize\backslash\textrm{uparrow} & \uparrow & &
! 2735: \hspace{10}\normalsize\backslash\textrm{downarrow} & \downarrow & &
! 2736: \hspace{10}\normalsize\backslash\textrm{leftrightarrow}&&\leftrightarrow\\
! 2737: \hspace{10}\backslash\textrm{nearrow} & \nearrow & &
! 2738: \hspace{10}\backslash\textrm{searrow} & \searrow & &
! 2739: \hspace{10}\backslash\textrm{simeq} & \simeq & \\
! 2740: \hspace{10}\normalsize\backslash\textrm{Leftarrow} & \Leftarrow & &
! 2741: \hspace{10}\normalsize\backslash\textrm{Rightarrow} & \Rightarrow & &
! 2742: \hspace{10}\normalsize\backslash\textrm{Uparrow} & \Uparrow & \\
! 2743: \hspace{10}\normalsize\backslash\textrm{Downarrow} & \Downarrow & &
! 2744: \hspace{10}\normalsize\backslash\textrm{Leftrightarrow}&&\Leftrightarrow&
! 2745: \hspace{10}\backslash\textrm{nwarrow} & \nwarrow & \\
! 2746: \hspace{10}\backslash\textrm{swarrow} & \swarrow & &
! 2747: \hspace{10}\backslash\textrm{propto} & \propto & &
! 2748: \hspace{10}\backslash\textrm{prime} & \prime & \\
! 2749: \hspace{10}\backslash\textrm{infty} & \infty & &
! 2750: \hspace{10}\backslash\textrm{in} & \in & &
! 2751: \hspace{10}\backslash\textrm{ni} & \ni & \\
! 2752: \hspace{10}\backslash\textrm{triangle} & \triangle & &
! 2753: \hspace{10}\normalsize\backslash\textrm{bigtriangledown}&&\bigtriangledown&
! 2754: \hspace{10}\backslash^\prime & \' & \\
! 2755: \hspace{10}\textrm{/} & / & &
! 2756: \hspace{10}\backslash\textrm{forall} & \forall & &
! 2757: \hspace{10}\backslash\textrm{exists} & \exists & \\
! 2758: \hspace{10}\backslash\textrm{neg} & \neg & &
! 2759: \hspace{10}\backslash\textrm{emptyset} & \emptyset & &
! 2760: \hspace{10}\backslash\textrm{Re} & \Re & \\
! 2761: \hspace{10}\backslash\textrm{Im} & \Im & &
! 2762: \hspace{10}\backslash\textrm{top} & \top & &
! 2763: \hspace{10}\backslash\textrm{bot} & \bot & \\
! 2764: \hspace{10}\backslash\textrm{aleph} & \aleph & &
! 2765: \hspace{10}\normalsize\backslash\textrm{mathcal\lbrace A\rbrace}&\;\mathcal{A}&....&
! 2766: .... \normalsize\backslash\textrm{mathcal\lbrace Z\rbrace}&\;\mathcal{Z}&\\
! 2767: \; \\ \hline
! 2768: \end{array}"
! 2769: alt="" border=0 align="middle"></a><br>
! 2770: <a href="#preview"><img id="mthtbl2" onclick="eqntext('mthtbl2')"
! 2771: src="../cgi-bin/mimetex.cgi?\large\textstyle
! 2772: \begin{array}{|l98c28c28|l98c28c28|l98c28c28|}
! 2773: \hline \; \\
! 2774: \hspace{10}\backslash\textrm{cup} & \cup & \Bigcup &
! 2775: \hspace{10}\backslash\textrm{cap} & \cap & \Bigcap &
! 2776: \hspace{10}\backslash\textrm{uplus} & \uplus & \Biguplus \\
! 2777: \hspace{10}\backslash\textrm{wedge} & \wedge & \Bigwedge &
! 2778: \hspace{10}\backslash\textrm{vee} & \vee & \Bigvee &
! 2779: \hspace{10}\backslash\textrm{vdash} & \vdash & \\
! 2780: \hspace{10}\backslash\textrm{dashv} & \dashv & &
! 2781: \hspace{10}\backslash\textrm{lfloor} & \lfloor & &
! 2782: \hspace{10}\backslash\textrm{rfloor} & \rfloor & \\
! 2783: \hspace{10}\backslash\textrm{lceil} & \lceil & &
! 2784: \hspace{10}\backslash\textrm{rceil} & \rceil & &
! 2785: \hspace{10}\backslash\textrm{lbrace} & \lbrace & \\
! 2786: \hspace{10}\backslash\textrm{rbrace} & \rbrace & &
! 2787: \hspace{10}\backslash\textrm{langle} & \langle & &
! 2788: \hspace{10}\backslash\textrm{rangle} & \rangle & \\
! 2789: \hspace{10}\backslash\textrm{mid} & \mid & &
! 2790: \hspace{10}\backslash\textrm{parallel} & \parallel & &
! 2791: \hspace{10}\normalsize\backslash\textrm{updownarrow}& & \updownarrow \\
! 2792: \hspace{10}\normalsize\backslash\textrm{Updownarrow}& & \Updownarrow &
! 2793: \hspace{10}\backslash\textrm{setminus} & \setminus & &
! 2794: \hspace{10}\backslash\textrm{wr} & \wr & \\
! 2795: \hspace{10}\backslash\textrm{surd} & \raisebox{15}\surd & &
! 2796: \hspace{10}\backslash\textrm{amalg} & \amalg & &
! 2797: \hspace{10}\backslash\textrm{nabla} & \nabla & \\
! 2798: \hspace{10}\backslash\textrm{int} & \int & \Bigint &
! 2799: \hspace{10}\backslash\textrm{sqcup} & \sqcup & \Bigsqcup &
! 2800: \hspace{10}\backslash\textrm{sqcap} & \sqcap & \\
! 2801: \hspace{10}\normalsize\backslash\textrm{sqsubseteq} & \sqsubseteq & &
! 2802: \hspace{10}\normalsize\backslash\textrm{sqsupseteq} & \sqsupseteq & &
! 2803: \hspace{10}\backslash\textrm{S} & \S & \\
! 2804: \hspace{10}\backslash\textrm{dag} & \dag & &
! 2805: \hspace{10}\backslash\textrm{ddag} & \ddag & &
! 2806: \hspace{10}\backslash\textrm{P} & \P & \\
! 2807: \hspace{10}\backslash\textrm{clubsuit} & \clubsuit & &
! 2808: \hspace{10}\backslash\textrm{Diamond} & \Diamond & &
! 2809: \hspace{10}\backslash\textrm{Heart} & \Heart & \\
! 2810: \hspace{10}\backslash\textrm{spadesuit} & \spadesuit & \\
! 2811: \; \\ \hline
! 2812: \end{array}"
! 2813: alt="" border=0 align="middle"></a><br>
! 2814: <a href="#preview"><img id="mthtbl3" onclick="eqntext('mthtbl3')"
! 2815: src="../cgi-bin/mimetex.cgi?\large\textstyle
! 2816: \begin{array}{|l98c28c28|l98c28c28|l98c28c28|}
! 2817: \hline \; \\
! 2818: \hspace{10}\backslash\textrm{oint} & \oint & \Bigoint &
! 2819: \hspace{10}\backslash\textrm{sum} & \sum & \Bigsum &
! 2820: \hspace{10}\backslash\textrm{prod} & \prod & \Bigprod \\
! 2821: \hspace{10}\backslash\textrm{coprod} & \coprod & \Bigcoprod \\
! 2822: \; \\ \hline \; \\
! 2823: \hspace{10}\normalsize\backslash\textrm{leftharpoonup} &&\leftharpoonup&
! 2824: \normalsize\backslash\textrm{leftharpoondown} &&\;\leftharpoondown&
! 2825: \hspace{10}\normalsize\backslash\textrm{rightharpoonup}&&\rightharpoonup\\
! 2826: \normalsize\backslash\textrm{rightharpoondown}&&\;\rightharpoondown&
! 2827: \hspace{10}\normalsize\backslash\textrm{triangleright} &&\triangleright&
! 2828: \hspace{10}\normalsize\backslash\textrm{triangleleft} &&\triangleleft\\
! 2829: \normalsize\backslash\textrm{rightleftharpoons}&&\;\rightleftharpoons&
! 2830: \hspace{10}\backslash\textrm{star} & \LARGE{\star} & &
! 2831: \hspace{10}\backslash\textrm{partial} & \partial & \\
! 2832: \hspace{10}\backslash\textrm{flat} & \flat & &
! 2833: \hspace{10}\backslash\textrm{natural} & \natural & &
! 2834: \hspace{10}\backslash\textrm{sharp} & \sharp & \\
! 2835: \hspace{10}\backslash\textrm{smile} & \smile & &
! 2836: \hspace{10}\backslash\textrm{frown} & \frown & &
! 2837: \hspace{10}\backslash\textrm{ell} & \ell & \\
! 2838: \hspace{10}\backslash\textrm{imath} & \imath & &
! 2839: \hspace{10}\backslash\textrm{jmath} & \jmath & &
! 2840: \hspace{10}\backslash\textrm{wp} & \wp & \\
! 2841: \; \\ \hline \; \\
! 2842: \hspace{10}\backslash\textrm{ss} & \ss & &
! 2843: \hspace{10}\backslash\textrm{ae} & \ae & &
! 2844: \hspace{10}\backslash\textrm{oe} & \oe & \\
! 2845: \hspace{10}\backslash\textrm{AE} & \AE & &
! 2846: \hspace{10}\backslash\textrm{OE} & \OE & \\
! 2847: \; \\ \hline \; \\
! 2848: \hspace{10}\backslash\textrm{AA} & \AA & &
! 2849: \hspace{10}\backslash\textrm{aa} & \aa & &
! 2850: \hspace{10}\backslash\textrm{hbar} & \hbar & \\
! 2851: \hspace{10}\backslash\textrm{ldots} & \ldots & &
! 2852: \hspace{10}\backslash\textrm{cdots} & \cdots & &
! 2853: \hspace{10}\backslash\textrm{vdots} & \vdots & \\
! 2854: \hspace{10}\backslash\textrm{ddots} & \ddots & &
! 2855: \hspace{10}\backslash\textrm{angle} & \angle & &
! 2856: \hspace{10}\backslash\textrm{iint} & \iint & \Bigiint \\
! 2857: \; \\ \hline
! 2858: \end{array}"
! 2859: alt="" border=0 align="middle"></a></center>
! 2860:
1.1 albertel 2861: <h3> <a name="sizes">Font Sizes<font size=5>...</font></a> </h3>
2862:
1.2 albertel 2863: <p> MimeTeX currently has eight font sizes, numbered 0-7, with default 3.
2864: This font size numbering corresponds to the usual LaTeX directives
2865: <b>\tiny</b>, <b>\small</b>, <b>\normalsize</b>,
2866: <b>\large</b> (default), <b>\Large</b>,
2867: <b>\LARGE</b>, <b>\huge</b> and <b>\Huge</b>.
2868: These directives can be placed anywhere in a mimeTeX expression,
1.1 albertel 2869: and they change font size from that point forwards. However, as usual,
2870: a font size change inside a <b>{ }</b>-subexpression remains
2871: in effect only within that subexpression. </p>
2872:
1.2 albertel 2873: <p> In mimeTeX you may also write <b>\fontsize{0}...\fontsize{7}</b> or
2874: the shorter <b>\fs{0},...,\fs{7}</b> for <b>\tiny,...,\Huge</b>.
1.1 albertel 2875: And since these arguments are all single digits, the even shorter
1.2 albertel 2876: form <b>\fs0,...,\fs7</b> works equally well. For example, </p>
1.1 albertel 2877: <center> <table cellpadding=0>
2878: <tr align=center>
1.2 albertel 2879: <td align="left"> <b>0</b>:
2880: <img src="../cgi-bin/mimetex.cgi?<b>\tiny</b> f(x)=x^2">
2881: produces... </td>
2882: <td> <a href="#preview"><img id="sizes0" onclick="eqntext('sizes0')"
2883: src="../cgi-bin/mimetex.cgi?\tiny f(x)=x^2"
2884: alt="" border=0 align=middle></a> </td> </tr>
2885: <tr align=center>
2886: <td align="left"> <b>1</b>:
2887: <img src="../cgi-bin/mimetex.cgi?<b>\fs1</b> f(x)=x^2"> </td>
2888: <td> <a href="#preview"><img id="sizes1" onclick="eqntext('sizes1')"
2889: src="../cgi-bin/mimetex.cgi?\fs1 f(x)=x^2"
2890: alt="" border=0 align=middle></a> </td> </tr>
2891: <tr align=center>
2892: <td align="left"> <b>2</b>:
2893: <img src="../cgi-bin/mimetex.cgi?<b>\normalsize</b> f(x)=x^2"> </td>
1.1 albertel 2894: <td> <a href="#preview"><img id="sizes1" onclick="eqntext('sizes1')"
1.2 albertel 2895: src="../cgi-bin/mimetex.cgi?\normalsize f(x)=x^2"
2896: alt="" border=0 align=middle></a> </td> </tr>
2897: <tr align=center>
2898: <td align="left"> <b>3</b>:
2899: <img src="../cgi-bin/mimetex.cgi?<b></b>f(x)=x^2"> </td>
2900: <td> <a href="#preview"><img id="sizes3" onclick="eqntext('sizes3')"
1.1 albertel 2901: src="../cgi-bin/mimetex.cgi?f(x)=x^2"
1.2 albertel 2902: alt="" border=0 align=middle></a> </td> </tr>
2903: <tr align=center>
2904: <td align="left"> <b>4</b>:
2905: <img src="../cgi-bin/mimetex.cgi?<b>\Large</b> f(x)=x^2"> </td>
2906: <td> <a href="#preview"><img id="sizes4" onclick="eqntext('sizes4')"
2907: src="../cgi-bin/mimetex.cgi?\Large f(x)=x^2"
2908: alt="" border=0 align=middle></a> </td> </tr>
2909: <tr align=center>
2910: <td align="left"> <b>5</b>:
2911: <img src="../cgi-bin/mimetex.cgi?<b>\fs5</b> f(x)=x^2"> </td>
2912: <td> <a href="#preview"><img id="sizes5" onclick="eqntext('sizes5')"
2913: src="../cgi-bin/mimetex.cgi?\fs5f(x)=x^2"
2914: alt="" border=0 align=middle></a> </td> </tr>
1.1 albertel 2915: <tr align=center>
1.2 albertel 2916: <td align="left"> <b>6</b>:
2917: <img src="../cgi-bin/mimetex.cgi?<b>\huge</b> f(x)=x^2"> </td>
2918: <td> <a href="#preview"><img id="sizes6" onclick="eqntext('sizes6')"
2919: src="../cgi-bin/mimetex.cgi?\huge f(x)=x^2"
2920: alt="" border=0 align=middle></a> </td> </tr>
1.1 albertel 2921: <tr align=center>
1.2 albertel 2922: <td align="left"> <b>7</b>:
2923: <img src="../cgi-bin/mimetex.cgi?<b>\fs7</b> f(x)=x^2"> </td>
2924: <td> <a href="#preview"><img id="sizes7" onclick="eqntext('sizes7')"
2925: src="../cgi-bin/mimetex.cgi?\fs7 f(x)=x^2"
2926: alt="" border=0 align=middle></a> </td> </tr>
1.1 albertel 2927: </table> </center> <p class="continue">
1.2 albertel 2928: rendering <b>f(x)=x^2</b> in mimeTeX font sizes
2929: <b>0</b> (\tiny or \fs0), <b>1</b> (\small or \fs1),
2930: <b>2</b> (\normalsize or \fs2), <b>3</b> (default \large),
2931: <b>4</b> (\Large or \fs4), <b>5</b> (\LARGE or \fs5),
2932: <b>6</b> (\huge or \fs6) and <b>7</b> (\Huge or \fs7). </p>
1.1 albertel 2933:
2934: <p> You'll soon notice that exponents and \frac's and \atop's
2935: are automatically rendered one size smaller than their base
2936: expressions. For example, </p> <center>
2937: <b>\Large y=e^{x^2}</b> produces
2938: <a href="#preview"><img id="sizes4" onclick="eqntext('sizes4')"
2939: src="../cgi-bin/mimetex.cgi?\Large y=e^{x^2}"
2940: alt="" border=0 align=middle></a> </center> <p class="continue">
2941: rendering the <b>"y=e"</b> in font size 4 (\Large), the <b>"x"</b> in
2942: font size 3 (\large), and the <b>"2"</b> in font size 2 (\normalsize).
2943: If you get below font size 0, the font size remains 0. </p>
2944:
2945: <p> Explicit size declarations override mimeTeX's default sizing behavior.
2946: You can rewrite the preceding example as, say, </p> <center>
2947: <b>\Large y=e^{\normalsize x^{\tiny2}}</b> which now produces
2948: <a href="#preview"><img id="sizes5" onclick="eqntext('sizes5')"
2949: src="../cgi-bin/mimetex.cgi?\Large y=e^{\normalsize x^{\tiny2}}"
2950: alt="" border=0 align=middle></a> </center> <p class="continue">
2951: rendering the <b>"y=e"</b> in font size 4 (\Large unchanged),
2952: the <b>"x"</b> in font size 2 (\normalsize), and the <b>"2"</b>
2953: in font size 0 (\tiny). </p>
2954:
2955: <p> Preceding an <b>\fs{ }</b> size argument with <b>+</b> or
2956: <b>-</b> specifies "relative" sizing. For example,
2957: <b>\large\text{abc{\fs{-2}def}ghi}</b> produces
2958: <a href="#preview"><img id="sizes6" onclick="eqntext('sizes6')"
2959: src="../cgi-bin/mimetex.cgi?\large\text{abc{\fs{-2}def}ghi}"
2960: alt="" border=0 align=middle></a>, rendering the <b>"def"</b>
2961: in font size 1 (two sizes smaller than \large). Note that
2962: <b>\fs{-2}</b> affects only the subexpression in which it appears,
2963: and that its braces are no longer optional since <b>-2</b> contains
2964: two characters. For exponents (or any other size-changing commands
2965: like \frac), </p> <center>
2966: <b>\Large y=e^{\fs{-1}x^2}</b> produces
2967: <a href="#preview"><img id="sizes7" onclick="eqntext('sizes7')"
2968: src="../cgi-bin/mimetex.cgi?\Large y=e^{\fs{-1}x^2}"
2969: alt="" border=0 align=middle></a> </center> <p class="continue">
2970: rendering the <b>"y=e"</b> in font size 4 (\Large), as usual.
2971: The <b>"x"</b> would usually be rendered one size smaller,
2972: in font size 3, and your <b>\fs{-1}</b> is applied to that,
2973: resulting in font size 2. And the final <b>"2"</b> is rendered,
2974: by the usual rules, one size smaller than the <b>"x"</b>,
2975: in font size 1. </p>
2976:
1.5 ! raeburn 2977: <p> Finally, illustrated below are some examples of fonts and symbols
! 2978: at several mimeTeX sizes. All symbols and sizes from cmr, cmmi,
! 2979: cmmib (use <b>\mathbf{ }</b>), cmsy, cmex, bbold (use
! 2980: <b>\mathbb{ }</b>), rsfs (use <b>\mathscr{ }</b>),
! 2981: stmary and cyrillic wncyr (use <b>{\cyr }</b> or
! 2982: <b>\cyr{ }</b>) should be available, but they're not all shown.
! 2983: <!-- And also not shown are various "constructed symbols" like \sqrt,
! 2984: accents, etc. --> The illustrated font sizes are numbered 4=\Large,
! 2985: 3=\large and 2=\normalsize (not shown are 7=\Huge, 6=\huge,
! 2986: 5=\LARGE, 1=\small and 0=\tiny). </p>
! 2987:
! 2988: <center> <table cellspacing="7">
! 2989: <tr> <td align="left">
! 2990: <font size="4">cmmi latin uppercase, and lowercase</font>
! 2991: <br><img src="../cgi-bin/mimetex.cgi?\array{r$
! 2992: 2$\rm~size~4:~&4$A&4$B&4$C&4$D,&4$a&4$b&4$c&4$d\\
! 2993: 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\\
! 2994: 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,&
! 2995: 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}"
! 2996: alt="" border=0 align=middle>
! 2997: </td> <tr>
! 2998: <tr> <td align="left">
! 2999: <font size="4">calligraphic, and rsfs (<b>\cal{A}, \scr{B}, etc</b>)</font>
! 3000: <br><img src="../cgi-bin/mimetex.cgi?\array{r$
! 3001: 2$\rm~size~4:~&4$\calA&4$\calB&4$\calC&4$\calD&4$\calE&4$\calF&4$\calG,&
! 3002: 4$\scrA&4$\scrB&4$\scrC&4$\scrD&4$\scrE&4$\scrF&4$\scrG\\
! 3003: 2$\rm~3:~&3$\calH&3$\calI&3$\calJ&3$\calK&3$\calL&3$\calM&3$\calN&3$\calO&
! 3004: 3$\calP,&
! 3005: 3$\scrH&3$\scrI&3$\scrJ&3$\scrK&3$\scrL&3$\scrM&3$\scrN&3$\scrO&3$\scrP\\
! 3006: 2$\rm~2:~&2$\calQ&2$\calR&2$\calS&2$\calT&2$\calU&
! 3007: 2$\calV&2$\calW&2$\calX&2$\calY&2$\calZ,&
! 3008: 2$\scrQ&2$\scrR&2$\scrS&2$\scrT&2$\scrU&2$\scrV&2$\scrW&
! 3009: 2$\scrX&2$\scrY&2$\scrZ}"
! 3010: alt="" border=0 align=middle>
! 3011: </td> <tr>
! 3012: <tr> <td align="left">
! 3013: <font size="4">cmmi greek uppercase, and \var lowercase</font>
! 3014: <br><img src="../cgi-bin/mimetex.cgi?\array{r$
! 3015: 2$\rm~size~4:~&4$\Gamma&4$\Delta&4$\Theta&4$\Lambda&4$\Xi&4$\Pi&4$\Sigma&
! 3016: 4$\Upsilon&4$\Phi&4$\Psi&4$\Omega,&4$\rm~~&4$\varepsilon&4$\vartheta&4$\varpi&
! 3017: 4$\varrho&4$\varsigma&4$\varphi\\
! 3018: 2$\rm~3:~&3$\Gamma&3$\Delta&3$\Theta&3$\Lambda&3$\Xi&3$\Pi&3$\Sigma&
! 3019: 3$\Upsilon&3$\Phi&3$\Psi&3$\Omega,&~&3$\varepsilon&3$\vartheta&3$\varpi&
! 3020: 3$\varrho&3$\varsigma&3$\varphi\\
! 3021: 2$\rm~2:~&2$\Gamma&2$\Delta&2$\Theta&2$\Lambda&2$\Xi&2$\Pi&2$\Sigma&
! 3022: 2$\Upsilon&2$\Phi&2$\Psi&2$\Omega,&~&2$\varepsilon&2$\vartheta&2$\varpi&
! 3023: 2$\varrho&2$\varsigma&2$\varphi}"
! 3024: alt="" border=0 align=middle>
! 3025: </td> <tr>
! 3026: <tr> <td align="left">
! 3027: <font size="4">cmmi greek lowercase</font>
! 3028: <br><img src="../cgi-bin/mimetex.cgi?\array{r$
! 3029: 2$\rm~size~4:~&4$\alpha&4$\beta&4$\gamma&4$\delta&4$\epsilon&4$\zeta&
! 3030: 4$\eta&4$\theta&4$\iota&4$\kappa&4$\lambda&4$\mu&4$\nu&4$\xi&4$%%\omicron%%&
! 3031: 4$\pi&4$\rho&4$\sigma&4$\tau&4$\upsilon&4$\phi&4$\chi&4$\psi&4$\omega\\
! 3032: 2$\rm~3:~&3$\alpha&3$\beta&3$\gamma&3$\delta&3$\epsilon&3$\zeta&
! 3033: 3$\eta&3$\theta&3$\iota&3$\kappa&3$\lambda&3$\mu&3$\nu&3$\xi&3$%%\omicron%%&
! 3034: 3$\pi&3$\rho&3$\sigma&3$\tau&3$\upsilon&3$\phi&3$\chi&3$\psi&3$\omega\\
! 3035: 2$\rm~2:~&2$\alpha&2$\beta&2$\gamma&2$\delta&2$\epsilon&2$\zeta&
! 3036: 2$\eta&2$\theta&2$\iota&2$\kappa&2$\lambda&2$\mu&2$\nu&2$\xi&2$%%\omicron%%&
! 3037: 2$\pi&2$\rho&2$\sigma&2$\tau&2$\upsilon&2$\phi&2$\chi&2$\psi&2$\omega}"
! 3038: alt="" border=0 align=middle>
! 3039: </td> <tr>
! 3040: <tr> <td align="left">
! 3041: <font size="4">cmsy symbols at mimeTeX font size 3</font><br>
! 3042: <font size="3">(operators shown large are automatically "promoted"<br>
! 3043: to the larger size in \displaystyle mode)</font>
! 3044: <br><img src="../cgi-bin/mimetex.cgi?\array{3,r$1$\rm~chars~\\
! 3045: 1$\rm~0-15:~&-&\cdot&\times&\ast&\div&\diamond&\pm&\mp&
! 3046: \oplus&\ominus&\otimes&\oslash&\odot&\bigcirc&\circ&\bullet\\
! 3047: 1$\rm~16-31:~&\asymp&\equiv&\subseteq&\supseteq&\leq&\geq&\preceq&\succeq&
! 3048: \sim&\approx&\subset&\supset&\ll&\gg&\prec&\succ\\
! 3049: 1$\rm~32-47:~&\leftar&\rightar&\uparr&\downar&\leftrightar&\near&\sear&
! 3050: \simeq&\Leftar&\Rightar&\Upar&\Downar&\Leftrightar&\nwar&\swar&\propto\\
! 3051: 1$\rm~48-63:~&\prime&\infty&\in&\ni&\triangle&\bigtriangledo&/&\'&
! 3052: \forall&\exists&\neg&\emptyset&\Re&\Im&\top&\bot\\
! 3053: 1$\rm~64-100:~&\aleph&&\calA&4$.\,.\,.&\calZ&&\cup&\cap&
! 3054: \uplus&\wedge&\vee&\vdash&\dashv&\lfloor&\rfloor&\lceil\\
! 3055: 1$\rm~101-116:~&\rceil&\lbrace&\rbrace&\langle&\rangle&\mid&\parallel&
! 3056: \updownar&\Updownar&\setminus&\wr&\surd&\amalg&\nabla&\int&\sqcup\\
! 3057: 1$\rm~117-127:~&\sqcap&\sqsubseteq&\sqsupseteq&\S&\dag&\ddag&\P&\clubsuit&
! 3058: \Diamond&\Heart&\spadesuit}" alt="" border=0 align=middle>
! 3059: </td> <tr>
! 3060: <tr> <td align="left">
! 3061: <font size="4">a few other cmmi, cmr, stmary and wncyr symbols
! 3062: at mimeTeX font size 4</font>
! 3063: <br><img src="../cgi-bin/mimetex.cgi?\array{4,r$
! 3064: 1$\rm~cmmi:~&\leftharpoonup&\leftharpoondo&\rightharpoonup&\rightharpoondo&
! 3065: \triangleright&\triangleleft&\star&\partial&
! 3066: \flat&\natural&\sharp&\smile&\frown&\ell&\imath&\jmath&\wp&\vec\\
! 3067: 1$\rm~cmr:~&\ss&\ae&\oe&\AE&\OE \\
! 3068: 1$\rm~stmary:~&\moo&\Lbag&\Rbag&\lightning&\llbracket&\rrbracket&
! 3069: \subsetpluseq&\supsetpluseq&\Yup&\Ydown\\
! 3070: 1$\rm~wncyr:~&\cyr A&\cyr a&\cyr B&\cyr b&\cyr V&\cyr v&\cyr G&\cyr g&
! 3071: \cyr D&\cyr d&\cyr Dj&\cyr dj&\cyr\=E&\cyr\=e&\cyr Zh&\cyr zh}"
! 3072: alt="" border=0 align=middle>
! 3073: </td> <tr>
! 3074: </table> </center>
! 3075:
1.1 albertel 3076: <h3> <a name="modes">Modes<font size=5>...</font></a> </h3>
3077:
3078: <p> MimeTeX is always in a math-like mode, so you needn't surround
3079: expressions with <b>$...$</b>'s for <b>\textstyle</b>,
3080: or <b>$$...$$</b>'s for <b>\displaystyle</b>.
3081: <!-- or <b>\[...\]</b>'s, etc. In fact, mimeTeX interprets <b>$</b>
3082: as a "preamble" terminator (e.g., see <a href="#array">\array</a>
3083: below), and interprets <b>\[...\]</b> as an abbreviation for
3084: <b>\left[...\right]</b>. -->
3085: By default, operator limits like <b>\int_a^b</b> are rendered
3086: <b>\textstyle</b> <a href="#preview">
3087: <img id="modes99a" onclick="eqntext('modes99a')"
3088: src="../cgi-bin/mimetex.cgi?\normalsize\int_a^b"
3089: alt="" border=0 align=middle></a> at font sizes <b>\normalsize</b>
3090: and smaller, and rendered <b>\displaystyle</b> <a href="#preview">
3091: <img id="modes99b" onclick="eqntext('modes99b')"
3092: src="../cgi-bin/mimetex.cgi?\large\int_a^b"
3093: alt="" border=0 align=middle></a> at font sizes <b>\large</b> and
3094: larger (see the <b>-DDISPLAYSIZE</b>
3095: <a href="#options">compile option</a> to change this default).
3096: And when <b>\displaystyle</b> is invoked (either implicitly at font size
3097: <b>\large</b> or larger, or if you explicitly write <b>\displaystyle</b>
3098: at any font size), then operators <b>\int</b>, <b>\sum</b>,
3099: <b>\prod</b>, etc, are automatically promoted to larger sizes.
3100: <!-- their <a href="#characters">\Bigxxx</a> counterparts. -->
3101: <!-- Conversely, <b>\displaystyle</b> is applied to all
3102: <a href="#characters">\Bigxxx</a> operators regardless of font size. -->
3103: <!-- i.e., super/subscripts are placed directly above/below
3104: <b>\Bigsum</b>, but "alongside" <b>\sum</b>. -->
3105: For example, </p> <center>
3106: <!-- <b>\Bigsum_{i=1}^ni=\frac{n(n+1)}2</b> produces
3107: <a href="#preview"><img id="modes1a" onclick="eqntext('modes1a')"
1.2 albertel 3108: src="../cgi-bin/mimetex.cgi?
3109: \normalsize\Bigsum_{i=1}^ni=\frac{n(n+1)}2"
1.1 albertel 3110: alt="" border=0 align=middle></a>, <br> -->
1.2 albertel 3111: <b>\normalsize \sum_{i=1}^ni=\frac{n(n+1)}2</b>
1.1 albertel 3112: produces
3113: <a href="#preview"><img id="modes2a" onclick="eqntext('modes2a')"
1.2 albertel 3114: src="../cgi-bin/mimetex.cgi?\normalsize\sum_{i=1}^ni=\frac{n(n+1)}2"
1.1 albertel 3115: alt="" border=0 align=middle></a>, whereas <br>
1.2 albertel 3116: <b>\displaystyle \normalsize \sum_{i=1}^ni=\frac{n(n+1)}2</b>
3117: produces
1.1 albertel 3118: <a href="#preview"><img id="modes1b" onclick="eqntext('modes1b')"
1.2 albertel 3119: src="../cgi-bin/mimetex.cgi?
3120: \normalsize\displaystyle\sum_{i=1}^ni=\frac{n(n+1)}2"
1.1 albertel 3121: alt="" border=0 align=middle></a>, </center>
3122: <p class=continue> and <!-- replacing <b>\Bigsum</b> with the smaller
3123: <b>\sum</b> symbol, --> </p> <center>
3124: <b>\large \sum_{i=1}^ni=\frac{n(n+1)}2</b> produces
3125: <a href="#preview"><img id="modes1b" onclick="eqntext('modes1b')"
3126: src="../cgi-bin/mimetex.cgi?\large\sum_{i=1}^ni=\frac{n(n+1)}2"
3127: alt="" border=0 align=middle></a>, whereas <br>
3128: <b>\textstyle \large \sum_{i=1}^ni=\frac{n(n+1)}2</b>
3129: produces
3130: <a href="#preview"><img id="modes2b" onclick="eqntext('modes2b')"
3131: src="../cgi-bin/mimetex.cgi?\textstyle\large
3132: \sum_{i=1}^ni=\frac{n(n+1)}2" alt="" border=0 align=middle></a>.
3133: <!-- instead. --> </center>
3134:
3135: <p> As usual, <b>\nolimits</b> turns displaystyle off (or textstyle on)
3136: for the operator immediately preceding it. For example, </p> <center>
1.2 albertel 3137: <b>\large \sum\nolimits_{i=1}^ni=\frac{n(n+1)}2</b>
1.1 albertel 3138: produces
3139: <a href="#preview"><img id="modes3" onclick="eqntext('modes3')"
3140: src="../cgi-bin/mimetex.cgi?
3141: \large\sum\nolimits_{i=1}^ni=\frac{n(n+1)}2"
3142: alt="" border=0 align=middle></a></center> <p class="continue">
3143: and likewise, <b>\limits</b> turns displaystyle on for the operator
3144: immediately preceding it. For example, </p> <center>
1.2 albertel 3145: <b>\normalsize \sum\limits_{i=1}^ni=\frac{n(n+1)}2</b>
3146: produces
1.1 albertel 3147: <a href="#preview"><img id="modes4" onclick="eqntext('modes4')"
1.2 albertel 3148: src="../cgi-bin/mimetex.cgi?
3149: \normalsize\sum\limits_{i=1}^ni=\frac{n(n+1)}2"
1.1 albertel 3150: alt="" border=0 align=middle></a> </center>
3151:
3152: <p> By the way, <b>\limits</b> affects <i><b>_any_</b></i> character
3153: or subexpression immediately preceding it. For example, </p> <center>
3154: <b>A^i_j</b> produces
3155: <a href="#preview"><img id="modes5" onclick="eqntext('modes5')"
1.2 albertel 3156: src="../cgi-bin/mimetex.cgi?\large A^i_j"
1.1 albertel 3157: alt="" border=0 align=middle></a> as usual, whereas <br>
3158: <b>A\limits^i_j</b> produces
3159: <a href="#preview"><img id="modes6" onclick="eqntext('modes6')"
3160: src="../cgi-bin/mimetex.cgi?\large A\limits^i_j"
3161: alt="" border=0 align=middle></a> instead. </center>
3162: <p class="continue">Likewise, for subexpressions, </p> <center>
3163: <b>\widehat{xyz}\limits^a</b> produces
3164: <a href="#preview"><img id="modes7" onclick="eqntext('modes7')"
3165: src="../cgi-bin/mimetex.cgi?\large\widehat{xyz}\limits^a"
3166: alt="" border=0 align=middle></a> </center> <p class="continue">
3167: This side effect may occasionally be useful. For example, </p> <center>
3168: <b>x\rightarrow\limits^gy</b> produces
3169: <a href="#preview"><img id="modes8" onclick="eqntext('modes8')"
3170: src="../cgi-bin/mimetex.cgi?\large x\rightarrow\limits^gy"
3171: alt="" border=0 align=middle></a> </center> <p class="continue">
3172: (mimeTeX automatically centers super/subscripts above/below
3173: the long and Long <a href="#arrows">arrow</a> forms) </p>
3174:
3175: <p> The <b>\displaystyle</b> command turns on displaystyle math mode for
3176: the entire expression (or <b>{ }</b>-enclosed subexpression),
3177: affecting <b><i>_all_</i></b> super/subscripts to the right
3178: of the \displaystyle, except for character classes Ordinary and
3179: Variable (TeXbook page 154). Similarly, <b>\textstyle</b> turns
3180: off displaystyle math mode. For example, </p> <center>
3181: <b>\sum_1^n {\displaystyle\sum_1^k\sum_1^lx_i^j} \sum_1^m</b>
3182: produces
3183: <a href="#preview"><img id="modes9" onclick="eqntext('modes9')"
3184: src="../cgi-bin/mimetex.cgi?\normalsize\sum_1^n
3185: {\displaystyle\sum_1^k\sum_1^lx_i^j}\sum_1^m"
3186: alt="" border=0 align=middle></a> </center> <p class="continue">
3187: Note that <b>\sum</b>'s within the subexpression are all affected by
3188: the beginning <b>\displaystyle</b>, but not the Variable <b>x_i^j</b>.
3189: An explicit <b>x\limits_i^j</b> always affects any preceding term. </p>
3190:
3191: <h3> <a name="textboxes">text boxes<font size=5>...</font></a> </h3>
3192:
3193: <p> Finally, mimeTeX also has a text-like/roman mode
3194: entered by writing either <b>\text{anything at all}</b>
3195: or the equivalent LaTeX-2.09-like command
3196: <b>{\rm anything at all}</b>, both of which render
3197: <b>anything at all</b> in roman (font family cmr10).
3198: <b>\mbox{ }</b> and several similar LaTeX commands are
3199: recognized by mimeTeX as synonyms for <b>\text{ }</b>.
3200: For italic, write <b>\textit{anything at all}</b> or
3201: <b>{\it anything at all}</b>, both of which render
3202: <b>anything at all</b> in italic (font family cmmi10).
3203: All four forms respect spaces between words, except that the
3204: first/required space after <b>{\rm etc}</b> and
1.3 albertel 3205: <b>{\it etc}</b> is still ignored. <!-- Math <b>$...$</b>
3206: subexpressions inside <b>\mbox{ }</b> or <b>\text{ }</b>
3207: are treated in the usual way. --> For example, </p> <center>
1.1 albertel 3208: <b>anything at all</b> just produces
3209: <a href="#preview"><img id="textboxes1" onclick="eqntext('textboxes1')"
1.2 albertel 3210: src="../cgi-bin/mimetex.cgi?\normalsize anything at all"
1.1 albertel 3211: alt="" border=0 align=middle></a> whereas <br> <br>
3212: <b>\text{anything at all}</b> produces
3213: <a href="#preview"><img id="textboxes2" onclick="eqntext('textboxes2')"
1.2 albertel 3214: src="../cgi-bin/mimetex.cgi?\normalsize\text{anything at all}"
1.1 albertel 3215: alt="" border=0 align=middle></a> and <br> <br>
3216: <b>\textit{anything at all}</b> produces
3217: <a href="#preview"><img id="textboxes3" onclick="eqntext('textboxes3')"
1.2 albertel 3218: src="../cgi-bin/mimetex.cgi?\normalsize\textit{anything at all}"
3219: alt="" border=0 align=middle></a> instead. </center>
1.1 albertel 3220:
1.3 albertel 3221: <p> You don't usually surround mimeTeX expressions with <b>$</b>'s,
3222: but that works in the usual way for <b>\text{ }</b> and
3223: <b>\mbox{ }</b>, rendering the <b>$...$</b>-enclosed
3224: subexpression in mathmode. For example, </p> <center>
3225: <b>n=\left\{m/2\text{ if $m$ even}
3226: \\(m+1)/2\text{ if $m$ odd}\right.</b>
3227: produces
3228: <a href="#preview"><img id="textboxes9" onclick="eqntext('textboxes9')"
3229: src="../cgi-bin/mimetex.cgi?
3230: n=\left\{m/2\text{ if $m$ even}\\(m+1)/2\text{ if $m$ odd}\right."
3231: alt="" border=0 align=middle></a> </center>
3232:
1.1 albertel 3233:
3234: <h2> <a name="delimiters"> (IIIc) Delimiters </a> </h2>
3235:
3236: <h3> <a name="parens">Parentheses and Braces
3237: (delimiters)<font size=5>...</font></a> </h3>
3238:
1.2 albertel 3239: <p> LaTeX's <b>\left( ... \right)</b> and the other 21
3240: standard LaTeX delimiters are also recognized by mimeTeX.
3241: And mimeTeX also recognizes an etex-like <b>\middle</b>.
3242: <!-- may be written exactly
1.1 albertel 3243: like that, or may be abbreviated <b>\(</b> and <b>\)</b> in mimeTeX.
3244: Not all <b>\left</b> and <b>\right</b> LaTeX delimiters are currently
3245: available in mimeTeX, but those that are can be written in the usual
3246: way, or can be abbreviated as described above. One exception is
3247: that <b>\left\|...\right\|</b> must instead be abbreviated
3248: <b>\=...\=</b> or can be written in full <b>\left\|...\right\|</b>
3249: as usual. Also, <b>\left\langle...\right\rangle</b> is abbreviated
1.2 albertel 3250: <b>\<...\></b> . </p> -->
3251: <!-- <p> Mixing abbreviated and unabbreviated delimiters within
3252: a matching pair is not allowed, e.g., \left(...\) <b>_won't_</b> work.
3253: But you can mix nested pairs, e.g., <b>\left(...\(...\)...\right)</b>
3254: will work as long as the matching delimiters comprising each pair are
1.1 albertel 3255: either both abbreviated or both unabbreviated. </p>
1.2 albertel 3256: <p> --> Several of the most common automatically sized delimiters
3257: are illustrated below... </p> <center>
1.1 albertel 3258: <!-- <table cellpadding=3 cellspacing=0 border=1> -->
3259: <table cellspacing=0 cellpadding=2 border=1>
3260: <tr align=center>
1.2 albertel 3261: <!-- <td> <b>LaTeX or <br> mimeTeX</b> </td> -->
3262: <td> <b>Delimiter</b> </td>
3263: <!-- <td> <b>or mimeTeX <br> abbreviation</b> </td> -->
1.1 albertel 3264: <td> <b>example...</b> </td>
3265: <td> <b>...renders</b> </td>
3266: </tr>
3267: <tr align=center>
3268: <td> \left( ... \right) </td>
1.2 albertel 3269: <!-- <td> \( ... \) </td> -->
1.1 albertel 3270: <td> \left( \frac1{1-x^2} \right)^2 </td>
3271: <td> <a href="#preview"><img id="parens1" onclick="eqntext('parens1')"
3272: src="../cgi-bin/mimetex.cgi?\Large\left(\frac1{1-x^2}\right)^2"
3273: alt="" border=0 align=middle></a> </td>
3274: </tr>
3275: <tr align=center>
3276: <td> \left[ ... \right] </td>
1.2 albertel 3277: <!-- <td> \[ ... \] </td> -->
3278: <td> \left[ \frac1{\sqrt2}x - y \right]^n </td>
1.1 albertel 3279: <td> <a href="#preview"><img id="parens2" onclick="eqntext('parens2')"
1.2 albertel 3280: src="../cgi-bin/mimetex.cgi?\Large
3281: \left[ \frac1{\sqrt2}x - y \right]^n"
1.1 albertel 3282: alt="" border=0 align=middle></a> </td>
3283: </tr>
3284: <tr align=center>
3285: <td> \left\{ ... \right\} </td>
1.2 albertel 3286: <!-- <td> \{ ... \} </td> -->
1.1 albertel 3287: <td> \left\{ 1^2,2^2,3^2,\ldots \right\} </td>
3288: <td> <a href="#preview"><img id="parens3" onclick="eqntext('parens3')"
3289: src="../cgi-bin/mimetex.cgi?
3290: \large\left\{1^2,2^2,3^2,\ldots\right\}"
3291: alt="" border=0 align=middle></a> </td>
3292: </tr>
3293: <tr align=center>
3294: <td> \left\langle ...<br>
3295: ... \right\rangle </td>
1.2 albertel 3296: <!-- <td> \< ... \> </td> -->
3297: <td> \left\langle \varphi \middle| \hat H <br>
3298: \middle| \phi \right\rangle </td>
1.1 albertel 3299: <td> <a href="#preview"><img id="parens4" onclick="eqntext('parens4')"
1.2 albertel 3300: src="../cgi-bin/mimetex.cgi?\Large
3301: \left\langle\varphi\middle|\hat H\middle|\phi\right\rangle"
1.1 albertel 3302: alt="" border=0 align=middle></a> </td>
3303: </tr>
3304: <tr align=center>
3305: <td> \left| ... \right| </td>
1.2 albertel 3306: <!-- <td> \| ... \| </td> -->
3307: <td> \left| \begin{matrix} a_1 & a_2 \\<br>
3308: a_3 & a_4 \end{matrix} \right|</td>
1.1 albertel 3309: <td> <a href="#preview"><img id="parens5" onclick="eqntext('parens5')"
1.2 albertel 3310: src="../cgi-bin/mimetex.cgi?\large
3311: \left|\begin{matrix}a_1&a_2\\a_3&a_4\end{matrix}\right|"
1.1 albertel 3312: alt="" border=0 align=middle></a> </td>
3313: </tr>
3314: <tr align=center>
3315: <td> \left\| ... \right\| </td>
1.2 albertel 3316: <!-- <td> \= ... \= </td> -->
1.1 albertel 3317: <td> \left\|x^2-y^2\right\| </td>
3318: <td> <a href="#preview"><img id="parens6" onclick="eqntext('parens6')"
3319: src="../cgi-bin/mimetex.cgi?\large\left\|x^2-y^2\right\|"
3320: alt="" border=0 align=middle></a> </td>
3321: </tr>
3322: <tr align=center>
1.2 albertel 3323: <td> \left\{ ...
3324: \right<font size="5"><b>.</b></font> </td>
3325: <!-- <td> \{ ... \<b>.</b> </td> -->
3326: <td> y=\left\{ \text{this\\that}
3327: \right<font size="5"><b>.</b></font> </td>
1.1 albertel 3328: <td> <a href="#preview"><img id="parens7" onclick="eqntext('parens7')"
3329: src="../cgi-bin/mimetex.cgi?
1.2 albertel 3330: \large y=\left\{\text{this\\that}\right."
1.1 albertel 3331: alt="" border=0 align=middle></a> </td>
3332: </tr>
3333: <tr align=center>
1.2 albertel 3334: <td> \left<font size="5"><b>.</b></font>
3335: ... \right\} </td>
3336: <!-- <td> \<b>.</b> ... \} </td> -->
3337: <td> \left<font size="5"><b>.</b></font>
3338: \text{this\\that} \right\}=y </td>
1.1 albertel 3339: <td> <a href="#preview"><img id="parens8" onclick="eqntext('parens8')"
3340: src="../cgi-bin/mimetex.cgi?
1.2 albertel 3341: \large\left.\text{this\\that}\right\}=y"
1.1 albertel 3342: alt="" border=0 align=middle></a> </td>
3343: </tr>
3344: </table> </center>
3345: <p> <b><u>Notes... </u></b> </p>
3346: <ol compact type=1>
1.2 albertel 3347: <!-- <li> The other LaTeX delimiters, i.e., floor's, ceil's,
3348: arrows, etc, can't yet be sized to fit. </li> -->
1.1 albertel 3349: <li> <a href="#sizes">Size declarations</a> inside any of the
3350: above delimiter pairs affect only the enclosed subexpression,
3351: e.g., <b>\Large w=\left(\small x+y\right)+z</b> produces
3352: <a href="#preview"><img id="parens9" onclick="eqntext('parens9')"
3353: src="../cgi-bin/mimetex.cgi?\Large w=\left(\small x+y\right)+z"
3354: alt="" border=0 align=middle></a> </li>
1.2 albertel 3355: <li> An expression may contain as many etex-like <b>\middle</b>'s as
3356: you like, and in mimeTeX the surrounding <b>\left...\right</b>
3357: isn't required. When omitted, the scope of <b>\middle</b> is
3358: either the entire expression or the <b>{ }</b>-enclosed
3359: subexpression in which the <b>\middle</b>'s occur. For example,
3360: <b>\frac{a+1}b \middle/ \middle(\frac{c+1}d \middle/ \frac{e+1}f\middle)</b>
3361: renders
3362: <img src="../cgi-bin/mimetex.cgi?\large
3363: \frac{a+1}b\middle/\middle(\frac{c+1}d\middle/\frac{e+1}f\middle)"
3364: border=0 align=middle>. </li>
3365: <li> In the last two examples, note that mimeTeX recognizes the
3366: <b>\\</b> in <b>\text{this\\that}</b>
3367: as a linebreak. For example, <b>x=1\\y=2\\z=3</b> renders
3368: <a href="#preview"><img id="parens9b" onclick="eqntext('parens9b')"
3369: src="../cgi-bin/mimetex.cgi?\small x=1\\y=2\\z=3"
3370: alt="" border=0 align=middle></a> </li>
3371: <!-- <li> An abbreviated left delimiter must be paired with the same
1.1 albertel 3372: "type" of matching right delimiter, e.g., <b>\[...\]</b> works
3373: whereas <b>\[...\)</b> doesn't work. To render an "unmatched"
3374: pair of delimiters you must use the unabbreviated form, e.g.,
1.2 albertel 3375: <b>\left[...\right)</b> works fine. </li> -->
3376: <!-- <li> Similarly, "unusual" delimiter abbreviations like
3377: <b>\)...\(</b> also don't work in mimeTeX. That is,
1.1 albertel 3378: <b>(, [, <, {,</b> etc, must always be "left"
3379: in mimeTeX, and <b>), ], >, },</b> etc,
3380: must always be "right". To render "unusual" delimiter pairs you
3381: must use the unabbreviated form, e.g., <b>\left)...\right[</b>
1.2 albertel 3382: works fine. </li> -->
3383: <!-- <li> <b>\right.</b> may be paired with any of the automatically
1.1 albertel 3384: sized delimiters, and may optionally be abbreviated as <b>\.</b>
3385: The same <b>\.</b> also serves as an abbreviation
3386: for <b>\left.</b> MimeTeX correctly interprets your
3387: intention if you correctly balance delimiters. For example,
3388: either <b>y=\left\{{this\atop that}\right.</b> or
3389: <b>y=\{{this\atop that}\.</b> renders the usual useful
3390: construction
3391: <a href="#preview"><img id="parens10" onclick="eqntext('parens10')"
1.2 albertel 3392: src="../cgi-bin/mimetex.cgi?
3393: \normalsize y=\{\text{this\atop that}\."
3394: alt="" border=0 align=middle></a> illustrated above. </li> -->
3395: <!-- <li> However, abbreviated <b>\.</b>'s cannot be nested in mimeTeX,
1.1 albertel 3396: e.g., <b>\[\(...\.\.</b> doesn't work. Instead, unabbreviated
3397: <b>\left.</b> and <b>\right.</b> may be nested, e.g.,
1.2 albertel 3398: <b>\left[\left(...\right.\right.</b> works fine. </li> -->
3399: <!-- <li> Simply nested abbreviations like <b>\[\(...\)\]</b> work
3400: fine in mimeTeX. But abbreviated delimiters like <b>\|...\|</b>
1.1 albertel 3401: and <b>\=...\=</b>, whose left and right forms are
3402: identical, cannot be nested. To nest these delimiters you
3403: must use the corresponding unabbreviated <b>\left|..\right|</b>
1.2 albertel 3404: and <b>\left\|...\right\|</b>. </li> -->
3405: <!-- <li> All <b>\left(...\right)</b>'s (and abbreviated
3406: <b>\(...\)</b>'s), etc, must be correctly balanced,
3407: which may include being matched with <b>\left.</b>
3408: or <b>\right.</b> (or abbreviated <b>\.</b>).
1.1 albertel 3409: And, to repeat, you may <b>_not_</b> mix
3410: abbreviated and unabbreviated \(...\right), etc, within a
1.2 albertel 3411: matching pair. </li> -->
1.1 albertel 3412: </ol>
3413:
3414: <p> Besides the <b>\left...\right</b> delimiters discussed above,
3415: mimeTeX also supports constructions like
3416: <b>\left\int_a^b...\right<b>.</b></b> , which automatically
3417: sizes the <b>\left\int</b> to accommodate everything between it
3418: and its matching <b>\right<b>.</b></b> delimiter.
3419: The <b>\right</b> delimiter needn't necessarily be
3420: the <b>\right<b>.</b></b> illustrated, e.g.,
1.2 albertel 3421: <b>\left\int_a^b x^2dx =\frac{x^3}3\right|_a^b</b>
1.1 albertel 3422: produces
3423: <a href="#preview"><img id="parens11" onclick="eqntext('parens11')"
3424: src="../cgi-bin/mimetex.cgi?\large
1.2 albertel 3425: \left\int_a^bx^2dx=\frac{x^3}3\right|_a^b" border=0 alt=""
3426: align=middle></a>. <!-- Except for Opening (TeX class 4) and
1.1 albertel 3427: Closing (class 5) delimiter characters like <b>( )</b> and
3428: <b>[ ]</b> and <b>\{ \}</b>, limits are default-rendered
1.2 albertel 3429: \displaystyle, which is why <b>\right|\nolimits_a^b</b> was required. -->
1.1 albertel 3430: You can also write <b>\left\sum</b>, <b>\left\prod</b>,
1.3 albertel 3431: <b>\left\cup</b>, etc, for many of the symbols in CMEX10 and STMARY10.
1.1 albertel 3432: And any symbol that works with <b>\left</b> will also work
1.2 albertel 3433: with <b>\right</b> . <!-- But mimeTeX abbreviations like
1.1 albertel 3434: <b>\(...\)</b> for <b>\left(...\right)</b>
3435: won't work with any of these CMEX10 symbols. You'll have to write
1.2 albertel 3436: the usual unabbreviated <b>\left...\right</b> form. --> </p>
1.1 albertel 3437:
3438: <p> Unescaped <b>( )</b>'s and <b>[ ]</b>'s and <b>| |</b>'s
3439: and <b>< ></b>'s don't need to be balanced since mimeTeX just
3440: displays them like ordinary characters without any special significance.
3441: Ditto for the usual four <b>\big(</b> and <b>\Big(</b> and <b>\bigg(</b>
3442: and <b>\Bigg(</b>, and for their four right <b>)</b> counterparts, which
3443: just display <b>(...)</b>'s at fixed larger sizes, and also have no
3444: special significance. All four big <b>[ ]</b>'s and
3445: <b>< ></b>'s and <b>{ }</b>'s are also available
3446: as ordinary characters. </p>
3447:
3448: <p> As usual, unescaped <b>{...}</b>'s aren't displayed at all,
3449: must be balanced, and have the usual special LaTeX significance.
3450: MimeTeX interprets escaped <b>\{...\}</b>'s as abbreviations
3451: for <b>\left\{...\right\}</b> and therefore always sizes them to fit.
3452: If you need displayed but unsized <b>{...}</b>'s, write
3453: <b>\lbrace...\rbrace</b> or any of the four <b>\big{...\big}</b>'s. </p>
3454:
3455:
3456: <h2> <a name="accents"> (IIId) Accents, Functions, Arrows,
3457: Raise and rotate, Compose, Abbreviations, etc. </a> </h2>
3458:
3459: <h3> Accents<font size=5>...</font> </h3>
3460:
3461: <p class="continue">
1.2 albertel 3462: <b>\vec{ } \hat{ } \bar{ } \tilde{ } \dot{ }
3463: \ddot{ }</b> and <b>\acute{ } \grave{ }
3464: \breve{ } \check{ }</b> are the only accents currently
3465: supported. The first four are all "wide". For example, you can write
3466: <b>\widehat{ }</b> if you like, but there's absolutely no
3467: difference either way (and <b>\bar{ }</b> and
3468: <b>\overline{ }</b> are identical). The last four accents
3469: only take a single character argument. <p>
3470:
3471: <p> Other accent-like directives available in mimeTeX are
3472: <b>\underline{ } \cancel{ } \sout{ }</b>,
3473: as well as
3474: <b>\overset{ }{ } \underset{ }{ }</b>
3475: and the more ususal
3476: <b>\overbrace{ }^{ } \underbrace{ }_{ }</b>.
3477: And <b>\not</b> also works on the single character immediately
3478: following it. Some of these directives are discussed in more detail
3479: below. </p>
1.1 albertel 3480:
3481: <h3> <a name="functions">Function names<font size=5>...</font></a> </h3>
3482:
3483: <p> All 32 usual LaTeX function names <b>\arccos</b>,...,<b>\tanh</b>
3484: are recognized by mimeTeX and treated in the usual way. MimeTeX
3485: also recognizes <b>\tr</b> for the trace, and also <b>\bmod</b>
3486: and <b>\pmod</b>. And those functions that normally take "limits"
3487: also behave as expected, e.g., </p> <center>
3488: <b>\lim_{n\to\infty}S_n=S</b> produces
3489: <a href="#preview"><img id="functions1" onclick="eqntext('functions1')"
1.2 albertel 3490: src="../cgi-bin/mimetex.cgi?\large\lim_{n\to\infty}S_n=S"
1.1 albertel 3491: alt="" border=0 align=middle></a> </center>
3492:
3493: <h3> <a name="arrows">long Arrows<font size=5>...</font></a> </h3>
3494:
3495: <p> All mimeTeX \long and \Long arrows take an optional [width] argument
3496: that explicitly sets the arrow's width in pixels, scaled by
3497: <a href="#unitlength">\unitlength</a>. For example,
3498: <b>\longrightarrow[50]</b> draws a 50-pixel wide arrow
3499: <a href="#preview"><img id="arrows1" onclick="eqntext('arrows1')"
3500: src="../cgi-bin/mimetex.cgi?\longrightarrow[50]" alt="" border=0
3501: align=middle></a>, whereas just <b>\longrightarrow</b> calculates
3502: a default width
3503: <a href="#preview"><img id="arrows2" onclick="eqntext('arrows2')"
3504: src="../cgi-bin/mimetex.cgi?\longrightarrow" alt="" border=0
3505: align=middle></a>, as usual. And, in addition to the usual
3506: right, left and leftright arrows, there are also \long (and \Long) up,
3507: down and updown arrows that take an optional [height] argument, also
3508: scaled by any preceding <a href="#unitlength">\unitlength</a>. </p>
3509:
3510: <p> In the event that you actually want to place an []-enclosed expression
3511: immediately following an "unsized" long arrow, just place a <b>~</b> or
3512: any white space after the arrow, e.g., <b>f:x\longrightarrow~[0,1]</b>
3513: produces
3514: <a href="#preview"><img id="arrows3" onclick="eqntext('arrows3')"
1.2 albertel 3515: src="../cgi-bin/mimetex.cgi?\normalsize f:x\longrightarrow~[0,1]"
1.1 albertel 3516: alt="" border=0 align=middle></a>. Without any intervening white space,
3517: mimeTeX would have "eaten" the [0,1]. </p>
3518:
3519: <p> Super/subscripts immediately following all long/Long left/right arrows
3520: are displayed the same way <a href="#modes">\limits</a> displays them,
3521: e.g., </p> <center>
3522: <b>x\longrightarrow^gy</b> produces
3523: <a href="#preview"><img id="arrows4" onclick="eqntext('arrows4')"
3524: src="../cgi-bin/mimetex.cgi?\large x\longrightarrow^gy"
3525: alt="" border=0 align=middle></a> <br>
3526: <b>x\longrightarrow[50]^gy</b> produces
3527: <a href="#preview"><img id="arrows5" onclick="eqntext('arrows5')"
3528: src="../cgi-bin/mimetex.cgi?\large x\longrightarrow[50]^gy"
3529: alt="" border=0 align=middle></a> </center> <p class="continue">
3530: Subscripted long arrows can occasionally be useful, too, as in
3531: <a href="#example11">Example 11</a> above, e.g., </p> <center>
3532: <b>u\longrightarrow[50]_\beta v</b> produces
3533: <a href="#preview"><img id="arrows6" onclick="eqntext('arrows6')"
3534: src="../cgi-bin/mimetex.cgi?\large u\longrightarrow[50]_\beta^{\,}v"
3535: alt="" border=0 align=middle></a> </center> <p class="continue">
3536: To defeat this default behavior, e.g., <b>\longrightarrow\nolimits^g</b>
3537: displays super/subscripts in the usual way. </p>
3538:
3539: <p> Super/subscripts immediately following all long/Long up/down arrows
3540: are treated correspondingly, i.e., superscripts are vertically
3541: centered to the arrow's left, and subscripts to its right.
3542: For example, </p> <center>
3543: <b>\longuparrow[30]^\gamma</b> produces
3544: <a href="#preview"><img id="arrows7" onclick="eqntext('arrows7')"
3545: src="../cgi-bin/mimetex.cgi?\large\longuparrow[30]^\gamma"
3546: alt="" border=0 align=middle></a> <br>
3547: <b>\longdownarrow[30]_\gamma</b> produces
3548: <a href="#preview"><img id="arrows8" onclick="eqntext('arrows8')"
3549: src="../cgi-bin/mimetex.cgi?\large\longdownarrow[30]_\gamma"
3550: alt="" border=0 align=middle></a> </center> <p class="continue">
3551: whose occasional usefulness is also illustrated by
3552: <a href="#example11">Example 11</a>. And as before, to defeat
3553: this default behavior, e.g., <b>\longuparrow\nolimits^\gamma</b>
3554: displays super/subscripts in the usual way. </p>
3555:
3556: <h3> <a name="raiserotate">\raisebox{ }{ } and
1.3 albertel 3557: \rotatebox{ }{ } and \reflectbox[ ]{ }
3558: <font size=5>...</font></a> </h3>
1.1 albertel 3559:
3560: <p> The <b>\raisebox{<i>height</i>}{<i>expression</i>}</b>
3561: and <b>\rotatebox{<i>angle</i>}{<i>expression</i>}</b>
1.3 albertel 3562: and <b>\reflectbox[<i>axis</i>]{<i>expression</i>}</b>
3563: commands help you fine-tune and manipulate mimeTeX renderings: </p>
3564: <ul>
3565: <li> <b>\raisebox</b>'s <b><i>height</i></b> argument is number
3566: of pixels, scaled by <a href="#unitlength">\unitlength</a>,
3567: and can be positive or negative. </li>
3568: <li> <b>\rotatebox</b>'s <b><i>angle</i></b> argument is number
3569: of degrees, and can also be positive (for clockwise) or
3570: negative, but must be a multiple of 90. </li>
3571: <li> <b>\reflectbox</b>'s optional <b><i>axis</i></b> argument
3572: defaults to 1 if not given, which reflects horizontally
3573: (the usual LaTeX behavior), or reflects vertically if
3574: specified as 2. </li>
3575: <li> For all three commands, the <b><i>expression</i></b>
3576: can be any valid LaTeX/mimeTeX expression. </li>
3577: </ul>
3578: <p> For example, mimeTeX's preprocessor
1.1 albertel 3579: defines the LaTeX <b>?`</b> symbol, an upside-down question
3580: mark, like </p> <center>
3581: <b>abc\raisebox{-2}{\rotatebox{180}?}def</b> produces
3582: <a href="#preview"><img id="raiserot1" onclick="eqntext('raiserot1')"
3583: src="../cgi-bin/mimetex.cgi?
3584: \large\rm abc\raiseb{-2}{\rotateb{180}{\LARGE?}}def"
3585: alt="" border=0 align=middle></a> </center>
1.3 albertel 3586: <p> Using <b>\reflectbox[2]{ }</b> instead of
3587: <b>\rotatebox{180}{ }</b> would result in the slightly
3588: different </p> <center>
3589: <b>abc\raisebox{-2}{\reflectbox[2]?}def</b> produces
3590: <a href="#preview"><img id="raiserot2" onclick="eqntext('raiserot2')"
3591: src="../cgi-bin/mimetex.cgi?
3592: \large\rm abc\raiseb{-2}{\reflectb[2]{\LARGE?}}def"
1.5 ! raeburn 3593: alt="" border=0 align="bottom"></a> </center>
1.1 albertel 3594:
3595: <h3> <a name="compose">\compose{ }{ }<font size=5>...</font></a></h3>
3596:
3597: <p class="continue">
3598: <b>\compose[<i>offset</i>]{<i>base</i>}{<i>overlay</i>}</b>
3599: superimposes the <b><i>overlay</i></b> expression on top of the
3600: <b><i>base</i></b> expression, displaying the result.
1.5 ! raeburn 3601: The superimposed <b><i>overlay</i></b> is centered, both
! 3602: horizontally and vertically, on the <b><i>base</i></b> image,
! 3603: with the composite image baseline
! 3604: <!-- the same as the <b><i>base</i></b>. -->
! 3605: completely ignored.
! 3606: That means the <b><i>base</i></b> remains positioned in your expression
! 3607: just as if it had been rendered alone, while the <b><i>overlay</i></b>
! 3608: is moved around, vertically as well as horizontally, to accommodate it.
! 3609: For example, </p> <center>
! 3610: <b>\compose{\LARGE O}{\normalsize c}</b> renders
1.1 albertel 3611: <a href="#preview"><img id="compose1" onclick="eqntext('compose1')"
3612: src="../cgi-bin/mimetex.cgi?\compose{\LARGE O}{\normalsize c}"
1.5 ! raeburn 3613: alt="" border=0 align="bottom"></a> </center>
! 3614:
! 3615: <p> Optionally, the <b><i>overlay</i></b> is horizontally
! 3616: <b><i>offset</i></b> by the specified number of pixels
! 3617: (positive offsets to the right, negative to the left).
! 3618: For example, </p> <center>
! 3619: <b>\compose[-4]{\LARGE O}{\normalsize c}</b> renders
! 3620: <a href="#preview"><img id="compose2" onclick="eqntext('compose2')"
! 3621: src="../cgi-bin/mimetex.cgi?\compose[-4]{\LARGE O}{\normalsize c}"
! 3622: alt="" border=0 align="bottom"></a> </center>
! 3623:
! 3624: <p> Vertical offset can be obtained using a <b>\raisebox</b>
! 3625: in either the <b><i>base</i></b> or <b><i>overlay</i></b>
! 3626: expression, or in both. (Although, note that
! 3627: <b>\compose{\raisebox{10}{<i>base</i>}}{<i>overlay</i>}</b>
! 3628: renders identically to
! 3629: <b>\raisebox{10}{\compose{<i>base</i>}{<i>overlay</i>}}</b>,
! 3630: so applying <b>\raisebox</b> to the <b><i>base</i></b>
! 3631: expression is typically unnecessary.)
! 3632: Vertical <b><i>overlay</i></b> offset is relative to the
! 3633: centered image, as discussed immediately above,
! 3634: i.e., <b>\compose{<i>base</i>}{\raisebox{0}{<i>overlay</i>}}</b>
! 3635: has no effect at all, and the <b><i>overlay</i></b> image
! 3636: remains centered on the <b><i>base</i></b>.
! 3637: For example, </p> <center>
! 3638: <b>abc\compose{\LARGE O}{\raisebox{5}{\normalsize c}}def</b>
! 3639: renders
! 3640: <a href="#preview"><img id="compose3" onclick="eqntext('compose3')"
! 3641: src="../cgi-bin/mimetex.cgi?
! 3642: abc\compose{\LARGE O}{\raisebox{5}{\normalsize c}}def"
! 3643: alt="" border=0 align="bottom"></a>, and <br>
! 3644: <b>abc\compose{\raisebox{10}{\LARGE O}}{\raisebox{-20}{\normalsize c}}def</b>
! 3645: renders
! 3646: <a href="#preview"><img id="compose3" onclick="eqntext('compose3')"
! 3647: src="../cgi-bin/mimetex.cgi?abc
! 3648: \compose{\raisebox{10}{\LARGE O}}{\raisebox{-20}{\normalsize c}}def"
! 3649: alt="" border=0 align="bottom"></a></center>
1.1 albertel 3650:
3651: <p> Separately or in some judicious combination, <b>\compose</b> and
1.5 ! raeburn 3652: <b>\raisebox</b> and <b>\rotatebox</b> and <b>\reflectbox</b>,
! 3653: discussed above, perhaps along with <b>\rule</b> and <b>\eval</b>
! 3654: discussed immediately below, may help you construct special symbols
! 3655: not "natively" available with mimeTeX's limited set of built-in font
! 3656: families. This can be especially useful in conjunction with the
! 3657: <a href="#newcommands">–DNEWCOMMANDS</a> compile-time
1.1 albertel 3658: <a href="#options">option</a> discussed above. </p>
3659:
1.3 albertel 3660: <h3> <a name="rule">\rule{ }{ }<font size=5>...</font></a></h3>
3661:
3662: <p class="continue">
3663: <b>\rule{<i>width</i>}{<i>height</i>}</b> behaves in the usual way,
3664: rendering a black rectangle <b><i>width</i></b> pixels wide and
3665: <b><i>height</i></b> pixels high, with its base on the established
3666: baseline. For example, </p> <center>
3667: <b>\frac12xyz\rule{10}{20}ghi</b> produces
3668: <a href="#preview"><img id="rule1" onclick="eqntext('rule1')"
3669: src="../cgi-bin/mimetex.cgi?\frac12xyz\rule{10}{20}ghi"
3670: alt="" border=0 align=middle></a> </center>
3671:
3672: <p> The mimeTeX version of <b>\rule</b> has an optional
3673: <b>[<i>lift</i>]</b> argument, so that its full form is
3674: <b>\rule[<i>lift</i>]{<i>width</i>}{<i>height</i>}</b>.
3675: <b><i>lift</i></b> moves the rule's baseline by the specified
3676: number of pixels, up if positive or down if negative.
3677: For example, </p> <center>
3678: <b>\frac12xyz\rule[5]{10}{20}ghi</b> produces
3679: <a href="#preview"><img id="rule2" onclick="eqntext('rule2')"
3680: src="../cgi-bin/mimetex.cgi?\frac12xyz\rule[5]{10}{20}ghi"
3681: alt="" border=0 align=middle></a> and <br>
3682: <b>\frac12xyz\rule[-15]{10}{20}ghi</b> produces
3683: <a href="#preview"><img id="rule3" onclick="eqntext('rule3')"
3684: src="../cgi-bin/mimetex.cgi?\frac12xyz\rule[-15]{10}{20}ghi"
3685: alt="" border=0 align=middle></a> </center>
3686:
1.5 ! raeburn 3687: <h3> <a name="evaluate">\eval{ }<font size=5>...</font></a> </h3>
! 3688:
! 3689: <p class="continue"> mimeTeX can evaluate arithmetic expressions,
! 3690: which is a feature intended primarily for use in
! 3691: <a href="#newcommands">\newcommand's</a> discussed above.
! 3692: Expressions can be built up from the following elements </p>
! 3693: <ul>
! 3694: <li> digits <b>0</b>-<b>9</b>
! 3695: and numbers composed of uninterrupted (no whitespace)
! 3696: sequences of digits, </li>
! 3697: <li> binary operators
! 3698: <b>+</b>, <b>-</b>, <b>*</b>, <b>/</b>, <b>%</b>
! 3699: (<b>+</b> and <b>-</b> can be unary, preceding
! 3700: the first number in an expression, and <b>%</b> is
! 3701: the modulo operator), </li>
! 3702: <li> balanced <b>(</b> ... <b>)</b>
! 3703: parentheses nested to any level (see below), </li>
! 3704: <li> whitespace anywhere
! 3705: (except between digits comprising a number), </li>
! 3706: <li> One additional construction interpreted by <b>\eval{ }</b>
! 3707: is similar to (but not identical to) the
! 3708: <a href="http://wikipedia.org/wiki/Conditional_(programming)#As_a_ternary_operator"
! 3709: target="_top">?: conditional</a>, as follows.
! 3710: The expression <b>(i?v0:v1:v2:<i>etc</i>)</b>, usually
! 3711: parenthesized as illustrated, evaluates to <b>v0</b>
! 3712: if <b>i</b> evaluates to <b>0</b>, or evaluates to <b>v1</b>
! 3713: if <b>i</b> evaluates to <b>1</b>, etc. If <b>i < 0</b>
! 3714: then <b>v0</b> is used, and if <b>i</b> is too large, the last
! 3715: <b>v</b> is used. All components, <b>i</b> and all <b>v</b>'s,
! 3716: can themselves be expressions, even another
! 3717: <b>(i?v0:v1:v2:<i>etc</i>)</b>, which in this case must be
! 3718: parenthesized. The only situation where parentheses aren't
! 3719: required is when <b>i?v0:v1:v2:<i>etc</i></b> comprises
! 3720: your entire expression.
! 3721: For example, <br> <nobr>
! 3722: <b>\eval{1+2?10:11:12:13:14:15}</b> renders
! 3723: <a href="#preview"><img id="eval1" onclick="eqntext('eval1')"
! 3724: src="../cgi-bin/mimetex.cgi?\large\eval{1+2?10:11:12:13:14:15}"
! 3725: alt="" border=0 align=bottom></a></nobr></li>
! 3726: <li> and <u> most importantly, </u>
! 3727: the built-in variables<br>
! 3728: <b>fs</b> for current fontsize and<br>
! 3729: <b>unitlength</b> for unitlength<br>
! 3730: which provide the capability for useful constructions,
! 3731: as follows... </li>
! 3732: </ul>
! 3733:
! 3734: <p> All optional <b>[</b> <b>]</b> and mandatory
! 3735: <b>{</b> <b>}</b> numeric arguments for
! 3736: <a href="#rule">\rule[lift]{width}{height}</a>,
! 3737: <a href="#compose">\compose[offset]{ }{ }</a>,
! 3738: <a href="#raiserotate">\raisebox{height}{ }</a>,
! 3739: <a href="#raiserotate">\rotatebox{angle}{ }</a>, and
! 3740: <a href="#arrows">\longarrow[width]</a>
! 3741: can be expressions as described above, rather than just
! 3742: numeric constants. By using the <b>fs</b> variable, you can
! 3743: construct <a href="#newcommands">\newcommand</a>
! 3744: expressions that properly scale with font size.
! 3745: For example, the <b>\mapsto</b> symbol is not explicitly provided
! 3746: in any mimeTeX font, but is instead constructed by the
! 3747: embedded <a href="#newcommands">\newcommand</a><br>
! 3748: <nobr> <b>
! 3749: { "\\mapsto", NULL, "{\\rule[fs/2]{1}{5+fs}\\hspace{-99}\\to}" },</b>
! 3750: </nobr><br>
! 3751: where \rule's [lift]=fs/2 and {height}=5+fs are scaled by
! 3752: font size to render symbols<br>
! 3753:
! 3754: <a href="#preview"><img id="eval2" onclick="eqntext('eval2')"
! 3755: src="../cgi-bin/mimetex.cgi?\small\text\begin{array}{rrl}
! 3756: \backslash tiny & fs=\tiny\eval{fs} & \tiny\mapsto \\
! 3757: \backslash small & fs=\small\eval{fs} & \small\mapsto \\
! 3758: \backslash normalsize & fs=\normal\eval{fs} & \normal\mapsto\\
! 3759: \backslash large & fs=\large\eval{fs} & \large\mapsto \\
! 3760: etc. & &
! 3761: \end{array}" alt="" border=0 align=middle></a><br>
! 3762: whose rendering automatically varies appropriately with font size.
! 3763: This kind of <a href="#newcommands">\newcommand</a> construction
! 3764: is the primary use intended for mimeTeX's expression evaluation feature.
! 3765: </p>
! 3766:
! 3767: <p> But mimeTeX also provides the <b>\eval{<i>expression</i>}</b>
! 3768: command to make the expression evaluation feature render
! 3769: "visible" results. It's not particularly useful,
! 3770: but an expression like <b>1+2+3+4+5=\eval{1+2+3+4+5}</b>
! 3771: renders
! 3772: <a href="#preview"><img id="eval2" onclick="eqntext('eval2')"
! 3773: src="../cgi-bin/mimetex.cgi?\small 1+2+3+4+5=\eval{1+2+3+4+5}"
! 3774: alt="" border=0 align="bottom"></a>. </p>
! 3775:
! 3776: <p> Finally, one little "gotcha" is mimeTeX's
! 3777: order of evaluation when interpreting expressions.
! 3778: Parentheses are respected as you'd expect. But within
! 3779: <b>(</b>...<b>)</b> parentheses, or in an
! 3780: unparenthesized expression, mimeTeX finds the first (reading
! 3781: from the left) operator, then iteratively evaluates the
! 3782: separate subexpressions to that operator's left and to its right,
! 3783: and then finally combines those two separate results.
! 3784: So an expression like <b>2*3+4</b> renders <b>14</b>,
! 3785: and you need to write <b>(2*3)+4</b> to get <b>10</b>.
! 3786: </p>
! 3787:
! 3788:
! 3789: <h3> <a name="magstep"> \magstep{ } and
! 3790: \magbox{ }{ }<font size=5>...</font></a> </h3>
! 3791:
! 3792: <p class="continue">
! 3793: <b>\magstep{<i>magnification</i>}</b>, placed anywhere
! 3794: within an expression, magnifies the entire expression
! 3795: by an integer factor <b>1<=<i>magnification</i><=10</b>
! 3796: in both width and height.
! 3797: Each single pixel thus becomes a square box, <i>e.g.</i>,
! 3798: for <b><i>magnification</i>=2</b> each single pixel becomes
! 3799: a four-pixel square box with dimensions <b>2</b>-by-<b>2</b>.
! 3800: This compromises mimeTeX's anti-aliasing algorithm,
! 3801: and the resulting image is both hazy/blurry and jagged/staircased
! 3802: compared to an unmagnified image of the same expression.
! 3803: For example, at <b>\LARGE</b> size,<br>
! 3804: <nobr>  
! 3805: <b>f(x)=x^2</b>
! 3806: renders
! 3807: <a href="#preview"><img id="magbox1" onclick="eqntext('magbox1')"
! 3808: src="../cgi-bin/mimetex.cgi?\LARGE f(x)=x^2"
! 3809: alt="" border=0 align="absmiddle"></a> and </nobr><br>
! 3810: <nobr>  
! 3811: <b>\magstep{2} f(x)=x^2</b>
! 3812: renders
! 3813: <a href="#preview"><img id="magbox2" onclick="eqntext('magbox2')"
! 3814: src="../cgi-bin/mimetex.cgi?\LARGE\magstep{2} f(x)=x^2"
! 3815: alt="" border=0 align="absmiddle"></a> , whereas </nobr><br>
! 3816: at mimeTeX's largest "native" font size, <br>
! 3817: <nobr>  
! 3818: <b>\Huge f(x)=x^2</b>
! 3819: renders
! 3820: <a href="#preview"><img id="magbox3" onclick="eqntext('magbox3')"
! 3821: src="../cgi-bin/mimetex.cgi?\HUGE f(x)=x^2"
! 3822: alt="" border=0 align="absmiddle"></a> . </nobr><br>
! 3823: Nevertheless, if you still want to render images larger than
! 3824: mimeTeX's <b>\Huge</b> size, then <b>\magstep{<i>magnification</i>}</b>
! 3825: may render almost-acceptable results. </p>
! 3826:
! 3827: <p> To magnify just part of an expression,
! 3828: you can use <b>\magbox{<i>magnification</i>}{<i>expression</i>}</b>,
! 3829: which only magnifies each pixel within the enclosed
! 3830: <b>{<i>expression</i>}</b>, again
! 3831: by an integer factor <b>1<=<i>magnification</i><=10</b>
! 3832: in both width and height, and also adjusts the baseline accordingly.
! 3833: But <b>\magbox</b> is applied directly to mimeTeX's black-and-white
! 3834: bitmap <u><b><i> before anti-aliasing </i></b></u>.
! 3835: At the present time, this virtually completely defeats
! 3836: mimeTeX's anti-aliasing algorithm, and the resulting image
! 3837: exhibits even more pronounced jagged-line/staircase effects.
! 3838: For example, <br>
! 3839: <nobr>  
! 3840: <b>\LARGE f(x)={\magbox{2}{x}}^2</b>
! 3841: renders
! 3842: <a href="#preview"><img id="magbox5" onclick="eqntext('magbox5')"
! 3843: src="../cgi-bin/mimetex.cgi?\LARGE f(x)={\magbox{2}{x}}^2"
! 3844: alt="" border=0 align="absmiddle"></a>.<br>
! 3845: </p>
! 3846:
1.1 albertel 3847: <h3> <a name="abbreviations">Abbreviations<font size=5>...</font></a> </h3>
3848:
3849: <p class="continue">
3850: <b>\ga</b> displays <b>\gamma</b>, but just <b>\g</b> displays
3851: <b>\gg</b> (<b>>></b>). That is, mimeTeX selects the
3852: shortest symbol or command which begins with whatever you type.
3853: This feature can help shorten an otherwise very long line,
3854: but it may be a bit dangerous. </p>
3855:
3856: <p> The mimeTeX <a href="#symbols">preprocessor</a>, briefly mentioned
3857: above, is responsible for recognizing several LaTeX symbols like
3858: <b>\ldots</b> and several commands like <b>\atop</b> .
3859: These symbols and commands cannot be abbreviated. The special
3860: html characters like <b>&nbsp;</b> are also recognized by
3861: the preprocessor and cannot be abbreviated. </p>
3862:
3863: <h3> <a name="colors">Colors<font size=5>...</font></a> </h3>
3864:
3865: <p> Rudimentary color commands are provided by mimeTeX. You can write
3866: <b>\color{red}</b> or <b>\color{green}</b> or<b>\color{blue}</b>
3867: (which may be abbreviated <b>\red</b> or <b>\green</b> or
3868: <b>\blue</b>) anywhere in an expression to render the entire
3869: expression in the specified color. That is,
3870: <b>abc{\red def}ghi</b> renders the entire expression red,
3871: not just the <b>def</b> part. Also, note that mimeTeX's "green"
3872: is actually color <b>#00FF00</b>, which the html standard more
3873: accurately calls "lime". For example, </p> <center>
3874: <b>\blue e^x=\sum_{n=0}^\infty\frac{x^n}{n!}</b> produces
3875: <a href="#preview"><img id="colors1" onclick="eqntext('colors1')"
3876: src="../cgi-bin/mimetex.cgi?
3877: \Large\color{blue} e^x=\sum_{n=0}^\infty\frac{x^n}{n!}"
3878: alt="" border=0 align=middle></a> </center>
3879:
1.2 albertel 3880: <h3> <a name="smash">"Smash"<font size=5>...</font></a> </h3>
1.1 albertel 3881:
3882: <p> TeX represents characters by boxes, with no idea how ink will be
3883: distributed inside. So an expression like
3884: <b>\frac12\int_{a+b+c}^{d+e+f}g(x)dx</b> is typically rendered as
1.2 albertel 3885: <a href="#preview"><img id="smash1" onclick="eqntext('smash1')"
3886: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
3887: \nosmash\frac12\int_{a+b+c}^{d+e+f}{g(x)dx}"
1.1 albertel 3888: alt="" border=0 align=middle></a>.
3889: But mimeTeX knows the character shapes of its fonts, and therefore tries
3890: to remove extra whitespace, rendering the same expression as
1.2 albertel 3891: <a href="#preview"><img id="smash2" onclick="eqntext('smash2')"
3892: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
3893: \smash\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
1.1 albertel 3894: alt="" border=0 align=middle></a> instead. </p>
3895:
1.2 albertel 3896: <p> Precede any expression with the mimeTeX directive <b>\nosmash</b>
3897: to render it without "smashing". Or compile mimetex.c with the
3898: <b>-DNOSMASH</b> <a href="#options">option</a> if you prefer
1.1 albertel 3899: the typical TeX behavior as mimeTeX's default. In this case,
1.2 albertel 3900: precede any expression with <b>\smash</b> to render it "smashed".
1.1 albertel 3901: And note that explicit space like <b>\hspace{10}</b>
1.2 albertel 3902: or <b>\;</b> , etc, is never smashed. </p>
1.1 albertel 3903:
1.2 albertel 3904: <p> The scope of <b>\smash</b> and <b>\nosmash</b> is the
1.1 albertel 3905: <b>{ }</b>-enclosed subexpression in which the directive occurs.
3906: For example, if you want the <b><i>g(x)</i></b> part of the
1.2 albertel 3907: preceding example smashed, but not the <b>1/2</b> part,
1.1 albertel 3908: then the expression
1.2 albertel 3909: <b>\nosmash\frac12{\smash\int_{a+b+c}^{d+e+f}g(x)dx}</b>
1.1 albertel 3910: renders as
1.2 albertel 3911: <a href="#preview"><img id="smash3" onclick="eqntext('smash3')"
3912: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
3913: \nosmash\frac12{\smash\int_{a+b+c}^{d+e+f}{g(x)dx}}"
1.1 albertel 3914: alt="" border=0 align=middle></a>.
3915: <!-- Moreover, explicit space like
1.2 albertel 3916: <b>\hspace{10}</b> or <b>\;</b>, etc, is never smashed.
1.1 albertel 3917: So <b>{\frac12\;\;}\int_{a+b+c}^{d+e+f}g(x)dx</b> renders as
1.2 albertel 3918: <a href="#preview"><img id="smash4" onclick="eqntext('smash4')"
3919: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
1.1 albertel 3920: {\frac12\;\;}\int_{a+b+c}^{d+e+f}{g(x)dx}"
3921: alt="" border=0 align=middle></a>. --> </p>
3922:
1.2 albertel 3923: <p> For finer-grained control, note that <b>\smash</b> is shorthand
3924: for the default <b>\smashmargin{+3}</b> (and <b>\nosmash</b> is
3925: shorthand for <b>\smashmargin{0}</b>). <b>\smashmargin</b>'s value
3926: is the minimum number of pixels between smashed symbols. The leading
3927: <b>+</b> is optional. If present, the font size (\tiny=0,...,\Huge=7)
1.1 albertel 3928: is added to the specified minimum. Compile mimetex.c with the
1.2 albertel 3929: <b>-DSMASHMARGIN=<i>n</i></b> <a href="#options">option</a> to change
1.1 albertel 3930: the default from <b>3</b> to <b><i>n</i></b>. Compare the preceding
1.2 albertel 3931: example with the over-smashed <b>\smashmargin{1}</b>
3932: <a href="#preview"><img id="smash5" onclick="eqntext('smash5')"
3933: src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
3934: \smashmargin1\frac12\int_{a+b+c}^{d+e+f}{g(x)}dx"
1.1 albertel 3935: alt="" border=0 align=middle></a> instead. </p>
3936:
1.2 albertel 3937: <p> Smashing is in "beta testing" and some expressions still don't look
3938: quite right when smashed, e.g., <b>1^2,2^2,3^2,\ldots</b> renders as
3939: <a href="#preview"><img id="smash6" onclick="eqntext('smash6')"
1.1 albertel 3940: src="../cgi-bin/mimetex.cgi?\Large1^2,2^2,3^2,\ldots"
1.2 albertel 3941: alt="" border=0 align=middle></a>. Just compile with <b>-DNOSMASH</b>
1.1 albertel 3942: if you come across numerous annoying situations. </p>
3943:
1.2 albertel 3944: <h3> <a name="not">\not and \cancel and \sout<font size=5>...</font></a> </h3>
1.1 albertel 3945:
3946: <p> The usual LaTeX <b>\not</b> "slashes" the single symbol
3947: following it, e.g., <b>i\not\partial\equiv i\not\nabla</b>
3948: produces <a href="#preview">
3949: <img id="not1" onclick="eqntext('not1')"
1.2 albertel 3950: src="../cgi-bin/mimetex.cgi?\normalsize i\not\partial\equiv i\not\nabla"
1.1 albertel 3951: alt="" border=0 align=middle></a>. </p>
3952:
1.2 albertel 3953: <p> For arbitrary expressions, mimeTeX provides <b>\cancel</b>
1.1 albertel 3954: which draws a line from the upper-right to lower-left corner of its
1.2 albertel 3955: argument, e.g., <b>a\cancel{x^2}=bx^{\not3}</b> produces
1.1 albertel 3956: <a href="#preview"><img id="not2" onclick="eqntext('not2')"
1.2 albertel 3957: src="../cgi-bin/mimetex.cgi?\large a\cancel{x^2}=bx^{\not3}"
1.1 albertel 3958: alt="" border=0 align=bottom></a>. </p>
3959:
3960: <p> Finally, similar to the <b>ulem.sty</b> package, <b>\sout</b>
3961: draws a horizontal strikeout line through its argument,
3962: e.g., <b>\sout{abcdefg}</b> produces <a href="#preview">
3963: <img id="not3" onclick="eqntext('not3')"
1.2 albertel 3964: src="../cgi-bin/mimetex.cgi?\normalsize\sout{abcdefg}"
1.1 albertel 3965: alt="" border=0 align=middle></a>. MimeTeX's <b>\sout</b> also
3966: takes an optional argument that adjusts the vertical position of its
3967: strikeout line by the specified number of pixels, e.g.,
3968: <b>\sout[+2]{abcdefg}</b> produces <a href="#preview">
3969: <img id="not4" onclick="eqntext('not4')"
1.2 albertel 3970: src="../cgi-bin/mimetex.cgi?\normalsize\sout[+2]{abcdefg}"
1.1 albertel 3971: alt="" border=0 align=middle></a> and
3972: <b>\sout[-2]{abcdefg}</b> produces
3973: <a href="#preview"><img id="not5" onclick="eqntext('not5')"
1.2 albertel 3974: src="../cgi-bin/mimetex.cgi?\normalsize\sout[-2]{abcdefg}"
1.1 albertel 3975: alt="" border=0 align=middle></a>. </p>
3976:
3977:
3978: <h2> <a name="array"> (IIIe) \begin{array}{lcr}...\end{array} Environment
3979: </a> </h2>
3980:
3981: <p> Rendering vectors and matrices, aligning equations, etc, is all done
3982: using the customary LaTeX environment
3983: <b>\begin{array}{lcr} a&b&c\\d&e&f\\etc \end{array}</b>
3984: which you can write in exactly that form. MimeTeX also
3985: recognizes the following array-like environments </p>
3986: <center> <table cellpadding="1" cellspacing="1">
3987: <tr> <td align="left"> <b>\begin{array}{lcr}</b> </td>
3988: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
3989: <td align="left"> <b>\end{array}</b> </td> </tr>
3990: <tr> <td align="left"> <b>\begin{matrix}</b> </td>
3991: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
3992: <td align="left"> <b>\end{matrix}</b> </td> </tr>
1.5 ! raeburn 3993: <tr> <td align="left"> <b>\begin{tabular}</b> </td>
! 3994: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
! 3995: <td align="left"> <b>\end{tabular}</b> </td> </tr>
1.1 albertel 3996: <tr> <td align="left"> <b>\begin{pmatrix}</b> </td>
3997: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
3998: <td align="left"> <b>\end{pmatrix}</b> </td> </tr>
3999: <tr> <td align="left"> <b>\begin{bmatrix}</b> </td>
4000: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
4001: <td align="left"> <b>\end{bmatrix}</b> </td> </tr>
4002: <tr> <td align="left"> <b>\begin{Bmatrix}</b> </td>
4003: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
4004: <td align="left"> <b>\end{Bmatrix}</b> </td> </tr>
4005: <tr> <td align="left"> <b>\begin{vmatrix}</b> </td>
4006: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
4007: <td align="left"> <b>\end{vmatrix}</b> </td> </tr>
4008: <tr> <td align="left"> <b>\begin{Vmatrix}</b> </td>
4009: <td align="center"> <b>a&b&c \\ d&e&f \\ etc</b> </td>
4010: <td align="left"> <b>\end{Vmatrix}</b> </td> </tr>
4011: <tr> <td align="left"> <b>\begin{eqnarray}</b> </td>
4012: <td align="center"> <b>a&=&b \\ c&=&d \\ etc</b> </td>
4013: <td align="left"> <b>\end{eqnarray}</b> </td> </tr>
4014: <tr> <td align="left"> <b>\begin{align}</b> </td>
4015: <td align="center"> <b>a&=b \\ c&=d \\ etc</b> </td>
4016: <td align="left"> <b>\end{align}</b> </td> </tr>
1.3 albertel 4017: <tr> <td align="left"> <b>\begin{cases}</b> </td>
4018: <td align="center"> <b>a&b \\ c&d \\ etc</b> </td>
4019: <td align="left"> <b>\end{cases}</b> </td> </tr>
1.1 albertel 4020: <tr> <td align="left"> <b>\begin{gather}</b> </td>
4021: <td align="center"> <b>a \\ b \\ etc</b> </td>
4022: <td align="left"> <b>\end{gather}</b> </td> </tr>
4023: </table> </center> <p class="continue">
4024: There's a built-in maximum of 64 columns and 64 rows. Nested
4025: array environments, e.g.,
4026: <b>\begin{pmatrix}a&\begin{matrix}1&2\\3&4\end{matrix}\\c&d\end{pmatrix}</b>,
4027: are permitted. </p>
4028:
4029: <p> MimeTeX also provides the abbreviation
4030: <b>\array{lcr$a&b&c\\d&e&f\\etc}</b>
4031: which has exactly the same effect as
4032: <b>\begin{array}{lcr} a&b&c\\d&e&f\\etc \end{array}</b>.
4033: And the <b>lcr$</b> "preamble" in <b>\array{lcr$etc}</b> is optional.
4034: In that case, <b>\array{a&b&c\\d&e&f\\etc}</b>
4035: has exactly the same effect as
4036: <b>\begin{matrix} a&b&c\\d&e&f\\etc \end{matrix}</b>.
4037: You can also write <b>\(\array{etc}\)</b> to "manually abbreviate"
4038: the pmatrix environment, or <b>\array{rcl$etc}</b> to abbreviate
4039: eqnarray, but mimeTeX has no explicit abbreviations for these
4040: other environments. For example, </p> <center>
4041: <b>\begin{matrix}a_1&a_2&a_3\\b_1&b_2&b_3\\c_1&c_2&c_3\end{matrix}</b>
4042: produces
4043: <a href="#preview"><img id="array1" onclick="eqntext('array1')"
4044: src="../cgi-bin/mimetex.cgi?\large\begin{matrix}a_1&a_2&a_3\\
4045: b_1&b_2&b_3\\c_1&c_2&c_3\end{matrix}"
4046: alt="" border=0 align=middle></a> </center>
4047:
4048: <p> Solid <b>\hline</b>'s (but not \cline's) and vertical <b>l|c|r</b> bars
4049: are available, as usual. For dashed lines and bars,
4050: <b>\begin{array}</b> provides the additional features <b>\hdash</b>
4051: and <b>l.c.r</b> . <b>\hline</b> and <b>\hdash</b> may not be
4052: abbreviated. For example, </p> <center>
4053: <b>\begin{array}{c.c|c} a_1&a_2&a_3 \\\hdash b_1&b_2&b_3 <br>
4054: \\\hline c_1&c_2&c_3 \end{array}</b> produces <br>
4055: <a href="#preview"> <img id="array22" onclick="eqntext('array22')"
4056: src="../cgi-bin/mimetex.cgi?\large\begin{array}{c.c|c}
4057: a_1&a_2&a_3\\\hdash b_1&b_2&b_3\\\hline c_1&c_2&c_3\end{array}"
4058: alt="" border="0" align="middle"> </a> </center>
4059:
4060: <p> The default font size is unchanged by <b>\array{ }</b>, but you
4061: can explicitly control it in the usual way, e.g.,
1.2 albertel 4062: <b>{\Large\begin{matrix}...\end{matrix}}</b> renders the entire array
4063: in font size 4. In addition, any <b>&...&</b> cell may contain font
1.1 albertel 4064: size declarations which are always local to that cell,
4065: e.g., <b>&\fs{-1}...&</b> renders that one cell one font size smaller
4066: than current. </p>
4067:
4068: <p> The <b>{lcr}</b> in <b>\begin{array}{lcr}</b> sets left,center,right
4069: <i>"horizontal justification"</i> down columns of an array,
4070: as usual. And "vertical justification" across rows defaults
4071: to what we'll call <b><i>baseline</i></b>, i.e., aligned equations,
4072: as in <a href="#example10">Example 10</a> above, display properly.
4073: But the down arrows (for
4074: <a href="#preview"><img id="array3" onclick="eqntext('array3')"
4075: src="../cgi-bin/mimetex.cgi?\small\array{C$\gamma&\Large\downarr}"
4076: alt="" border=0 align=middle></a> and for
4077: <a href="#preview"><img id="array4" onclick="eqntext('array4')"
4078: src="../cgi-bin/mimetex.cgi?\small\array{C$\Large\downarr&\beta}"
4079: alt="" border=0 align=middle></a>)
4080: in <a href="#example11">Example 11</a> require
4081: <i>"vertical centering"</i> across the middle row of that
4082: array. So, in addition to lowercase <b>lcr</b>, mimeTeX's <b>{lcr}</b>
4083: in <b>\begin{array}{lcr}</b> may also contain uppercase <b>BC</b> to
4084: set "<b>B</b>"aseline or "<b>C</b>"enter vertical justification across
4085: the corresponding rows. For example, <b>\begin{array}{rccclBCB}</b>
4086: sets baseline justification for the first and third rows, and center
4087: justification for the second row. Without any <b>BC</b>'s,
4088: all rows default to the usual <b>B</b> baseline justification. </p>
4089:
4090: <p> MimeTeX has no <b>\arraycolsep</b> or <b>\arraystretch</b> parameters.
4091: Instead, <b>\begin{array}{lc25rB35C}</b> sets the absolute width
4092: of the second column to 25 pixels, and the absolute height of the
4093: first row to 35 pixels, as illustrated by
4094: <a href="#example9">Example 9</a>. Any number following
4095: an <b>lcrBC</b> specification sets the width of that one column
4096: (for <b>lcr</b>), or the height of that one row (for <b>BC</b>). <br>
4097: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
4098: You can optionally precede the number with a <b>+</b> sign,
4099: which "propagates" that value forward to all subsequent columns for
4100: <b>lcr</b>, or all subsequent rows for <b>BC</b>. For example,
4101: <b>\begin{array}{lc+25rB+35C}</b> sets the absolute width of
4102: column 2 and all subsequent columns to 25 pixels,
4103: and the absolute height of row 1 and all subsequent rows
4104: to 35 pixels. After absolute sizing has been set, the special
4105: value <b>0</b> reverts to automatic sizing for that one row or
4106: column, and <b>+0</b> reverts to automatic sizing for all subsequent
4107: rows or columns. For example, <b>\begin{array}{c+25ccc+35ccc+0}</b>
4108: sets the absolute widths of columns 1-3 to 25 pixels,
4109: columns 4-6 to 35 pixels, and then reverts to automatic
4110: sizing for columns 7 and all subsequent columns. <br>
4111: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
4112: The "propagation" introduced by <b>+</b> is local to the
4113: <b>\begin{array}</b> in which it occurs. So you have to repeat
4114: the same specifications if you want rows aligned across several
4115: arrays on the same line (or columns aligned on several lines
4116: separated by <b>\\</b>). Instead, a lowercase <b>g</b> globally
4117: copies your column specifications to all subsequent arrays,
4118: and an uppercase <b>G</b> globally copies your row specifications.
4119: And <b>gG</b> copies both column and row specifications. For example,
4120: <b>\begin{array}{GC+25}</b> sets the height of all rows in this
4121: array to 25 pixels, and ditto for all subsequent arrays to its right.
4122: Explicit specifications in subsequent arrays override previous global
4123: values. <br>
4124: <img src="../cgi-bin/mimetex.cgi?\hspace{35}" alt="" border=0>
4125: Click one of the following examples to see illustrations
4126: of the above discussion: </p> <center>
4127: <a href="#preview"> <img id="array31" onclick="eqntext('array31')"
4128: src="../cgi-bin/mimetex.cgi?\large
4129: \left( \begin{array}{GC+30}
4130: \cos\frac\theta2 & i\,\sin\frac\theta2\\
4131: i\,\sin\frac\theta2 & \cos\frac\theta2 \end{array} \right)
4132: \left( \begin{array}
4133: z & x_{\tiny-} \\ x_{\tiny+} & -z \end{array} \right)
4134: \hfill{300}\text{\normalsize Example 1}"
4135: alt="" border="0" align="middle"> </a> <br>
4136: <a href="#preview"> <img id="array32" onclick="eqntext('array32')"
4137: src="../cgi-bin/mimetex.cgi?\large
4138: \left( \begin{array}{GC+30gc+40}
4139: \cos\frac\theta2 & i\,\sin\frac\theta2 \\
4140: i\,\sin\frac\theta2 & \cos\frac\theta2 \end{array} \right)
4141: \left( \begin{array}
4142: z & x_{\tiny-} \\ x_{\tiny+} & -z \end{array} \right)
4143: \hfill{300}\text{\normalsize Example 2}"
4144: alt="" border="0" align="middle"> </a> </center>
4145:
4146: <p> See <a href="#example8">Examples 8-11</a> above for several
4147: additional <b>\begin{array}{lcr}</b> applications. </p>
4148:
4149:
4150: <h2> <a name="picture"> (IIIf) \picture( ){ } "Environment",
4151: including \line( ){ } and \circle( ) </a> </h2>
4152:
4153: <p> Besides <b>\begin{array}{lcr}</b>, mimeTeX also tries to emulate the
4154: familiar LaTeX picture environment with the somewhat similar<br>
4155: <b> \picture(width[,height])
4156: { (loc1){pic_elem1} (loc2){pic_elem2} ... }</b><br>
4157: as illustrated by <a href="#example12">Examples 12-13</a> above.
4158: Arguments surrounded by <b>[ ]</b>'s are optional.
4159: If the optional <b>[,height]</b> is omitted, then <b>height=width</b>
4160: is assumed. Locations <b>(loc1)</b> and <b>(loc2) ...</b> each
4161: denote either a <b>\put(loc)</b> or a <b>\multiput(loc)</b>,
4162: and each location is of the form <b>([c]x,y[;xinc,yinc[;num]])</b>. </p>
4163:
4164: <p> A <b>\put(loc)</b> is denoted by a location of the form <b>([c]x,y)</b>
4165: where <b>x,y</b> denotes the coordinate where the lower-left corner
4166: of the subsequent picture_element will be placed, unless the letter
4167: <b>c</b> precedes the <b>x</b>-number, in which case <b>cx,y</b>
4168: denotes the center point instead. The very lower-left corner of the
4169: entire picture is always <b>0,0</b>, and the upper-right corner is
4170: <b>width-1,height-1</b>. Note, for example, that you'd never want
4171: to specify location <b>c0,0</b> since the picture_element would be
4172: mostly out-of-bounds (only its upper-right quadrant would be
4173: in-bounds). </p>
4174:
4175: <p> A <b>\multiput(loc)</b> starts like a <b>\put(loc)</b>, but location
4176: <b>[c]x,y</b> is followed by <b>;xinc,yinc[;num]</b> indicating the
4177: <b>x,y-inc</b>rements applied to each of <b>num</b> repetitions
4178: of picture_element. If <b>;num</b> is omitted, repetitions continue
4179: until the picture_element goes out-of-bounds of the specified
4180: <b>width[,height]</b>. Note that <b>x,y</b> are always positive or
4181: zero, but <b>xinc,yinc</b> may be postive, zero or negative. </p>
4182:
4183: <p> The <b>\picture(,){...}</b> parameters <b>width, height, x, y, xinc,
4184: yinc</b> may be either integer or may contain a decimal point,
4185: and they're all scaled by <a href="#unitlength">\unitlength</a>.
4186: The <b>num</b> parameter must be integer. </p>
4187:
4188: <p> Picture_element's <b>{pic_elem1}</b> and <b>{pic_elem2} ...</b>
4189: may be any expressions recognized by mimeTeX, even including other
4190: <b>\picture</b>'s nested to any level. </p>
4191:
4192: <h3> <a name="circleline">\line( ){ } and
4193: \circle( )<font size=5>...</font></a> </h3>
4194:
4195: <p> To help draw useful picture_element's, mimeTeX provides several
4196: drawing commands, <b>\line(xinc,yinc)[{xlen}]</b> and
4197: <b>\circle(xdiam[,ydiam][;arc])</b>. Although primarily intended
4198: for use in <b>\picture</b>'s, you can use them in any mimeTeX
4199: expression, e.g., <b>abc\circle(20)def</b> produces
4200: <a href="#preview"><img id="circleline1" onclick="eqntext('circleline1')"
4201: src="../cgi-bin/mimetex.cgi?\large abc\circle(20)def"
4202: alt="" border="0" align="middle"></a>. </p>
4203:
4204: <p> Without its optional <b>{xlen}</b> parameter, the expression
4205: <b>(x,y){\line(xinc,yinc)}</b> draws a straight line from point
4206: <b>x,y</b> to point <b>x+xinc,y+yinc</b>. The <b>inc</b>'s
4207: can be positive, zero or negative. Don't prefix location <b>x,y</b>
4208: with a leading <b>c</b> for <b>\line</b>'s; the intended "corner"
4209: is determined by the signs of <b>xinc</b> and <b>yinc</b>.
4210: If given, the optional <b>{xlen}</b> parameter rescales the length
4211: of the line so its x-projection is <b>xlen</b> and its slope is
4212: unchanged. </p>
4213:
4214: <p> Without optional <b>,ydiam</b> and <b>;arc</b>, the expression
4215: <b>(x,y){\circle(xdiam)}</b> draws a circle of diameter <b>xdiam</b>
4216: centered at <b>x,y</b>. Don't prefix location <b>x,y</b> with a
4217: leading <b>c</b> for <b>\circle</b>'s; centering is assumed.
4218: If <b>,ydiam</b> is also given, then <b>(x,y){\circle(xdiam,ydiam)}</b>
4219: draws the ellipse inscribed in a rectangle of width <b>xdiam</b>
4220: and height <b>ydiam</b> centered at <b>x,y</b>. <br>
4221: Finally, <b>;arc</b> specifies the arc to be
4222: drawn, in one of two ways. An <b>;arc</b> argument given in the
4223: form <b>;1234</b> interprets each digit as a quadrant to be drawn,
4224: with <b>1</b> the upper-right quadrant and then proceeding
4225: counterclockwise, e.g., <b>\circle(12;34)</b> specifies the
4226: lower half of a circle whose diameter is twelve. <br>
4227: Alternatively, an <b>;arc</b> argument given in
4228: the form <b>45,180</b> or <b>-60,120</b> specifies the endpoints of
4229: the desired arc in degrees, with <b>0</b> the positive x-axis and
4230: then proceeding counterclockwise. The first number must always
4231: be smaller than the second (negative numbers are allowed), and the
4232: arc is drawn counterclockwise starting from the smaller number. </p>
4233:
4234: <p> Besides <a href="#example12">Examples 12-13</a> above,
4235: it's hard to resist illustrating<br>
4236: <font size=4><b>
4237: \unitlength{.6} \picture(100) {<br>
4238:
4239: (50,50){\circle(99)} %%head%%<br>
4240:
4241: (20,55;50,0;2){\fs{+1}\hat\bullet} %%eyes%%<br>
4242:
4243: (50,40){\bullet} %%nose%%<br>
4244:
4245: (50,35){\circle(50,25;34)} %%upper lip%%<br>
4246:
4247: (50,35){\circle(50,45;34)} %%lower lip%% }</b></font></p>
4248: <center>
4249: <a href="#preview"><img id="circleline2" onclick="eqntext('circleline2')"
1.2 albertel 4250: src="../cgi-bin/mimetex.cgi?\normalsize\unitlength{.6}\picture(100){
1.1 albertel 4251: (50,50){\circle(99)} (20,55;50,0;2){\fs{+1}\hat\bullet} (50,40){\bullet}
4252: (50,35){\circle(50,25;34)} (50,35){\circle(50,45;34)}}"
4253: alt="" border=0 align=middle></a><br>Have a nice day!</center>
4254:
4255:
4256: <h2> <a name="commands"> (IIIg) Other mimeTeX Commands </a> </h2>
4257:
4258: <p> Various and sundry other LaTeX-like commands are also provided
4259: by mimeTeX. In addition to features explicitly discussed below,
4260: mimeTeX supports the usual sub<b>_</b>scripts and super<b>^</b>scripts,
4261: and most of the typical LaTeX commands, many already discussed
4262: above, including </p>
4263: <ul>
4264: <li> <b>\frac{ }{ }</b> and <b>{ \over }</b> </li>
4265: <li> <b>{ \atop }</b> and <b>{ \choose }</b> </li>
4266: <li> <b>\sqrt{ }</b> </li>
4267: <li> <b>\lim_{ }</b> and all the usual LaTeX function names </li>
4268: <li> <b>\hat{ }</b> and <b>\widehat{ }</b>
4269: and many of the usual LaTeX accents </li>
4270: <li> <b>\overbrace{ }^{ }</b> and
4271: <b>\underbrace{ }_{ }</b> </li>
4272: <li> <b>\overline{ }</b> and <b>\underline{ }</b> </li>
4273: </ul> <p class="continue">
4274: All these typical commands should behave as they usually do
4275: in LaTeX, and won't be discussed further. Short discussions
4276: of some other commands follow. </p>
4277:
1.3 albertel 4278: <h3> <a name="stackrel">\overset{ }{ } or
4279: \stackrel{ }{ } and
4280: \underset{ }{ } or \relstack{ }{ }
4281: <font size=5>...</font></a> </h3>
1.1 albertel 4282:
4283: <p class="continue">
4284: <b>\stackrel{ }{ }</b> behaves as usual in LaTeX,
4285: rendering its first argument one font size smaller and centered above
4286: its second. And the amsmath-style <b>\overset{ }{ }</b> is
4287: identical. For example, </p> <center>
1.3 albertel 4288: <b>"\vec x\overset{\rm def}=(x_1\ldots x_n)"</b>
1.1 albertel 4289: produces
4290: <a href="#preview"><img id="stackrel1" onclick="eqntext('stackrel1')"
4291: src="../cgi-bin/mimetex.cgi?
1.3 albertel 4292: \Large\vec x\,\overset{\small\rm def}=
1.1 albertel 4293: \,(x_1\ldots x_n)" alt="" border=0 align=middle></a> </center>
4294:
4295: <p> "Conversely" to <b>\stackrel{ }{ }</b>, mimeTeX provides
4296: <b>\relstack{ }{ }</b>, which renders its second argument
4297: one font size smaller and centered below its first.
4298: And the amsmath-style <b>\underset{ }{ }</b> renders its
4299: first argument one font size smaller and centered below its second.
4300: For example, the <b>\log</b> function name doesn't treat
4301: limits like <b>\lim_</b>, but you can write, for example, </p> <center>
1.3 albertel 4302: <b>"\underset{\rm base 2}\log32=5"</b> to render
1.1 albertel 4303: <a href="#preview"><img id="stackrel2" onclick="eqntext('stackrel2')"
4304: src="../cgi-bin/mimetex.cgi?
1.3 albertel 4305: \Large\underset{\small\rm base 2}\log32\,=\,5"
1.1 albertel 4306: alt="" border=0 align=middle></a> </center>
4307:
4308: <p> MimeTeX's <b>\limits</b> provides an easier but non-standard
4309: alternative to achieve the same effect. For example, </p> <center>
4310: <b>"\vec x =\limits^{\rm def} (x_1\ldots x_n)"</b>
4311: produces
4312: <a href="#preview"><img id="stackrel3" onclick="eqntext('stackrel3')"
4313: src="../cgi-bin/mimetex.cgi?\Large\vec x\,=\limits^{\small\rm def}
4314: \,(x_1\ldots x_n)" alt="" border=0 align=middle></a> <br><br>
4315: and <b>"\log\limits_{\rm base 2}32=5"</b>
4316: produces
4317: <a href="#preview"><img id="stackrel4" onclick="eqntext('stackrel4')"
4318: src="../cgi-bin/mimetex.cgi?
4319: \Large\log\limits_{\small\rm base 2}32\,=\,5"
4320: alt="" border=0 align=middle></a> </center>
4321:
4322: <h3> <a name="fbox">\fbox{ }<font size=5>...</font></a> </h3>
4323:
4324: <p> In case html border attributes aren't suitable, mimeTeX provides
4325: the usual <b>\fbox{<i>expression</i>}</b> command, e.g., </p> <center>
4326: <b>"\fbox{x=\frac12}"</b> produces
4327: <a href="#preview"><img id="fbox1" onclick="eqntext('fbox1')"
1.2 albertel 4328: src="../cgi-bin/mimetex.cgi?\Large\fbox{x=\frac12}"
1.1 albertel 4329: alt="" border=0 align=middle></a> </center>
4330:
4331: <p> You can also write <b>\fbox[<i>width</i>]{<i>expression</i>}</b>
4332: to explicitly set the box's width, or you can write
4333: <b>\fbox[<i>width</i>][<i>height</i>]{<i>expression</i>}</b>
4334: to explicitly set both width and height. </p>
4335:
1.2 albertel 4336: <h3> <a name="today">\today and \calendar<font size=5>...</font></a> </h3>
4337:
4338: <p class="continue"> <b>\today</b> renders
4339: <a href="#preview"><img id="today1" onclick="eqntext('today1')"
4340: src="../cgi-bin/mimetex.cgi?\normalsize\today"
4341: border=0 align=middle></a>
4342: in the usual LaTeX text mode way.
4343: That's <b>\today</b>'s default format#1. MimeTeX has
4344: an optional format argument so that, for example,
4345: <b>\blue\today[2]</b> renders
4346: <a href="#preview"><img id="today2" onclick="eqntext('today2')"
4347: src="../cgi-bin/mimetex.cgi?\normalsize\blue\today[2]"
4348: border=0 align=middle></a>,
4349: showing both date and time. And
4350: <b>\red\today[3]</b> renders
4351: <a href="#preview"><img id="today3" onclick="eqntext('today3')"
4352: src="../cgi-bin/mimetex.cgi?\normalsize\red\today[3]"
4353: border=0 align=bottom></a>,
4354: showing time only. </p>
4355:
4356: <p> To accommodate time zones, you may also write, for example,
4357: <b>\small\blue\today[2,+3]</b>, which renders
4358: <a href="#preview"><img id="today4" onclick="eqntext('today4')"
4359: src="../cgi-bin/mimetex.cgi?\small\blue\today[2,+3]"
4360: border=0 align=middle></a>,
4361: adding three hours to format#2.
4362: The arguments may be in either order. The time zone increment
4363: must always be preceded by either <b>+</b> or <b>-</b>,
4364: and must be in the range <b>-</b>23 to <b>+</b>23. </p>
4365:
4366: <p class="continue"> <b>\calendar</b> renders a calendar for
4367: the current month, as illustrated by the left-hand image below.
4368: For a different month, the optional argument  
4369: <b>\small\blue\calendar[2001,9]</b> renders the right-hand
4370: image, for the requested year and month. Years must be
4371: 1973<b>...</b>2099 and months must be 1<b>...</b>12. </p>
4372: <center>
4373: <a href="#preview"><img id="today5" onclick="eqntext('today5')"
4374: src="../cgi-bin/mimetex.cgi?\normalsize\calendar"
4375: border=0 align=middle> </a>
4376: <a href="#preview"><img id="today6" onclick="eqntext('today6')"
4377: src="../cgi-bin/mimetex.cgi?\small\blue\calendar[2001,9]"
4378: border=0 align=middle> </a> </center>
4379:
4380: <p> The default calendar emphasizes the current day of the current month,
4381: while any other month emphasizes no day. Day emphasis is controlled
4382: by an optional third argument. <b>\calendar[0,0,1]</b>
4383: emphasizes the first day of the current month, and
4384: <b>\calendar[2001,9,11]</b> emphasizes the eleventh
4385: day of that month. <b>\calendar[0,0,99]</b>
4386: renders the current month with no day emphasized. </p>
4387:
1.1 albertel 4388: <h3> <a name="input">\input{ }<font size=5>...</font></a> </h3>
4389:
4390: <p class="continue">
4391: <b>\input{<i>filename</i>}</b> behaves just like the corresponding
4392: LaTeX command, reading the entire contents of <b><i>filename</i></b>
4393: into your expression at the point where the <b>\input</b> command
4394: occurs. By default, <b><i>filename</i></b> resides in the same
4395: directory as mimetex.cgi. Moreover, for security, absolute paths
4396: with leading <b>/</b>'s or <b>\</b>'s, and paths with <b>../</b>'s
4397: or <b>..\</b>'s, are not permitted. See the <b>-DPATHPREFIX</b>
4398: <a href="#options">compile option</a>, discussed above,
4399: if you want <b>\input</b> files in some other directory.
4400: In any case, if <b><i>filename</i></b> isn't found, then
4401: <b>\input</b> tries to read <b><i>filename</i>.tex</b> instead.</p>
4402:
1.5 ! raeburn 4403: <p> And for further security, <b>\input{ }</b> is disabled by default
! 4404: unless mimeTeX is compiled with either the <b>-DINPUTOK</b> or
! 4405: <b>-DINPUTPATH</b> or <b>-DINPUTREFERER</b>
! 4406: <a href="#options">compile option</a> discussed above.
! 4407: When it's disabled, the command <b>\input{<i>filename</i>}</b>
! 4408: renders the error message
! 4409: <b>[\input{<i>filename</i>} not permitted]</b> . </p>
! 4410:
1.1 albertel 4411: <p> MimeTeX also supports the optional form
4412: <b>\input{<i>filename:tag</i>}</b>. In this case,
4413: <b><i>filename</i></b> is read as before, but only those characters
4414: between <b><<i>tag</i>>...</<i>tag</i>></b> are placed
4415: into your expression. This permits you to have one file containing
4416: many different <b><<i>tag</i>></b>'s, e.g., one file containing
4417: all the questions and/or answers to a homework assignment or a quiz,
4418: etc. </p>
4419:
4420: <h3> <a name="counter">\counter[ ]{ }
4421: <font size=5>...</font></a> </h3>
4422:
4423: <p> The bottom-right corner of this page contains a page hit counter
4424: that's maintained using mimeTeX's
4425: <b>\counter[<i>logfile</i>]{<i>counterfile</i>:<i>tag</i>}</b>
4426: command. As with <b>\input</b>, described immediately above,
4427: both the required <b><i>counterfile</i></b> and the optional
4428: <b><i>logfile</i></b> are the names of files that reside in the
4429: same directory as your mimetex.cgi executable, unless you compiled
4430: mimetex with the <b>-DPATHPREFIX</b>
4431: <a href="#options">compile option</a>. Before using
4432: the <b>\counter</b> command, Unix "touch" and "chmod" those files
4433: so they're mimeTeX readable and writable. </p>
4434:
1.5 ! raeburn 4435: <p> Also as with <b>\input</b>, for security <b>\counter</b> is
! 4436: disabled by default unless mimeTeX is compiled with either
! 4437: the <b>-DINPUTOK</b> or the <b>-DCOUNTEROK</b>
! 4438: <a href="#options">compile option</a>
! 4439: (notice that <b>-DINPUTOK</b> also enables <b>\counter</b>).
! 4440: If you've compiled mimeTeX with <b>\counter</b> enabled,
! 4441: then it behaves as <nobr>follows...</nobr> </p>
! 4442:
1.1 albertel 4443: <p> If <b><i>counterfile</i></b> isn't readable and writable,
4444: then the <b>\counter</b> command always displays
4445: <b>1<sup><u>st</u></sup></b>. Otherwise, it maintains a
4446: line in <b><i>counterfile</i></b> of the form
4447: <b><<i>tag</i>> <i>value</i> </<i>tag</i>></b>
4448: where <b><i>value</i></b> is initialized as <b>1_</b> if the
4449: specified <b><<i>tag</i>></b> line doesn't already exist,
4450: and then incremented on each subsequent call. That trailing
4451: underscore on the value in the file, e.g., <b>99_</b>, tells
4452: mimeTeX to display <b>99<sup><u>th</u></sup></b> with an
4453: ordinal suffix. Edit the value in the file and remove the
4454: underscore if you don't want the ordinal suffix displayed.
4455: Finally, mimeTeX makes no effort to lock files or
4456: records (tags), so be careful using <b>\counter</b>
4457: if your hit rates are high enough so that frequent collisions
4458: are likely. </p>
4459:
4460: <p> The same <b><i>counterfile</i></b> can contain as many different
4461: <b><<i>tag</i>></b> lines as you like, so counters for
4462: all the pages on your site can be maintained in one file.
4463: MimeTeX also maintains a special <b><timestamp></b> tag
4464: in <b><i>counterfile</i></b> that logs the the date/time and
4465: name of the most recently updated tag. </p>
4466:
4467: <p> Somewhat more detailed log information can be accumulated in
4468: the optional <b><i>logfile</i></b>. If you provide that
4469: filename, mimeTeX writes a line to it of the form
1.4 riegler 4470: <b>2008-09-07:12:59:33pm <<i>tag</i>>=99 192.168.1.1 <i>http_referer</i></b>
1.1 albertel 4471: containing a timestamp, the counter tag and its current value,
4472: and the user's IP address and http_referer page if they're
4473: available. </p>
4474:
4475: <p> The page hit counter displayed at the bottom-right corner
4476: of this page is maintained by the command
4477: <b>\counter[counters.log]{counters.txt:mimetex.html}</b>.
4478: After compiling and installing your
4479: own mimetex.cgi and your own copy of this page, that counter will
4480: continually show <b>1<sup><u>st</u></sup></b>'s
4481: unless/until you "touch" and "chmod" counters.txt (and, optionally,
4482: counters.log) in your mimetex.cgi directory. </p>
4483:
1.5 ! raeburn 4484: <h3> <a name="environment">\environment
! 4485: <font size=5>...</font></a> </h3>
! 4486: <p> Submitting the expression <b>\environment</b>
! 4487: to mimeTeX renders </p> <center>
! 4488: <img id="environ1"
! 4489: src="../cgi-bin/mimetex.cgi?\nocaching\environment"
! 4490: align="middle" border=0> </center>
! 4491: <p class="continue"> displaying the http environment variables
! 4492: known to mimeTeX. This is primarily a programming aid,
! 4493: showing information available to mimeTeX that might facilitate
! 4494: future enhancements. </p>
! 4495:
! 4496: <p> As with <b>\input</b> and <b>\counter</b> above,
! 4497: for security <b>\environment</b> is
! 4498: disabled by default unless mimeTeX is compiled with either
! 4499: the <b>-DINPUTOK</b> or the <b>-DENVIRONOK</b>
! 4500: <a href="#options">compile option</a>
! 4501: (notice that <b>-DINPUTOK</b> also enables <b>\environment</b>). </p>
! 4502:
1.1 albertel 4503:
4504: <h2> <a name="exceptions"> (IIIh) Other Exceptions
4505: to LaTeX Syntax </a> </h2>
4506:
4507: <h3> Binding Exceptions<font size=5>...</font> </h3>
4508:
4509: <p> MimeTeX's bindings are pretty much left-to-right. For example,
4510: although mimeTeX correctly interprets <b>\frac12</b> as well as
4511: <b>\frac{1}{2}</b>, etc, the legal LaTeX expression <b>x^\frac12</b>
4512: must be written <b>x^{\frac12}</b>. Otherwise, mimeTeX interprets
4513: it as <b>{x^\frac}12</b>, i.e., the same way <b>x^\alpha12</b>
4514: would be interpreted, which is entirely wrong for <b>\frac</b>.
4515: The same requirement also applies to other combinations of commands,
4516: e.g., you must write <b>\sqrt{\frac\alpha\beta}</b>, etc. </p>
4517:
4518:
1.5 ! raeburn 4519: <h2> <a name="messages"> (IIIi) mimeTeX Errors
! 4520: and Messages </a> </h2>
! 4521:
! 4522: <h3> mimeTeX Errors<font size=5>...</font> </h3>
! 4523:
! 4524: <p> Any (La)TeX error is typically also a mimeTeX error.
! 4525: However, mimeTeX has no command line interface or
! 4526: <b>.</b>log file for reporting errors. Its only
! 4527: communication with you is through the mimeTeX image
! 4528: rendered by your browser. So error messages are embedded
! 4529: in that image whenever feasible. For example,
! 4530: suppose you want to see
! 4531: <a href="#preview"><img id="messages1" onclick="eqntext('messages1')"
! 4532: src="../cgi-bin/mimetex.cgi?\normalsize\alpha\beta\gamma\delta"
! 4533: border=0 align=bottom></a>, but you mistakenly type
! 4534: <b>\alpha\bethe\gamma\delta</b> instead.
! 4535: Then the image rendered is
! 4536: <a href="#preview"><img id="messages2" onclick="eqntext('messages2')"
! 4537: src="../cgi-bin/mimetex.cgi?\normalsize\alpha\bethe\gamma\delta"
! 4538: border=0 align=bottom></a>, indicating the unrecognized
! 4539: <b>[\bethe?]</b> where you wanted to type <b>\beta</b>
! 4540: and hoped to see
! 4541: <a href="#preview"><img id="messages3" onclick="eqntext('messages3')"
! 4542: src="../cgi-bin/mimetex.cgi?\normalsize\bf\beta"
! 4543: border=0 align=bottom></a>.
! 4544: If your expression contains some unprintable character
! 4545: (meaning any character mimeTeX has no bitmap for),
! 4546: then just
! 4547: <a href="#preview"><img id="messages4" onclick="eqntext('messages4')"
! 4548: src="../cgi-bin/mimetex.cgi?\small\bf[?]"
! 4549: border=0 align=bottom></a> is displayed in the
! 4550: corresponding position. </p>
! 4551:
! 4552: <p> The preceding example illustrates a pretty trivial error.
! 4553: Any non-trivial errors in your expression are likely to
! 4554: go unrecognized and unreported by mimeTeX, and to render
! 4555: unexpected images. While checking your input expression
! 4556: for syntax errors, keep in mind the following points
! 4557: about mimeTeX's behavior: </p>
! 4558: <ul>
! 4559: <li> An unmatched left brace <b>{</b> is matched
! 4560: by mimeTeX with a "phantom" right brace <b>}</b>
! 4561: that's imagined to be at the end of your expression. </li>
! 4562: <li> Likewise, an unmatched <b>\left(</b>,
! 4563: or <b>\left\{</b> or <b>\left\</b><i>anything</i>,
! 4564: is matched by mimeTeX with a "phantom" <b>\right.</b>
! 4565: at the end of your expression. </li>
! 4566: <li> On the other hand, an unmatched right brace <b>}</b>
! 4567: is displayed in place, as if you had typed \rbrace. </li>
! 4568: <li> But an unmatched <b>\right\</b><i>anything</i>
! 4569: is interpreted as an abbreviation for <b>\</b>rightarrow
! 4570: followed by <b>\</b><i>anything</i>. For example,
! 4571: <b>\leff( abc \right) def</b> renders
! 4572: <a href="#preview"><img id="messages5"
! 4573: onclick="eqntext('messages5')"
! 4574: src="../cgi-bin/mimetex.cgi?\small\leff(abc\right)def"
! 4575: border=0 align=bottom></a>. </li>
! 4576: </ul> <!-- p class="continue">
! 4577: </p -->
! 4578:
! 4579: <h3> mimeTeX Messages<font size=5>...</font> </h3>
! 4580:
! 4581: <!--
! 4582: <p> The special mimeTeX directive <b>\version</b>
! 4583: displays the following information </p>
! 4584: <center>
! 4585: <a href="#preview"><img id="messages6" onclick="eqntext('messages6')"
! 4586: src="../cgi-bin/mimetex.cgi?\version"
! 4587: border=0 align=middle> </a> </center>
! 4588: -->
! 4589: <p> The latest release of mimeTeX is version
! 4590: <a href="#preview"><img id="messages11" onclick="eqntext('messages11')"
! 4591: src="../cgi-bin/mimetex.cgi?\small\versionnumber"
! 4592: alt="" border=0 align="bottom"></a>
! 4593: which was last revised
! 4594: <a href="#preview"><img id="messages12" onclick="eqntext('messages12')"
! 4595: src="../cgi-bin/mimetex.cgi?\small\revisiondate"
! 4596: alt="" border=0 align="bottom"></a>.
! 4597: The special mimeTeX directive <b>\version</b>
! 4598: displays that same information, </p>
! 4599: <center>
! 4600: <a href="#preview"><img id="messages13" onclick="eqntext('messages13')"
! 4601: src="../cgi-bin/mimetex.cgi?\version"
! 4602: alt="" border=0 align=middle></a> </center>
! 4603: <p> To check that your own release of mimeTeX is current,
! 4604: type a url into your browser's locator window something like <br>
! 4605:
! 4606: <b>http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?\version</b> <br>
! 4607: which will display the version and revision date of
! 4608: mimeTeX installed on your server. </p>
! 4609:
! 4610:
1.1 albertel 4611: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
4612: SECTION IV. APPENDICES
4613: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
4614: <h1> <a name="appendices"> (IV) Appendices </a> </h1>
4615:
4616: <p> Programming information to help you modify mimeTeX's behavior,
4617: and to use its functionality in your own programs, is provided
4618: by these appendices. The currently available appendices discuss
4619: (a)how to modify or extend mimeTeX's fonts, (b)how to use
4620: mimeTeX's principal function, make_raster(), and (c)how to use
4621: <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
4622: gifsave.c library. </p>
4623:
4624:
4625: <h2> <a name="fonts"> (IVa) mimeTeX Fonts </a> </h2>
4626:
4627: <p> The font information mimeTeX uses to render characters is
4628: derived from .gf font files (usually generated by <b>metafont</b>
4629: running against .mf files), which are then run through
4630: <b>gftype -i</b> and finally through my <b>gfuntype</b> program
4631: (supplied with your mimeTeX distribution). </p>
4632:
4633: <p> The final output from each such sequence of three runs
1.2 albertel 4634: (metafont > gftype -i > gfuntype) gives mimeTeX the
4635: bitmap information it needs to render one particular font
4636: family at one particular size. The file <b>texfonts.h</b>
4637: supplied with your mimeTeX distribution collects the output
1.3 albertel 4638: from 72 such (sequences of) runs, representing nine font
1.2 albertel 4639: families at eight sizes each. </p>
1.1 albertel 4640:
1.2 albertel 4641: <p> This collection of information in texfonts.h is
1.1 albertel 4642: "wired" into mimeTeX through tables maintained in <b>mimetex.h</b>.
4643: To change mimeTeX's fonts, you'll have to first modify (or totally
4644: replace) texfonts.h using your own gfuntype output, and then
4645: change mimetex.h to reflect your texfonts.h modifications. </p>
4646:
4647: <p> This appendix provides a brief description of the above
4648: process, though you'll probably need at least some previous
4649: C programming experience to confidently accomplish it.
4650: Your motivation might be to add more fonts to mimeTeX,
4651: to change the font sizes I chose, or to add more
4652: font sizes, etc. MimeTeX's design permits all this to be
4653: easily done once you understand the process. </p>
4654:
4655: <p> Running <b>metafont</b> to generate a <b>.gf</b> file from <b>.mf</b>
4656: source will usually be your very first step. A typical such run
4657: might be </p>
1.2 albertel 4658: <!-- <b>mf '\mode=onetz; mag=magstep(.5); input cmmi10'</b> --> <center>
4659: <b>mf '\mode=preview; mag=magstep(-16.393225); input cmmi10'</b></center>
1.1 albertel 4660: <p class="continue"> which in this case generates output file
4661: <b>cmmi10.131gf</b> (which is mimeTeX's font size 3 for the
4662: cmmi family). </p>
4663:
4664: <p> Given the cmmi10.131gf file from this metafont run
4665: (or substitute any other .gf file you like), next run </p>
4666: <center><b>gftype -i cmmi10.131gf > typeout</b></center>
4667: <p class="continue"> where <b>typeout</b> can be any temporary
4668: filename you like. </p>
4669:
4670: <p> Finally, run <b>gfuntype</b> against the typeout file
4671: you just generated with the command </p>
4672: <center><b>gfuntype -n cmmi131 typeout cmmi131.h</b></center>
4673: <p class="continue"> to generate the final output file <b>cmmi131.h</b>
4674: (or any filename you supply as the last arg). This
4675: contains the cmmi data in an array whose name is taken
4676: from the <b>-n</b> arg you supplied to gfuntype. </p>
4677:
4678: <p> The above sequence of three runs resulted in output file
4679: <b>cmmi131.h</b>, containing the font information mimeTeX needs
4680: for one font family (cmmi) at one font size (3). Repeat this
4681: sequence of three runs for each font size and each font family.
4682: Then pull all the output files into one big <b>texfonts.h</b> file
4683: (or write a small texfonts.h which just #include's them all). </p>
4684:
1.3 albertel 4685: <p> For your information, the 72 sequences of runs represented
1.1 albertel 4686: in the texfonts.h file supplied with your mimeTeX distribution
1.2 albertel 4687: correspond to the following eight inital metafont runs for cmr10 </p>
4688: <!--
1.1 albertel 4689: 1 (.100gf) mf '\mode=nextscrn; input cmr10'
4690: 2 (.118gf) mf '\mode=lview; input cmr10'
4691: 3 (.131gf) mf '\mode=onetz; mag=magstep(.5); input cmr10'
4692: 4 (.160gf) mf '\mode=itoh; input cmr10'
1.2 albertel 4693: 5 (.180gf) mf '\mode=lqlores; input cmr10'
4694: -->
4695: <pre> size=0 (.83gf) mf '\mode=eighthre; input cmr10'
4696: 1 (.100gf) mf '\mode=preview; mag=magstep(-17.874274); input cmr10'
4697: 2 (.118gf) mf '\mode=preview; mag=magstep(-16.966458); input cmr10'
4698: 3 (.131gf) mf '\mode=preview; mag=magstep(-16.393225); input cmr10'
4699: 4 (.160gf) mf '\mode=preview; mag=magstep(-15.296391); input cmr10'
4700: 5 (.180gf) mf '\mode=preview; mag=magstep(-14.650373); input cmr10'
4701: 6 (.210gf) mf '\mode=preview; mag=magstep(-13.804885); input cmr10'
4702: 7 (.250gf) mf '\mode=preview; mag=magstep(-12.848589); input cmr10'</pre>
1.1 albertel 4703: <p class="continue">
1.3 albertel 4704: Then ditto for the eight other font families cmmi10, cmmib10, cmsy10,
4705: cmex10, bbold10, rsfs10, stmary10 and wncyr10. And to generate other
1.2 albertel 4706: <b>.</b><i>dpi</i><b>gf</b> font sizes, calculate magsteps
4707: <img src="../cgi-bin/mimetex.cgi?\normalsize\frac{\log(dpi/2602)}{\log1.2}"
4708: alt="" align=middle border=0>. All the subsequent gftype and
4709: gfuntype runs just follow the standard format described above. </p>
1.1 albertel 4710:
4711: <p> To incorporate all this font information you just generated into
4712: mimeTeX, edit your <b>mimetex.h</b> file and find the table that looks
1.2 albertel 4713: something like </p><pre>static fontfamily aafonttable[] = {
4714: /* ----------------------------------------------------------------------------------------
4715: family size=0, 1, 2, 3, 4, 5, 6, 7
4716: ----------------------------------------------------------------------------------------- */
4717: { CMR10,{ cmr83, cmr100, cmr118, cmr131, cmr160, cmr180, cmr210, cmr250}},
4718: { CMMI10,{ cmmi83, cmmi100, cmmi118, cmmi131, cmmi160, cmmi180, cmmi210, cmmi250}},
4719: { CMMIB10,{ cmmib83, cmmib100, cmmib118, cmmib131, cmmib160, cmmib180, cmmib210, cmmib250}},
4720: { CMSY10,{ cmsy83, cmsy100, cmsy118, cmsy131, cmsy160, cmsy180, cmsy210, cmsy250}},
4721: { CMEX10,{ cmex83, cmex100, cmex118, cmex131, cmex160, cmex180, cmex210, cmex250}},
4722: { RSFS10,{ rsfs83, rsfs100, rsfs118, rsfs131, rsfs160, rsfs180, rsfs210, rsfs250}},
4723: { BBOLD10,{ bbold83, bbold100, bbold118, bbold131, bbold160, bbold180, bbold210, bbold250}},
4724: {STMARY10,{stmary83,stmary100,stmary118,stmary131,stmary160,stmary180,stmary210,stmary250}},
1.3 albertel 4725: { CYR10,{ wncyr83, wncyr100, wncyr118, wncyr131, wncyr160, wncyr180, wncyr210, wncyr250}},
1.2 albertel 4726: { -999,{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}}
4727: } ; /* --- end-of-fonttable[] --- */</pre><p class="continue">
1.3 albertel 4728: Note the 72 names <b>cmr83...wncyr250</b> in the table. These must
1.1 albertel 4729: correspond to (or must be changed to) the names following the <b>-n</b>
1.2 albertel 4730: switch you specified for your gfuntype runs. </p>
1.1 albertel 4731:
1.2 albertel 4732: <p> If you want more than eight font sizes, first build up texfonts.h
1.1 albertel 4733: with all the necessary information. Then change LARGESTSIZE (and
4734: probably NORMALSIZE) in mimetex.h, and finally edit the above aafonttable[]
4735: by extending the columns in each row up to your largest size. </p>
4736:
4737: <p> You can also add new rows by #define'ing a new family,
4738: and then adding a whole lot of character definitions at the bottom
4739: of mimetex.h, all in the obvious way (i.e., it should become obvious
4740: after reviewing mimetex.h). A new row would be required,
4741: for example, to make another font available in mimeTeX. </p>
4742:
1.2 albertel 4743: <p> One small problem with the above procedure is that the default
4744: gftype program supplied with most TeX distributions
1.5 ! raeburn 4745: can't emit the long lines needed to display mimeTeX's larger font sizes.
! 4746: <a href="http://www.forkosh.com/gftype.zip"
! 4747: target="_top">gftype.zip</a> contains a statically linked linux
! 4748: executable modified to emit the necessary long lines.
! 4749: It may or may not run on your intel linux machine.
! 4750: If not, you'll need to compile your own version from source.
1.2 albertel 4751: The following instructions are for Unix/Linux: <br>
4752: First, download both
1.5 ! raeburn 4753: <!-- http://www.ctan.org/tex-archive/systems/web2c/web-7.5.3.tar.gz -->
! 4754: <a href="http://www.forkosh.com/web-7.5.3.tar.gz"
1.2 albertel 4755: target="_top">web-7.5.3.tar.gz</a> and
1.5 ! raeburn 4756: <!-- http://www.ctan.org/tex-archive/systems/web2c/web2c-7.5.3.tar.gz -->
! 4757: <a href="http://www.forkosh.com/web2c-7.5.3.tar.gz"
! 4758: target="_top">web2c-7.5.3.tar.gz</a>
! 4759: <!-- or more recent versions. --> (note: these files are no longer
! 4760: explicitly archived by <a href="http://www.ctan.org/"
! 4761: target="_top">ctan</a>, having been superceded
! 4762: by <a href="http://www.ctan.org/tex-archive/systems/texlive"
! 4763: target="_top">texlive</a> sources, so the preceding two links
! 4764: point to copies kept on my site, www.forkosh.com).
! 4765: Then untar both gzipped tar files,
1.2 albertel 4766: cd web2c-7.5.3/ and run ./configure
4767: and make in the usual way (make may fail before
4768: completion if you don't have all needed fonts installed,
4769: but it will create and compile gftype.c before failing). Now edit
1.5 ! raeburn 4770: texk/web2c/gftype.c and notice three lines very near the top
! 4771: that #define maxrow (79)   and similarly for
! 4772: maxcol and linelength. Change all three 79's to 1024, and
! 4773: then re-run make. The new texk/web2c/gftype executable
! 4774: image can emit the long lines needed for mimeTeX's larger font sizes. </p>
1.2 albertel 4775:
4776: <p> Finally, the Unix/Linux bash shell script
4777: <a href="http://www.forkosh.com/texfonts.sh"
4778: target="_top">texfonts.sh</a> generates file texfonts.h
1.3 albertel 4779: containing the information for all 72 mimeTeX fonts discussed above
1.2 albertel 4780: (and, optionally, an extra 1200dpi cmr font used to test mimeTeX's
4781: supersampling algorithm). You'll need to understand and edit this
4782: script to use it meaningfully. But it helps automate mimeTeX's font
4783: generation procedure in case you want to experiment with different
4784: fonts. (Note that metafont emits a complaint while generating the
4785: 83dpi rsfs font. Just press <CR> and it completes
4786: successfully.) </p>
4787:
1.1 albertel 4788:
4789: <h2> <a name="makeraster"> (IVb) mimeTeX's make_raster()
4790: function </a> </h2>
4791:
4792: <p> MimeTeX converts an input LaTeX math expression to a corresponding GIF
4793: image in two steps. First, it converts the input LaTeX expression to a
4794: corresponding bitmap raster. Then <a href="http://shh.thathost.com"
4795: target="_top">Sverre Huseby's</a> gifsave library, discussed
4796: <a href="#gifsave">below</a>, converts that bitmap to the emitted gif.
4797: Though you never explicitly see that bitmap, it's mimeTeX's principal
4798: result. MimeTeX is written so any program can easily use its
4799: expression-to-bitmap conversion capability with just a single line of code.
4800: The following complete program demonstrates the simplest such use. </p>
4801:
4802: <pre> #include <stdio.h>
4803: #include "mimetex.h"
4804: int main ( int argc, char *argv[] )
4805: {
4806: raster *rp = make_raster(argv[1],NORMALSIZE);
4807: type_raster(rp,stdout); /* display ascii image of raster */
4808: }</pre>
4809:
4810: <p> Cut-and-paste the above sample code from this file to, say,
4811: mimedemo.c (and fix the brackets around stdio.h). Then compile <br>
1.3 albertel 4812:
4813: cc -DTEXFONTS mimedemo.c mimetex.c -lm -o mimedemo <br>
1.1 albertel 4814: and run it from your unix shell command line like <br>
4815: ./mimedemo "x^2+y^2" </p>
4816:
4817: <p> MimeTeX's expression-to-bitmap conversion is accomplished by the
4818: make_raster() call, whose first argument is just a pointer to a
4819: (null-terminated) string containing any mimeTeX-compliant LaTeX
4820: expression, and whose second argument is the mimeTeX font size
4821: to use (overridden if your expression contains a preamble).
4822: The ascii display of the bitmap raster returned by make_raster()
4823: results from the subsequent call to type_raster(). That's all
4824: this program does, but you could use make_raster()'s returned bitmap
4825: for any other purpose you have in mind. </p>
4826:
4827: <p> MimeTeX's primary purpose is to emit either xbitmaps or gif images
4828: rather than ascii displays. And mimeTeX has anti-aliasing and various
4829: other options that further complicate its main() function compared to
4830: the simple example above. The example below demonstrates mimeTeX
4831: usage in the slightly more realistic situation where an input expression
4832: is converted to a gif, without anti-aliasing, and emitted on stdout. </p>
4833:
4834: <pre> #include <stdio.h>
4835: #include <stdlib.h>
4836: #include "mimetex.h"
4837:
4838: /* --- global needed by callback function, below, for gifsave.c --- */
4839: static raster *rp = NULL; /* 0/1 bitmap raster image */
4840:
4841: /* --- callback function to return pixel value at col x, row y --- */
4842: int GetPixel ( int x, int y ) /* pixel value will be 0 or 1 */
4843: { return (int)getpixel(rp,y,x); } /* just use getpixel() macro */
4844:
4845: /* --- main() entry point --- */
4846: int main ( int argc, char *argv[] )
4847: {
4848: /* --- get LaTeX expression from either browser query or command-line --- */
4849: char *query = getenv("QUERY_STRING"), /* check for query string */
4850: *expression = (query!=NULL? query : /* input either from query */
4851: (argc>1? argv[1] : "f(x)=x^2")); /* or from command line */
4852: /* ---- mimeTeX converts expression to bitmap raster ---- */
4853: rp = make_raster(expression,NORMALSIZE); /* mimeTeX rasterizes expression */
4854: /* ---- convert returned bitmap raster to gif, and emit it on stdout ---- */
4855: if ( query != NULL ) /* Content-type line for browser */
4856: fprintf( stdout, "Content-type: image/gif\n\n" );
4857: /* --- initialize gifsave library and colors, and set transparent bg --- */
4858: GIF_Create(NULL, rp->width, rp->height, 2, 8); /* init for black/white */
4859: GIF_SetColor(0, 255, 255, 255); /* always set background white */
4860: GIF_SetColor(1, 0, 0, 0); /* and foreground black */
4861: GIF_SetTransparent(0); /* and set transparent background */
4862: /* --- finally, emit compressed gif image (to stdout) --- */
4863: GIF_CompressImage(0, 0, -1, -1, GetPixel);
4864: GIF_Close();
4865: }</pre>
4866:
4867: <p> Cut-and-paste as before, compile like <br>
1.3 albertel 4868:
4869: cc -DTEXFONTS mimedemo.c mimetex.c gifsave.c -lm -o mimedemo <br>
1.1 albertel 4870: and run it like the first example, but this time you may want to redirect
4871: stdout <br>
4872: ./mimedemo "x^2+y^2"
4873: <b>></b> mimedemo.gif <br>
4874: since output is now a gif image consisting of mostly unprintable bytes.
4875: Input is typically from the command line as illustrated, but this example
4876: checks for a browser query string too. That means you could actually
4877: replace mimetex.cgi with this executable, though anti-aliasing wouldn't
4878: be available. </p>
4879:
4880: <p> Of course, this example's intent isn't to replace the mimetex.cgi
4881: executable, but rather to illustrate GIFSAVE library usage, documented
4882: in detail below. And this example also illustrates usage of several
4883: mimeTeX raster structure elements, like rp->width and rp->height.
4884: So you'll probably also want to refer to mimetex.h, which contains those
4885: raster structures and other relevant definitions. For instance, the
4886: example's GetPixel() callback function illustrates usage of the getpixel()
4887: macro in mimetex.h, to retrieve individual pixels by their x,y-coordinates.
4888: And there's a similar setpixel() macro in mimetex.h to store pixels.
4889: After completing all this reading, you'll be prepared to begin using
4890: mimeTeX functions in your own code. </p>
4891:
4892:
4893:
4894: <h2> <a name="gifsave">
4895: (IVc)</a> <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
4896: gifsave.c library </h2>
4897:
4898: <p> The information below is taken from the README file accompanying
4899: <a href="http://shh.thathost.com" target="_top">Sverre Huseby's</a>
4900: distribution of GIFSAVE. I've made a few small editorial modifications,
4901: including descriptions of the several minor changes necessary
4902: to support mimeTeX. And the mimeTeX example program immediately above
4903: uses GIFSAVE in a very straightforward way that should help clarify
4904: any questions which may remain after reading the documentation below. </p>
4905:
4906: <pre>
4907: INTRODUCTION
4908: ============
4909:
4910: The GIFSAVE functions make it possible to save GIF images from
4911: your own C programs.
4912:
4913: GIFSAVE creates simple GIF files following the GIF87a standard.
4914: Interlaced images cannot be created. There should only be
4915: one image per file.
4916:
4917: GIFSAVE consists of five functions, all returning type int,
4918: and no separate header file is required.
4919:
4920: The functions should be called in the order listed below
4921: for each GIF-file. One file must be closed before a new one
4922: can be created.
4923:
4924: GIF_Create() creates new GIF-files. It takes parameters
4925: specifying filename, screen size, number of colors,
4926: and color resolution.
4927:
4928: GIF_SetColor() sets up red, green, blue color components.
4929: It should be called once for each possible color.
4930:
4931: GIF_SetTransparent() is optional. If called, it sets the
4932: color number of the color that should be transparent,
4933: i.e., the background color shows through this one.
4934:
4935: GIF_CompressImage() performs the compression of the image.
4936: It accepts parameters describing the position and size
4937: of the image on screen, and a user defined callback
4938: function that is supposed to fetch the pixel values.
4939:
4940: GIF_Close() terminates and closes the file.
4941:
4942: To use these functions, you must also write a callback
4943: function that returns the pixel values for each point
4944: in the image.
4945:
4946:
4947: THE FUNCTIONS
4948: =============
4949:
4950: GIF_Create()
4951: ------------
4952: Function Creates a new GIF-file, and stores info on
4953: the screen.
4954:
4955: Syntax int GIF_Create(
4956: char *filename,
4957: int width, int height,
4958: int numcolors, int colorres
4959: );
4960:
4961: Remarks Creates a new (or overwrites an existing)
4962: GIF-file with the given filename. No
4963: .GIF-extension is added.
4964:
4965: If filename is passed as a NULL pointer,
4966: output is directed to stdout.
4967:
4968: The width- and height- parameters specify
4969: the size of the image in pixels.
4970:
4971: numcolors is the number of colors used in
4972: the image.
4973:
4974: colorres is number of bits used to encode a
4975: primary color (red, green or blue).
4976: In GIF-files, colors are built by combining
4977: given amounts of each primary color.
4978: On VGA-cards, each color is built by
4979: combining red, green and blue values in
4980: the range [0, 63]. Encoding the number 63
4981: would require 6 bits, so colorres would be
4982: set to 6.
4983:
4984: Return value GIF_OK - OK
4985: GIF_ERRCREATE - Error creating file
4986: GIF_ERRWRITE - Error writing to file
4987: GIF_OUTMEM - Out of memory
4988:
4989:
4990: GIF_SetColor()
4991: --------------
4992: Function Specifies the primary color component of a
4993: color used in the image.
4994:
4995: Syntax void GIF_SetColor(
4996: int colornum,
4997: int red, int green, int blue
4998: );
4999:
5000: Remarks This function updates the colortable-values
5001: for color number colornum in the image.
5002:
5003: Should be called for each color in the range
5004: [0, numcolors]
5005:
5006: with red, green and blue components in the
5007: range [0, (2^colorres)-1]
5008:
5009: colorres and colornum are values previousely
5010: given to the function GIF_Create().
5011:
5012: Return value None
5013:
5014:
5015: GIF_SetTransparent()
5016: --------------------
5017: Function Specifies the color number of the color
5018: that should be considered transparent.
5019:
5020: Syntax void GIF_SetTransparent(
5021: int colornum
5022: );
5023:
5024: Remarks Need not be called at all. But if called,
5025: should be called only once with colornum in
5026: the range [0, numcolors] i.e., colornum
5027: must be one of the values previously
5028: given to GIF_SetColor().
5029:
5030: Return value None
5031:
5032:
5033: GIF_CompressImage()
5034: -------------------
5035: Function Compresses an image and stores it in the
5036: current file.
5037:
5038: Syntax int GIF_CompressImage(
5039: int left, int top,
5040: int width, int height,
5041: int (*getpixel)(int x, int y)
5042: );
5043:
5044: Remarks The left- and top- parameters indicate the
5045: image offset from the upper left corner of
5046: the screen. They also give the start values
5047: for calls to the userdefined callback
5048: function.
5049:
5050: width and height give the size of the image.
5051: A value of -1 indicates the equivalent screen
5052: size given in the call to GIF_Create().
5053:
5054: If the image is supposed to cover the entire
5055: screen, values 0, 0, -1, -1 should be given.
5056:
5057: GIF_CompressImage() obtains the pixel values
5058: by calling a user specified function. This
5059: function is passed in the parameter getpixel.
5060: See "callback()" further down for a
5061: description of this function.
5062:
5063: Return value GIF_OK - OK
5064: GIF_ERRWRITE - Error writing to file
5065: GIF_OUTMEM - Out of memory
5066:
5067:
5068: GIF_Close()
5069: -----------
5070: Function Closes the GIF-file.
5071:
5072: Syntax int GIF_Close(void);
5073:
5074: Remarks This function writes a terminating descriptor
5075: to the file, and then closes it. Also frees
5076: memory used by the other functions of GIFSAVE.
5077:
5078: Return value GIF_OK - OK
5079: GIF_ERRWRITE - Error writing to file
5080:
5081:
5082: THE CALLBACK FUNCTION
5083: =====================
5084:
5085: callback()
5086: ----------
5087: Function Obtains pixel-values for the
5088: GIF_CompressImage() -function.
5089:
5090: Syntax int callback(int x, int y);
5091:
5092: Remarks This function must be written by the
5093: programmer. It should accept two integer
5094: parameters specifying a point in the image,
5095: and return the pixel value at this point.
5096:
5097: The ranges for these parameters are as
5098: follows
5099: x : [img_left, img_left + img_width - 1]
5100: y : [img_top, img_top + img_height - 1]
5101:
5102: where img_left, img_top, img_width and
5103: img_height are the values left, top, width
5104: and height passed to GIF_CompressImage().
5105:
5106: An example; if the screen has width 640 and
5107: height 350, and the image covers the entire
5108: screen, x will be in the range [0, 639]
5109: and y in the range [0, 349].
5110:
5111: callback() need not get its values from the
5112: screen. The values can be fetched from a
5113: memory array, they can be calculated for
5114: each point requested, etc.
5115:
5116: The function is passed as a parameter to
5117: GIF_CompressImage(), and can thus have any
5118: name, not only callback().
5119:
5120: Return value Pixel value at the point requested. Should
5121: be in the range [0, numcolors-1] where
5122: numcolors is as specified to GIF_Create().
5123: </pre>
5124:
5125:
5126:
5127: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5128: CONCLUDING REMARKS
5129: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
5130: <h1 id="remarks"> Concluding Remarks </h1>
5131:
5132: <p> I hope you find mimeTeX useful. If so, a contribution to your
5133: country's <a href="http://www.tug.org" target="_top">TeX Users Group</a>,
5134: or to the <a href="http://www.gnu.org" target="_top">GNU</a> project, is
5135: suggested, especially if you're a company that's currently profitable. </p>
5136:
5137: <!--
5138: <p> If you also like mimeTeX's source, I'm an independent contractor
5139: incorporated in the US as John Forkosh Associates, Inc.
5140: A <a href="http://www.forkosh.com/resume.html" target="_top">resume</a>
5141: is at <a href="http://www.forkosh.com" target="_top">www.forkosh.com</a>
5142: or email
5143: <a href="mailto:john@forkosh.com">john@forkosh.com</a> </p>
5144: -->
5145:
5146: <!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5147: Footer across bottom of page
5148: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
5149: <hr size=4>
5150: <table> <tr>
5151: <td> <font size=3 color="maroon"> <b>
1.5 ! raeburn 5152: <nobr>Copyright <font size=5>©</font> 2002-2012,
1.1 albertel 5153: <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a>
5154: </nobr><br>
5155: email: <a href="mailto:john@forkosh.com">john@forkosh.com</a>
5156: </b> </font> </td>
5157: <td> <img src="../cgi-bin/mimetex.cgi?\hspace{100}" alt="" border=0> </td>
5158: <td> <img src="../cgi-bin/mimetex.cgi?\blue{\small\rm You're the }
5159: \Large\counter[counters.log]{counters.txt:mimetex.html}\\[0]
5160: {\small\rm visitor to this page." alt="" border=0 align=bottom> </td>
5161: </tr> </table>
5162: </body>
5163: </html>
5164: <!-- end-of-file mimetex.html -->
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>