Skip to content

Commit

Permalink
Correct spacing between closing delimiter and large operators
Browse files Browse the repository at this point in the history
  • Loading branch information
damaxwell committed Aug 3, 2023
1 parent 028d2f5 commit 9e0f45c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions crates/typst-library/src/math/spacing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Expand Down
Binary file modified tests/ref/math/spacing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/typ/math/spacing.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)$ \
Expand Down

0 comments on commit 9e0f45c

Please sign in to comment.