From 5794f89813276b750277511bae759a1e9953f96b Mon Sep 17 00:00:00 2001 From: fiedorow Date: Tue, 17 Feb 2004 19:06:22 +0000 Subject: [PATCH] Support for absolute value added --- filter/algebra/filter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); -- 2.39.5