--- loncom/xml/lontexconvert.pm 2002/03/06 20:27:00 1.5 +++ loncom/xml/lontexconvert.pm 2002/09/16 21:25:22 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Conversion Module # -# $Id: lontexconvert.pm,v 1.5 2002/03/06 20:27:00 matthew Exp $ +# $Id: lontexconvert.pm,v 1.9 2002/09/16 21:25:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -97,6 +97,33 @@ sub footer { return $xmlstring; } +# ------------------------------------------------------------ Message display + +sub to_convert { + my ($string) = @_; + return &converted(\$string); +} + +sub msgtexconverted { + my $message=shift; + + #FIXME this crap needs to go but right now the -L option might be + #ignored if this isn;t the first time the tth engine is used + #thus the \\document class crap, it makes sure we init the LaTeX stuff + if ($ENV{'browser.mathml'}) { + &tth::ttminit(); + &tth::ttmoptions("-L"); + } else { + &tth::tthinit(); + &tth::tthoptions("-L"); + } + $message=~s/(\$\$.+?\$\$)/&to_convert("\\documentclass{article}".$1)/ge; + $message=~s/(\$.+?\$)/&to_convert("\\documentclass{article}".$1)/ge; + $message=~s/(\\\(.+?\\\))/&to_convert("\\documentclass{article}".$1)/ge; + $message=~s/(\\\[.+?\\\])/&to_convert("\\documentclass{article}".$1)/ge; + return $message.$errorstring; +} + 1; __END__