diff --git a/lib/expression/node/OperatorNode.js b/lib/expression/node/OperatorNode.js index 1d24e5cf0..2e980eca0 100644 --- a/lib/expression/node/OperatorNode.js +++ b/lib/expression/node/OperatorNode.js @@ -323,7 +323,7 @@ OperatorNode.prototype._toTex = function(callbacks) { //op contains '\\frac' at this point return op + '{' + lhsTex + '}' + '{' + rhsTex + '}'; } - return lhsTex + ' ' + op + ' ' + rhsTex; + return lhsTex + op + rhsTex; default: //fall back to formatting as a function call diff --git a/test/expression/node/FunctionAssignmentNode.test.js b/test/expression/node/FunctionAssignmentNode.test.js index f56b3f2ef..09a461c6c 100644 --- a/test/expression/node/FunctionAssignmentNode.test.js +++ b/test/expression/node/FunctionAssignmentNode.test.js @@ -265,7 +265,7 @@ describe('FunctionAssignmentNode', function() { var p = new OperatorNode('^', 'pow', [o, a]); var n = new FunctionAssignmentNode('f', ['x'], p); - assert.equal(n.toTex(), '\\mathrm{f}\\left(\\mathrm{x}\\right):={{\\frac{{\\mathrm{x}}}{{2}}} ^ {2}}'); + assert.equal(n.toTex(), '\\mathrm{f}\\left(\\mathrm{x}\\right):={{\\frac{{\\mathrm{x}}}{{2}}}^{2}}'); }); it ('should LaTeX a FunctionAssignmentNode containing an AssignmentNode', function () { diff --git a/test/expression/node/FunctionNode.test.js b/test/expression/node/FunctionNode.test.js index ccfc0cb48..c08086cd9 100644 --- a/test/expression/node/FunctionNode.test.js +++ b/test/expression/node/FunctionNode.test.js @@ -278,7 +278,7 @@ describe('FunctionNode', function() { var o = new OperatorNode('+', 'add', [c1, c2]); var n3 = new FunctionNode('permutations', [o]); - assert.equal(n3.toTex(), '\\mathrm{permutations}\\left({{4} + {5}}\\right)'); + assert.equal(n3.toTex(), '\\mathrm{permutations}\\left({{4}+{5}}\\right)'); }); it ('should have an identifier', function () { diff --git a/test/expression/node/OperatorNode.test.js b/test/expression/node/OperatorNode.test.js index 53b995fc8..f60dacd49 100644 --- a/test/expression/node/OperatorNode.test.js +++ b/test/expression/node/OperatorNode.test.js @@ -276,7 +276,7 @@ describe('OperatorNode', function() { var c = new ConstantNode(4); var n = new OperatorNode('+', 'add', [a, b]); - assert.equal(n.toTex(), '{2} + {3}'); + assert.equal(n.toTex(), '{2}+{3}'); }); it ('should LaTeX an OperatorNode with factorial', function () { @@ -298,9 +298,9 @@ describe('OperatorNode', function() { var n2= new OperatorNode('!', 'factorial', [add] ); var n3= new OperatorNode('!', 'factorial', [mult] ); var n4= new OperatorNode('!', 'factorial', [div] ); - assert.equal(n1.toTex(), '\\left({{2} - {3}}\\right)!'); - assert.equal(n2.toTex(), '\\left({{2} + {3}}\\right)!'); - assert.equal(n3.toTex(), '\\left({{2} \\cdot {3}}\\right)!'); + assert.equal(n1.toTex(), '\\left({{2}-{3}}\\right)!'); + assert.equal(n2.toTex(), '\\left({{2}+{3}}\\right)!'); + assert.equal(n3.toTex(), '\\left({{2}\\cdot{3}}\\right)!'); assert.equal(n4.toTex(), '{\\frac{{2}}{{3}}}!'); }); @@ -316,8 +316,8 @@ describe('OperatorNode', function() { var n3 = new OperatorNode('-', 'unaryMinus', [add]); assert.equal(n1.toTex(), '-{2}'); - assert.equal(n2.toTex(), '-\\left({{2} - {3}}\\right)'); - assert.equal(n3.toTex(), '-\\left({{2} + {3}}\\right)'); + assert.equal(n2.toTex(), '-\\left({{2}-{3}}\\right)'); + assert.equal(n3.toTex(), '-\\left({{2}+{3}}\\right)'); }); it ('should LaTeX an OperatorNode that subtracts an OperatorNode', function() { @@ -331,8 +331,8 @@ describe('OperatorNode', function() { var n1 = new OperatorNode('-', 'subtract', [a, sub]); var n2 = new OperatorNode('-', 'subtract', [a, add]); - assert.equal(n1.toTex(), '{1} - \\left({{2} - {3}}\\right)'); - assert.equal(n2.toTex(), '{1} - \\left({{2} + {3}}\\right)'); + assert.equal(n1.toTex(), '{1}-\\left({{2}-{3}}\\right)'); + assert.equal(n2.toTex(), '{1}-\\left({{2}+{3}}\\right)'); }); it ('should LaTeX an OperatorNode with zero arguments', function () { @@ -363,10 +363,10 @@ describe('OperatorNode', function() { var m2 = new OperatorNode('*', 'multiply', [n1, c]); var m3 = new OperatorNode('-', 'subtract', [m2, d]); - assert.equal(n1.toTex(), '{2} + {3}'); - assert.equal(n2.toTex(), '{4} - {5}'); - assert.equal(n3.toTex(), '\\left({{2} + {3}}\\right) \\cdot \\left({{4} - {5}}\\right)'); - assert.equal(m3.toTex(), '{\\left({{2} + {3}}\\right) \\cdot {4}} - {5}'); + assert.equal(n1.toTex(), '{2}+{3}'); + assert.equal(n2.toTex(), '{4}-{5}'); + assert.equal(n3.toTex(), '\\left({{2}+{3}}\\right)\\cdot\\left({{4}-{5}}\\right)'); + assert.equal(m3.toTex(), '{\\left({{2}+{3}}\\right)\\cdot{4}}-{5}'); }); it('should LaTeX fractions with operators that are enclosed in parenthesis', function () { @@ -375,7 +375,7 @@ describe('OperatorNode', function() { var add = new OperatorNode('+', 'add', [a,a]); var frac = new OperatorNode('/', 'divide', [add,b]); - assert.equal(frac.toTex(), '\\frac{{{1} + {1}}}{{2}}'); + assert.equal(frac.toTex(), '\\frac{{{1}+{1}}}{{2}}'); }); it ('should have an identifier', function () { diff --git a/test/function/complex/arg.test.js b/test/function/complex/arg.test.js index 5930fcc65..30abd6c4c 100644 --- a/test/function/complex/arg.test.js +++ b/test/function/complex/arg.test.js @@ -71,7 +71,7 @@ describe('arg', function() { it('should LaTeX arg', function () { var expression = math.parse('arg(1+i)'); - assert.equal(expression.toTex(), '\\arg\\left({{1} + {{i}}}\\right)'); + assert.equal(expression.toTex(), '\\arg\\left({{1}+{{i}}}\\right)'); }); }); diff --git a/test/function/complex/conj.test.js b/test/function/complex/conj.test.js index 7db4659e3..cc0bc670c 100644 --- a/test/function/complex/conj.test.js +++ b/test/function/complex/conj.test.js @@ -54,7 +54,7 @@ describe('conj', function() { it('should LaTeX conj', function () { var expression = math.parse('conj(1+i)'); - assert.equal(expression.toTex(), '\\left({{1} + {{i}}}\\right)^{*}'); + assert.equal(expression.toTex(), '\\left({{1}+{{i}}}\\right)^{*}'); }); }); diff --git a/test/function/complex/im.test.js b/test/function/complex/im.test.js index 51c7caf2f..c4135f570 100644 --- a/test/function/complex/im.test.js +++ b/test/function/complex/im.test.js @@ -48,7 +48,7 @@ describe('im', function() { it('should LaTeX im', function () { var expression = math.parse('im(1+i)'); - assert.equal(expression.toTex(), '\\Im\\left\\lbrace{{1} + {{i}}}\\right\\rbrace'); + assert.equal(expression.toTex(), '\\Im\\left\\lbrace{{1}+{{i}}}\\right\\rbrace'); }); }); diff --git a/test/function/complex/re.test.js b/test/function/complex/re.test.js index 2a1ba487d..cbaa86342 100644 --- a/test/function/complex/re.test.js +++ b/test/function/complex/re.test.js @@ -43,7 +43,7 @@ describe('re', function() { it('should LaTeX re', function () { var expression = math.parse('re(1+i)'); - assert.equal(expression.toTex(), '\\Re\\left\\lbrace{{1} + {{i}}}\\right\\rbrace'); + assert.equal(expression.toTex(), '\\Re\\left\\lbrace{{1}+{{i}}}\\right\\rbrace'); }); }); diff --git a/test/function/units/to.test.js b/test/function/units/to.test.js index 9bcebf106..349bce3a4 100644 --- a/test/function/units/to.test.js +++ b/test/function/units/to.test.js @@ -77,7 +77,7 @@ describe('to', function() { it('should LaTeX to', function () { var expression = math.parse('to(2cm,m)'); - assert.equal(expression.toTex(), '\\left({{2} \\cdot {\\mathrm{cm}}}\\rightarrow{\\mathrm{m}}\\right)'); + assert.equal(expression.toTex(), '\\left({{2}\\cdot{\\mathrm{cm}}}\\rightarrow{\\mathrm{m}}\\right)'); }); });