Problem with TeX overbrace

142 views
Skip to first unread message

George Benthien

unread,
Apr 11, 2020, 8:37:38 PM4/11/20
to MathJax Users
I ran the test file mathjax3_test_svg.html that uses Tex input and svg output.. The output is shown in Mathjax Test1.pdf. As you can see, the TeX code was not rendered. I then commented out the equation containing \overbrace. The output is shown in Mathjax Test2.pdf. The TeX code was rendered correctly except for the equation commented out. I then ran the file mathjax3_test_chtml that was the same except that it used chtml output. Everything rendered correctly as can be seen in Mathjax Test3.pdf. The results shown were the same in Chrome, Firefox, Edge(Chromium), and Edge(Legacy). Mathjax Test4.png shows a screenshot of the chtml test in IE11. There are a number of problems with this output.

I am using Windows 10 and the latest version of Mathjax 3.
Mathjax Test1.pdf
Mathjax Test2.pdf
Mathjax Test3.pdf
MathJax Test4.png
mathjax3_test_svg.html
PascalRightTriangle-359x250.png
PascalTriangle-486x250.png
mathjax3_test_chtml.html

Davide Cervone

unread,
Apr 13, 2020, 9:30:22 AM4/13/20
to mathja...@googlegroups.com
I have opened an issue tracker


for the problem with SVG output.  It turns out that changes in 3.0.5 caused a failure when creating the overbrace stretchy character.  I will include a fix in the next release.  In the meantime, you can incorporate the following configuration into your existing one to work around the problem:


    <script>
    MathJax = {
      startup: {
        ready() {
          if (MathJax.version === '3.0.5') {
            const SVGWrapper = MathJax._.output.svg.Wrapper.SVGWrapper;
            const CommonWrapper = SVGWrapper.prototype.__proto__;
            SVGWrapper.prototype.unicodeChars = function (text, variant) {
              if (!variant) variant = this.variant;
              return CommonWrapper.unicodeChars.call(this, text, variant);
            }
          }
          MathJax.startup.defaultReady();
        }
      }
    };
    </script>


As for IE11, your configuration is not being read because IE11 doesn't support modern function syntax.  You need to use

        ready: function () {

rather than

        ready() {

But IE11 also has a bug that causes some of the characters to be clipped.  If you resize the window, for example, you will see that the full equation is there, but is being improperly refreshed.  I do not know a work-around for this at the moment.

Davide


On Apr 11, 2020, at 8:37 PM, George Benthien <george....@gmail.com> wrote:

I ran the test file mathjax3_test_svg.html that uses Tex input and svg output.. The output is shown in Mathjax Test1.pdf. As you can see, the TeX code was not rendered. I then commented out the equation containing \overbrace. The output is shown in Mathjax Test2.pdf. The TeX code was rendered correctly except for the equation commented out. I then ran the file mathjax3_test_chtml that was the same except that it used chtml output. Everything rendered correctly as can be seen in Mathjax Test3.pdf. The results shown were the same in Chrome, Firefox, Edge(Chromium), and Edge(Legacy). Mathjax Test4.png shows a screenshot of the chtml test in IE11. There are a number of problems with this output.

I am using Windows 10 and the latest version of Mathjax 3.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/28b5a232-3ee8-43f1-9d64-6889072c1c13%40googlegroups.com.
<Mathjax Test1.pdf><Mathjax Test2.pdf><Mathjax Test3.pdf><MathJax Test4.png><mathjax3_test_svg.html><PascalRightTriangle-359x250.png><PascalTriangle-486x250.png><mathjax3_test_chtml.html>

Message has been deleted

George Benthien

unread,
Apr 13, 2020, 8:19:49 PM4/13/20
to MathJax Users
I made the changes you suggested along with the edge fix you suggested earlier. The modified file is mathjax3_test_svg_pascal.html. This file rendered correctly in chrome. opera, firefox, edge(chromium), edge(legacy), and IE-11. I then tried these fixes on another test file mathjax3_test_kepler.html. This rendered correctly in all the browsers except IE-11. IE-11 didn't render any of the math. I tracked down the problem to the command \eqref. When I replaced each \eqref by the corresponding equation number, IE-11 rendered correctly. However, it was much slower than the others.
To unsubscribe from this group and stop receiving emails from it, send an email to mathja...@googlegroups.com.
mathjax3_test_svg_pascal.html
PascalRightTriangle-359x250.png
PascalTriangle-486x250.png
dtheta-250x276.png
ellipse1-443x276.png
ellipse-433x276.png
mathjax3_test_kepler.html

Davide Cervone

unread,
Apr 18, 2020, 9:57:18 AM4/18/20
to mathja...@googlegroups.com
It turns out that the problem lies in a limitation of IE11's SVG implementation.  MathJax uses the elements classList object to add classes to a DOM node, and although IE11 (or the polyfill, I'm not sure which one) implements classList for HTML elements, it seems that SVG elements don't have it.  The SVG output uses a class to style elements that are links (like the \eqref macro produces), and that was causing the failure.

You can merge the following into your configuration to work around it for now:

MathJax = {
  startup: {
    ready: function () {
      MathJax.startup.defaultReady();
      const adaptor = MathJax.startup.adaptor;
      adaptor.addClass = function (node, string) {
        if (node.classList) {
          node.classList.add(string);
        } else {
          node.className += ' ' + string;
        }
      }
    }
  }
}

Again, I have started an issue tracker for the problem.


I hope that clears up the problem for you.

Davide


To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mathjax-users/3647cbbd-0070-4fb4-b77e-54a9e914d92e%40googlegroups.com.
<mathjax3_test_svg_pascal.html><PascalRightTriangle-359x250.png><PascalTriangle-486x250.png><dtheta-250x276.png><ellipse1-443x276.png><ellipse-433x276.png><mathjax3_test_kepler.html>

George Benthien

unread,
Apr 18, 2020, 6:32:05 PM4/18/20
to MathJax Users
Thanks! That fixed everything. I've used MathJax for some and have always been pleased with the results. However, version 3 is a big improvement. Thanks again for all your work'
Reply all
Reply to author
Forward
0 new messages