Katex: \not =, \neq, \ne, etc. not aligned correctly inside iframe [pen included]

Created on 18 Jul 2019  路  5Comments  路  Source: KaTeX/KaTeX

Before reporting a bug

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):

  • KaTeX Version: 0.10.2
  • Device: MacBook Air 2018
  • OS: OSX Mojave (10.14.5), also tested on Windows 10
  • Browser: FireFox 68.0, Safari 12.1.1, Chrome 75.0.3770.142
  • Version: see above?

Additional context:
n/a; thanks!

bug

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.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OisinMoran picture OisinMoran  路  4Comments

jason-s picture jason-s  路  3Comments

mpolyak picture mpolyak  路  3Comments

pyramation picture pyramation  路  4Comments

fabiospampinato picture fabiospampinato  路  4Comments