Wrap into an equation when a Math expr is evaluated (#2081)

This commit is contained in:
LU Jialin 2023-09-11 16:47:08 +08:00 committed by GitHub
parent 71dccde031
commit d056280165
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -202,9 +202,10 @@ pub fn eval_string(
EvalMode::Markup => {
Value::Content(root.cast::<ast::Markup>().unwrap().eval(&mut vm)?)
}
EvalMode::Math => {
Value::Content(root.cast::<ast::Math>().unwrap().eval(&mut vm)?)
}
EvalMode::Math => Value::Content((vm.items.equation)(
root.cast::<ast::Math>().unwrap().eval(&mut vm)?,
false,
)),
};
// Handle control flow.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -0,0 +1,5 @@
// Evaluating a math expr should renders the same as an equation
#eval(mode: "math", "f(a) = cases(a + b\, space space x >= 3,a + b\, space space x = 5)")
$f(a) = cases(a + b\, space space x >= 3,a + b\, space space x = 5)$