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

mathjax 3 latex command underbrace gives js error (svg) or faulty output (chtml) #2466

Closed
ronligt opened this issue Jul 7, 2020 · 9 comments

Comments

@ronligt
Copy link

ronligt commented Jul 7, 2020

Issue Summary

When using tex->svg in Mathjax 3 the use of the latex command \underbrace results in a javascript error:

Unhandled Promise Rejection: TypeError: t.setAttribute is not a function.
   (In 't.setAttribute(Q,e)', 't.setAttribute' is undefined)

When using tex->chtml the equation is rendered but gives an ugly result:
tex_chtml_underbrace

This happens in Firefox 78.0.1, Safari 13.1.1 and Chrome 83.0.4103.116 tested on macOS 10.15.5

Steps to Reproduce:

  1. write HTML as follows:
<!DOCtype html>
<html>
    <head>
        <title>Test underbrace</title>
    </head>
    <body>
        $$\underbrace{blablabla}_{bloe}$$
        <script type="text/javascript" id="MathJax-script" async
        src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-svg.js">
        </script>
    </body>
</html>
  1. Open HTML-file in browser
  2. Observe error in javascript-console
  3. replace in HTML-file tex-mml-svg.js with tex-mml-chtml.js
  4. Re-open HTML-file in browser
  5. Observe output as included above

Technical details:

  • MathJax Version: 3
  • Client OS: Mac OS X 10.15.5
  • Browser: Firefox 78.0.1, Safari 13.1.1 and Chrome 83.0.4103.116

Supporting information:

  • no mathjax-configuration is used
@dpvc
Copy link
Member

dpvc commented Jul 7, 2020

The svg issue is a duplicate of #2408, which is in turn a duplicate of #2402. There is a work-around in the latter that you may be able to use.

The CommonHTML issue is a known issue (though I don't think there is an issue tracker for it). I hope to have a fix for it this summer, as we work on font issues.

@ronligt ronligt changed the title mathjax 3 latex command underbrace gives js error (svg) or ugly output (chtml) mathjax 3 latex command underbrace gives js error (svg) or faulty output (chtml) Jul 7, 2020
@ronligt
Copy link
Author

ronligt commented Jul 7, 2020

Thank you very much for the speedy reply and fix!

@ronligt ronligt closed this as completed Jul 7, 2020
@eric-wieser
Copy link

eric-wieser commented Aug 24, 2022

The CommonHTML issue is a known issue (though I don't think there is an issue tracker for it). I hope to have a fix for it this summer, as we work on font issues.

@dpvc, is it related to #661?

@dpvc
Copy link
Member

dpvc commented Aug 24, 2022

@eric-wieser, no, #661 is for v2, and the mechanism used for stretchy characters v3 is substantially different. Also, #661 only affected the Asana-Math font, which is not yet available in v3.

@eric-wieser
Copy link

eric-wieser commented Aug 24, 2022

Ah, ok. I'm still seeing the same problem, so I guess this hasn't been fixed yet:

image

<!DOCtype html>
<html>
    <head>
        <title>Test underbrace</title>
    </head>
    <body>
        <div style="font-size: 42px">
        $$\underbrace{a^2b}_3\times \underbrace{a^3b}_4 = \underbrace{a^2ba^3b}_{3 + 4}$$
        </div>
        <script type="text/javascript" id="MathJax-script" async
        src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
        </script>
    </body>
</html>

Do you know of any other discussions about this elsewhere?

@eric-wieser
Copy link

eric-wieser commented Aug 24, 2022

The cause seems to be these lines

mjx-stretchy-h > mjx-ext > mjx-c::before {
    transform: scalex(500);
}

If I change this to 200 the problem goes away.

@dpvc
Copy link
Member

dpvc commented Aug 24, 2022

We are preparing an alpha release that includes support for alternative fonts, and that includes a new font set for the default font. Your example works for me with the current v3 in Safari 15.5 on Mac OS 12.4, as well as Firefox 104.0 and Chrome 104.0.5112.101.

braces

and also with the new fonts.

Can you tell me the OS and browser versions that you are using?

@eric-wieser
Copy link

eric-wieser commented Aug 24, 2022

I will try to update with exact versions tomorrow, but this was with Chrome on Windows 10 (and since it might matter, a 1920px wide monitor/window and a 3000px wide overall desktop area)

@eric-wieser
Copy link

Chrome is at Version 104.0.5112.102 (Official Build) (64-bit), and Windows 10 Pro is at version 1909.

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

No branches or pull requests

3 participants