I found that the “display” equations themselves also break paragraphs. For example,
#set par(hanging-indent: 3em)
#lorem(50)
$ display(y=a x + b) $
#lorem(100)
This code block is renderred as
The output would not change even with the following code
#lorem(50) $ display(y=a x + b) $ #lorem(100)
However, a “display” equation should be a part of a paragraph, if there is no blank lines around it. This is also how LaTeX and Word deals with display equations.
P.S. To be honest, I’m afraid the priority of the paragraph now is a bit too low. Anything showing by a block can break the paragraph.
From what I understand, you do want the equation to be separate in terms of a new line, but the paragraph should remain the same. As you already assumed correctly, all block level elements currently break the paragraph, so this isn’t really possible at the moment.
If you really want to, you can work around this by wrapping the equation in a box and adding line breaks manually. The following may not work well when the equation is at the start or end of a paragraph, but then you can also just use normal equations.
Oh I see, I wonder if there are any good arguments for either case, i.e. merging the paragraphs vs keeping them separate.
I reckon it would have positive impact in most cases to actually merge math blocks into its surrounding paragraphs, if there’s no issue for this you could create one.
If a block equation is semantically part of a paragraph, as was intended here, then the current behavior introduces a parbreak regardless of intention. Depending on set and show rules in effect this could then cause a few hiccups:
For first-line-indent being set this, the next paragraph to get and indentation even when the user did not intend so.
Spacing would likely be incorrect.
Something like tagged PDF export would not place the correct tags, resulting in the paragraph being split up for the PDF reader too.
So, I’m thinking, perhaps we should treat math blocks as part of a paragraph unless a parbreak is explicitly added, i.e.:
I agree with you. I think this should be a language-level feature, although we can create something like the environment equation in LaTeX to wrap our equations. Moreover, if you want to display equation numbers, there would be another issue,
I think so. As I said, the priority of the paragraph seems to be too low and a block can easily break the paragraph flow. But fixing this would be a breaking change. I’m afraid that it would not happen in a short time.