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

output/chtml component sometimes renders msubsup's superscript as a subscript if the real subscript is void/empty #2765

Closed
EricDunsworth opened this issue Sep 7, 2021 · 1 comment
Labels
Accepted Issue has been reproduced by MathJax team Fixed Test Needed v3 v3.2
Milestone

Comments

@EricDunsworth
Copy link
Contributor

Issue Summary

MathML's <msubsup> element is meant to contain three child elements that represent base, subscript and superscript. If the subscript is void and the superscript is filled-in, the superscript is still supposed to be treated as a superscript.

MathJax 3.2.0's output/chtml component seems to be prone to misrepresenting the msubsup element's superscript as a subscript if the real subscript is void or empty. But not always :S.

It seems to be dependant on nearby elements and which elements are used inside msubsup. In the reproduction steps below, I was able to provide examples that always render properly, always render improperly and one that renders differently depending on whether it precedes or follows other equations.

The input/mml and output/svg components seem to be unaffected. The accessibility extension always identifies superscripts correctly and the SVG renderer always renders them as such.

Steps to Reproduce:

JSBin examples:

Expected outcome:
All superscripts are rendered as superscripts (top-aligned).

Actual outcome:

  • The "Never works" example's superscript is rendered as a subscript (bottom-aligned).
  • The "Always works" example's superscript is rendered as a superscript (top-aligned).
  • The "2" superscript in the Cauchy-Schwarz Inequality appears as a subscript if that equation comes first.
  • The "2" superscript in the Cauchy-Schwarz Inequality appears as a superscript if that equation comes last.

Technical details:

  • MathJax Version: 3.2.0 (latest commit: 7146ffa)
  • Client OS: Windows 10
  • Browser: Edge 92.0.902.55, Firefox 92.0b9, Internet Explorer 11

Supporting information:

@dpvc
Copy link
Member

dpvc commented Sep 15, 2021

Thanks for the report. It turns out that the order in which the CSS is generated affected which rule was used (in a way that I didn't expect). I have created a pull request to resolve the issue. In the meantime, you can use

<style>
  mjx-script > * {
    display: inline-block ! important
  }
  mjx-script > mjx-spacer {
    display: block ! important
  }
</style>

to remove the problem for now.

@dpvc dpvc added Accepted Issue has been reproduced by MathJax team Ready for Review Test Needed v3 labels Sep 15, 2021
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Sep 20, 2021
Drastically reduces MathJax's burden on the build:
* Brings a huge speed boost to Grunt's "copy:js" task (from ~13 to ~2 seconds)
* Reduces MathJax's compiled size down from ~25 MB (1,347 files/809 folders) to ~1 MB (24 files/5 folders)
* Almost halves the production dist folder's size (from ~55 MB to ~31 MB)

Related changes:
* Disable MathJax's context menu
* Add an ES6 polyfill for IE11 support
* Add extra line comments to give more context about how the polyfills are loaded in
* Change the MathJax fallback test to look for a configuration option we're not customizing
* Always use the CDN's latest version of MathJax 3
* Add a temporary CSS workaround for mathjax/MathJax#2765 (thanks @dpvc!)
* Remove the build system's string-replace:inline task (was only being used to insert a specific version number in the CDN's URL)
* Try falling back on a local version of MathJax 2 if all else fails
* Update the documentation's known issues section:
  * Change it into an unordered list
  * Replace mentions of IE7-9 support with Chromium and IE11
  * Remove mention of SVG support
  * Add an item about IE11 only being supported in internet-connected networks (due to its ES6 polyfill)
  * Remove items specific to IE7-8

Notes:
* Disabling MathJax's context menu has the following impacts:
  * Works around MathJax 3.x's missing i18n support
  * Makes MathJax more closely mimic native MathML implementations (i.e. scraps bells and whistles that go beyond being a polyfill)
  * Removes some accessibility/usability enhancements that were present in WET's MathJax 2.x implementation (e.g. focusing on expressions, double-click to zoom). But it's not a huge loss since those enhancements don't exist in native MathML implementations. Visually-hidden MathML markup is still provided for ATs that support it.
  * Prevents users from accessing options that are excluded from WET's local copy of MathJax (e.g. "Math Settings - Math Renderer - SVG")
* IE considerations:
  * Breaks compatibility with older versions of IE (older than IE11)
  * IE11 will only work if internet access is available
* Somewhat alleviates wet-boew#8425 (could still be improved by removing MathJax from the "copy:js" task)
* Fixes wet-boew#8769
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Sep 22, 2021
Drastically reduces MathJax's burden on the build:
* Brings a huge speed boost to Grunt's "copy:js" task (from ~13 to ~2 seconds)
* Reduces MathJax's compiled size down from ~25 MB (1,347 files/809 folders) to ~1 MB (24 files/5 folders)
* Almost halves the production dist folder's size (from ~55 MB to ~31 MB)

