diff --git a/crates/typst-layout/src/math/run.rs b/crates/typst-layout/src/math/run.rs index 8f12c509..b07f5893 100644 --- a/crates/typst-layout/src/math/run.rs +++ b/crates/typst-layout/src/math/run.rs @@ -419,7 +419,10 @@ impl MathRunFrameBuilder { } fn affects_row_height(fragment: &MathFragment) -> bool { - !matches!(fragment, MathFragment::Align | MathFragment::Linebreak) + !matches!( + fragment, + MathFragment::Align | MathFragment::Linebreak | MathFragment::Tag(_) + ) } /// Create the spacing between two fragments in a given style. diff --git a/tests/ref/math-equation-tag-affects-row-height.png b/tests/ref/math-equation-tag-affects-row-height.png new file mode 100644 index 00000000..d0cc2359 Binary files /dev/null and b/tests/ref/math-equation-tag-affects-row-height.png differ diff --git a/tests/suite/math/equation.typ b/tests/suite/math/equation.typ index 6cdf7b7e..148a49d0 100644 --- a/tests/suite/math/equation.typ +++ b/tests/suite/math/equation.typ @@ -260,6 +260,15 @@ $ q &= sum_k ln A \ // Test numbering on empty equations. #math.equation(numbering: "1", block: true, []) +--- math-equation-tag-affects-row-height --- +// Tags should not affect the row height of equations. +#box($ - - $, fill: silver) +#box($ #metadata(none) - - $, fill: silver) \ +#box($ a \ - - $, fill: silver) +#box($ a \ #metadata(none) - - $, fill: silver) +#box($ - - \ a $, fill: silver) +#box($ #metadata(none) - - \ a $, fill: silver) + --- issue-4187-alignment-point-affects-row-height --- // In this bug, a row of "-" only should have a very small height; but // after adding an alignment point "&", the row gains a larger height.