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

Combining Right Arrow Above U+20D7 display issue #3231

Closed
olegip opened this issue May 15, 2024 · 2 comments
Closed

Combining Right Arrow Above U+20D7 display issue #3231

olegip opened this issue May 15, 2024 · 2 comments
Labels
Expected Behavior This is how MathJax works v3 v4

Comments

@olegip
Copy link

olegip commented May 15, 2024

Issue Summary:

The Right Arrow Above U+20D7 character is not displayed as expected. Specifically, the arrow is centered and has a fixed width, so when displayed over a string of characters, it is not stretched to cover the full width of the expression below.

Here is the screenshot illustrating the problem
https://www.screencast.com/t/BfrEZ5G0

Steps to Reproduce:

Render following MathML in the browser

<math xmlns="http://www.w3.org/1998/Math/MathML"><mover accent="true"><mrow><mi mathvariant="italic">ABCDE</mi></mrow><mo>⃗</mo></mover></math>

Observed Behavior:

The arrow is centered and has a fixed width, not stretching to cover the entire width of the expression "ABCDE."

Expected Behavior:

The arrow should stretch to cover the full width of the expression "ABCDE."

Alternative Approach:

When replacing U+20D7 with Rightwards Arrow U+2192 the formula displayed as expected.

<math xmlns="http://www.w3.org/1998/Math/MathML"><mover accent="true"><mrow><mi mathvariant="italic">ABCDE</mi></mrow><mo>→</mo></mover></math>

Technical details:

  • MathJax Version: 3.2 and beta 4
  • Client OS: Any
  • Browser: Any

Supporting information:

Note that MathML source equation is displayed in MS word correctly. But when copying this equasion and then pasting it into notepad the U+20D7 char is being replaced with U+2192.
When looking in the document.xml however, it is still the U+20D7 that is used in the equation.

Thank you,
Oleg

@dpvc
Copy link
Member

dpvc commented May 15, 2024

Whether a character stretches is determined by the MathML "operator dictionary", which is described in Appendix C of the MathML specification. The character U+2192 (right arrow) is defined as a stretchy accent (it gets stretchy="true" and accent="true" attributes by default), but U+20D7 (combining over right arrow) is not listed in the table, so gets no special attributes. In particular, it is not stretchy by default. It may be that Word is substituting U+2192 for U+20D7 and so is considering it as stretchy, but the MathML specification doesn't indicate that U+20D7 should be stretchy by default. Or they may have augmented the operator table to include other characters that aren't part of the MathML recommendations.

There are two possible solutions. First, you cold use

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mover accent="true">
    <mrow>
      <mi mathvariant="italic">ABCDE</mi>
    </mrow>
    <mo stretchy="true">&#x20D7;</mo>
  </mover>
</math>

or you could use the configuration

MathJax = {
  startup: {
    ready() {
      const {TEXCLASS} = MathJax._.core.MmlTree.MmlNode;
      const {OPTABLE, MO} = MathJax._.core.MmlTree.OperatorDictionary;
      OPTABLE.infix['\u20D7'] = MO.WIDEACCENT;
      MathJax.startup.defaultReady();
    }
  }
}

to add U+20D7 to the operator table with the defaults for the stretchy and accent attributes.

@dpvc dpvc added Expected Behavior This is how MathJax works v3 v4 labels May 15, 2024
@olegip
Copy link
Author

olegip commented May 15, 2024

Thanks @dpvc
Adding stretchy="true fixes the display issue.

@olegip olegip closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expected Behavior This is how MathJax works v3 v4
Projects
None yet
Development

No branches or pull requests

2 participants