diff options
| author | Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com> | 2024-01-03 20:04:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-03 12:04:36 +0000 |
| commit | 34e3bd52aa4ca0ba0586736dde299070848c5a42 (patch) | |
| tree | 8e3d6c2e3821af05f9c7aa4690a9708fc52cf343 /tests/typ | |
| parent | 3aeb150c95f9ae55ded7233b86108be18c3028db (diff) | |
Inline equations linebreak at appropriate places (#2938)
Co-authored-by: David Maxwell <damaxwell@alaska.edu>
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests/typ')
| -rw-r--r-- | tests/typ/math/delimited.typ | 1 | ||||
| -rw-r--r-- | tests/typ/math/linebreak.typ | 50 | ||||
| -rw-r--r-- | tests/typ/math/spacing.typ | 2 |
3 files changed, 52 insertions, 1 deletions
diff --git a/tests/typ/math/delimited.typ b/tests/typ/math/delimited.typ index 6607c302..ba623b34 100644 --- a/tests/typ/math/delimited.typ +++ b/tests/typ/math/delimited.typ @@ -2,6 +2,7 @@ --- // Test automatic matching. +#set page(width:122pt) $ (a) + {b/2} + abs(a)/2 + (b) $ $f(x/2) < zeta(c^2 + abs(a + b/2))$ diff --git a/tests/typ/math/linebreak.typ b/tests/typ/math/linebreak.typ new file mode 100644 index 00000000..88ce69d2 --- /dev/null +++ b/tests/typ/math/linebreak.typ @@ -0,0 +1,50 @@ +// Test inline equation line breaking. + +--- +// Basic breaking after binop, rel +#let hrule(x) = box(line(length: x)) +#hrule(45pt)$e^(pi i)+1 = 0$\ +#hrule(55pt)$e^(pi i)+1 = 0$\ +#hrule(70pt)$e^(pi i)+1 = 0$ + +--- +// LR groups prevent linbreaking. +#let hrule(x) = box(line(length: x)) +#hrule(76pt)$a+b$\ +#hrule(74pt)$(a+b)$\ +#hrule(74pt)$paren.l a+b paren.r$ + +--- +// Multiline yet inline does not linebreak +#let hrule(x) = box(line(length: x)) +#hrule(80pt)$a + b \ c + d$\ + +--- +// A single linebreak at the end still counts as one line. +#let hrule(x) = box(line(length: x)) +#hrule(60pt)$e^(pi i)+1 = 0\ $ + +--- +// Inline, in a box, doesn't linebreak. +#let hrule(x) = box(line(length: x)) +#hrule(80pt)#box($a+b$) + +--- +// A relation followed by a relation doesn't linebreak +#let hrule(x) = box(line(length: x)) +#hrule(70pt)$a < = b$\ +#hrule(74pt)$a < = b$ + +--- +// Page breaks can happen after a relation even if there is no +// explicit space. +#let hrule(x) = box(line(length: x)) +#hrule(90pt)$<;$\ +#hrule(95pt)$<;$\ +#hrule(90pt)$<)$\ +#hrule(95pt)$<)$ + +--- +// Verify empty rows are handled ok. +$ $\ +Nothing: $ $, just empty. diff --git a/tests/typ/math/spacing.typ b/tests/typ/math/spacing.typ index e62d2eb3..63a60ae1 100644 --- a/tests/typ/math/spacing.typ +++ b/tests/typ/math/spacing.typ @@ -3,7 +3,7 @@ --- // Test spacing cases. $ä, +, c, (, )$ \ -$=), (+), {times}$ +$=), (+), {times}$ \ $⟧<⟦, abs(-), [=$ \ $a=b, a==b$ \ $-a, +a$ \ |
