mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Wrap into an equation when a Math expr is evaluated (#2081)
This commit is contained in:
parent
71dccde031
commit
d056280165
@ -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.
|
||||
|
BIN
tests/ref/bugs/math-eval.png
Normal file
BIN
tests/ref/bugs/math-eval.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
5
tests/typ/bugs/math-eval.typ
Normal file
5
tests/typ/bugs/math-eval.typ
Normal 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)$
|
Loading…
x
Reference in New Issue
Block a user