[LON-CAPA-cvs] cvs: loncom /xml lontexconvert.pm
riegler
riegler@source.lon-capa.org
Thu, 04 Dec 2008 19:53:53 -0000
riegler Thu Dec 4 19:53:53 2008 EDT
Modified files:
/loncom/xml lontexconvert.pm
Log:
added call to mimetex_valign which destills the vertical alignment shift needed to vertically align mimetex-formula-images.
Note that two calls are needed to mimetex.cgi.
The first one (within mimetex_align) has the only purpose to strip the needed value from the HTTP header field. The second call gets the actual image.
According to
http://forkosh.com/mimetex.html
this currently seems to be the only way to do it.
Note, however, that the double call is not that detrimental w.r.t. to performance as mimetex on loncapa is configured such that images (and vertical alignment values) are cached.
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.92 loncom/xml/lontexconvert.pm:1.93
--- loncom/xml/lontexconvert.pm:1.92 Thu Dec 4 09:51:14 2008
+++ loncom/xml/lontexconvert.pm Thu Dec 4 19:53:53 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# TeX Conversion Module
#
-# $Id: lontexconvert.pm,v 1.92 2008/12/04 09:51:14 hauer Exp $
+# $Id: lontexconvert.pm,v 1.93 2008/12/04 19:53:53 riegler Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -248,7 +248,7 @@
$ua->timeout(10);
$ua->env_proxy;
#header without imagedata saved to response:
- my $response = $ua->head('http://lcdevhost.localdomain/cgi-bin/mimetex.cgi?'.$texstring);
+ my $response = $ua->head('http://localhost.localdomain/cgi-bin/mimetex.cgi?'.$texstring);
if ($response->is_success) {
#get the valign-value:
return($response->headers->{'vertical-align'});}
@@ -267,12 +267,7 @@
$$texstring='\\displaystyle \\Large '.$$texstring;
}
-# FIXME
-# this is the line that calls the new function mimetex_valign above:
-# my $result='<img src="/cgi-bin/mimetex.cgi?'.&escape($$texstring).'" style="vertical-align:'.&mimetex_valign($$texstring).'px" alt="$'.$$texstring.'$" />';
-#
-# this line is the old implementation without valign of the images:
- my $result='<img src="/cgi-bin/mimetex.cgi?'.&escape($$texstring).'" alt="$'.$$texstring.'$" />';
+ my $result='<img src="/cgi-bin/mimetex.cgi?'.&escape($$texstring).'" style="vertical-align:'.&mimetex_valign($$texstring).'px" alt="$'.$$texstring.'$" />';
if ($displaystyle) {
$result='<center>'.$result.'</center>';
}