Related changes:
* Disable MathJax's context menu
* Add an ES6 polyfill for IE11 support
* Add extra line comments to give more context about how the polyfills are loaded in
* Change the MathJax fallback test to look for a configuration option we're not customizing
* Uses the CDN's latest version of MathJax 3
  * Falls back on WET's local version of MathJax 3.2.0 if the CDN is unreachable
  * Tries loading a local version of MathJax 2 if all else fails
* Add a temporary CSS workaround for mathjax/MathJax#2765 (thanks @dpvc!)
* Remove the build system's string-replace:inline task (was only being used to insert a specific version number in the CDN's URL)
* Update the documentation's known issues section:
  * Change it into an unordered list
  * Replace mentions of IE7-9 support with Chromium and IE11
  * Remove mention of SVG support
  * Add an item about IE11 only being supported in internet-connected networks (due to its ES6 polyfill)
  * Remove items specific to IE7-8

Notes:
* Disabling MathJax's context menu has the following impacts:
  * Works around MathJax 3.x's missing i18n support
  * Makes MathJax more closely mimic native MathML implementations (i.e. scraps bells and whistles that go beyond being a polyfill)
  * Removes some accessibility/usability enhancements that were present in WET's MathJax 2.x implementation (e.g. focusing on expressions, double-click to zoom). But it's not a huge loss since those enhancements don't exist in native MathML implementations. Visually-hidden MathML markup is still provided for ATs that support it.
  * Prevents users from accessing options that are excluded from WET's local copy of MathJax (e.g. "Math Settings - Math Renderer - SVG")
* IE considerations:
  * Breaks compatibility with older versions of IE (older than IE11)
  * IE11 will only work if internet access is available
* Somewhat alleviates wet-boew#8425 (could still be improved by removing MathJax from the "copy:js" task)
* Fixes wet-boew#8769
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Sep 29, 2021
Drastically reduces MathJax's burden on the build:
* Brings a huge speed boost to Grunt's "copy:js" task (from ~13 to ~2 seconds)
* Reduces MathJax's compiled size down from ~25 MB (1,347 files/809 folders) to ~1 MB (24 files/5 folders)
* Almost halves the production dist folder's size (from ~55 MB to ~31 MB)

Related changes:
* Disable MathJax's context menu
* Add an ES6 polyfill for IE11 support
* Add extra line comments to give more context about how the polyfills are loaded in
* Change the MathJax fallback test to look for a configuration option we're not customizing
* Uses the CDN's latest version of MathJax 3
  * Falls back on WET's local version of MathJax 3.2.0 if the CDN is unreachable
  * Tries loading a local version of MathJax 2 if all else fails
* Add a temporary CSS workaround for mathjax/MathJax#2765 (thanks @dpvc!)
* Remove the build system's string-replace:inline task (was only being used to insert a specific version number in the CDN's URL)
* Update the documentation's known issues section:
  * Change it into an unordered list
  * Replace mentions of IE7-9 support with Chromium and IE11
  * Remove mention of SVG support
  * Add an item about IE11 only being supported in internet-connected networks (due to its ES6 polyfill)
  * Remove items specific to IE7-8

Notes:
* Disabling MathJax's context menu has the following impacts:
  * Works around MathJax 3.x's missing i18n support
  * Makes MathJax more closely mimic native MathML implementations (i.e. scraps bells and whistles that go beyond being a polyfill)
  * Removes some accessibility/usability enhancements that were present in WET's MathJax 2.x implementation (e.g. focusing on expressions, double-click to zoom). But it's not a huge loss since those enhancements don't exist in native MathML implementations. Visually-hidden MathML markup is still provided for ATs that support it.
  * Prevents users from accessing options that are excluded from WET's local copy of MathJax (e.g. "Math Settings - Math Renderer - SVG")
* IE considerations:
  * Breaks compatibility with older versions of IE (older than IE11)
  * IE11 will only work if internet access is available
  * Letter capitalization issues exist due to mathjax/MathJax#2440
* Somewhat alleviates wet-boew#8425 (could still be improved by removing MathJax from the "copy:js" task)
* Fixes wet-boew#8769
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Oct 13, 2021
Drastically reduces MathJax's burden on the build:
* Brings a huge speed boost to Grunt's "copy:js" task (from ~13 to ~2 seconds)
* Reduces MathJax's compiled size down from ~25 MB (1,347 files/809 folders) to ~1 MB (24 files/5 folders)
* Almost halves the production dist folder's size (from ~55 MB to ~31 MB)

