--- loncom/xml/lontexconvert.pm 2016/08/05 21:04:25 1.112.2.5 +++ loncom/xml/lontexconvert.pm 2018/04/23 19:33:17 1.112.2.7 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Conversion Module # -# $Id: lontexconvert.pm,v 1.112.2.5 2016/08/05 21:04:25 raeburn Exp $ +# $Id: lontexconvert.pm,v 1.112.2.7 2018/04/23 19:33:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -270,11 +270,19 @@ sub displaystyle { sub MathJax_converted { my $texstring=shift; - my $tag='math/tex;'; - if (&displaystyle($texstring)) { $tag='math/tex; mode=display'; } + my ($tag,$startspan,$endspan); + $tag='math/tex;'; + if (&displaystyle($texstring)) { + $tag='math/tex; mode=display'; + $startspan=''; + $endspan=''; + } else { + $startspan=''; + $endspan=''; + } &clean_out_math_mode($texstring); - return &MathJax_header(). - ''; + return &MathJax_header().$startspan. + ''.$endspan; } { @@ -388,7 +396,7 @@ sub converted { if ($mode =~ /tth/i) { return &tth_converted($string); } elsif ($mode =~ /jsmath/i) { - return &jMathJax_converted($string); + return &MathJax_converted($string); } elsif ($mode =~ /mathjax/i) { return &MathJax_converted($string); } elsif ($mode =~ /mimetex/i) { @@ -537,7 +545,7 @@ sub postprocess_algebra { # $string =~s/\\fun/ /g; # sqrt(3,4) means the 4 root of 3 - $string =~s/\\sqrt{([^,]+),([^\}]+)}/\\sqrt[$2]{$1}/gs; + $string =~s/\\sqrt\{([^,]+),([^\}]+)}/\\sqrt[$2]{$1}/gs; # log(3,4) means the log base 4 of 3 $string =~s/\\log\\left\((.+?),(.+?)\\right\)/\\log_{$2}\\left($1\\right)/gs; @@ -603,7 +611,6 @@ Header =item tex_engine() - =item init_math_support() =item mimetex_valign()