Line break should not happen after/before math if there is no whitespace

This is a minor typesetting issue with the math plugin.

Here’s a screenshot of a line I wrote:

Notice the line break right before ). and after b_2.

There should be no line break either before or after math, unless there is also whitespace.

Here’s the markdown version of that line:

In your example, $C_{a_1, a_2} = 2$ because there are 2 vertices that point to both $a_1$ and $a_2$ (namely $b_1$ and $b_2$).

I cannot demonstrate it here directly as math support is not enabled here.

This is reproducible both in Firefox and Chrome.

1 Like

So is this a bug in the math plugin?

Are you sure there is a linebreak. What happens if you delete a word from the sentence?

What is the minimal text that reproduces the issue?

1 Like

I don’t understand your questions. Look at the screenshot: it’s quite clear. The ) is on a line on its own. It should not be.

To reproduce it, type some math preceded by a space and followed by non-whitespace characters, e.g. (word $x$). Now keep adding characters to the beginning of the line to make the line longer, until it wraps. You will see the ) jumping onto a new line on its own, as in my screenshot.

I don’t understand. Posts are in a container if text does not fit it wraps. Same as it wraps on this line which is this.

I don't understand. Posts are in a container if text does not fit it wraps. Same as it wraps on this line which is this.

Can you explain what you are expecting here?

Here’s the screenshot again, with the incorrectly wrapped part marked with an arrow.

This is wrong:

This would be correct:

Wrapping should happen only at whitespace. Words are not broken into half in the middle. The same way, $b_2$ should not separate from ) because there is no space between them.

Here’s another, artifical example. Compare when “x” is math vs when it is not math. When it is not math, it is not separated from the closing parenthesis. This is how it should be. Placing “x” into math mode should not change this.



mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm hhhh hhhh (a $x$)

mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm hhhh hhhh (a x)

@sam, let me know if this clarified it for you.

Yes this clarifies things, I support improving this, but I suspect it is going to be pretty tricky … @danekhollas what are your thoughts here, can you think of any easy improvements that can be made?


Yeah, I was expecting that it would not be easy to fix. But it’s really a cosmetic issue, so not a huge deal. It would be nice if it could be improved, but if not, people can still read the posts just fine. It’s a forum, not a system for publishing books.