From e4e888b9ce361616545da319170c61d2d8878a59 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Sun, 29 Jan 2023 17:53:25 +0100 Subject: [PATCH] Fix `lr` with already matched body --- library/src/math/lr.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/src/math/lr.rs b/library/src/math/lr.rs index e265affb8..2eb567b9d 100644 --- a/library/src/math/lr.rs +++ b/library/src/math/lr.rs @@ -53,8 +53,14 @@ impl LrNode { impl LayoutMath for LrNode { fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { - let mut row = ctx.layout_row(&self.body)?; + let mut body = &self.body; + if let Some(node) = self.body.to::() { + if node.size.is_none() { + body = &node.body; + } + } + let mut row = ctx.layout_row(body)?; let axis = scaled!(ctx, axis_height); let max_extent = row .0 @@ -95,7 +101,12 @@ fn scale( fragment.class(), Some(MathClass::Opening | MathClass::Closing | MathClass::Fence) ) { - let MathFragment::Glyph(glyph) = *fragment else { return }; + let glyph = match fragment { + MathFragment::Glyph(glyph) => *glyph, + MathFragment::Variant(variant) => GlyphFragment::new(ctx, variant.c), + _ => return, + }; + let short_fall = DELIM_SHORT_FALL.scaled(ctx); *fragment = MathFragment::Variant(glyph.stretch_vertical(ctx, height, short_fall));