--- loncom/xml/lontexconvert.pm 2016/02/20 00:12:45 1.118 +++ loncom/xml/lontexconvert.pm 2018/04/23 18:59:28 1.121 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # TeX Conversion Module # -# $Id: lontexconvert.pm,v 1.118 2016/02/20 00:12:45 raeburn Exp $ +# $Id: lontexconvert.pm,v 1.121 2018/04/23 18:59:28 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -271,11 +271,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; } { @@ -331,7 +339,12 @@ sub tex_engine { } return $env{'environment.texengine'}; } - return 'tth'; + my $dom = $env{'request.role.domain'} || $env{'user.domain'}; + my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); + if ($domdefaults{'texengine'} ne '') { + return $domdefaults{'texengine'}; + } + return 'MathJax'; } sub init_math_support { @@ -548,7 +561,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;