[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /xml londefdef.pm

raeburn raeburn at source.lon-capa.org
Fri May 17 11:41:33 EDT 2019


raeburn		Fri May 17 15:41:33 2019 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/xml	londefdef.pm 
  Log:
  - For 2.11
    Backport 1.458
  
  
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.456.2.3 loncom/xml/londefdef.pm:1.456.2.4
--- loncom/xml/londefdef.pm:1.456.2.3	Mon Jan 30 20:14:31 2017
+++ loncom/xml/londefdef.pm	Fri May 17 15:41:32 2019
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Tags Default Definition Module 
 #
-# $Id: londefdef.pm,v 1.456.2.3 2017/01/30 20:14:31 raeburn Exp $
+# $Id: londefdef.pm,v 1.456.2.4 2019/05/17 15:41:32 raeburn Exp $
 # 
 #
 # Copyright Michigan State University Board of Trustees
@@ -92,6 +92,14 @@
     my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser);
     if ($target eq 'web' || $target eq 'analyze') {
 	&Apache::lonxml::debug("M is starting with:$inside:");
+        if (!($inside =~ /^\s*\$.*\$\s*$/ || $inside =~ /^\s*\\[([].*\\[)\]]\s*$/)) {
+            # Non-math LaTeX will not be rendered correctly with MathJax
+            # and it should be avoided anyway.
+            # On top of that, MathJax will render math without $, but
+            # it will fail with tth. This is worth a warning.
+            # (even though some people might just use latex for printing)
+            &Apache::lonxml::warning(&mt("Missing \$ in <m>."));
+        }
 	my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval);
 	if ($eval eq 'on') {
 	    $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]);




More information about the LON-CAPA-cvs mailing list