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

spacing in scripts seems too large #2241

Closed
NSoiffer opened this issue Nov 11, 2019 · 4 comments
Closed

spacing in scripts seems too large #2241

NSoiffer opened this issue Nov 11, 2019 · 4 comments
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3.0

Comments

@NSoiffer
Copy link

The following is an attempt to simulate the MathML spacing rules in scripts:

\[\displaystyle x^{(n\>+\>1)(n\>-\>1)}=x^{n^2\>-\>1} \neq x^{n^2}-1
\]\[
\displaystyle\sum_{i\;=\;0}^{\infty} e^{i\>+\>1} \hskip 1em
\displaystyle\int _0^{2\pi}e^{e^{it}\> - \>it}dt \hskip 1em
\displaystyle\int _0^{2\pi}e^{ - it\>+\>e^{it}}dt \hskip 1em
\]\[
\displaystyle \left( \frac{-1}{p} \right) = (-1)^{\frac{p\>-\>1}2}=\ldots 
\]

In v2.7, it looks like the spacing amounts are interpreted correctly, but in v3.0, they are too big, perhaps been taken from the displaystyle font, not the scriptstyle font.

2.7 (as rendered in Firefox):
image

3.0 (as rendered in Firefox):
image

In the first line, the difference seems particularly obvious around the n+1 and n-1.

For reference, the script tags are:

  <script type="text/javascript"
          src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">			 
  </script>

and

<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
@dpvc
Copy link
Member

dpvc commented Nov 16, 2019

It does look like there is a bug there. I will check into it.

In the meantime, perhaps you can just set the mathmlSpacing option of the CHTML output jax:

<script>
MathJax = {
  chtml: {mathmlSpacing: true}
};
</script>

in order to have MathJax use MathML spacing rules rather than TeX spacing rules.

@dpvc
Copy link
Member

dpvc commented Nov 16, 2019

OK, it turns out that this is due to a bug in the handling of tex classes of the elements, which is being handled by another PR (not yet in place). So it will be fixed in the next release.

Thanks for the report.

@NSoiffer
Copy link
Author

Thanks for checking on this.

FYI: The MathML refresh group is formalizing all the layout rules, and one of the ones currently being decided upon is spacing in scripts. I encourage you and anyone else who sees this to take a look at the issue/samples on github, and add a comment to the issue with your preference.

@dpvc dpvc added the Accepted Issue has been reproduced by MathJax team label Nov 17, 2019
dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 17, 2019
…han requiring both). This means that mspace wrapped in mstyle with scriptstyle=0 (as used for the fixed-size spaces in TeX) won't include extra spaces. Resolves issue mathjax/MathJax#2241
@dpvc
Copy link
Member

dpvc commented Nov 17, 2019

I was wrong, there was another issue at play, so I've made a new pull request for the fix.

dpvc added a commit to mathjax/MathJax-src that referenced this issue Nov 17, 2019
@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Nov 17, 2019
@dpvc dpvc added this to the MathJax v3.0.1 milestone Dec 31, 2019
@dpvc dpvc added Fixed v3.0 and removed Merged Merged into develop branch labels Feb 10, 2020
@dpvc dpvc closed this as completed Feb 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3.0
Projects
None yet
Development

No branches or pull requests

2 participants