mathjax / MathJax

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

subtle? poor translation from TeX #2775

Closed NSoiffer closed 2 years ago

NSoiffer commented 3 years ago

Issue Summary

I suspect that there is nothing that can be done, but I felt I should mention this because it does have accessibility implications.

If an author groups the base of a subscript (and likely superscript), the translation from TeX fails to group the base into a single mi in a case like {GL}_2. I doubt many TeX authors would even try to indicate that the base is "GL", but if the author makes an effort to provide some "semantics", the translator should respect that. I also tried \rm{GL}_2" -- it doesn't do any better.

The ClearSpeak translation ends up "G of L sub 2" instead of "GL sub 2"

The Nemeth code uses two capitalization indicators (one before the G and one before the L) instead of a leading double capitalization indicator.

FYI: this came from sre-tests/output/nemeth/AataNemeth.html # 246 where the output is wrong (should use double capitalizaiton indicator as it does with # 241).

Technical details:

dpvc commented 3 years ago

As you say, trying to decide whether {GL}_2 should be separate mi elements for G and L or a single one containing both is not easy. Note, however, that your example \rm{GL}_2 is not correct (or at least not what I think you intend), as \rm doesn't take an argument; it is a switch that turns the font to roman from then on (so in your example, it applies to the 2 as well as anything else that follows, and the braces are redundant). You may have meant {\rm GL}_2, but I don't consider this to be semantic as the \rm is changing the font style, not providing a meaning.

Did you mean \mathrm{GL}_2 instead? As it turns out, MathJax does code \mathrm{GL}_2 using a single mi for both letters. This was the result of a discussion in issue #2595 where \mathbf, \mathrm, and similar macros are handled specially so that letter groups in their arguments are combined into a single mi, as will occur in your example. Personally, I still don't consider the use of \mathrm, etc., to be semantic, but apparently some do.

There is also \operatorname{GL}_2 that actually is semantic, and does produce a single mi, when possible. Finally, \mathop{\rm GL}\nolimits_2 also produces a single mi (as a special case), since this also suggests a semantic interpretation.

The \mathrm handling is new in v3.1, but the \operatorname and \mathop treatment is also in v2.

NSoiffer commented 2 years ago

I thought I had replied earlier, but apparently I never clicked on the "comment" button.

At this point, I just want to record a "thank you" for your reply. Indeed I should have/meant to use mathrm{GL}_2 and perhaps should have used \operatorname (which I wasn't familiar with).

I agree that closing this issue is appropriate.