summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYip Coekjan <69834864+Coekjan@users.noreply.github.com>2024-06-22 16:40:10 +0800
committerGitHub <noreply@github.com>2024-06-22 08:40:10 +0000
commitddce645ef006ac86109a7dfe8cc9d3565598fbf0 (patch)
treea91a5e06edba03867fb781e1c874797abe04ad3d
parenta2c980715958bc3fd71e1f0a5975fea3f5b63b85 (diff)
Add named symbols: `⌈`, `⌉`, `⌊`, `⌋` (#4267)
-rw-r--r--crates/typst/src/math/mod.rs2
-rw-r--r--crates/typst/src/symbols/sym.rs8
-rw-r--r--docs/src/lib.rs2
3 files changed, 9 insertions, 3 deletions
diff --git a/crates/typst/src/math/mod.rs b/crates/typst/src/math/mod.rs
index 4b5ce56b..dc79f48b 100644
--- a/crates/typst/src/math/mod.rs
+++ b/crates/typst/src/math/mod.rs
@@ -187,8 +187,6 @@ pub fn module() -> Module {
math.define_elem::<PrimesElem>();
math.define_func::<abs>();
math.define_func::<norm>();
- math.define_func::<floor>();
- math.define_func::<ceil>();
math.define_func::<round>();
math.define_func::<sqrt>();
math.define_func::<upright>();
diff --git a/crates/typst/src/symbols/sym.rs b/crates/typst/src/symbols/sym.rs
index d09cb4c2..1dec0039 100644
--- a/crates/typst/src/symbols/sym.rs
+++ b/crates/typst/src/symbols/sym.rs
@@ -64,6 +64,14 @@ pub(crate) const SYM: &[(&str, Symbol)] = symbols! {
spheric.rev: '⦠',
spheric.top: '⦡',
],
+ ceil: [
+ #[call(crate::math::ceil)] l: '⌈',
+ r: '⌉',
+ ],
+ floor: [
+ #[call(crate::math::floor)] l: '⌊',
+ r: '⌋',
+ ],
// Punctuation.
amp: ['&', inv: '⅋'],
diff --git a/docs/src/lib.rs b/docs/src/lib.rs
index 231fe97c..7575817a 100644
--- a/docs/src/lib.rs
+++ b/docs/src/lib.rs
@@ -542,7 +542,7 @@ fn group_page(
let mut outline_items = vec![];
for name in &group.filter {
let value = group.module().scope().get(name).unwrap();
- let Value::Func(func) = value else { panic!("not a function") };
+ let Ok(ref func) = value.clone().cast::<Func>() else { panic!("not a function") };
let func = func_model(resolver, func, &path, true);
let id_base = urlify(&eco_format!("functions-{}", func.name));
let children = func_outline(&func, &id_base);