Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The tex2jax Preprocessor doesn't work! #423

Open
ystreibel opened this issue Aug 29, 2018 · 4 comments
Open

The tex2jax Preprocessor doesn't work! #423

ystreibel opened this issue Aug 29, 2018 · 4 comments

Comments

@ystreibel
Copy link

Hi, this is the configuration and the test that I try to do but doesn't work for me.

const mathjaxNode = require('mathjax-node');
mathjaxNode.config({MathJax: {tex2jax: {inlineMath: [ ['$','$'], ['\\(','\\)'] ],processEscapes: true}}});

mathjaxNode.typeset({
                                    math: ''$ d = a \left( \eta _0 \right) \Delta \eta $'',
                                    format: "inline-TeX",
                                    svg: true,
                                    html: true
                                }, (data) => {
                if (!data.errors) {
                    label.displayLabel = data.html;
                    label.image = {
                        data: 'data:image/svg+xml;base64,' + Buffer.from(data.svg).toString('base64'),
                        contentType: 'image/svg+xml'
                    };
                }

And the result is for svg :
<span class="mjx-chtml"><span class="mjx-math" aria-label="$ \frac {2 G m }{r c ^2 } $"><span class="mjx-mrow" aria-hidden="true"><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.372em;">$</span></span></span></span><span class="mjx-mfrac"><span class="mjx-box MJXc-stacked" style="width: 1.672em; padding: 0px 0.12em;"><span class="mjx-numerator" style="font-size: 70.7%; width: 2.364em; top: -1.433em;"><span class="mjx-mrow" style=""><span class="mjx-mn"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">2</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.519em; padding-bottom: 0.298em;">G</span></span><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">m</span></span></span></span><span class="mjx-denominator" style="font-size: 70.7%; width: 2.364em; bottom: -0.85em;"><span class="mjx-mrow" style=""><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">r</span></span><span class="mjx-msubsup"><span class="mjx-base"><span class="mjx-mi"><span class="mjx-char MJXc-TeX-math-I" style="padding-top: 0.225em; padding-bottom: 0.298em;">c</span></span></span><span class="mjx-sup" style="font-size: 83.3%; vertical-align: 0.347em; padding-left: 0px; padding-right: 0.06em;"><span class="mjx-mn" style=""><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.372em; padding-bottom: 0.372em;">2</span></span></span></span></span></span><span style="border-bottom: 1.3px solid; top: -0.296em; width: 1.672em;" class="mjx-line"></span></span><span style="height: 1.615em; vertical-align: -0.601em;" class="mjx-vsize"></span></span><span class="mjx-texatom"><span class="mjx-mrow"><span class="mjx-mo"><span class="mjx-char MJXc-TeX-main-R" style="padding-top: 0.446em; padding-bottom: 0.372em;">$</span></span></span></span></span></span></span>

Delimiter $ is not remove after the typeset.

What can I do to remove delimiter? Could I need to contribute for this project?

@pkra
Copy link
Contributor

pkra commented Aug 29, 2018

Mathjax-node expects a single expression without delimiters. You will need to remove them yourself beforehand.

@ystreibel
Copy link
Author

But what about the MathJax configuration ?

mathjaxNode.config({MathJax: {tex2jax: {inlineMath: [ ['$','$'], ['\\(','\\)'] ],processEscapes: true}}});

@pkra
Copy link
Contributor

pkra commented Aug 29, 2018

But what about the MathJax configuration ?

It is ignored.

@ystreibel
Copy link
Author

Ok! So, could you add this in a feature request?

Maybe fix the readme.md that say:

MathJax: { } // standard MathJax configuration options, see https://docs.mathjax.org for more detail.

because the project doesn't support all the MathJax features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants