[LON-CAPA-cvs] cvs: loncom /cgi/mimeTeX COPYING README commands gfuntype.c gifsave.c mimetex.c mimetex.h mimetex.html texfonts.h

riegler riegler@source.lon-capa.org
Thu, 04 Dec 2008 12:17:15 -0000


This is a MIME encoded message

--riegler1228393035
Content-Type: text/plain

riegler		Thu Dec  4 12:17:15 2008 EDT

  Added files:                 
    /loncom/cgi/mimeTeX	COPYING 

  Modified files:              
    /loncom/cgi/mimeTeX	commands gfuntype.c gifsave.c mimetex.c 
                       	mimetex.h mimetex.html README texfonts.h 
  Log:
  upgrade to mimetex version 1.7
  This version will be needed in order to align formulas neatly.
  noticable change is the % in the path specified in "commands".
  
  
  
--riegler1228393035
Content-Type: text/plain
Content-Disposition: attachment; filename="riegler-20081204121715.txt"

Index: loncom/cgi/mimeTeX/commands
diff -u loncom/cgi/mimeTeX/commands:1.2 loncom/cgi/mimeTeX/commands:1.3
--- loncom/cgi/mimeTeX/commands:1.2	Tue Jul 15 10:49:02 2008
+++ loncom/cgi/mimeTeX/commands	Thu Dec  4 12:17:13 2008
@@ -1,4 +1,4 @@
 #!/bin/sh
-cc -DAA -DCACHEPATH=\"mimetexcache/\" -DNEWCOMMANDS="\"loncapanewcommands.h\"" \
+cc -DAA -DCACHEPATH=\"%mimetexcache/\" -DNEWCOMMANDS="\"loncapanewcommands.h\"" \
     mimetex.c gifsave.c -lm -o mimetex.cgi
 
Index: loncom/cgi/mimeTeX/gfuntype.c
diff -u loncom/cgi/mimeTeX/gfuntype.c:1.3 loncom/cgi/mimeTeX/gfuntype.c:1.4
--- loncom/cgi/mimeTeX/gfuntype.c:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/gfuntype.c	Thu Dec  4 12:17:13 2008
@@ -1,20 +1,23 @@
 /****************************************************************************
  *
- * Copyright (c) 2002, John Forkosh Associates, Inc.  All rights reserved.
+ * Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
+ *           http://www.forkosh.com   mailto: john@forkosh.com
  * --------------------------------------------------------------------------
  * This file is part of mimeTeX, which is free software. You may redistribute
  * and/or modify it under the terms of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
+ * version 3 or later, as published by the Free Software Foundation.
  *      MimeTeX is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
  * See the GNU General Public License for specific details.
  *      By using mimeTeX, you warrant that you have read, understood and
- * agreed to these terms and conditions, and that you are at least 18 years
- * of age and possess the legal right and ability to enter into this
- * agreement and to use mimeTeX in accordance with it.
- *      Your mimeTeX distribution should contain a copy of the GNU General
- * Public License.  If not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * agreed to these terms and conditions, and that you possess the legal
+ * right and ability to enter into this agreement and to use mimeTeX
+ * in accordance with it.
+ *      Your mimetex.zip distribution file should contain the file COPYING,
+ * an ascii text copy of the GNU General Public License, version 3.
+ * If not, point your browser to  http://www.gnu.org/licenses/
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
  * --------------------------------------------------------------------------
  *
  * Program:	gfuntype  [-g gformat]  [-u isnoname] [-m msglevel]
@@ -55,6 +58,7 @@
  * Revision History:
  * 09/22/02	J.Forkosh	Installation.
  * 10/11/05	J.Forkosh	.gf-style format options added.
+ * 09/06/08	J.Forkosh	mimeTeX version 1.70 released.
  *
  ****************************************************************************/
 
Index: loncom/cgi/mimeTeX/gifsave.c
diff -u loncom/cgi/mimeTeX/gifsave.c:1.3 loncom/cgi/mimeTeX/gifsave.c:1.4
--- loncom/cgi/mimeTeX/gifsave.c:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/gifsave.c	Thu Dec  4 12:17:13 2008
@@ -1,4 +1,4 @@
-/* $Id: gifsave.c,v 1.3 2007/10/09 21:41:41 albertel Exp $ */
+/* $Id: gifsave.c,v 1.4 2008/12/04 12:17:13 riegler Exp $ */
 /**************************************************************************
  *
  *  FILE            gifsave.c
@@ -76,6 +76,8 @@
 #endif				/* " */
 int gifSize = 0;		/* " #bytes comprising gif */
 int maxgifSize = MAXGIFSZ;	/* " max #bytes written to OutBuffer */
+extern int  iscachecontenttype;	/* " true to cache mime content-type */
+extern char contenttype[2048];	/* " content-type:, etc. buffer */
 
 /* used when writing to a file bitwise */
 static Byte Buffer[256];        /* there must be one more than `needed' */
@@ -196,7 +198,10 @@
       if ( *filename != '\000' )		/* " */
 	{ if ((OutFile = fopen(filename, "wb")) == NULL)
 	    return GIF_ERRCREATE;
-	  isCloseOutFile = 1; }			/* (added by j.forkosh) */
+	  isCloseOutFile = 1;			/* (added by j.forkosh) */
+          if ( iscachecontenttype )		/* " cache headers in file */
+            if ( *contenttype != '\000' )	/* " have headers in buffer*/
+              fputs(contenttype,OutFile); }	/* " write buffered headers*/
       else					/* " */
 	OutBuffer = (Byte *)filename;		/* " */
     return GIF_OK;
Index: loncom/cgi/mimeTeX/mimetex.c
diff -u loncom/cgi/mimeTeX/mimetex.c:1.3 loncom/cgi/mimeTeX/mimetex.c:1.4
--- loncom/cgi/mimeTeX/mimetex.c:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/mimetex.c	Thu Dec  4 12:17:13 2008
@@ -1,10 +1,11 @@
 /****************************************************************************
  *
- * Copyright(c) 2002-2006, John Forkosh Associates, Inc. All rights reserved.
+ * Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
+ *           http://www.forkosh.com   mailto: john@forkosh.com
  * --------------------------------------------------------------------------
  * This file is part of mimeTeX, which is free software. You may redistribute
  * and/or modify it under the terms of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
+ * version 3 or later, as published by the Free Software Foundation.
  *      MimeTeX is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
  * See the GNU General Public License for specific details.
@@ -12,10 +13,11 @@
  * agreed to these terms and conditions, and that you possess the legal
  * right and ability to enter into this agreement and to use mimeTeX
  * in accordance with it.
- *      Your mimeTeX distribution should contain a copy of the GNU General
- * Public License.  If not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
- * or point your browser to  http://www.gnu.org/licenses/gpl.html
+ *      Your mimetex.zip distribution file should contain the file COPYING,
+ * an ascii text copy of the GNU General Public License, version 3.
+ * If not, point your browser to  http://www.gnu.org/licenses/
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
  * --------------------------------------------------------------------------
  *
  * Purpose:   o	MimeTeX, licensed under the gpl, lets you easily embed
@@ -25,23 +27,29 @@
  *		entirely separate little program that doesn't use TeX or
  *		its fonts in any way.  It's just one cgi that you put in
  *		your site's cgi-bin/ directory, with no other dependencies.
- *		So mimeTeX is very easy to install.  And it's equally easy
- *		to use.  Just place an html <img> tag in your document
+ *		     So mimeTeX is very easy to install.  And it's equally
+ *		easy to use.  Just place an html <img> tag in your document
  *		wherever you want to see the corresponding LaTeX expression.
  *		For example,
  *		 <img src="../cgi-bin/mimetex.cgi?\int_{-\infty}^xe^{-t^2}dt"
  *		  alt="" border=0 align=middle>
  *		immediately generates the corresponding gif image on-the-fly,
  *		displaying the rendered expression wherever you put that
- *		<img> tag.  MimeTeX doesn't need intermediate dvi-to-gif
- *		conversion, and it doesn't clutter up your filesystem with
- *		separate little gif files for each converted expression.
+ *		<img> tag.
+ *		     MimeTeX doesn't need intermediate dvi-to-gif conversion,
+ *		and it doesn't clutter up your filesystem with separate
+ *		little gif files for each converted expression.
  *		But image caching is available by using mimeTeX's
  *		-DCACHEPATH=\"path/\" compile option (see below).
  *		There's also no inherent need to repeatedly write the
  *		cumbersome <img> tag illustrated above.  You can write
  *		your own custom tags, or write a wrapper script around
  *		mimeTeX to simplify the notation.
+ *		     Further discussion about mimeTeX's features and
+ *		usage is available on its homepage,
+ *		  http://www.forkosh.com/mimetex.html
+ *		and similarly in mimetex.html included with your mimetex.zip
+ *		distribution file.
  *
  * Functions:	===================== Raster Functions ======================
  *	PART2	--- raster constructor functions ---
@@ -188,13 +196,13 @@
  *		ismonth(month)          is month current month ("jan"-"dec")?
  *		unescape_url(url,isescape), x2c(what)   xlate %xx url-encoded
  *		logger(fp,msglevel,logvars)        logs environment variables
- *		emitcache(cachefile,maxage,isbuffer) emit cachefile to stdout
+ *		emitcache(cachefile,maxage,valign,isbuffer)    emit cachefile
  *		readcachefile(cachefile,buffer)    read cachefile into buffer
  *		md5str(instr)                      md5 hash library functions
  *		GetPixel(x,y)           callback function for gifsave library
  *
  * Source:	mimetex.c  (needs mimetex.h and texfonts.h to compile,
- *		and also needs gifsave.c if compiled with -DAA or -DGIF)
+ *		and also needs gifsave.c when compiled with -DAA or -DGIF)
  *
  * --------------------------------------------------------------------------
  * Notes      o	See bottom of file for main() driver (and "friends"),
@@ -211,9 +219,10 @@
  *		and with -DAA or -DGIF you'll also need gifsave.c
  *	      o	For gif images, the gifsave.c library by Sverre H. Huseby
  *		<http://shh.thathost.com> slightly modified by me to allow
- *		(a)sending output to stdout and (b)specifying a transparent
- *		background color index, is included with mimeTeX,
- *		and it's documented in mimetex.html#gifsave .
+ *		(a)sending output to stdout or returning it in memory,
+ *		and (b)specifying a transparent background color index,
+ *		is included with mimeTeX, and it's documented in
+ *		mimetex.html#gifsave .
  *	      o	Optional compile-line -D defined symbols are documented
  *		in mimetex.html#options .  They include (additional -D
  *		switches are discussed in mimetex.html#options)...
@@ -332,7 +341,8 @@
  * 10/02/04	J.Forkosh	Version 1.50 released.
  * 11/30/04	J.Forkosh	Version 1.60 released.
  * 10/11/05	J.Forkosh	Version 1.64 released.
- * 11/30/06	J.Forkosh	most recent changes
+ * 11/30/06	J.Forkosh	Version 1.65 released.
+ * 09/06/08	J.Forkosh	Version 1.70 released.
  *
  ****************************************************************************/
 
@@ -669,7 +679,6 @@
 /*SHARED(int,imageformat,1);*/		/* image is 1=bitmap, 2=.gf-like */
 GLOBAL(int,isdisplaystyle,1);		/* displaystyle mode (forced if 2) */
 GLOBAL(int,ispreambledollars,0);	/* displaystyle mode set by $$...$$ */
-GLOBAL(int,isemitcontenttype,1);	/* true to emit mime content-type */
 GLOBAL(int,fontnum,0);			/* cal=1,scr=2,rm=3,it=4,bb=5,bf=6 */
 GLOBAL(int,fontsize,NORMALSIZE);	/* current size */
 GLOBAL(int,displaysize,DISPLAYSIZE);	/* use \displaystyle when fontsize>=*/
@@ -716,6 +725,9 @@
 /*GLOBAL(int,currentcharclass,NOVALUE);*/ /*primarily to check for PUNCTION*/
 GLOBAL(int,iscaching,ISCACHING);	/* true if caching images */
 GLOBAL(char,cachepath[256],CACHEPATH);	/* relative path to cached files */
+GLOBAL(int,isemitcontenttype,1);	/* true to emit mime content-type */
+int	iscachecontenttype = 0;		/* true to cache mime content-type */
+char	contenttype[2048] = "\000";	/* content-type:, etc buffer */
 GLOBAL(char,pathprefix[256],PATHPREFIX); /*prefix for \input,\counter paths*/
 /*GLOBAL(int,iswindows,ISWINDOWS);*/	/* true if compiled for ms windows */
 
@@ -13474,7 +13486,7 @@
 -------------------------------------------------------------------------- */
 static	char *copyright =		/* copyright, gnu/gpl notice */
  "+-----------------------------------------------------------------------+\n"
- "|mimeTeX vers 1.64, Copyright(c) 2002-2006, John Forkosh Associates, Inc|\n"
+ "|mimeTeX vers 1.70, Copyright(c) 2002-2008, John Forkosh Associates, Inc|\n"
  "+-----------------------------------------------------------------------+\n"
  "| mimeTeX is free software, licensed to you under terms of the GNU/GPL, |\n"
  "|           and comes with absolutely no warranty whatsoever.           |\n"
@@ -13551,6 +13563,7 @@
 	cachefile[256] = "\000",	/* full path and name to cache file*/
 	*md5str();			/* md5 has of expression */
 int	maxage = 7200;			/* max-age is two hours */
+int	valign = (-9999);		/*Vertical-Align:baseline-(height-1)*/
 /* --- pbm/pgm (-g switch) --- */
 int	ispbmpgm = 0;			/* true to write pbm/pgm file */
 int	type_pbmpgm(), ptype=0;		/* entry point, graphic format */
@@ -13583,7 +13596,18 @@
 /* --- set global variables --- */
 msgfp = stdout;				/* for comamnd-line mode output */
 isss = issupersampling;			/* set supersampling flag */
+isemitcontenttype = 1;			/* true to emit mime content-type */
+iscachecontenttype = 0;			/* true to cache mime content-type */
+*contenttype = '\000';			/* reset content-type:, etc. cache */
+iscaching = ISCACHING;			/* true if caching images */
+if ( iscaching ) {			/* images are being cached */
+  strcpy(cachepath,CACHEPATH);		/* relative path to cached files */
+  if ( *cachepath == '%' ) {		/* leading % signals cache headers */
+    iscachecontenttype = 1;		/* signal caching mime content-type*/
+    strcpy(cachepath,cachepath+1); } }	/* and squeeze out leading % char */
 gifSize = 0;				/* signal that image not in memory */
