diff --git a/lib/core/config.js b/lib/core/config.js index d01420c28..dc00f0e50 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -17,6 +17,9 @@ function factory (type, config, load, typed, math) { * {number} precision * The number of significant digits for BigNumbers. * Not applicable for Numbers. + * {string} parenthesis + * How to display parentheses in LaTeX and String + * output. * @return {Object} Returns the current configuration */ return function _config(options) { diff --git a/lib/core/core.js b/lib/core/core.js index a4e928823..a571af525 100644 --- a/lib/core/core.js +++ b/lib/core/core.js @@ -19,6 +19,9 @@ var configFactory = require('./config'); * {number} precision * The number of significant digits for BigNumbers. * Not applicable for Numbers. + * {string} parenthesis + * How to display parentheses in LaTeX and String + * output. * @returns {Object} Returns a bare-bone math.js instance containing * functions: * - `import` to add new functions @@ -57,7 +60,11 @@ exports.create = function create (options) { // minimum relative difference between two compared values, // used by all comparison functions - epsilon: 1e-14 + epsilon: 1e-14, + + // which type of parenthesis to use for toString and toTex + // one of 'keep', 'auto', and 'all' + parenthesis: 'keep' }; if (options) { diff --git a/test/index.test.js b/test/index.test.js index c7df48e56..b264280f0 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -10,7 +10,8 @@ describe('factory', function() { matrix: 'matrix', number: 'number', precision: 64, - epsilon: 1e-14 + epsilon: 1e-14, + parenthesis: 'keep' }); }); @@ -25,7 +26,8 @@ describe('factory', function() { matrix: 'array', number: 'bignumber', precision: 64, - epsilon: 1e-14 + epsilon: 1e-14, + parenthesis: 'keep' }); }); @@ -56,21 +58,24 @@ describe('factory', function() { matrix: 'matrix', number: 'number', precision: 64, - epsilon: 1e-14 + epsilon: 1e-14, + parenthesis: 'keep' }); math1.config({ matrix: 'array', number: 'bignumber', precision: 32, - epsilon: 1e-7 + epsilon: 1e-7, + parenthesis: 'auto' }); assert.deepEqual(math1.config(), { matrix: 'array', number: 'bignumber', precision: 32, - epsilon: 1e-7 + epsilon: 1e-7, + parenthesis: 'auto' }); // restore the original config @@ -91,4 +96,4 @@ describe('factory', function() { Object.create = create; }); -}); \ No newline at end of file +});