summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordamaxwell <damaxwell@alaska.edu>2023-08-05 02:01:53 -0800
committerGitHub <noreply@github.com>2023-08-05 12:01:53 +0200
commitad55755f33d2e5a386717e3af2f7b1a52db6ad87 (patch)
treeb1bd58b7f2f14e87b8a988edd6ef3b4cbab2d74e
parentb8b0137504d388efbe2d1ba5082c0dcabcd8bc8a (diff)
Correct spacing between closing delimiter and large operators (#1857)
-rw-r--r--crates/typst-library/src/math/spacing.rs5
-rw-r--r--tests/ref/math/spacing.pngbin17941 -> 18848 bytes
-rw-r--r--tests/typ/math/spacing.typ2
3 files changed, 4 insertions, 3 deletions
diff --git a/crates/typst-library/src/math/spacing.rs b/crates/typst-library/src/math/spacing.rs
index 848aca78..80bb30a0 100644
--- a/crates/typst-library/src/math/spacing.rs
+++ b/crates/typst-library/src/math/spacing.rs
@@ -47,8 +47,9 @@ pub(super) fn spacing(
(Binary, _) if !script(l) => resolve(MEDIUM, l),
(_, Binary) if !script(r) => resolve(MEDIUM, r),
- // Thin spacing around large operators, unless next to a delimiter.
- (Large, Opening | Fence) | (Closing | Fence, Large) => None,
+ // Thin spacing around large operators, unless to the left of
+ // an opening delimiter. TeXBook, p170
+ (Large, Opening | Fence) => None,
(Large, _) => resolve(THIN, l),
(_, Large) => resolve(THIN, r),
diff --git a/tests/ref/math/spacing.png b/tests/ref/math/spacing.png
index 31768239..0430060b 100644
--- a/tests/ref/math/spacing.png
+++ b/tests/ref/math/spacing.png
Binary files differ
diff --git a/tests/typ/math/spacing.typ b/tests/typ/math/spacing.typ
index 132477f7..87bfb002 100644
--- a/tests/typ/math/spacing.typ
+++ b/tests/typ/math/spacing.typ
@@ -13,7 +13,7 @@ $sum x, sum(x)$ \
$sum product x$ \
$f(x), zeta(x), "frac"(x)$ \
$a+dots.c+b$
-
+$f(x) sin(y)$
---
// Test ignored vs non-ignored spaces.
$f (x), f(x)$ \