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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 16 Sep 2002 21:25:22 -0000


albertel		Mon Sep 16 17:25:22 2002 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  - This will get redone when I get a chance to look at the new tth/m stuff
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.8 loncom/xml/lontexconvert.pm:1.9
--- loncom/xml/lontexconvert.pm:1.8	Mon Sep 16 15:29:06 2002
+++ loncom/xml/lontexconvert.pm	Mon Sep 16 17:25:22 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.8 2002/09/16 19:29:06 albertel Exp $
+# $Id: lontexconvert.pm,v 1.9 2002/09/16 21:25:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -99,8 +99,17 @@
 
 # ------------------------------------------------------------ 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");
@@ -108,9 +117,10 @@
       &tth::tthinit();
       &tth::tthoptions("-L");
     }
-    $message=~s/(\$\$.+?\$\$)/&converted(\$1)/ge;
-    $message=~s/(\$.+?\$)/&converted(\$1)/ge;
-    $message=~s/(\\\[.+?\\\])/&converted(\$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;
+    $message=~s/(\\\[.+?\\\])/&to_convert("\\documentclass{article}".$1)/ge;
     return $message.$errorstring;
 }