diff options
| author | Marmare314 <49279081+Marmare314@users.noreply.github.com> | 2023-05-03 11:16:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-03 11:16:38 +0200 |
| commit | edc0632d8c9d7a17cc795a57de27c6b22a748158 (patch) | |
| tree | a1c6e412512bed7b56c7c100b8affeac7e29f389 /library/src | |
| parent | 2772e6436c8a010662820c3e545e69ab922f133a (diff) | |
Add shorthand for root operation (#929)
Diffstat (limited to 'library/src')
| -rw-r--r-- | library/src/lib.rs | 3 | ||||
| -rw-r--r-- | library/src/math/root.rs | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/library/src/lib.rs b/library/src/lib.rs index 3701894d..785390f4 100644 --- a/library/src/lib.rs +++ b/library/src/lib.rs @@ -254,6 +254,9 @@ fn items() -> LangItems { math::AccentElem::new(base, math::Accent::new(accent)).pack() }, math_frac: |num, denom| math::FracElem::new(num, denom).pack(), + math_root: |index, radicand| { + math::RootElem::new(radicand).with_index(index).pack() + }, library_method: |vm, dynamic, method, args, span| { if let Some(counter) = dynamic.downcast::<meta::Counter>().cloned() { counter.call_method(vm, method, args, span) diff --git a/library/src/math/root.rs b/library/src/math/root.rs index 8b272160..7e00c45a 100644 --- a/library/src/math/root.rs +++ b/library/src/math/root.rs @@ -31,11 +31,11 @@ pub fn sqrt( pub struct RootElem { /// Which root of the radicand to take. #[positional] - index: Option<Content>, + pub index: Option<Content>, /// The expression to take the root of. #[required] - radicand: Content, + pub radicand: Content, } impl LayoutMath for RootElem { |
