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

Cramped style not respected #2395

Closed
NSoiffer opened this issue Apr 4, 2020 · 1 comment
Closed

Cramped style not respected #2395

NSoiffer opened this issue Apr 4, 2020 · 1 comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3
Milestone

Comments

@NSoiffer
Copy link

NSoiffer commented Apr 4, 2020

Issue Summary

I find this surprising enough to think that maybe I'm doing something wrong (and I didn't find an issue about this)...

TeX has a notion of "cramped" which causes superscripts to be lower in a number of cases such as in accents, overlines, fractions (denominators), and subscripts. Here's a latex rendering:
image

The position of the '2' in x^2 is lowered in first instance except for the fraction, where it is the second instance (the denominator).

However, MathJax doesn't reduce the superscript position. Here's a codepen that shows that. Here's a screen shot of that:
image

[To be honest, my sons happened to be looking at what I was doing and liked the MathJax rendering better...]

Steps to Reproduce:

This is the header

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

and this is the input

\[ \hat{x^2} x^2\]
\[ \overline{x^2} x^2 \]
\[ \frac{x^2}{x^2} \]
\[ a_{x^2}a^{x^2} \]
@dpvc
Copy link
Member

dpvc commented Apr 4, 2020

Thanks for the report. MathJax is supposed to handle the cramped styles (what is listed as "prime" styles in appendix G of the TeXBook). In version 2, properties like "primestyle" where stored in the same place as the MathML attributes, and that caused difficulty in distinguishing the two, so in version 3, they are stored in two separate places. Unfortunately, when translating the code that determines the superscript offsets to version 3, I neglected to switch the location, so was looking for the prime style in the wrong place. So it never appeared to be set.

I will make a pull request to fix the problem. It also turns out that there was a problem handling the prime style in display mode, which I will also fix.

dpvc added a commit to mathjax/MathJax-src that referenced this issue Apr 4, 2020
@dpvc dpvc added Accepted Issue has been reproduced by MathJax team Ready for Review Test Needed v3 labels Apr 4, 2020
@dpvc dpvc added this to the 3.0.2 milestone Apr 6, 2020
dpvc added a commit to mathjax/MathJax-src that referenced this issue Apr 6, 2020
Fix positions of superscripts in "cramped" style.  (mathjax/MathJax#2395)
@dpvc dpvc added Merged Merged into develop branch Fixed and removed Ready for Review labels Apr 6, 2020
@dpvc dpvc closed this as completed Apr 10, 2020
@dpvc dpvc removed the Merged Merged into develop branch label Sep 3, 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
Projects
None yet
Development

No branches or pull requests

2 participants