[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.pm

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 02 Mar 2004 16:09:42 -0000


sakharuk		Tue Mar  2 11:09:42 2004 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  I hope that bug 2765 (numericalresponse sometimes still creates incorrect width tables) is finally resolved. Nevertheless I am always ready to resume work on this bug though I've closed bug in Bugzilla.
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.137 loncom/homework/caparesponse/caparesponse.pm:1.138
--- loncom/homework/caparesponse/caparesponse.pm:1.137	Thu Feb 26 16:25:28 2004
+++ loncom/homework/caparesponse/caparesponse.pm	Tue Mar  2 11:09:42 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.137 2004/02/26 21:25:28 albertel Exp $
+# $Id: caparesponse.pm,v 1.138 2004/03/02 16:09:42 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -382,12 +382,14 @@
     my $cell_width=0;
     foreach my $member (@$rbubble_values) {
 	my $cell_width_real=0;
-	if ($member=~/(\d*)\.?(\d*)(E|e)(\+|-)?(\d*)/) {
+	if ($member=~/(\+|-)?(\d*)\.?(\d*)\s*\$\\times\s*10\^{(\+|-)?(\d+)}\$/) {
+	    $cell_width_real=(length($2)+length($3)+length($5)+7)*$scale;
+	} elsif ($member=~/(\d*)\.?(\d*)(E|e)(\+|-)?(\d*)/) {
 	    $cell_width_real=(length($1)+length($2)+length($5)+9)*$scale;
-	} elsif ($member=~/(\d*)\.(\d*)/) {
+        } elsif ($member=~/(\d*)\.(\d*)/) {
 	    $cell_width_real=(length($1)+length($2)+3)*$scale;
 	} else {
-	    $cell_width_real=(length($member)+1)*$scale;
+	    $cell_width_real=(length($member)+1)*$scale*0.9;
 	}
 	if ($cell_width_real>$cell_width) {$cell_width=$cell_width_real;}
     }