From 5ccc6876194a3f9329021bf22e7c8d0ed6bf74a1 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Mon, 24 Apr 2023 02:04:04 -0700 Subject: Obey alignment in matrices (#892) --- library/src/math/matrix.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'library/src/math') diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 2243eb38..956c7f8a 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -272,8 +272,10 @@ fn layout_mat_body(ctx: &mut MathContext, rows: &[Vec]) -> SourceResult let mut y = Abs::zero(); for ((cell, &ascent), &descent) in col.into_iter().zip(&ascents).zip(&descents) { let cell = cell.into_aligned_frame(ctx, &points, Align::Center); - let pos = - Point::new(x + (rcol - cell.width()) / 2.0, y + ascent - cell.ascent()); + let pos = Point::new( + if points.is_empty() { x + (rcol - cell.width()) / 2.0 } else { x }, + y + ascent - cell.ascent(), + ); frame.push_frame(pos, cell); y += ascent + descent + row_gap; } -- cgit v1.2.3