MathJax icon indicating copy to clipboard operation
MathJax copied to clipboard

(v4 inline) the spacing around \implies is different from v3

Open hbghlyj opened this issue 2 years ago • 3 comments

I'm loading MathJax v3 via
<html>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg.js"></script>
\(P\implies Q\)
</html>

Screenshot: image

I'm loading MathJax v4 via

<html>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/tex-svg.js"></script>
\(P\implies Q\)
</html>

Screenshot: image

The CHTML output is fine.

hbghlyj avatar Jan 24 '24 13:01 hbghlyj

This is an interaction of the in-line lin-breaking code with the spacing in SVG output, similar to #3165 and #3135, but apparently not quite the same one. I will need to look into it further.

dpvc avatar Jan 24 '24 14:01 dpvc

PS, the current version for v3 is 3.2.2, not 3.0.1, so best to test against that in the future.

dpvc avatar Jan 24 '24 14:01 dpvc

I have made a PR to resolve this issue, but for now, you can incorporate

MathJax = {
  startup: { 
    ready() {
      const {SvgWrappers} = MathJax._.output.svg.Wrappers_ts;
      SvgWrappers.mspace = class mySvgMspace extends SvgWrappers.mspace {
        computeLineBBox(i) {
          const bbox = super.computeLineBBox(i);
          if (i === 1) {
            bbox.w = this.getBBox().w;
            bbox.isFirst = (bbox.w === 0);
          }
          return bbox;
        }
      }
      MathJax.startup.defaultReady();
    }
  }
};

into your MathJax configuration in order to work around the problem.

dpvc avatar Jan 26 '24 15:01 dpvc