diff --git a/crates/typst/src/math/equation.rs b/crates/typst/src/math/equation.rs index 83d3fc748..963a35c5e 100644 --- a/crates/typst/src/math/equation.rs +++ b/crates/typst/src/math/equation.rs @@ -379,6 +379,12 @@ fn layout_equation_block( equation_builder.size.y = height; } + // Ensure that there is at least one frame, even for empty equations. + if equation_builders.is_empty() { + equation_builders + .push(MathRunFrameBuilder { frames: vec![], size: Size::zero() }); + } + equation_builders } else { vec![full_equation_builder] diff --git a/tests/suite/math/multiline.typ b/tests/suite/math/multiline.typ index 3c0ed2f49..34e66b99c 100644 --- a/tests/suite/math/multiline.typ +++ b/tests/suite/math/multiline.typ @@ -147,11 +147,15 @@ $ a + b $ Shouldn't overflow: $ a + b $ +--- issue-5113-pagebreaking-empty --- +// Test empty breakable equations. +#show math.equation: set block(breakable: true) +#math.equation(block: true, []) + --- issue-1948-math-text-break --- // Test text with linebreaks in math. $ x := "a\nb\nc\nd\ne" $ - --- issue-4829-math-pagebreaking-wrong-number --- // Test numbering of empty regions of broken equations. #set page(height: 5em)