mathjax / MathJax

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

Faulty display of Sigma Notation #3260

Closed luis261 closed 1 month ago

luis261 commented 1 month ago

Issue Summary

I'm having trouble with a Sigma Notation in a formula here on GitHub: https://github.com/scikit-learn/scikit-learn/issues/29365#issuecomment-2225692407 (GitHub uses MathJax to render latex according to https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions)

Steps to Reproduce:

this is the context where the issue occurs: inline version: $a{ pts } coredist(x{ i }) = \left(\frac{ \sum{ z=2 }^{N{ i }} { \left(\frac{ 1 }{ KNN(x{ i }, z) }\right)^{ n } } }{ N{ i }-1 }\right)^{ -\frac{ 1 }{ n } }$

block version: $$a{ pts } coredist(x{ i }) = \left(\frac{ \sum{ z=2 }^{N{ i }} { \left(\frac{ 1 }{ KNN(x{ i }, z) }\right)^{ n } } } { N{ i }-1 }\right)^{ -\frac{ 1 }{ n } }$$

The N_i end value should display above the Sigma symbol. It doesn't though, at least not on my end (both for the block and the inline version): image

the \sum_ component does work properly in isolation: $$\sum{ z=2 }^{N{ i }}$$

Technical details:

Supporting information:

EDIT: I also had a look at this from a few other environments:

Also for some reason the block version above isn't rendering at all now even though it is 100% identical to the one here, which is rendering?! ... very strange


Sorry for just "chucking this over the fence" without looking too deep into it, but maybe the issue is obvious? Probably there's something wrong in the formula after all -- some MathJax implementation specific syntax I need to adjust? Or maybe I should report this to GitHub instead?

Unsure if this is the right place to report this, but thank you in advance anyway!

dpvc commented 1 month ago

This is a bug with the way GitHub has handled their MathJax implementation. They are removing some attributes from the tags that MathJax produces, and those are needed in order to trigger the CSS needed to style the elements properly. This was reported in bug list over a year ago, so it looks like they not be interested in doing anything about it. Unfortunately, that is outside our hands.

luis261 commented 1 month ago

Oh ok - interesting, sad to hear that there isn't any real recourse for me to get it fixed/low likelihood of the fix moving forward.

Thank you so much anyway for the information you've provided though! Very helpful, especially with you having a direct reference to the bug in store, now I at least know for sure there isn't anything wrong with the formula source itself (: