From: fiedorow Date: Tue, 17 Feb 2004 19:06:22 +0000 (+0000) Subject: Support for absolute value added X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5794f89813276b750277511bae759a1e9953f96b;p=moodle.git Support for absolute value added --- diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php index ea99288b47..3d4de01d66 100644 --- a/filter/algebra/filter.php +++ b/filter/algebra/filter.php @@ -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);