diff --git a/docs/expressions/customization.md b/docs/expressions/customization.md index 08af41ce0..8af9223f8 100644 --- a/docs/expressions/customization.md +++ b/docs/expressions/customization.md @@ -197,7 +197,8 @@ The functions `toTex` and `toString` accept an `options` argument to customise o ```js { parenthesis: 'keep', // parenthesis option - handler: someHandler // handler to change the output + handler: someHandler, // handler to change the output + implicit: 'hide' // how to treat implicit multiplication } ``` @@ -325,3 +326,20 @@ var expression = math.parse('binomial(2,1)'); var latex = expression.toTex({handler: customLaTeX}); //latex now contains "\binom{2}{1}" ``` + +### Implicit multiplication + +You can change the way that implicit multiplication is converted to a string or LaTeX. The two options are `hide`, to not show a multiplication operator for implicit multiplication and `show` to show it. + +Example: +```js +var node = math.parse('2a'); + +node.toString(); //'2 a' +node.toString({implicit: 'hide'}); //'2 a' +node.toString({implicit: 'show'}); //'2 * a' + +node.toTex(); //'2~ a' +node.toTex({implicit: 'hide'}); //'2~ a' +node.toTex({implicit: 'show'}); //'2\\cdot a' +``` diff --git a/examples/browser/pretty_printing_with_mathjax.html b/examples/browser/pretty_printing_with_mathjax.html index 5a8d5019a..c59e0c0a9 100644 --- a/examples/browser/pretty_printing_with_mathjax.html +++ b/examples/browser/pretty_printing_with_mathjax.html @@ -65,13 +65,18 @@ keep auto all +
+Implicit multiplication: +hide +show