From c3cc23141194f4c0e56d6802f7e9ff082d21c5fb Mon Sep 17 00:00:00 2001 From: Jean-Michel Vedrine Date: Sun, 4 Feb 2018 11:13:51 +0100 Subject: Display formula using Ajax --- displayformula.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'displayformula.php') diff --git a/displayformula.php b/displayformula.php index 9693af3..6ba12fb 100644 --- a/displayformula.php +++ b/displayformula.php @@ -48,11 +48,22 @@ try { $texexp = ''; } else { $exp = $p->parse($m[2], $vars); - if ($CFG->qtype_algebra_texdelimiters == 'old') { - $texexp = '$$'.$exp->tex().'$$'; - } else { - $texexp = '\['.$exp->tex().'\]'; + $texexp = $exp->tex(); + switch($CFG->qtype_algebra_texdelimiters) { + case 'old': + $texexp = '$$' . $texexp . '$$'; + break; + case 'new': + $texexp = '\\[' . $texexp . '\\]'; + break; + case 'simple'; + $texexp = '$' . $texexp . '$'; + break; + case 'inline': + $texexp = '\\(' . $texexp . '\\)'; + break; } + } } catch (Exception $e) { $validanswer = false; -- cgit v1.2.3