aboutsummaryrefslogtreecommitdiff
path: root/displayformula.php
diff options
context:
space:
mode:
authorJean-Michel Vedrine <vedrine@vedrine.org>2018-02-04 11:13:51 +0100
committerJean-Michel Vedrine <vedrine@vedrine.org>2018-02-04 11:13:51 +0100
commitc3cc23141194f4c0e56d6802f7e9ff082d21c5fb (patch)
treedcca1dd671f1b45608cf1570f927be31f2f6efe4 /displayformula.php
parent6e5d28ec5e338854112daaeb237c55fa6990e30c (diff)
Display formula using Ajax
Diffstat (limited to 'displayformula.php')
-rw-r--r--displayformula.php19
1 files changed, 15 insertions, 4 deletions
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;