summaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2023-04-24 02:04:04 -0700
committerGitHub <noreply@github.com>2023-04-24 11:04:04 +0200
commit5ccc6876194a3f9329021bf22e7c8d0ed6bf74a1 (patch)
tree672bc2785e52ef643bd7ab20a172af8dfe96ff8e /library
parente5ea3ecbbb2cebe1f602996dff911d07e2f7741d (diff)
Obey alignment in matrices (#892)
Diffstat (limited to 'library')
-rw-r--r--library/src/math/matrix.rs6
1 files changed, 4 insertions, 2 deletions
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<Content>]) -> 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;
}