summaryrefslogtreecommitdiff
path: root/crates/typst-library/src/math/lr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/typst-library/src/math/lr.rs')
-rw-r--r--crates/typst-library/src/math/lr.rs18
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/typst-library/src/math/lr.rs b/crates/typst-library/src/math/lr.rs
index 07ab0dd4..965f5351 100644
--- a/crates/typst-library/src/math/lr.rs
+++ b/crates/typst-library/src/math/lr.rs
@@ -1,4 +1,4 @@
-use crate::foundations::{elem, func, Content, NativeElement, Smart};
+use crate::foundations::{elem, func, Content, NativeElement};
use crate::layout::{Length, Rel};
use crate::math::Mathy;
use crate::text::TextElem;
@@ -10,7 +10,9 @@ use crate::text::TextElem;
#[elem(title = "Left/Right", Mathy)]
pub struct LrElem {
/// The size of the brackets, relative to the height of the wrapped content.
- pub size: Smart<Rel<Length>>,
+ #[resolve]
+ #[default(Rel::one())]
+ pub size: Rel<Length>,
/// The delimited content, including the delimiters.
#[required]
@@ -44,7 +46,7 @@ pub struct MidElem {
pub fn floor(
/// The size of the brackets, relative to the height of the wrapped content.
#[named]
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
/// The expression to floor.
body: Content,
) -> Content {
@@ -60,7 +62,7 @@ pub fn floor(
pub fn ceil(
/// The size of the brackets, relative to the height of the wrapped content.
#[named]
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
/// The expression to ceil.
body: Content,
) -> Content {
@@ -76,7 +78,7 @@ pub fn ceil(
pub fn round(
/// The size of the brackets, relative to the height of the wrapped content.
#[named]
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
/// The expression to round.
body: Content,
) -> Content {
@@ -92,7 +94,7 @@ pub fn round(
pub fn abs(
/// The size of the brackets, relative to the height of the wrapped content.
#[named]
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
/// The expression to take the absolute value of.
body: Content,
) -> Content {
@@ -108,7 +110,7 @@ pub fn abs(
pub fn norm(
/// The size of the brackets, relative to the height of the wrapped content.
#[named]
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
/// The expression to take the norm of.
body: Content,
) -> Content {
@@ -119,7 +121,7 @@ fn delimited(
body: Content,
left: char,
right: char,
- size: Option<Smart<Rel<Length>>>,
+ size: Option<Rel<Length>>,
) -> Content {
let span = body.span();
let mut elem = LrElem::new(Content::sequence([