mathjax / MathJax

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

horizontal spacing for displayed equation structures when a floated element exists on the same line (version 4 beta 7) #3299

Open cebola2 opened 1 week ago

cebola2 commented 1 week ago

Issue Summary

There is something wrong with horizontal spacing for displayed equation structures when a floated element exists on the same line. I have a page which is a kind of torture test on this respect.

Steps to Reproduce:

Go to https://mr.math.tecnico.ulisboa.pt/seminars_1?id=7380 on a tablet in vertical mode. You will probably see something like this

https://photos.app.goo.gl/5uY6UQs9G38vVwsXA

There is a displayed equation block missing between the words "form" and "where".

On a phone you might see it or not. I have not been able to make it reproducible but when you do see it it will look all right except for some extra vertical spacing after the displayed equation block as in

https://photos.app.goo.gl/JhR5o1jXf2v1GjbUA

On a desktop system there are no visible problems.

It might be relevant or not that the displayed equation block has an equation number.

Technical details:

This seems quite independent from browsers and other technical details except for screen width and MathJax version which is MathJax-4.0.0-beta.7 installed locally.

Configuration is available from https://mr.math.tecnico.ulisboa.pt/seminars_1?id=7380

Supporting information:

imagem

imagem

dpvc commented 1 week ago

It looks like it may be related to the lazy typesetting extension. Can you try disabling that (i.e., not loading it) and see if that resolves the issue? My best guess is that the events needed by the intersection observer that indicate when the math comes into view may have fired before MathJax has been set up, and so the expressions aren't being displayed for that reason.

You might also try changing the defer to async on the script that loads tex-mml-svg-nofont.js and removing defer from the one that loads your configuration. It may be that getting MathJax to run earlier will allow it to get the needed events.

If either of those work for you, please let us know. We may have to figure out a way to get the initial intersection observer events if that is the problem.

dpvc commented 1 week ago

Oh, as for the extra spacing, it looks like the linebreaking is trying to kick in and may be inserting a break after the final comma (not what it should be doing), which is causing a blank line to be inserted. I will have to look into that further.

cebola2 commented 1 week ago

Removing lazy typesetting does solve the disappearance of the displayed equation block in portable devices. On this particular site that is an acceptable solution. I will create a page with lazy typesetting displaying the original problem sometime later today and correct the link in the report above.

Thanks for your usual super fast and accurate answer!

cebola2 commented 1 week ago

I have changed the link in the original report from https://mr.math.tecnico.ulisboa.pt/seminars?id=7380 to https://mr.math.tecnico.ulisboa.pt/seminars_1?id=7380

The former link no longer uses the lazy typesetting extension.

The far less serious problem of extra vertical spacing is visible in both.