Closed ghost closed 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.
Thank you clearing this up!
Would like to see mathjax-node emit accurate HTML output with symbology similar to mathjax.org live demo.
mathjax-node typeset({ math: '\sum_{n=1}^{\infty} 2^{-n} = 1', html:true, css:true }, ...);
mathjax-node typeset({math: ''x = {-b \pm \sqrt{b^2-4ac} \over 2a}'', html:true, css:true}, ...);