aboutsummaryrefslogtreecommitdiff
path: root/parser.php
diff options
context:
space:
mode:
authorJohn Denker <jsd@av8n.com>2021-11-11 14:17:28 -0700
committerJohn Denker <jsd@av8n.com>2021-11-11 16:08:19 -0700
commit540b67046c2e94e8198b2ade7b3d9fcae315c36b (patch)
tree77028aaee1f91fcf98c2d437e1613b4450dac33f /parser.php
parent22665704696c4c404142156217401cda5be697e6 (diff)
fix it so that -(123) shows correctly,
i.e. not dropping the - sign
Diffstat (limited to 'parser.php')
-rw-r--r--parser.php25
1 files changed, 17 insertions, 8 deletions
diff --git a/parser.php b/parser.php
index 0efc21b..4423c38 100644
--- a/parser.php
+++ b/parser.php
@@ -1378,15 +1378,24 @@ class qtype_algebra_parser_bracket extends qtype_algebra_parser_term {
// Static class properties.
const NARGS = 1;
private static $formats = array(
- '(' => array('str' => '(%s)',
- 'tex' => '\\left( %s \\right)'),
- '[' => array('str' => '[%s]',
- 'tex' => '\\left[ %s \\right]'),
- '{' => array('str' => '{%s}',
- 'tex' => '\\left\\lbrace %s \\right\\rbrace'),
- '<' => array('str' => '(%s)',
- 'tex' => '{%s}')
+ '(' => array('str' => '%s(%s)',
+ 'tex' => '%s\\left( %s \\right)'),
+ '[' => array('str' => '%s[%s]',
+ 'tex' => '%s\\left[ %s \\right]'),
+ '{' => array('str' => '%s{%s}',
+ 'tex' => '%s\\left\\lbrace %s \\right\\rbrace'),
+ '<' => array('str' => '%s(%s)',
+ 'tex' => '%s{%s}')
);
+
+ public function print_args($method) {
+ $args = array($this->_sign);
+ foreach ($this->_arguments as $arg) {
+ $args[] = $arg->$method();
+ }
+ // Return the array of arguments.
+ return $args;
+ }
}