[LON-CAPA-cvs] cvs: loncom /xml lontexconvert.pm

bisitz bisitz@source.lon-capa.org
Mon, 14 Mar 2011 16:10:21 -0000


bisitz		Mon Mar 14 16:10:21 2011 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  - Bug 6320: Same alignment/new paragraph for eqnarrays as it is used for, e.g. $$ ... $$ (Thanks to Juliane Wenzel for research)
  - Replaced deprectated <center> tag with div/CSS
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.105 loncom/xml/lontexconvert.pm:1.106
--- loncom/xml/lontexconvert.pm:1.105	Thu Feb 10 19:28:29 2011
+++ loncom/xml/lontexconvert.pm	Mon Mar 14 16:10:21 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.105 2011/02/10 19:28:29 raeburn Exp $
+# $Id: lontexconvert.pm,v 1.106 2011/03/14 16:10:21 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,10 +165,12 @@
 
 sub displaystyle {
     my ($texstring)=@_;
-    #has a $$ or \[ or \displaystyle in it, guessinng it's display mode
+    #has a $$ or \[ or \displaystyle or eqnarray in it, guessinng it's display mode
     if ($$texstring=~/[^\\]\$\$/ ||
-	$$texstring=~/\\\[/ ||
-	$$texstring=~/\\displaystyle/) { return 1; }
+        $$texstring=~/\\\[/ ||
+        $$texstring=~/\\displaystyle/ ||
+        $$texstring=~/eqnarray/
+       ) { return 1; }
     return 0;
 }
 
@@ -289,7 +291,7 @@
     my $valign = &mimetex_valign($esc_texstring);
     my $result='<img src="/cgi-bin/mimetex.cgi?'.$esc_texstring.'" style="vertical-align:'.$valign.'px" alt="'.$alt_string.'" />';
     if ($displaystyle) {
-	$result='<center>'.$result.'</center>';
+	$result='<div style="text-align:center">'.$result.'</div>';
     }
     return $result;
 }