diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 84dcfd9ba..aaccc3328 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -93,15 +93,15 @@ pub struct MatElem { let mut width = 0; let values = args.all::>()?; - if values.iter().all(|spanned| matches!(spanned.v, Value::Content(_))) { - rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()]; - } else { + if values.iter().any(|spanned| matches!(spanned.v, Value::Array(_))) { for Spanned { v, span } in values { let array = v.cast::().at(span)?; let row: Vec<_> = array.into_iter().map(Value::display).collect(); width = width.max(row.len()); rows.push(row); } + } else { + rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()]; } for row in &mut rows { diff --git a/tests/ref/math/matrix.png b/tests/ref/math/matrix.png index 9e3571462..d3d2681c7 100644 Binary files a/tests/ref/math/matrix.png and b/tests/ref/math/matrix.png differ diff --git a/tests/typ/math/matrix.typ b/tests/typ/math/matrix.typ index 514827c3c..f65004a7e 100644 --- a/tests/typ/math/matrix.typ +++ b/tests/typ/math/matrix.typ @@ -57,3 +57,9 @@ $ a + mat(delim: #none, 1, 2; 3, 4) + b $ --- // Error: 13-14 expected array, found content $ mat(1, 2; 3, 4, delim: "[") $, + +--- +$ mat(B, A B) $ +$ mat(B, A B, dots) $ +$ mat(B, A B, dots;) $ +$ mat(#1, #(foo: "bar")) $