+fgred=FGRED; fggreen=FGGREEN; fgblue=FGBLUE; /* default foreground colors */
+bgred=BGRED; bggreen=BGGREEN; bgblue=BGBLUE; /* default background colors */
 shrinkfactor = shrinkfactors[NORMALSIZE]; /* set shrinkfactor */
 for ( ipattern=1; ipattern<=51; ipattern++ )
  patternnumcount0[ipattern] = patternnumcount1[ipattern] = 0;
@@ -13594,6 +13618,9 @@
   if ( strlen(query) >= 1 )		/* caller gave us a query string */
     { strncpy(expression,query,MAXEXPRSZ); /* so use it as expression */
       expression[MAXEXPRSZ] = '\000';	/* make sure it's null terminated */
+      if ( 0 )				/*true to remove leading whitespace*/
+        while ( isspace(*expression) && *expression!='\000' )
+          strcpy(expression,expression+1); /* squeeze out white space */
       isquery = 1; }			/* and set isquery flag */
 if ( !isquery )				/* empty query string */
   { char *host = getenv("HTTP_HOST"),	/* additional getenv("") results */
@@ -13913,9 +13940,11 @@
    /* --- emit mime content-type line --- */
    if ( 0 && isemitcontenttype )	/* now done in emitcache() */
     { fprintf( stdout, "Cache-Control: max-age=%d\n",maxage );
+      if ( abs(valign) < 999 )		/* have vertical align */
+        fprintf( stdout, "Vertical-Align: %d\n",valign );
       fprintf( stdout, "Content-type: image/gif\n\n" ); }
    /* --- emit cached image if it already exists --- */
-   if ( emitcache(cachefile,maxage,0) > 0 ) /* cached image emitted */
+   if ( emitcache(cachefile,maxage,valign,0) > 0 ) /* cached image emitted */
     goto end_of_job;			/* so nothing else to do */
    /* --- log caching request --- */
    if ( msglevel >= 1			/* check if logging */
@@ -13958,7 +13987,8 @@
 rasterize expression and put a border around it
 -------------------------------------------------------------------------- */
 /* --- preprocess expression, converting LaTeX constructs for mimeTeX  --- */
-expression = mimeprep(expression);	/* preprocess expression */
+if ( expression != NULL ) {		/* have expression to rasterize */
+  expression = mimeprep(expression); }	/* preprocess expression */
 /* --- double-check that we actually have an expression to rasterize --- */
 if ( expression == NULL )		/* nothing to rasterize */
  { if ( (!isquery||isqlogging) && msgfp!=NULL ) /*emit error if not a query*/
@@ -13977,6 +14007,9 @@
 else					/* for mime xbitmaps must have... */
   bp = border_raster(sp->image,0,0,0,1); /* image width multiple of 8 bits */
 sp->image = bitmap_raster = bp;		/* global copy for gif,png output */
+if ( sp!=NULL && bp!=NULL ) {		/* have raster */
+  valign = sp->baseline - (bp->height - 1); /* #pixels for Vertical-Align: */
+  if ( abs(valign) > 255 ) valign = (-9999); } /* sanity check */
 if ( ispbmpgm && ptype<2 )		/* -g switch or -g1 switch */
   type_pbmpgm(bp,ptype,pbm_outfile);	/* emit b/w pbm file */
 /* -------------------------------------------------------------------------
@@ -14119,15 +14152,24 @@
  ------------------------------------------------------------------------- */
   /* --- don't use memory buffer if outout file given --- */
   if ( gif_outfile != NULL ) isinmemory = 0; /* reset memory buffer flag */
+  /* --- construct contenttype[] buffer containing mime headers --- */
+  if ( 1 ) {				/* always construct buffer */
+    sprintf( contenttype, "Cache-Control: max-age=%d\n", maxage );
+    /*sprintf(contenttype+strlen(contenttype),
+       "Expires: Fri, 31 Oct 2003 23:59:59 GMT\n" );*/
+    /*sprintf(contenttype+strlen(contenttype),
+       "Last-Modified: Wed, 15 Oct 2003 01:01:01 GMT\n");*/
+    if ( abs(valign) < 999 )		/* have Vertical-Align: header info*/
+      sprintf( contenttype+strlen(contenttype),
+       "Vertical-Align: %d\n", valign );
+    sprintf( contenttype+strlen(contenttype),
+      "Content-type: image/gif\n\n" ); }
   /* --- emit mime content-type line --- */
   if ( isemitcontenttype		/* content-type lines wanted */
   &&   !isdumpimage			/* don't mix ascii with image dump */
   &&   !isinmemory			/* done below if in memory */
   &&   !iscaching )			/* done by emitcache() if caching */
-    { fprintf( stdout, "Cache-Control: max-age=%d\n",maxage );
-      /*fprintf( stdout, "Expires: Fri, 31 Oct 2003 23:59:59 GMT\n" );*/
-      /*fprintf( stdout, "Last-Modified: Wed, 15 Oct 2003 01:01:01 GMT\n" );*/
-      fprintf( stdout, "Content-type: image/gif\n\n" ); }
+    { fputs(contenttype,stdout); }	/* emit content-type: header buffer*/
   /* --- write output to memory buffer, possibly for testing --- */
   if ( isinmemory			/* want gif written to memory */
   ||   isdumpbuffer )			/*or dump memory buffer for testing*/
@@ -14190,9 +14232,9 @@
   ||   msglevel >= 99 ) {		/* or debugging */
   int maxage2 = (isdumpimage?(-1):maxage); /* no headers if dumping image */
    if ( iscaching )			/* caching enabled */
-     emitcache(cachefile,maxage2,0);	/* cached image (hopefully) emitted*/
+     emitcache(cachefile,maxage2,valign,0); /*emit cached image (hopefully)*/
    else if ( isinmemory )		/* or emit image from memory buffer*/
-     emitcache(gif_buffer,maxage2,1); }	/* emitted from memory buffer */
+     emitcache(gif_buffer,maxage2,valign,1); } /*emitted from memory buffer*/
   /* --- for testing, may need to write image buffer to file --- */
   if ( isdumpbuffer > 99 )		/* gif image in memory buffer */
    if ( gifSize > 0 )			/* and it's not an empty buffer */
@@ -14572,14 +14614,16 @@
 } /* --- end-of-function logger() --- */
 
 /* ==========================================================================
- * Function:	emitcache ( cachefile, maxage, isbuffer )
+ * Function:	emitcache ( cachefile, maxage, valign, isbuffer )
  * Purpose:	dumps bytes from cachefile to stdout
  * --------------------------------------------------------------------------
  * Arguments:	cachefile (I)	pointer to null-terminated char string
  *				containing full path to file to be dumped,
  *				or contains buffer of bytes to be dumped
- *		maxage (I)	int containing maxage. in seconds, for
+ *		maxage (I)	int containing maxage, in seconds, for
  *				http header, or -1 to not emit headers
+ *		valign (I)	int containing Vertical-Align:, in pixels,
+ *				for http header, or <= -999 to not emit
  *		isbuffer (I)	1 if cachefile is buffer of bytes to be
  *				dumped
  * --------------------------------------------------------------------------
@@ -14588,7 +14632,7 @@
  * Notes:     o
  * ======================================================================= */
 /* --- entry point --- */
