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
mi-tag with mathvariant creates extra spans #1774
Comments
This is a bit complicated, I'm afraid. On the one hand, your demos use a combined configuration file that specifies the SVG output but since you are mentioning Assuming that's the case, I can't actually reproduce the issue -- the relevant piece ( However, the HTML-CSS output is highly client dependent so depending on your browser, OS and installed fonts you might get different results (in my case, Chrome 59 on Linux). Can you provide more information and perhaps a screenshot? In particular, it's not a good idea to copy the output from the HTML-CSS output. You can do this with CommonHTML output which works across browsers and platforms though. (Since it's layout is more modern, it also won't have the "spacing spans" that I described for the HTML-CSS output earlier). |
@dpvc will know best, but I'm guessing that's just another Chrome+windows specific hack that the HTML-CSS output needed at some point. |
I was going to say that I couldn't reproduce it either, but your screen shot gave me the clue I needed to figure out what was going on. MathJax's HTML-CSS output has mechanism for dealing with tags that include characters from several fonts by putting some inside spans that specify the different fonts. It turns out that there is an interaction between that mechanism and another one that patches a problem that Chrome had with loading web fonts with italic or bold variants. That second issue only affects web fonts, and since I (and I presume Peter) have the MathJax fonts installed locally, we didn't trigger the web-font patch, and so didn't get the interaction you are seeing. When I use web fonts, then I see the issue that you describe. I suspect that Chrome has fixed the bug that MathJax works around, and so one possible work-around is to turn off that fix. It first appeared in Chrome 32, but I don't know when it may have been fixed. There were quite a few buggy versions for a while (I remember 38 was pretty bad, if I recall correctly). So you might try adding
I don't know if version 40.0 is really the right one, but Chrome is pretty aggressive about updating itself, so you are probably OK with this. In any case, Peter's comment about copying the resulting HTML is correct: you don't want to copy the HTML-CSS output, as it is browser dependent (and also OS dependent, and dependent on the fonts installed on your system, and a couple of other things). If you want something portable, use the CommonHTML output instead. |
The |
This seems to be working! Thanks! |
Handle FontFaceBug interaction with web fonts in Chrome. #1774
==> Merged |
==> In testsuite MathMLToDisplay/Characters/issue1774.html |
I have an
mi
-tag with multiple characters in it that I want printed italic. According to the MathML specs I should add themathvariant
attribute and set it to italic. This works, it prints the contents italic, but it also adds unnecessaryspan
-tags; all but the first character are in a seperatespan
with thefont-family
set as a style property.This causes issues for me because I copy the generated HTML and the extra spans cause issues there.
I found the issue started arising in version 2.4.
I made two codepens, one with version 2.3-latest, which can be found here
And one with 2.7-latest, which can be found here
I've added some css to show the spans in the generated code.
I also added some alternative versions, with
mtext
andmo
-tags, also usingmathvariant="italic"
, but with those there are no issues.Is this a feature that can somehow be disabled with a configuration setting or is it a bug?
The text was updated successfully, but these errors were encountered: