From 540b67046c2e94e8198b2ade7b3d9fcae315c36b Mon Sep 17 00:00:00 2001 From: John Denker Date: Thu, 11 Nov 2021 14:17:28 -0700 Subject: fix it so that -(123) shows correctly, i.e. not dropping the - sign --- parser.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'parser.php') 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; + } } -- cgit v1.2.3