mathjax / MathJax-node

MathJax for Node
Apache License 2.0
616 stars 97 forks source link

Request html output produce correct symbolic representation. #346

Closed ghost closed 7 years ago

ghost commented 7 years ago

Would like to see mathjax-node emit accurate HTML output with symbology similar to mathjax.org live demo. mathjax-sum-expression

mathjax-node typeset({ math: '\sum_{n=1}^{\infty} 2^{-n} = 1', html:true, css:true }, ...);

mathjax-node-sum-expression

mathjax-quadratic-formula

mathjax-node typeset({math: ''x = {-b \pm \sqrt{b^2-4ac} \over 2a}'', html:true, css:true}, ...);

mathjax-node-quadratic-formula

dpvc commented 7 years ago

In Javascript strings, the backslash is used as an "escape character" to allow you to create non-printing character like newlines (\n) and tabs (\t), so if you want to include a literal backslash in your string (as you do for TeX code), then you must escape the backslash as \\. So use

mathjax-node typeset({ math: '\\sum_{n=1}^{\\infty} 2^{-n} = 1', html:true, css:true }, ...);

for example. This is standard practice for Javascript strings.

ghost commented 7 years ago

Thank you clearing this up!