diff options
| author | Malo <57839069+MDLC01@users.noreply.github.com> | 2024-02-20 13:59:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 12:59:29 +0000 |
| commit | 6402bdacc7534ec9d893a84a2c4fd9c753d4a649 (patch) | |
| tree | 7908161081aaab6a4a28f48037eb97f655df42a8 | |
| parent | 196c144d8f108634b41b54d0d0c10317f154d197 (diff) | |
Always attach primes as scripts by default (#3437)
| -rw-r--r-- | crates/typst/src/eval/math.rs | 2 | ||||
| -rw-r--r-- | tests/ref/math/opticalsize.png | bin | 11912 -> 14078 bytes | |||
| -rw-r--r-- | tests/typ/math/opticalsize.typ | 24 |
3 files changed, 23 insertions, 3 deletions
diff --git a/crates/typst/src/eval/math.rs b/crates/typst/src/eval/math.rs index 62314fc2..0e5e0eef 100644 --- a/crates/typst/src/eval/math.rs +++ b/crates/typst/src/eval/math.rs @@ -55,7 +55,7 @@ impl Eval for ast::MathAttach<'_> { if let Some(expr) = self.top() { elem.push_t(Some(expr.eval_display(vm)?)); } else if let Some(primes) = self.primes() { - elem.push_t(Some(primes.eval(vm)?)); + elem.push_tr(Some(primes.eval(vm)?)); } if let Some(expr) = self.bottom() { diff --git a/tests/ref/math/opticalsize.png b/tests/ref/math/opticalsize.png Binary files differindex 4f219710..303f7bee 100644 --- a/tests/ref/math/opticalsize.png +++ b/tests/ref/math/opticalsize.png diff --git a/tests/typ/math/opticalsize.typ b/tests/typ/math/opticalsize.typ index f7d3aa88..83e2ce3d 100644 --- a/tests/typ/math/opticalsize.typ +++ b/tests/typ/math/opticalsize.typ @@ -37,7 +37,7 @@ $a'$, $a'''_b$, $'$, $'''''''$ $a' ' '$, $' ' '$, $a' '/b$ --- -// Test complex prime combilnations +// Test complex prime combinations $a'_b^c$, $a_b'^c$, $a_b^c'$, $a_b'^c'^d'$ $(a'_b')^(c'_d')$, $a'/b'$, $a_b'/c_d'$ @@ -46,4 +46,24 @@ $∫'$, $∑'$, $ ∑'_S' $ --- // Test attaching primes only -$a' = a^', a_', a_'''^''^'$
\ No newline at end of file +$a' = a^', a_', a_'''^''^'$ + +--- +// Test primes always attaching as scripts +$ x' $ +$ x^' $ +$ attach(x, t: ') $ +$ <' $ +$ attach(<, br: ') $ +$ op(<, limits: #true)' $ +$ limits(<)' $ + +--- +// Test forcefully attaching primes as limits +$ attach(<, t: ') $ +$ <^' $ +$ attach(<, b: ') $ +$ <_' $ + +$ limits(x)^' $ +$ attach(limits(x), t: ') $ |