-int	emitcache ( char *cachefile, int maxage, int isbuffer )
+int	emitcache ( char *cachefile, int maxage, int valign, int isbuffer )
 {
 /* -------------------------------------------------------------------------
 Allocations and Declarations
@@ -14597,6 +14641,8 @@
 FILE	*emitptr = stdout;		/* emit cachefile to stdout */
 unsigned char buffer[MAXGIFSZ+1];	/* bytes from cachefile */
 unsigned char *buffptr = buffer;	/* ptr to buffer */
+int	isvalign = (abs(valign)<999?1:0); /* true to emit Vertical-Align: */
+int	iscontenttypecached = iscachecontenttype; /*true if headers cached*/
 /* -------------------------------------------------------------------------
 initialization
 -------------------------------------------------------------------------- */
@@ -14604,17 +14650,21 @@
 if ( emitptr == (FILE *)NULL )		/* failed to open emit file */
   goto end_of_job;			/* so return 0 bytes to caller */
 /* --- read the file if necessary --- */
-if ( isbuffer )				/* cachefile is buffer */
- buffptr = (unsigned char *)cachefile;	/* so reset buffer pointer */
-else					/* cachefile is file name */
- if ( (nbytes = readcachefile(cachefile,buffer)) /* read the file */
- < 1 ) goto end_of_job;			/* quit if file not read */
+if ( isbuffer ) {			/* cachefile is buffer */
+  buffptr = (unsigned char *)cachefile;	/* so reset buffer pointer */
+  iscontenttypecached = 0; }		/* and iscontenttypecached flag */
+else {					/* cachefile is file name */
+  if ( (nbytes = readcachefile(cachefile,buffer)) /* read the file */
+  < 1 ) goto end_of_job; }		/* quit if file not read */
 /* --- first emit http headers if requested --- */
 if ( isemitcontenttype			/* content-type lines enabled */
+&&   !iscontenttypecached		/* and not in cached image */
 &&   maxage >= 0 )			/* caller wants http headers */
  { /* --- emit mime content-type line --- */
    fprintf( emitptr, "Cache-Control: max-age=%d\n",maxage );
    fprintf( emitptr, "Content-Length: %d\n",nbytes );
+   if ( isvalign )			/* Vertical-Align: header wanted */
+     fprintf( emitptr, "Vertical-Align: %d\n",valign );
    fprintf( emitptr, "Content-type: image/gif\n\n" ); }
 /* -------------------------------------------------------------------------
 set stdout to binary mode (for Windows)
Index: loncom/cgi/mimeTeX/mimetex.h
diff -u loncom/cgi/mimeTeX/mimetex.h:1.3 loncom/cgi/mimeTeX/mimetex.h:1.4
--- loncom/cgi/mimeTeX/mimetex.h:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/mimetex.h	Thu Dec  4 12:17:13 2008
@@ -2,22 +2,24 @@
 #define	_MIMETEX
 /****************************************************************************
  *
- * Copyright(c) 2002-2003, John Forkosh Associates, Inc. All rights reserved.
+ * Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
+ *           http://www.forkosh.com   mailto: john@forkosh.com
  * --------------------------------------------------------------------------
  * This file is part of mimeTeX, which is free software. You may redistribute
  * and/or modify it under the terms of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
+ * version 3 or later, as published by the Free Software Foundation.
  *      MimeTeX is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
  * See the GNU General Public License for specific details.
  *      By using mimeTeX, you warrant that you have read, understood and
- * agreed to these terms and conditions, and that you are at least 18 years
- * of age and possess the legal right and ability to enter into this
- * agreement and to use mimeTeX in accordance with it.
- *      Your mimeTeX distribution should contain a copy of the GNU General
- * Public License.  If not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
- * or point your browser to  http://www.gnu.org/licenses/gpl.html
+ * agreed to these terms and conditions, and that you possess the legal
+ * right and ability to enter into this agreement and to use mimeTeX
+ * in accordance with it.
+ *      Your mimetex.zip distribution file should contain the file COPYING,
+ * an ascii text copy of the GNU General Public License, version 3.
+ * If not, point your browser to  http://www.gnu.org/licenses/
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
  * --------------------------------------------------------------------------
  *
  * Purpose:	Structures, macros, symbols,
@@ -35,7 +37,9 @@
  * Revision History:
  * 09/18/02	J.Forkosh	Installation.
  * 12/11/02	J.Forkosh	Version 1.00 released.
- * 07/06/03	J.Forkosh	Version 1.10 begun.
+ * 07/04/03	J.Forkosh	Version 1.01 released.
+ * ---
+ * 09/06/08	J.Forkosh	Version 1.70 released.
  *
  ***************************************************************************/
 
Index: loncom/cgi/mimeTeX/mimetex.html
diff -u loncom/cgi/mimeTeX/mimetex.html:1.3 loncom/cgi/mimeTeX/mimetex.html:1.4
--- loncom/cgi/mimeTeX/mimetex.html:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/mimetex.html	Thu Dec  4 12:17:13 2008
@@ -1,10 +1,11 @@
 <!--
  ****************************************************************************
- * Copyright(c) 2002-2006, John Forkosh Associates, Inc. All rights reserved.
+ * Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
+ *           http://www.forkosh.com   mailto: john@forkosh.com
  * ==========================================================================
  * This file is part of mimeTeX, which is free software. You may redistribute
  * and/or modify it under the terms of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
+ * version 3 or later, as published by the Free Software Foundation.
  *      MimeTeX is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
  * See the GNU General Public License for specific details.
@@ -12,10 +13,11 @@
  * agreed to these terms and conditions, and that you possess the legal
  * right and ability to enter into this agreement and to use mimeTeX
  * in accordance with it.
- *      Your mimeTeX distribution should contain a copy of the GNU General
- * Public License.  If not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
- * or point your browser to  http://www.gnu.org/licenses/gpl.html
+ *      Your mimetex.zip distribution file should contain the file COPYING,
+ * an ascii text copy of the GNU General Public License, version 3.
+ * If not, point your browser to  http://www.gnu.org/licenses/
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
  ****************************************************************************
  -->
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
@@ -99,6 +101,12 @@
         document.expression.formdata.focus(); }
     -->
   </script>
+
+<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++ javascript from mathtran.org to render <img alt="tex:math expression">
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+<script type="text/javascript"
+    src="http://www.mathtran.org/js/mathtran_img.js"></script>
   </head>
 <body>
 
@@ -117,7 +125,7 @@
    <td align="center" valign="middle">
     <center> <font color="maroon" size=4>
     <b><nobr>m i m e T e X &nbsp; m a n u a l</nobr></b> <br>
-    <font size=3>( for mimeTeX version 1.64 )</font> <br>
+    <font size=3>( for mimeTeX version 1.70 )</font> <br>
     <font size=3> <b>Click for:</b>&nbsp;
      <!-- <a href="http://www.forkosh.com" target="_top">homepage</a>, &nbsp;
      <a href="http://www.forkosh.com/resume.html" target="_top">resume</a> -->
@@ -140,7 +148,7 @@
 </center>
 <hr size=4>
 <center><b><font color="maroon" size=3>
-Copyright <font size=5>&copy;</font> 2002-2006,
+Copyright <font size=5>&copy;</font> 2002-2008,
 <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a> <br>
 email: <a href="mailto:john&#64;forkosh&#46;com">john&#64;forkosh&#46;com</a>
 </font></b> <br><br>
@@ -262,7 +270,8 @@
     <a href="#preview"><img id="imageI1" onclick="eqntext('imageI1')"
     src="../cgi-bin/mimetex.cgi?\normalsize
     f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
