--- loncom/xml/lontexconvert.pm 2008/01/29 11:04:10 1.85 +++ loncom/xml/lontexconvert.pm 2008/11/18 10:02:56 1.90 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Conversion Module # -# $Id: lontexconvert.pm,v 1.85 2008/01/29 11:04:10 foxr Exp $ +# $Id: lontexconvert.pm,v 1.90 2008/11/18 10:02:56 hauer Exp $ # # Copyright Michigan State University Board of Trustees # @@ -85,7 +85,6 @@ $Apache::lontexconvert::messedup=0; # into the safe space since opcode checks only occur at compile time sub convert_real { my ($texstring)=@_; - &Apache::lonnet::logthis("convert_real converting '$$texstring"); my ($xmlstring,$errorstring); local $SIG{SEGV}=sub { $Apache::lontexconvert::messedup=1; die; }; local $SIG{ALRM}=sub { @@ -96,14 +95,12 @@ sub convert_real { }; &Apache::lonxml::start_alarm(); if ($env{'browser.mathml'}) { - &Apache::lonnet::logthis("mathml translation"); $xmlstring=&tth::ttm($$texstring); $xmlstring=~s/\/\/g; $xmlstring=~s/\/\/g; $xmlstring=~s/\/\\<\/p\>/g; $errorstring.=&tth::ttmerror(); } else { - &Apache::lonnet::logthis("tth translation"); $xmlstring=&tth::tth($$texstring); $errorstring.=&tth::ttherror(); $xmlstring=~s---g; @@ -116,9 +113,9 @@ sub convert_real { # reasonably well to ⇔. If we get many more of these, # we're going to need to have a translation sub. # - $xmlstring=~s/\\rightleftharpoons/\&\#8660;/g; + my $lrharpoon = pack("U", 0x21cc); + $xmlstring=~s/\\rightleftharpoons/$lrharpoon/g; - &Apache::lonnet::logthis("Final result: $xmlstring"); &Apache::lonxml::end_alarm(); return ($xmlstring,$errorstring); } @@ -222,7 +219,9 @@ sub jsMath_converted { sub tex_engine { if (exists($env{'form.texengine'})) { - return $env{'form.texengine'}; + if ($env{'form.texengine'} ne '') { + return $env{'form.texengine'}; + } } if ($env{'request.course.id'} && exists($env{'course.'.$env{'request.course.id'}.'.texengine'})) { @@ -254,7 +253,7 @@ sub mimetex_converted { if ($displaystyle) { $$texstring='\\displaystyle \\Large '.$$texstring; } - my $result=''; + my $result='$'.$$texstring.'$'; if ($displaystyle) { $result='
'.$result.'
'; } @@ -354,7 +353,7 @@ sub msgtexconverted { sub algebra { use AlgParser; - my ($string,$target,$style)=@_; + my ($string,$target,$style,$parstack,$safeeval)=@_; my $parser = new AlgParserWithImplicitExpand; $string=&prepare_algebra($string); my $ret = $parser->parse($string); @@ -371,7 +370,9 @@ sub algebra { $latex='\\ensuremath{'.$latex.'}'; } if ($target eq 'web' || $target eq 'analyze') { - $result = &converted(\$latex); + my $display=&Apache::lonxml::get_param('display',$parstack,$safeeval); + $result = &converted(\$latex,$display); +# $result = &converted(\$latex); } else { $result = $latex; }