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

sakharuk lon-capa-cvs@mail.lon-capa.org
Mon, 20 Oct 2003 19:47:23 -0000


sakharuk		Mon Oct 20 15:47:23 2003 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Bug 2260 (The table runneth over.) is fixed - at least partly. I can not see all
  possible situations with sub/superscripts ahead so I work with this more or lesspermanantly.  
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.182 loncom/xml/londefdef.pm:1.183
--- loncom/xml/londefdef.pm:1.182	Thu Oct 16 11:29:45 2003
+++ loncom/xml/londefdef.pm	Mon Oct 20 15:47:23 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.182 2003/10/16 15:29:45 sakharuk Exp $
+# $Id: londefdef.pm,v 1.183 2003/10/20 19:47:23 sakharuk Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -1322,7 +1322,7 @@
     if ($target eq 'web') {
 	$currentstring .= $token->[4];
     } elsif ($target eq 'tex') {
-	$currentstring .= "\$_{ ";
+	$currentstring .= "\$_{";
     } 
     return $currentstring;
 }
@@ -1333,7 +1333,7 @@
     if ($target eq 'web') {
 	$currentstring .= $token->[2];
     } elsif ($target eq 'tex') {
-	$currentstring .= " }\$";
+	$currentstring .= "}\$";
     }
     return $currentstring;
 }
@@ -1345,7 +1345,7 @@
     if ($target eq 'web') {
 	$currentstring .= $token->[4];
     } elsif ($target eq 'tex') {
-	$currentstring .= "\$^{ ";
+	$currentstring .= "\$^{";
     } 
     return $currentstring;
 }
@@ -1356,7 +1356,7 @@
     if ($target eq 'web') {
 	$currentstring .= $token->[2];
     } elsif ($target eq 'tex') {
-	$currentstring .= " }\$";
+	$currentstring .= "}\$";
     }
     return $currentstring;
 }
@@ -1997,11 +1997,15 @@
 		    $elementdata=~s/^\s+(\S.*)/$1/; 
 		    $elementdata=~s/(.*\S)\s+$/$1/;
 		    $elementdata=~s/(\s)+/$1/;
+
 		    my $lengthnewdata=1.8*length($elementdata);
 		    if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;}
 		}
 	    } else {
-		$current_length=1.8*length($data);
+		my $working_data=$data;
+		$working_data=~s/(\$\_\{|\$\_|\$\^{|\$\^|\}\$|\$)//g;
+		$working_data=~s/\\cdot/ /;
+		$current_length=1.8*length($working_data);
 	    }
 	    $Apache::londefdef::table[-1]{'length'} .= $current_length.',';
 	    $Apache::londefdef::table[-1]{'TeXlength'} .= '0,';