Skip to content
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

TeX Inline Wrapping #3297

Open
JustTheCoolest opened this issue Oct 13, 2024 · 3 comments
Open

TeX Inline Wrapping #3297

JustTheCoolest opened this issue Oct 13, 2024 · 3 comments
Labels
Expected Behavior This is how MathJax works v2

Comments

@JustTheCoolest
Copy link

Issue Summary

When inline MathJax is getting rendered and has to wrap, it's wrapping only the MathJax portion of it, and not the surrounding normal text

Steps to Reproduce:

(Note this $(inline * aaaaaaaaaaaa * aaaaaaaaaaaaaaaaaaa)$)

Screenshot_20241013-183413

This is incredibly misleading especially when dealing with brackets in mathematics

Technical details:

  • MathJax Version: 2.7.5 (whatever is used in Cross Validated Stack Exchange)
  • Client OS: Android 14; moto g54 5G Build/U1TD34.94-12-9-10
  • Browser: Chrome 129.0.6668.100
MathJax.js v2.7.5
TeX Input Jax v2.7.5
HTML-CSS Output Jax v2.7.5
PreviewHTML Output Jax v2.7.5
mml Element Jax v2.7.5
AssistiveMML Extension v2.7.5
MathEvents Extension v2.7.5
MathMenu Extension v2.7.5
MathZoom Extension v2.7.5
TeX/AMSmath Extension v2.7.5
TeX/AMSsymbols Extension v2.7.5
TeX/begingroup Extension v2.7.5
TeX/noErrors Extension v2.7.5
TeX/noUndefined Extension v2.7.5
accessibility-menu Extension v1.5.0
fast-preview Extension v2.7.5
tex2jax Extension v2.7.5
Safari v7.0 — woff or otf fonts
@dpvc
Copy link
Member

dpvc commented Oct 13, 2024

Well, version 2.7.5 used by StackExchange sites is pretty old (over six years old now). The current release is 3.2.2, and they have recently added an opt-in preference for using that instead of v2. but v3 doesn't support automatic line breaks. That is available in v4 (currently in beta release).

The issue you are seeing is due to the fact that when an inline formula is wider than the container, MathJax will break it, but it is in a box of its own, and in HTML-CSS output, that box is only as wide as the broken math rather than as wide as the whole container. If you switch to CommonHTML output (which is faster and less fragile), that should work better for you.

The issue was fixed in a later version of v2, though I don't remember which. In version 2.7.9 (the highest v2 version) HTML-CSS works like CommonHTML, making the box as wide as the container. That puts the broken inline math on lines separate from the preceding and following text, which is better but not idea. The in-line breaking in v4 is much better, and would put the first part of the math at the end of the same line with the preceding text, and the remainder of the math at the beginning of the next line of text, as you would expect.

When v4 is released, I expect StackExchange will move to that, though it may still be opt-in for the initial testing.

@dpvc dpvc added Expected Behavior This is how MathJax works v2 labels Oct 13, 2024
@dpvc
Copy link
Member

dpvc commented Oct 13, 2024

I'm marking as "expected behavior", as that is how MathJax works in v2, and that is not likely to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Expected Behavior This is how MathJax works v2
Projects
None yet
Development

No branches or pull requests

4 participants
@dpvc @JustTheCoolest and others