Fix breakable block equation overflow (#5078)

This commit is contained in:
Max 2024-10-01 08:01:28 +00:00 committed by GitHub
parent 4ef1096ad9
commit 8eee3ec8d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 3 deletions

View File

@ -322,10 +322,8 @@ fn layout_equation_block(
.layout_into_run(&elem.body, styles)?
.multiline_frame_builder(&ctx, styles);
let width = full_equation_builder.size.x;
let can_break =
BlockElem::breakable_in(styles) && full_equation_builder.frames.len() > 1;
let equation_builders = if can_break {
let equation_builders = if BlockElem::breakable_in(styles) {
let mut rows = full_equation_builder.frames.into_iter().peekable();
let mut equation_builders = vec![];
let mut last_first_pos = Point::zero();

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

View File

@ -130,6 +130,23 @@ $ a &+ b + & c \
& & c && + d \
&= 0 $
--- math-pagebreaking-single-line ---
// Test breaking of single line equations.
#set page(height: 4em)
#show math.equation: set block(breakable: true)
Shouldn't overflow:
$ a + b $
--- math-pagebreaking-single-line-numbered ---
// Test breaking of single line equations with numbering.
#set page(height: 4em)
#show math.equation: set block(breakable: true)
#set math.equation(numbering: "(1)")
Shouldn't overflow:
$ a + b $
--- issue-1948-math-text-break ---
// Test text with linebreaks in math.
$ x := "a\nb\nc\nd\ne" $