diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-02-12 22:43:37 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-02-12 22:43:37 +0100 |
| commit | a8f2e85f96ae5f9438847a64d9b66b3d6c18ec7f (patch) | |
| tree | 8bb2d87d05f462ff7cc2669cfce0485e015aa3c8 | |
| parent | 10b17a04bc27a4b38a0534446d29151d4f6303b3 (diff) | |
Add delimiter setting for `cases`
| -rw-r--r-- | library/src/math/matrix.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/src/math/matrix.rs b/library/src/math/matrix.rs index d523e590..978d262b 100644 --- a/library/src/math/matrix.rs +++ b/library/src/math/matrix.rs @@ -159,6 +159,14 @@ pub struct CasesNode(Vec<Content>); #[node] impl CasesNode { + /// The delimiter to use. + /// + /// ```example + /// #set math.cases(delim: "[") + /// $ x = cases(1, 2) $ + /// ``` + pub const DELIM: Delimiter = Delimiter::Brace; + fn construct(_: &Vm, args: &mut Args) -> SourceResult<Content> { Ok(Self(args.all()?).pack()) } @@ -166,8 +174,9 @@ impl CasesNode { impl LayoutMath for CasesNode { fn layout_math(&self, ctx: &mut MathContext) -> SourceResult<()> { + let delim = ctx.styles().get(Self::DELIM); let frame = layout_vec_body(ctx, &self.0, Align::Left)?; - layout_delimiters(ctx, frame, Some('{'), None) + layout_delimiters(ctx, frame, Some(delim.open()), None) } } |
