diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index 8fba10e71..66925cda5 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -24,8 +24,8 @@ pub struct VecElem { /// #set math.vec(delim: "[") /// $ vec(1, 2) $ /// ``` - #[default(Delimiter::Paren)] - pub delim: Delimiter, + #[default(Some(Delimiter::Paren))] + pub delim: Option, /// The elements of the vector. #[variadic] @@ -39,8 +39,8 @@ impl LayoutMath for VecElem { layout_delimiters( ctx, frame, - Some(delim.open()), - Some(delim.close()), + delim.map(Delimiter::open), + delim.map(Delimiter::close), self.span(), ) } @@ -76,8 +76,8 @@ pub struct MatElem { /// #set math.mat(delim: "[") /// $ mat(1, 2; 3, 4) $ /// ``` - #[default(Delimiter::Paren)] - pub delim: Delimiter, + #[default(Some(Delimiter::Paren))] + pub delim: Option, /// An array of arrays with the rows of the matrix. /// @@ -121,8 +121,8 @@ impl LayoutMath for MatElem { layout_delimiters( ctx, frame, - Some(delim.open()), - Some(delim.close()), + delim.map(Delimiter::open), + delim.map(Delimiter::close), self.span(), ) } diff --git a/tests/ref/math/matrix.png b/tests/ref/math/matrix.png index 59e3a7b09..f74384a36 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 a828e4b41..e57e102e4 100644 --- a/tests/typ/math/matrix.typ +++ b/tests/typ/math/matrix.typ @@ -32,6 +32,7 @@ $ mat( // Test alternative delimiter with set rule. #set math.mat(delim: "[") $ mat(1, 2; 3, 4) $ +$ a + mat(delim: #none, 1, 2; 3, 4) + b $ --- // Test alternative math delimiter directly in call. diff --git a/tests/typ/math/vec.typ b/tests/typ/math/vec.typ index 198a1d154..445b8104c 100644 --- a/tests/typ/math/vec.typ +++ b/tests/typ/math/vec.typ @@ -10,5 +10,5 @@ $ v = vec(1, 2+3, 4) $ $ vec(1, 2) $ --- -// Error: 22-25 expected "(", "[", "{", "|", or "||" +// Error: 22-25 expected "(", "[", "{", "|", "||", or none #set math.vec(delim: "%")