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

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 13 Mar 2007 15:05:19 -0000


foxr		Tue Mar 13 11:05:19 2007 EDT

  Modified files:              
    /loncom/xml	londefdef.pm 
  Log:
  Don't subst $ for \ensuremath if there are \verb's in the <m></m> tags.
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.359 loncom/xml/londefdef.pm:1.360
--- loncom/xml/londefdef.pm:1.359	Tue Mar 13 09:38:43 2007
+++ loncom/xml/londefdef.pm	Tue Mar 13 11:05:19 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.359 2007/03/13 13:38:43 foxr Exp $
+# $Id: londefdef.pm,v 1.360 2007/03/13 15:05:19 foxr Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -128,6 +128,7 @@
 	#&Apache::lonxml::debug("M is ends with:$currentstring:");
 	$Apache::lonxml::post_evaluate=0;
     } elsif ($target eq 'tex') {
+
 	$currentstring = $inside;
 	my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
 	if ($eval eq 'on') {
@@ -135,11 +136,13 @@
 	}
 	if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';}
 	# detect simple math mode entry exits, and convert them
-        # to use \ensuremath
-	if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) {
-	    $currentstring=~s/^(\s*)\$/$1/;
-	    $currentstring=~s/\$(\s*)$/$1/;
-	    $currentstring='\ensuremath{'.$currentstring.'}';
+        # to use \ensuremath ... unless there's a \verb inside.
+	if (! ($currentstring=~/\\verb/)) {
+	    if ($currentstring=~/^\s*\$[^\$].*[^\$]\$\s*$/) {
+		$currentstring=~s/^(\s*)\$/$1/;
+		$currentstring=~s/\$(\s*)$/$1/;
+		$currentstring='\ensuremath{'.$currentstring.'}';
+	    }
 	}
 	$Apache::lonxml::post_evaluate=0;
     }