From 65a275f40466bae8b27292cc7f7b7eba9dc43e84 Mon Sep 17 00:00:00 2001 From: fiedorow Date: Thu, 19 Feb 2004 21:27:16 +0000 Subject: [PATCH] Now strips outermost parentheses in denominators --- filter/algebra/algebradebug.php | 1 + filter/algebra/filter.php | 1 + 2 files changed, 2 insertions(+) diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index f4301e0164..0201dfaf3a 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -107,6 +107,7 @@ function refineTeX($texexp) { $texexp = str_replace('\mbox{asech}','\mbox{sech}^{-1}',$texexp); $texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp); $texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp); + $texexp = preg_replace('/\\\frac{(.+?)}{\\\left\((.+?)\\\right\)}/s','\frac{'."\$1}{\$2}",$texexp); $texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$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); diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php index fdedc56574..05ace6f7ca 100644 --- a/filter/algebra/filter.php +++ b/filter/algebra/filter.php @@ -170,6 +170,7 @@ function algebra_filter ($courseid, $text) { $texexp = str_replace('\mbox{asech}','\mbox{sech}^{-1}',$texexp); $texexp = str_replace('\mbox{acsch}','\mbox{csch}^{-1}',$texexp); $texexp = str_replace('\mbox{acoth}','\mbox{coth}^{-1}',$texexp); + $texexp = preg_replace('/\\\frac{(.+?)}{\\\left\((.+?)\\\right\)}/s','\frac{'."\$1}{\$2}",$texexp); $texexp = preg_replace('/\\\sqrt{(.+?),(.+?)}/s','\sqrt['. "\$2]{\$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); -- 2.39.5