Related changes:
* Disable MathJax's context menu
* Add an ES6 polyfill for IE11 support
* Add extra line comments to give more context about how the polyfills are loaded in
* Change the MathJax fallback test to look for a configuration option we're not customizing
* Uses the CDN's latest version of MathJax 3
  * Falls back on WET's local version of MathJax 3.2.0 if the CDN is unreachable
  * Tries loading a local version of MathJax 2 if all else fails
* Add a temporary CSS workaround for mathjax/MathJax#2765 (thanks @dpvc!)
* Remove the build system's string-replace:inline task (was only being used to insert a specific version number in the CDN's URL)
* Update the documentation's known issues section:
  * Change it into an unordered list
  * Replace mentions of IE7-9 support with Chromium and IE11
  * Remove mention of SVG support
  * Add an item about IE11 only being supported in internet-connected networks (due to its ES6 polyfill)
  * Remove items specific to IE7-8

Notes:
* Disabling MathJax's context menu has the following impacts:
  * Works around MathJax 3.x's missing i18n support
  * Makes MathJax more closely mimic native MathML implementations (i.e. scraps bells and whistles that go beyond being a polyfill)
  * Removes some accessibility/usability enhancements that were present in WET's MathJax 2.x implementation (e.g. focusing on expressions, double-click to zoom). But it's not a huge loss since those enhancements don't exist in native MathML implementations. Visually-hidden MathML markup is still provided for ATs that support it.
  * Prevents users from accessing options that are excluded from WET's local copy of MathJax (e.g. "Math Settings - Math Renderer - SVG")
* IE considerations:
  * Breaks compatibility with older versions of IE (older than IE11)
  * IE11 will only work if internet access is available
  * Letter capitalization issues exist due to mathjax/MathJax#2440
* Somewhat alleviates wet-boew#8425 (could still be improved by removing MathJax from the "copy:js" task)
* Fixes wet-boew#8769
EricDunsworth added a commit to EricDunsworth/wet-boew that referenced this issue Oct 22, 2021
Drastically reduces MathJax's burden on the build:
* Brings a huge speed boost to Grunt's "copy:js" task (from ~13 to ~2 seconds)
* Reduces MathJax's compiled size down from ~25 MB (1,347 files/809 folders) to ~1 MB (24 files/5 folders)
* Almost halves the production dist folder's size (from ~55 MB to ~31 MB)

Related changes:
* Disable MathJax's context menu
* Add an ES6 polyfill for IE11 support
* Add extra line comments to give more context about how the polyfills are loaded in
* Change the MathJax fallback test to look for a configuration option we're not customizing
* Uses the CDN's latest version of MathJax 3
  * Falls back on WET's local version of MathJax 3.2.0 if the CDN is unreachable
  * Tries loading a local version of MathJax 2 if all else fails
* Add a temporary CSS workaround for mathjax/MathJax#2765 (thanks @dpvc!)
* Remove the build system's string-replace:inline task (was only being used to insert a specific version number in the CDN's URL)
* Update the documentation's known issues section:
  * Change it into an unordered list
  * Replace mentions of IE7-9 support with Chromium and IE11
  * Remove mention of SVG support
  * Add an item about IE11 only being supported in internet-connected networks (due to its ES6 polyfill)
  * Remove items specific to IE7-8

Notes:
* Disabling MathJax's context menu has the following impacts:
  * Works around MathJax 3.x's missing i18n support
  * Makes MathJax more closely mimic native MathML implementations (i.e. scraps bells and whistles that go beyond being a polyfill)
  * Removes some accessibility/usability enhancements that were present in WET's MathJax 2.x implementation (e.g. focusing on expressions, double-click to zoom). But it's not a huge loss since those enhancements don't exist in native MathML implementations. Visually-hidden MathML markup is still provided for ATs that support it.
  * Prevents users from accessing options that are excluded from WET's local copy of MathJax (e.g. "Math Settings - Math Renderer - SVG")
* IE considerations:
  * Breaks compatibility with older versions of IE (older than IE11)
  * IE11 will only work if internet access is available
  * Letter capitalization issues exist due to mathjax/MathJax#2440
* Somewhat alleviates wet-boew#8425 (could still be improved by removing MathJax from the "copy:js" task)
* Fixes wet-boew#8769
@dpvc dpvc added Merged Merged into develop branch and removed Ready for Review labels Feb 22, 2022
@dpvc dpvc added this to the 3.2.1 milestone Mar 11, 2022
@dpvc dpvc added Fixed v3.2 and removed Merged Merged into develop branch labels Jun 1, 2022
@dpvc dpvc closed this as completed Jun 1, 2022
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 v3.2
Projects
None yet
Development

No branches or pull requests

2 participants