--- loncom/xml/londefdef.pm 2005/02/10 23:00:09 1.256 +++ loncom/xml/londefdef.pm 2005/02/25 05:54:01 1.258 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.256 2005/02/10 23:00:09 albertel Exp $ +# $Id: londefdef.pm,v 1.258 2005/02/25 05:54:01 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -84,7 +84,6 @@ sub start_m { my $currentstring = ''; my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); if ($target eq 'web' || $target eq 'analyze') { - $inside ='\\documentstyle{article}'.$inside; &Apache::lonxml::debug("M is starting with:$inside:"); my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); if ($eval eq 'on') { @@ -106,6 +105,13 @@ sub start_m { $currentstring=&Apache::run::evaluate($currentstring,$safeeval,$$parstack[-1]); } 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/^\$//; + $currentstring=~s/\$$//; + $currentstring='\ensuremath{'.$currentstring.'}'; + } $Apache::lonxml::post_evaluate=0; } return $currentstring;