-    alt="" border=0 align=middle></a> wherever you put that &lt;img&gt tag.
+    alt="" border=0 style="Vertical-Align:-11px"></a>
+    wherever you put that &lt;img&gt tag.
     MimeTeX doesn't need intermediate dvi-to-gif conversion, and it doesn't
     create separate gif files for each converted expression.
     (But you can enable image caching with mimeTeX's
@@ -278,12 +287,68 @@
     or write a wrapper&nbsp;script around mimeTeX to simplify the
     notation. </p>
 
-<p style="margin-bottom:0">  For example, if you're using
+<p style="margin-bottom:0">  For example,
+    the following javascript snippet (based on
+    <a href="http://www.mathtran.org" target="_top">mathtran</a>'s
+    <a href="http://www.mathtran.org/js/mathtran_img.js"
+    target="_top">mathtran_img.js</a>) lets you just write &nbsp;
+    <b>&lt;img&nbsp;alt="mimetex:c=\sqrt{a^2+b^2}"&gt;</b> &nbsp;
+    wherever you want to see&nbsp;<a href="#preview"><img id="imageJS1"
+    onclick="eqntext('imageJS1')" src="../cgi-bin/mimetex.cgi?
+    \normalsize c=\sqrt{a^2+b^2}" alt="" border=0
+    style="Vertical-Align:-1px"></a>&nbsp; </p>
+    <pre class="medium" style="margin-top:0;margin-bottom:0"
+>   &lt;script type="text/javascript"&gt;
+   &lt;!--
+   // Create a namespace to hold variables and functions
+   mimetex = new Object();
+   // Change this to use your server
+   mimetex.imgSrc = "http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?";
+   // Transform the whole document: add src to each img with
+   // alt text starting with "mimetex:", unless img already has a src.
+   mimetex.init = function () {
+       if (! document.getElementsByTagName) return;
+       var objs = document.getElementsByTagName("img");
+       var len  = objs.length;
+       for (i=0; i&lt;len; i++) {
+          var img = objs[i];
+          if (img.alt.substring(0,8) == 'mimetex:')
+             if (!img.src) {
+                var tex_src = img.alt.substring(8);
+                img.src = mimetex.imgSrc + encodeURIComponent(tex_src);
+                // Append TEX to the class of the IMG.
+                img.className +=' tex'; }
+          }
+       mimetex.hideElementById("mimetex.error"); }
+   // Utility function
+   mimetex.hideElementById = function (id) {
+       var obj = document.getElementById(id);
+       if (obj) obj.style.display = 'none'; }
+   // resolve a cross-browser issue (see <a href="http://scottandrew.com/weblog/articles/cbs-events" target="_top">CBS&nbsp;events</a>)
+   mimetex.addEvent = function (obj, evType, fn, useCapture) {
+       if (obj.addEventListener) { //For Mozilla.
+           obj.addEventListener(evType, fn, useCapture);
+           return true; }
+       else if (obj.attachEvent) { //For Internet Explorer.
+           var r = obj.attachEvent("on"+evType, fn);
+           return r; }
+       }
+   // Initialize after entire document is loaded
+   mimetex.addEvent(window, 'load', mimetex.init, false);
+   --&gt;
+   &lt;/script&gt;</pre>
+
+<p style="margin-bottom:0">
+    Bulletin boards, wikis, etc, can also incorporate mimeTeX images
+    with short scripts.  For example, if you're using
     <a href="http://www.phpbb.com" target="_top">phpBB2</a>, then
     <a href="http://www.themathforum.com/" target="_top">Jameson</a>
-    contributed the following typical one-line mod that lets you just write
-    <b>[tex]&nbsp;f(x)=\int_{-\infty}^xe^{-t^2}dt&nbsp;[/tex]</b>
-    to obtain the same image illustrated above: </p>
+    contributed the following typical one-line mod that lets you write
+    <b>[tex]&nbsp;c=\sqrt{a^2+b^2}&nbsp;[/tex]</b> to obtain the
+    same&nbsp;<a href="#preview"><img id="imageJS2"
+    onclick="eqntext('imageJS2')" src="../cgi-bin/mimetex.cgi?
+    \normalsize c=\sqrt{a^2+b^2}" alt="" border=0
+    style="Vertical-Align:-1px"></a> image illustrated above&nbsp; </p>
     <pre class="medium" style="margin-top:0;margin-bottom:0"
 >   #--------[open]-----------------------------------------------------
      /includes/bbcode.php
@@ -320,26 +385,31 @@
 	  <a href="http://www.pmichaud.com/wiki/Cookbook/MimeTeX"
 	  target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
      <tr> <td align=center>
-	  <a href="http://www.wikimedia.org/wiki/Main_Page" target="_top">
-	  Wikimedia</a> </td>
+	  <!-- a href="http://www.wikimedia.org/wiki/Main_Page" -->
+	  <a href="http://www.wikimediafoundation.org/wiki/Main_Page"
+          target="_top">Wikimedia</a> </td>
 	  <td align=center> &nbsp; </td>
 	  <td align=center>
-	  <a href="http://meta.wikimedia.org/wiki/Mimetex_alternative"
+	  <!-- a href="http://meta.wikimedia.org/wiki/Mimetex_alternative" -->
+	  <a href="http://www.mediawiki.org/wiki/Mimetex_alternative"
 	  target="_top">&quot;mimeTeX&nbsp;alternative&quot;</a> </td> </tr>
+<!-- ***redirect loop***
      <tr> <td align=center>
 	  <a href="http://www.unitorganizer.com/mathwiki/index.php/Main_Page"
 	  target="_top">MathWiki</a> </td> <td> &nbsp; </td>
 	  <td align=center> <a href=
 	  "http://www.unitorganizer.com/mathwiki/index.php/MimetexParser"
 	  target="_top">&quot;mimeTeX&nbsp;Parser&quot;</a> </td> </tr>
+-->
      <tr> <td align=center>
 	  <a href="http://forums.punbb.org/" target="_top">PunBB</a> </td>
 	  <td> &nbsp; </td> <td align=center>
 	  <a href="http://www.math-linux.com/spip.php?article44"
 	  target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
      <tr> <td align=center>
-	  <a href="http://www.sixapart.com/movabletype/" target="_top">
-	  Movable&nbsp;Type</a> </td> <td> &nbsp; </td>
+	  <!-- a href="http://www.sixapart.com/movabletype/" -->
+	  <a href="http://www.movabletype.com/"
+	  target="_top">Movable&nbsp;Type</a> </td> <td> &nbsp; </td>
 	  <td align=center> <a href=
 	  "http://www.unitorganizer.com/myblog/2006/08/creating_equations_in_movable.html"
           target="_top">mimeTeX&nbsp;plugin</a> </td> </tr>
@@ -376,6 +446,92 @@
     minimal risk when used as illustrated above, but you're responsible
     for any plugin/wrapper script you write around it. </p>
 
+<h3> <a name="valignment">
+Vertical alignment<font size=5>...</font></a> </h3>
+<p> An image like
+    <a href="#preview"><img id="imageAV1" onclick="eqntext('imageAV1')"
+    src="../cgi-bin/mimetex.cgi?
+    \normalsize f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
+    alt="" border=0 align=middle></a>
+    doesn't look as good as the same image
+    <a href="#preview"><img id="imageAV2" onclick="eqntext('imageAV2')"
+    src="../cgi-bin/mimetex.cgi?
+    \normalsize f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
+    alt="" border=0 style="Vertical-Align:-11px"></a>
+    that's vertically aligned with your surrounding text.
+    Along with several standard 
+    <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">
+    HTTP&nbsp;header&nbsp;fields</a>, mimeTeX also emits a special
+    &nbsp; <b>Vertical-Align:&nbsp;&#150;<i>nn</i></b> &nbsp;
+    header, where <b>&#150;<i>nn</i></b> is the number of pixels
+    (usually negative as illustrated) needed for a
+    &nbsp; <b>style="Vertical-Align:&nbsp;&#150;<i>nn</i>&nbsp;px"</b>
+    &nbsp; attribute in the <b>&lt;img&gt;</b>&nbsp;tag used to
+    render your expression. </p>
+
+<p> But mimeTeX's special Vertical-Align: header
+    is unrecognized and ignored by your browser.  You have to get the
+    header, interpret it, and write the corresponding &lt;img&gt; tag.
+    The only feasible way to do all this is using a scripting language,
+    as illustrated by the following, rather naive, php code </p>
+    <pre class="medium" style="margin-top:.5em;margin-bottom:.5em"
+>   &lt;?php
+   $mimetexurl = "http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?";
+   function verticalalign( $expression ) {
+      global $mimetexurl;
+      // note: curl_init() stops at the first whitespace char in $url argument
+      $expression = ereg_replace(" ","~",$expression); // so remove whitespace
+      $url     = $mimetexurl . $expression;
+      $valign  = "0";
+      $ch      = curl_init( $url );
+      curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
+      curl_setopt( $ch, CURLOPT_HEADER, true );
+      $gif     = curl_exec( $ch );
+      $errno   = curl_errno( $ch );
+      curl_close( $ch );
+      if ( $errno == 0 ) {
+        $fields = explode("Vertical-Align:",$gif);
+        $vfield = trim($fields[1]);
+        $fldlen = strspn($vfield,"+-0123456789");
+        $valign = substr($vfield,0,$fldlen); }
+      return $valign;
+      }
+   function mimetextag( $expression ) {
+      global $mimetexurl;
+      $valign = verticalalign($expression);
+      $url    = $mimetexurl . $expression;
+      echo ' &lt;img src="',$url,'" ';
+      echo ' style="Vertical-Align:',$valign,'px" ';
+      echo ' alt="" border=0&gt;', "\n";
+      }
+   ?&gt;</pre>
+
+<p> Now you can write &nbsp;
+    &lt;?php&nbsp;mimetextag('\frac12\left(a^2+b^2\right)');&nbsp;?&gt;
+    wherever you want to see
+    <a href="#preview"><img id="imageAV5" onclick="eqntext('imageAV5')"
+    src="../cgi-bin/mimetex.cgi?
+    \normalsize\frac12\left(a^2+b^2\right)"
+    alt="" border=0 style="Vertical-Align:-5px"></a>
+    correctly aligned.  <!-- Besides making you escape backslashes
+    (each&nbsp;&#092;&nbsp;must be written&nbsp;&#092;&#092;), -->
+    This code calls mimeTeX twice to render each expression,
+    once to get the Vertical-Align: header and build an
+    &lt;img&gt; tag, and then again to render that tag.
+    If you're a good php programmer and write better code,
+    please email me a copy. </p>
+
+<p> If you're using mimeTeX's
+    &nbsp; <b>-DCACHEPATH=\&quot;<i>path</i>/\&quot;</b> &nbsp;
+    <a href="#options">compile&nbsp;option</a>, prefix your
+    <b><i>path</i>/</b> with a leading&nbsp;<b>&#037;</b> and write &nbsp;
+    <b>-DCACHEPATH=\&quot;&#037;<i>path</i>/\&quot;</b> &nbsp; instead.
+    That leading&nbsp;<b>&#037;</b> won't become part of your cache
+    directory's <b><i>path</i>/</b>, but it will signal mimeTeX
+    to cache headers along with each image.
+    Otherwise, the Vertical-Align: information is lost,
+    and attempts to align cached images will fail. </p>
+
 <h3> <a name="alternatives">
 Alternative solutions<font size=5>...</font></a> </h3>
 <p> MimeTeX's benefit over similar math-on-the-web solutions is, as
@@ -391,35 +547,38 @@
     <a href="#preview"><img id="imageI2" onclick="eqntext('imageI2')"
     src="../cgi-bin/mimetex.cgi?\normalsize
     f(x)=\int\limits_{-\infty}^xe^{-t^2}dt"
-    alt="" border=0 align=middle></a>, with arbitrary mean
+    alt="" border=0 style="Vertical-Align:-11px"></a>,
+    with arbitrary mean
     <a href="#preview"><img id="imageI3" onclick="eqntext('imageI3')"
-    src="../cgi-bin/mimetex.cgi?\large\mu" alt="" border=0 align=middle></a>
-    and standard deviation
+    src="../cgi-bin/mimetex.cgi?\large\mu" alt="" border=0
+    style="Vertical-Align:-5px"></a> and standard deviation
     <a href="#preview"><img id="imageI4" onclick="eqntext('imageI4')"
     src="../cgi-bin/mimetex.cgi?\large\sigma" alt="" border=0
-    align=middle></a>, and at mimeTeX's next larger font size, looks like </p>
+    style="Vertical-Align:0px"></a>,
+    and at mimeTeX's next larger font size, looks like </p>
      <center>
       <table>
        <tr align="center">
-	<td> <font size="4">mimeTeX</font> </td>
+	<td> <font size="4">latexrender</font> </td>
 	<td> <img src="../cgi-bin/mimetex.cgi?\hspace{30}"
               alt="" border=0> </td>
-	<td> <font size="4">latexrender</font> </td>
+	<td> <font size="4">mimeTeX</font> </td>
        </tr>
        <tr align="center">
+	<td> <img src="http://www.forkosh.com/lrender.gif"
+	 alt="" border=0 align=middle> </td>
+        <td> &nbsp; </td>
  	<td>
 	 <a href="#preview"><img id="imageI5" onclick="eqntext('imageI5')"
 	 src="../cgi-bin/mimetex.cgi?\large
          f(x)={\Large\frac1{\sigma\sqrt{2\pi}}}
 	 \int_{\small-\infty}^xe^{-\small\frac{(t-\mu)^2}{2\sigma^2}}dt"
 	 alt="" border=0 align=middle></a> </td>
-        <td> &nbsp; </td>
-	<td> <img src="http://www.forkosh.com/lrender.gif"
-	 alt="" border=0 align=middle> </td>
        </tr>
       </table>
      </center>
 <p> Similar LaTeX-based solutions that you may want to look at are
+    <a href="http://www.mathtran.org" target="_top">mathtran</a>,
     <a href="http://www.fourmilab.ch/webtools/textogif/textogif.html"
     target="_top">textogif</a> and
     <a href="http://www.math.uio.no/~martingu/gladtex/"
@@ -428,6 +587,49 @@
     target="_top">www.tug.org/interest.html</a> and in the
     <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=LaTeX2HTML"
     target="_top">tex-faq</a>. </p>
+
+<p> For example, <a href="http://www.mathtran.org" target="_top">mathtran</a>
+    is a public LaTeX web service that's
+    particularly easy to use by following these simple
+    <a href="http://www.mathtran.org/wiki/index.php/TeX_image"
+    target="_top">instructions</a>.  In the &lt;head&gt; of your
+    html page, place the tag <br>
+    &nbsp; &nbsp;
+      &lt;script type="text/javascript" <br>
+    &nbsp; &nbsp; &nbsp; &nbsp;
+      src="http://www.mathtran.org/js/mathtran_img.js"&gt;&lt;/script&gt;<br>
+    and in the &lt;body&gt;, wherever you want to see latex images,
+    place tags like <br>
+    &nbsp; &nbsp;
+      &lt;img alt=<b>"</b>tex:<i>any latex math expression</i><b>"</b>&gt;<br>
+    For comparison, <br>
+    &nbsp; &nbsp;
+      &lt;img alt="tex: f(x) = \frac1{\sigma\sqrt{2\pi}} <br>
+    &nbsp; &nbsp;
+      \int_{-\infty}^x e^{-\frac{(t-\mu)^2}{2\sigma^2}}dt"&gt; <br>
+    looks like </p>
+     <center>
+      <table>
+       <tr align="center">
+	<td> <font size="4">mathtran</font> </td>
+	<td> <img src="../cgi-bin/mimetex.cgi?\hspace{30}"
+              alt="" border=0> </td>
+	<td> <font size="4">mimeTeX</font> </td>
+       </tr>
+       <tr align="center">
+	<td> <img alt="tex:\displaystyle f(x) = \frac1{\sigma\sqrt{2\pi}}
+         \int_{-\infty}^x e^{-\frac{(t-\mu)^2}{2\sigma^2}}dt"> <br> </td>
+        <td> &nbsp; </td>
+ 	<td>
+	 <a href="#preview"><img id="imageP3" onclick="eqntext('imageP3')"
+	 src="../cgi-bin/mimetex.cgi?\large
+         f(x)={\Large\frac1{\sigma\sqrt{2\pi}}}
+	 \int_{\small-\infty}^xe^{-\small\frac{(t-\mu)^2}{2\sigma^2}}dt"
+	 alt="" border=0 align=middle></a> </td>
+       </tr>
+      </table>
+     </center>
+
 <!--
 <p> The remainder of this introductory mimeTeX tutorial section contains </p>
      <ul>
@@ -487,11 +689,12 @@
            &nbsp; renders &nbsp;
            <a href="#preview"> <img id="imageBu" onclick="eqntext('imageBu')"
            src="../cgi-bin/mimetex.cgi?\large a+\small b+c"
-           alt="" border=0 align=bottom></a>, &nbsp; whereas &nbsp;
-           "<b>\small&nbsp;a+{\Large&nbsp;b+}c</b>" &nbsp; renders &nbsp;
+           alt="" border=0 style="Vertical-Align:-2px"></a>, &nbsp;
+           whereas &nbsp; "<b>\small&nbsp;a+{\Large&nbsp;b+}c</b>" &nbsp;
+           renders &nbsp;
            <a href="#preview"> <img id="imageBv" onclick="eqntext('imageBv')"
            src="../cgi-bin/mimetex.cgi?\small a+{\Large b+}c"
-           alt="" border=0 align=bottom></a>. </li>
+           alt="" border=0 style="Vertical-Align:-2px"></a>. </li>
 <!--  <li> At smaller font sizes, try preceding your expression with &nbsp;
            <b>\light</b> &nbsp; which adjusts mimeTeX's anti-aliasing
            parameters to produce thinner lines that you may feel are
@@ -522,13 +725,15 @@
            By default, mimeTeX renders limits textstyle &nbsp;
            <a href="#preview"> <img id="imageB1" onclick="eqntext('imageB1')"
            src="../cgi-bin/mimetex.cgi?\normalsize\textstyle
-           \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0 align=middle></a>
-           &nbsp; at sizes <b>\normalsize</b> and smaller,
+           \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
+           style="Vertical-Align:-5px"></a> &nbsp;
+           at sizes <b>\normalsize</b> and smaller,
            and renders them displaystyle &nbsp;
            <a href="#preview"> <img id="imageB2" onclick="eqntext('imageB2')"
            src="../cgi-bin/mimetex.cgi?\normalsize\displaystyle
-           \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0 align=middle></a>
-           &nbsp; at sizes <b>\large</b> and larger.
+           \sum_{n=0}^\infty\frac{x^n}{n!}" alt="" border=0
+           style="Vertical-Align:-15px"></a> &nbsp;
+           at sizes <b>\large</b> and larger.
            The LaTeX directives <b>\displaystyle</b> or <b>\textstyle</b>,
            and <b>\limits</b> or <b>\nolimits</b>, override mimeTeX's default
            in the usual way.  Or see the <b>-DDISPLAYSIZE=<i>n</i></b>
@@ -570,8 +775,8 @@
      <a href="#preview"><img id="imageIA3" onclick="eqntext('imageIA3')"
      src="../cgi-bin/mimetex.cgi?\normalsize
      f(x)=\int\limits_{-\infty}^x e^{-t^2}dt"
-     alt="" border=0 align=middle></a> if you submit the sample expression
-     already in the box. </p>
+     alt="" border=0 style="Vertical-Align:-11px"></a> &nbsp;
+     if you submit the sample expression already in the box. </p>
 
  <p> And the &lt;img&gt; tag to embed this same integral anywhere
      in your own document is </p>
@@ -1108,7 +1313,7 @@
         Your working directory should now contain <center>
         <table cellpadding=0 cellspacing=0>
          <tr><td width=100>README</td> <td>mimeTeX release notes</td></tr>
-         <tr><td>LICENSE</td>    <td>GPL license, under which you may use
+         <tr><td>COPYING</td>    <td>GPL license, under which you may use
                                      mimeTeX</td></tr>
          <tr><td>mimetex.c</td>  <td>mimeTeX source program and all required
                                      functions</td></tr>
@@ -1237,14 +1442,15 @@
       <b>http://www.<i>yourdomain</i>.com/cgi-bin/mimetex.cgi?x^2+y^2</b> <br>
      which should display &nbsp;
      <img src="../cgi-bin/mimetex.cgi?\normalsize x^2+y^2" alt="" border=0
-     align=middle> &nbsp; in the upper-left corner of your window,
+     style="Vertical-Align:-3px"> &nbsp;
+     in the upper-left corner of your window,
      just like clicking this link does, which tests my mimetex.cgi, <br>
      &nbsp; &nbsp; &nbsp; &nbsp;
       <a href="http://www.forkosh.com/cgi-bin/mimetex.cgi?x^2+y^2"
       target="_top">http://www.forkosh.com/cgi-bin/mimetex.cgi?x^2+y^2</a><br>
      If you see the same &nbsp; <img src="../cgi-bin/mimetex.cgi?
-     \normalsize x^2+y^2" alt="" border=0 align=middle> &nbsp; image
-     from the <b><i>yourdomain</i></b> link, then you've completed
+     \normalsize x^2+y^2" alt="" border=0 style="Vertical-Align:-3px"> &nbsp;
+     image from the <b><i>yourdomain</i></b> link, then you've completed
      a successful mimeTeX installation. </p>
 
  <p> If you don't see the image, then your installation failed.
@@ -1330,13 +1536,22 @@
            is relative to mimetex.cgi, and must be writable by it.
            Files created under <b><i>path/</i></b> are named
            <b><i>filename</i>.gif</b>, where <b><i>filename</i></b>
-           is the 32-character MD5 hash of the LaTeX expression. <br>
-           &nbsp; &nbsp; &nbsp; When caching a new image, mimeTeX also
+           is the 32-character MD5 hash of your LaTeX expression. <br>
+              &nbsp; &nbsp; &nbsp; If you're also using mimeTeX's
+           <a href="#valignment">Vertical-Align:</a> feature, prefix your
+           <b><i>path</i>/</b> with a leading&nbsp;<b>&#037;</b> and write
+           &nbsp; <b>-DCACHEPATH=\&quot;&#037;<i>path</i>/\&quot;</b> &nbsp;
+           instead.  That leading&nbsp;<b>&#037;</b> won't become part of
+           your cache directory's <b><i>path</i>/</b>, but it will signal
+           mimeTeX to cache headers along with each image.
+           Otherwise, the Vertical-Align: information is lost,
+           and attempts to align cached images will fail. <br>
+              &nbsp; &nbsp; &nbsp; When caching a new image, mimeTeX also
            updates the file <b><i>path/</i>mimetex.log</b> containing
            a timestamp, filename and LaTeX expression for each new file
            created.  A sample entry looks like
 <pre>---------------------------------------------------------------------
-2004-08-07:09:00:53am            f8ccc8dd93c8eeb1d9c40b353ef781e0.gif
+2008-09-07:11:29:53am            f8ccc8dd93c8eeb1d9c40b353ef781e0.gif
 \LARGE x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}
 ---------------------------------------------------------------------</pre></dd>
       <dt><b>-DDEFAULTSIZE=<i>n</i></b> </dt>
@@ -3176,7 +3391,7 @@
  <p> Somewhat more detailed log information can be accumulated in
      the optional <b><i>logfile</i></b>.  If you provide that
      filename, mimeTeX writes a line to it of the form
-     <b>2004-09-20:12:59:33pm&nbsp;&lt;<i>tag</i>&gt;=99&nbsp;192.168.1.1&nbsp;<i>http_referer</i></b>
+     <b>2008-09-07:12:59:33pm&nbsp;&lt;<i>tag</i>&gt;=99&nbsp;192.168.1.1&nbsp;<i>http_referer</i></b>
      containing a timestamp, the counter tag and its current value,
      and the user's IP address and http_referer page if they're
      available. </p>
@@ -3735,7 +3950,7 @@
 <hr size=4>
 <table> <tr>
  <td> <font size=3 color="maroon"> <b>
-  <nobr>Copyright <font size=5>&copy;</font> 2002-2006,
+  <nobr>Copyright <font size=5>&copy;</font> 2002-2008,
   <a href="http://www.forkosh.com">John Forkosh Associates, Inc.</a>
   </nobr><br>
   email: <a href="mailto:john&#64;forkosh&#46;com">john&#64;forkosh&#46;com</a>
Index: loncom/cgi/mimeTeX/README
diff -u loncom/cgi/mimeTeX/README:1.1 loncom/cgi/mimeTeX/README:1.2
--- loncom/cgi/mimeTeX/README:1.1	Mon Feb 28 19:08:11 2005
+++ loncom/cgi/mimeTeX/README	Thu Dec  4 12:17:13 2008
@@ -1,10 +1,10 @@
 
  --------------------------------------------------------------------------
- November 30, 2004                                             Version 1.60
+ September 6, 2008                                             Version 1.70
 
                   m i m e T e X   R e a d m e   F i l e
 
- Copyright(c) 2002-2005, John Forkosh Associates, Inc. All rights reserved.
+ Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
  --------------------------------------------------------------------------
 
                             by: John Forkosh
@@ -12,7 +12,7 @@
 
           This file is part of mimeTeX, which is free software.
           You may redistribute and/or modify it under the terms
-          of the GNU General Public License, version 2 or later,
+          of the GNU General Public License, version 3 or later,
           as published by the Free Software Foundation. See
                    http://www.gnu.org/licenses/gpl.html
 
@@ -91,7 +91,7 @@
   Your working directory should now contain
        mimetex.zip    your gnu zipped mimeTeX distribution containing...
        README         this file (see mimetex.html for demo/tutorial)
-       LICENSE        GPL license, under which you may use mimeTeX
+       COPYING        GPL license, under which you may use mimeTeX
        mimetex.c      mimeTeX source program and all required functions
        mimetex.h      header file for mimetex.c (and for gfuntype.c)
        gfuntype.c     parses output from  gftype -i  and writes bitmap data
@@ -176,7 +176,11 @@
 
 IV.  REVISION HISTORY
 ------------------------------------------------------------------------
-  11/30/04  J.Forkosh      version 1.60 (beta) released
+  A more detailed account of mimeTeX's revision history
+  is maintained at  http://www.forkosh.com/mimetexchangelog.html
+  ---
+  09/06/08  J.Forkosh      version 1.70 released.
+  11/30/04  J.Forkosh      version 1.60 released
   10/02/04  J.Forkosh      version 1.50 released on CTAN with various new
                            features and fixes, and updated documentation.
   07/18/04  J.Forkosh      version 1.40 re-released on CTAN with minor
@@ -208,9 +212,5 @@
   I hope you find mimeTeX useful.  If so, a contribution to your
   country's TeX Users Group, or to the GNU project, is suggested,
   especially if you're a company that's currently profitable.
-  
-  If you also like mimeTeX's source, I'm an independent contractor
-  incorporated in the US as John Forkosh Associates, Inc.  A resume
-  is at www.forkosh.com or email john@forkosh.com
 ========================= END-OF-FILE README ===========================
 
Index: loncom/cgi/mimeTeX/texfonts.h
diff -u loncom/cgi/mimeTeX/texfonts.h:1.3 loncom/cgi/mimeTeX/texfonts.h:1.4
--- loncom/cgi/mimeTeX/texfonts.h:1.3	Tue Oct  9 21:41:41 2007
+++ loncom/cgi/mimeTeX/texfonts.h	Thu Dec  4 12:17:13 2008
@@ -2,22 +2,24 @@
 #define _TEXFONTS
 /****************************************************************************
  *
- * Copyright(c) 2002-2003, John Forkosh Associates, Inc. All rights reserved.
+ * Copyright(c) 2002-2008, John Forkosh Associates, Inc. All rights reserved.
+ *           http://www.forkosh.com   mailto: john@forkosh.com
  * --------------------------------------------------------------------------
  * This file is part of mimeTeX, which is free software. You may redistribute
  * and/or modify it under the terms of the GNU General Public License,
- * version 2 or later, as published by the Free Software Foundation.
+ * version 3 or later, as published by the Free Software Foundation.
  *      MimeTeX is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY, not even the implied warranty of MERCHANTABILITY.
  * See the GNU General Public License for specific details.
  *      By using mimeTeX, you warrant that you have read, understood and
- * agreed to these terms and conditions, and that you are at least 18 years
- * of age and possess the legal right and ability to enter into this
- * agreement and to use mimeTeX in accordance with it.
- *      Your mimeTeX distribution should contain a copy of the GNU General
- * Public License.  If not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
- * or point your browser to  http://www.gnu.org/licenses/gpl.html
+ * agreed to these terms and conditions, and that you possess the legal
+ * right and ability to enter into this agreement and to use mimeTeX
+ * in accordance with it.
+ *      Your mimetex.zip distribution file should contain the file COPYING,
+ * an ascii text copy of the GNU General Public License, version 3.
+ * If not, point your browser to  http://www.gnu.org/licenses/
+ * or write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330,  Boston, MA 02111-1307 USA.
  * --------------------------------------------------------------------------
  *
  * Purpose:	chardef structure data for mimetex
@@ -60,6 +62,7 @@
  *				and rsfs fonts.
  * 07/12/03	J.Forkosh	Entirely new set of fonts generated.
  * 10/21/05	J.Forkosh	Compressed fonts generated
+ * 09/06/08	J.Forkosh	mimeTeX version 1.70 released.
  *
  ***************************************************************************/
 

--riegler1228393035--