--- loncom/xml/lonxml.pm	2011/12/01 04:14:12	1.525
+++ loncom/xml/lonxml.pm	2011/12/09 21:21:43	1.527
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.525 2011/12/01 04:14:12 raeburn Exp $
+# $Id: lonxml.pm,v 1.527 2011/12/09 21:21:43 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -301,7 +301,8 @@ sub xmlparse {
  &clean_safespace($safeeval);
 
  if (@script_var_displays) {
-     $finaloutput .= join('',@script_var_displays);
+     my $scriptoutput = join('',@script_var_displays);
+     $finaloutput=~s{(</body>\s*</html>)\s*$}{$scriptoutput$1}s;
      undef(@script_var_displays);
  }
  &init_state();
@@ -1496,7 +1497,8 @@ sub renderingoptions {
            {&Apache::lonlocal::texthash
                (''        => '',
                 'tth'     => 'tth (TeX to HTML)',
-                'jsMath'  => 'jsMath',
+                'MathJax' => 'MathJax',
+  		'jsMath'  => 'jsMath',
                 'mimetex' => 'mimetex (Convert to Images)')}).
      '</span>';
     return $output;