Before reporting a bug
- [x] Check common issues.
- [x] Check the bug is reproducible in the demo. If not, check KaTeX is up-to-date and installed correctly.
- [x] Search for existing issues.
Describe the bug:
As the title says,\not =, \neq, \ne, etc. are not aligned correctly inside the iframe even though it loads fine outside an iframe; other things don't seem to have issues, including fractions, which seems to have been reported before
(La)TeX code:
The code of (La)TeX you tried to render:
a \ne b
a \neq b
a \not = b
(in math mode, both display and inline)
Expected behavior:
i'd expect it to look the same inside and outside an iframe because everything else seems to do that
Pen:
https://codepen.io/anon/pen/XLvvvL
Environment (please complete the following information):
Additional context:
n/a; thanks!
I'm really surprised that this issue is cross browser. I'm not sure what's causing the difference in behavior, but my guess would be there's some default style applied to the content of iframes that is affecting our styles. Have you noticed any other differences in KaTeX's output when rendering inside an iframe?
I haven't noticed anything else that is different. I've actually been working a lot with KaTeX inside an iframe and so far, this is the only thing I've noticed.
while playing around a bit, I noticed that the .strut element coming before what seems to be the \not symbol had the following style:
vertical-align: -0.19444em;
and removing that seemed to align it correctly for one of the cases but I don't know if it covers all of them.
Thanks for taking a look at it!
The problem is that the iframe doesn't have a <!DOCTYPE html>, so it's running in quirks mode. Adding iframe.write('<!DOCTYPE html>') fixes the problem.
I forget what our current state is with respect to quirks mode (level of support), but I think rendering issues like this are not unexpected.
That's annoying that iframes without a src don't inherit the parent's DOCTYPE.
Indeed, although I think they're most often (?) used with src, and in that context, it makes sense to inherit the DOCTYPE of the linked document.
Most helpful comment
Indeed, although I think they're most often (?) used with
src, and in that context, it makes sense to inherit the DOCTYPE of the linked document.