diff --git a/MJLite.js b/MJLite.js index 2568c62e3..819d6e29e 100644 --- a/MJLite.js +++ b/MJLite.js @@ -62,11 +62,13 @@ var MJLite = (function() { }; var charLookup = { - '*': '\u2217', - '-': '\u2212', - 'cdot': '\u22C5', - 'lvert': '|', - 'rvert': '|' + "*": "\u2217", + "-": "\u2212", + "cdot": "\u22C5", + "lvert": "|", + "rvert": "|", + "pm": "\u00b1", + "div": "\u00f7" }; var textit = function(value) { diff --git a/parser.jison b/parser.jison index ff7b085a0..bb9b058db 100644 --- a/parser.jison +++ b/parser.jison @@ -9,6 +9,8 @@ cdot return 'CDOT' frac return 'FRAC' lvert return 'LVERT' rvert return 'RVERT' +pm return 'PM' +div return 'DIV' [/|a-zA-Z0-9] return 'ORD' [*+-] return 'BIN' \^ return '^' @@ -66,6 +68,10 @@ group func : 'CDOT' {$$ = [{type: 'bin', value: yytext}];} + | 'PM' + {$$ = [{type: 'bin', value: yytext}];} + | 'DIV' + {$$ = [{type: 'bin', value: yytext}];} | 'FRAC' group group {$$ = [{type: 'frac', value: {numer: $2, denom: $3}}];} | 'LVERT'