MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

\overline displayed varyingly as an overline or as nothing depending on font size

Open nabijaczleweli opened this issue 10 months ago • 1 comments

Issue Summary

\overline{Set(O)} either has an overline or doesn't depending on font-size. In my case I'm using font-size: smaller; which hides the overline. I would like to have the overline.

Steps to Reproduce:

  1. Write \overline{Set(O)}
  2. Tune font-size of parent element
  3. Despair

Behold a video:

https://github.com/user-attachments/assets/06d44257-cc94-4997-9a47-414b59e01406

Technical details:

  • MathJax Version: 3.2.2/whatever the demo is
  • Client OS: Windows 10, Bookworm
  • Browser: Nightly 139.0a1 (2025-04-02) (64-bit)

I am using the following MathJax configuration:

MathJax = {
  tex: {
    inlineMath:  [['[​[​',  '​]​]']],
    displayMath: [['[​![​', '​]!​]']]
  },

  // https://github.com/mathjax/MathJax/issues/3345#issuecomment-2731197248
  startup: {
    ready() {
      const {mathjax} = MathJax._.mathjax;
      const {STATE} = MathJax._.core.MathItem;
      const {Menu} = MathJax._.ui.menu.Menu;
      Menu.prototype.rerender = function rerender(start = STATE.TYPESET) {
        this.rerenderStart = Math.min(start, this.rerenderStart);
        const startup = MathJax.startup;
        if(!Menu.loading)
          startup.promise = startup.promise.then(
            () => mathjax.handleRetriesFor(
              () => {
                if (this.rerenderStart <= STATE.COMPILED)
                  this.document.reset({inputJax: []});
                this.document.rerender(this.rerenderStart);
                this.rerenderStart = STATE.LAST;
              }
            )
          );
      };
      MathJax.startup.defaultReady();
    }
  }
}

and loading MathJax via

<script id="MathJax-script" defer src="//cdn.jsdelivr.net/npm/[email protected]/es5/tex-chtml.js"></script>

nabijaczleweli avatar Apr 08 '25 21:04 nabijaczleweli

This is a duplicate of several other issues, including: #2858, #2701, and #2795. In v3, stretchy extenders are implemented using CSS transforms, and it turns out that browsers don't do a stellar job with that, and that it is very sensitive to the scaling in use (as you have seen). In v4, we have replaced this approach by one that uses multiple copies of the extenders to overcome this and some other alignment problems that the CSS transform introduces. That fix is in the develop branch, but not yet a release beta, but it will be in the upcoming beta.8 release.

dpvc avatar Apr 08 '25 23:04 dpvc

Fixed in v4.0.

dpvc avatar Aug 14 '25 12:08 dpvc