-
Notifications
You must be signed in to change notification settings - Fork 22
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
prime and superscript on same character enabled #59
base: master
Are you sure you want to change the base?
Conversation
A new symbol 'superScript' defined and used in compoundTerm new unit tests added for this
Thanks for the PR. Have you checked consistency with itex2MML? And whether all the unit tests pass? In any case, the MathML output seems incorrect a'^b should be semantically equivalent to {a'}^b i.e.
but your unit tests make it equivalent to a^{'b}. Probably, the correct MathML output if you want to put all the scripts on the same line should be
|
Arguably, itex2MML does it wrong (or, at least, differently):
(that is, the "′" is treated as an accent/modifier, rather than as a superscript). And (alas), you do need to write
|
(And, of course, TeXZilla currently follows itex2MML in this regard.) |
I had found that MathJax and MiKTex both handle a'^b. But arguably {a'}^b as distler suggested would be a better way of writing it so I am inclined to withdraw the merge request. |
On second thoughts ... Should TeXZilla handle a'^b at all? I haven't been able to find any definition of what is or is not valid TeX input. Regarding how a' is rendered: in fact TeXzilla does MathJax renders a'^b as I agree it should be semantically equivalent to {a'}^b but the presentation is much the same. Another case is a_b' which is semantically {a_b}' which renders with the prime to the right. While this is in a sense "more correct" it is not how it is usually typeset. It's more complicated than I thought at first. |
Welcome to my world. Trying to infer correct semantics from LaTeX input is a fiendishly difficult task. And it's not just primes... Consider (a+b)^2 . That should be equivalent to {(a+b)}^2, not (a+b{)}^2, but good luck finding a parser (itex2MML, TexZilla, MathJax, ...) that does that correctly. Since (La)TeX doesn't enforce any sort of semantics on its input (in this case, parentheses don't have to be balanced), there is, except in rare circumstances, no way to infer correct semantics from (La)TeX input. If you care about such things (e.g., if you hope that a screen reader might read your MathML correctly), then you should probably start typing in the braces yourself -- {(a+b)}^2 -- rather than hoping that TeXZilla (or itex2MML or MathJax) infers them correctly for you. |
A new symbol 'superScript' defined and used in compoundTerm
new unit tests added for this