mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.22k stars 1.16k forks source link

Spacing after \setminus too large #2325

Closed cebola2 closed 4 years ago

cebola2 commented 4 years ago

$A\setminus B$ produces excessive space before the B. Live page with example: https://logrus.math.tecnico.ulisboa.pt/test (MathJax 3.0.1) Counterexample: https://cdi1tp.math.tecnico.ulisboa.pt/solucoes/T1B20181110 (MathJax 2.7.x) Screenshot_2020-02-11 CDI II — Taguspark — Teste Observed in current versions of Firefox and Chromium on Linux.

dpvc commented 4 years ago

Thanks for the report. I can reproduce the issue. It looks like there is a font character mapping issue. The spacing is for a different character (which is shown in SVG output). So something is off with the character data.

dpvc commented 4 years ago

OK, I found the problem (it was caused by some complicated remapping that had been done in the v2 data that didn't transfer correctly to the v3 data via the automated tool I used for that). I have created a pull request with the fix.

In the meantime, you can use the configuration:

  MathJax = {
    startup: {
      ready() {
        MathJax.startup.defaultReady();
        if (MathJax.version.match(/^3\.0\.[01]$/)) {
          const output = MathJax.startup.document.outputJax;
          if (output.name === 'CHTML') {
            delete output.font.variant['-tex-variant'].chars[0x2216][3].f;
            output.font.variant['normal'].chars[0x2216] = [.75, .25, .5];
          } else {
            output.font.variant['normal'].chars[0x2216] = [.75, .25, .5, {
              p: '56 731Q56 740 62 745T75 750Q85 750 92 740Q96 733 270 255T444 -231Q444 -239 438 -244T424 -250Q414 -250 407 -240Q404 -236 230 242T56 731'
            }];
          }
          const handlers = MathJax.startup.document.inputJax[0].parseOptions.handlers;
          const map = handlers.retrieve('mathchar0mo');
          const amsmap = handlers.retrieve('AMSsymbols-mathchar0m0');
          delete map.map.get('setminus')._attributes.variantForm;
          amsmap.map.get('smallsetminus')._attributes = {variantForm: true};
        }
      }
    }
  }

to patch v2 on the fly.

cebola2 commented 4 years ago

Works like a charm. Thanks! Patched configuration for https://cdi2tp.math.tecnico.ulisboa.pt/test Maintained original configuration in https://logrus.math.tecnico.ulisboa.pt/test