]> git.mjollnir.org Git - moodle.git/commitdiff
Support for absolute value added
authorfiedorow <fiedorow>
Tue, 17 Feb 2004 19:06:22 +0000 (19:06 +0000)
committerfiedorow <fiedorow>
Tue, 17 Feb 2004 19:06:22 +0000 (19:06 +0000)
filter/algebra/filter.php

index ea99288b4743e1c3e4a62d5e959a4d26d7d1b2f8..3d4de01d660f8e033a66c534f4119ae5e217ea26 100644 (file)
@@ -3,7 +3,7 @@
 //                                                                         //
 // NOTICE OF COPYRIGHT                                                     //
 //                                                                         //
-// Moodle - Filter for converting simple caclculator-type algebraic        //
+// Moodle - Filter for converting simple calculator-type algebraic        //
 // expressions to cached gif images                                        //
 //                                                                         //
 // Copyright (C) 2004 Zbigniew Fiedorowicz fiedorow@math.ohio-state.edu    //
@@ -171,6 +171,8 @@ function algebra_filter ($courseid, $text) {
               $texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp);
               $texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp);
              $texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$1}",$texexp);
+             $texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
+             $texexp = preg_replace('/\\\mbox{abs}\\\left\((.+?)\\\right\)/s',"|\$1|",$texexp);
               $texexp = preg_replace('/\\\log\\\left\((.+?),(.+?)\\\right\)/s','\log_{'. "\$2}\\left(\$1\\right)",$texexp);
               $texexp = preg_replace('/(\\\cos|\\\sin|\\\tan|\\\sec|\\\csc|\\\cot)([h]*)\\\left\((.+?),(.+?)\\\right\)/s',"\$1\$2^{". "\$4}\\left(\$3\\right)",$texexp);
              $texexp = preg_replace('/\\\int\\\left\((.+?),(.+?),(.+?)\\\right\)/s','\int_'. "{\$2}^{\$3}\$1 ",$texexp);