diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /tests/typ/math | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'tests/typ/math')
32 files changed, 0 insertions, 1235 deletions
diff --git a/tests/typ/math/accent.typ b/tests/typ/math/accent.typ deleted file mode 100644 index 315e14b3..00000000 --- a/tests/typ/math/accent.typ +++ /dev/null @@ -1,33 +0,0 @@ -// Test math accents. - ---- -// Test function call. -$grave(a), acute(b), hat(f), tilde(§), macron(ä), diaer(a), ä \ - breve(\&), dot(!), circle(a), caron(@), arrow(Z), arrow.l(Z)$ - ---- -$ x &= p \ dot(x) &= v \ dot.double(x) &= a \ dot.triple(x) &= j \ dot.quad(x) &= s $ - ---- -// Test `accent` function. -$accent(ö, .), accent(v, <-), accent(ZZ, \u{0303})$ - ---- -// Test accent bounds. -$sqrt(tilde(T)) + hat(f)/hat(g)$ - ---- -// Test wide base. -$arrow("ABC" + d), tilde(sum)$ - ---- -// Test effect of accent on superscript. -$A^x != hat(A)^x != hat(hat(A))^x$ - ---- -// Test high base. -$ tilde(integral), tilde(integral)_a^b, tilde(integral_a^b) $ - ---- -// Test accent size. -$tilde(sum), tilde(sum, size: #50%), accent(H, hat, size: #200%)$ diff --git a/tests/typ/math/alignment.typ b/tests/typ/math/alignment.typ deleted file mode 100644 index 177e0188..00000000 --- a/tests/typ/math/alignment.typ +++ /dev/null @@ -1,34 +0,0 @@ -// Test implicit alignment math. - ---- -// Test alignment step functions. -#set page(width: 225pt) -$ -"a" &= c \ -&= c + 1 & "By definition" \ -&= d + 100 + 1000 \ -&= x && "Even longer" \ -$ - ---- -// Test post-fix alignment. -$ -& "right" \ -"a very long line" \ -"left" \ -$ - ---- -// Test no alignment. -$ -"right" \ -"a very long line" \ -"left" \ -$ - ---- -// Test #460 equations. -$ -a &=b & quad c&=d \ -e &=f & g&=h -$ diff --git a/tests/typ/math/attach-p1.typ b/tests/typ/math/attach-p1.typ deleted file mode 100644 index 5564ec60..00000000 --- a/tests/typ/math/attach-p1.typ +++ /dev/null @@ -1,63 +0,0 @@ -// Test t and b attachments, part 1. - ---- -// Test basics, postscripts. -$f_x + t^b + V_1^2 + attach(A, t: alpha, b: beta)$ - ---- -// Test basics, prescripts. Notably, the upper and lower prescripts' content need to be -// aligned on the right edge of their bounding boxes, not on the left as in postscripts. -$ -attach(upright(O), bl: 8, tl: 16, br: 2, tr: 2-), -attach("Pb", bl: 82, tl: 207) + attach(upright(e), bl: -1, tl: 0) + macron(v)_e \ -$ - ---- -// A mixture of attachment positioning schemes. -$ -attach(a, tl: u), attach(a, tr: v), attach(a, bl: x), -attach(a, br: y), limits(a)^t, limits(a)_b \ - -attach(a, tr: v, t: t), -attach(a, tr: v, br: y), -attach(a, br: y, b: b), -attach(limits(a), b: b, bl: x), -attach(a, tl: u, bl: x), -attach(limits(a), t: t, tl: u) \ - -attach(a, tl: u, tr: v), -attach(limits(a), t: t, br: y), -attach(limits(a), b: b, tr: v), -attach(a, bl: x, br: y), -attach(limits(a), b: b, tl: u), -attach(limits(a), t: t, bl: u), -limits(a)^t_b \ - -attach(a, tl: u, tr: v, bl: x, br: y), -attach(limits(a), t: t, bl: x, br: y, b: b), -attach(limits(a), t: t, tl: u, tr: v, b: b), -attach(limits(a), tl: u, bl: x, t: t, b: b), -attach(limits(a), t: t, b: b, tr: v, br: y), -attach(a, tl: u, t: t, tr: v, bl: x, b: b, br: y) -$ - ---- -// Test function call after subscript. -$pi_1(Y), a_f(x), a^zeta (x), a^abs(b)_sqrt(c) \ - a^subset.eq (x), a_(zeta(x)), pi_(1(Y)), a^(abs(b))_(sqrt(c))$ - ---- -// Test associativity and scaling. -$ 1/(V^2^3^4^5), - frac( - attach( - limits(V), br: attach(2, br: 3), b: attach(limits(2), b: 3)), - attach( - limits(V), tl: attach(2, tl: 3), t: attach(limits(2), t: 3))), - attach(Omega, - tl: attach(2, tl: attach(3, tl: attach(4, tl: 5))), - tr: attach(2, tr: attach(3, tr: attach(4, tr: 5))), - bl: attach(2, bl: attach(3, bl: attach(4, bl: 5))), - br: attach(2, br: attach(3, br: attach(4, br: 5))), - ) -$ diff --git a/tests/typ/math/attach-p2.typ b/tests/typ/math/attach-p2.typ deleted file mode 100644 index 8f97f74f..00000000 --- a/tests/typ/math/attach-p2.typ +++ /dev/null @@ -1,27 +0,0 @@ -// Test t and b attachments, part 2. - ---- -// Test high subscript and superscript. -$ sqrt(a_(1/2)^zeta), sqrt(a_alpha^(1/2)), sqrt(a_(1/2)^(3/4)) \ - sqrt(attach(a, tl: 1/2, bl: 3/4)), - sqrt(attach(a, tl: 1/2, bl: 3/4, tr: 1/2, br: 3/4)) $ - ---- -// Test for no collisions between descenders/ascenders and attachments - -$ sup_(x in P_i) quad inf_(x in P_i) $ -$ op("fff",limits: #true)^(y) quad op("yyy", limits:#true)_(f) $ - ---- -// Test frame base. -$ (-1)^n + (1/2 + 3)^(-1/2) $ - ---- -#set text(size: 8pt) - -// Test that the attachments are aligned horizontally. -$ x_1 p_1 frak(p)_1 2_1 dot_1 lg_1 !_1 \\_1 ]_1 "ip"_1 op("iq")_1 \ - x^1 b^1 frak(b)^1 2^1 dot^1 lg^1 !^1 \\^1 ]^1 "ib"^1 op("id")^1 \ - x_1 y_1 "_"_1 x^1 l^1 "`"^1 attach(I,tl:1,bl:1,tr:1,br:1) - scripts(sum)_1^1 integral_1^1 abs(1/2)_1^1 \ - x^1_1, "("b y")"^1_1 != (b y)^1_1, "[∫]"_1 [integral]_1 $ diff --git a/tests/typ/math/attach-p3.typ b/tests/typ/math/attach-p3.typ deleted file mode 100644 index 3591c248..00000000 --- a/tests/typ/math/attach-p3.typ +++ /dev/null @@ -1,42 +0,0 @@ -// Test t and b attachments, part 3. - ---- -// Test limit. -$ lim_(n->oo \ n "grows") sum_(k=0 \ k in NN)^n k $ - ---- -// Test forcing scripts and limits. -$ limits(A)_1^2 != A_1^2 $ -$ scripts(sum)_1^2 != sum_1^2 $ -$ limits(integral)_a^b != integral_a^b $ - ---- -// Error: 25-29 unknown variable: oops -$ attach(A, t: #context oops) $ - ---- -// Show and let rules for limits and scripts -#let eq = $ ∫_a^b iota_a^b $ -#eq -#show "∫": math.limits -#show math.iota: math.limits.with(inline: false) -#eq -$iota_a^b$ - ---- -// Test default of limit attachments on relations at all sizes -#set page(width: auto) -$ a =^"def" b quad a lt.eq_"really" b quad a arrow.r.long.squiggly^"slowly" b $ -$a =^"def" b quad a lt.eq_"really" b quad a arrow.r.long.squiggly^"slowly" b$ - -$a scripts(=)^"def" b quad a scripts(lt.eq)_"really" b quad a scripts(arrow.r.long.squiggly)^"slowly" b$ - ---- -// Test default of scripts attachments on integrals at display size -$ integral.sect_a^b quad \u{2a1b}_a^b quad limits(\u{2a1b})_a^b $ -$integral.sect_a^b quad \u{2a1b}_a^b quad limits(\u{2a1b})_a^b$ - ---- -// Test default of limit attachments on large operators at display size only -$ tack.t.big_0^1 quad \u{02A0A}_0^1 quad join_0^1 $ -$tack.t.big_0^1 quad \u{02A0A}_0^1 quad join_0^1$ diff --git a/tests/typ/math/call.typ b/tests/typ/math/call.typ deleted file mode 100644 index 0fce1627..00000000 --- a/tests/typ/math/call.typ +++ /dev/null @@ -1,7 +0,0 @@ -// Test function calls that aren't typst functions - ---- -$ pi(a) $ -$ pi(a,) $ -$ pi(a,b) $ -$ pi(a,b,) $ diff --git a/tests/typ/math/cancel.typ b/tests/typ/math/cancel.typ deleted file mode 100644 index ac715154..00000000 --- a/tests/typ/math/cancel.typ +++ /dev/null @@ -1,38 +0,0 @@ -// Tests the cancel() function. - ---- -// Inline -$a + 5 + cancel(x) + b - cancel(x)$ - -$c + (a dot.c cancel(b dot.c c))/(cancel(b dot.c c))$ - ---- -// Display -#set page(width: auto) -$ a + b + cancel(b + c) - cancel(b) - cancel(c) - 5 + cancel(6) - cancel(6) $ -$ e + (a dot.c cancel((b + c + d)))/(cancel(b + c + d)) $ - ---- -// Inverted -$a + cancel(x, inverted: #true) - cancel(x, inverted: #true) + 10 + cancel(y) - cancel(y)$ -$ x + cancel("abcdefg", inverted: #true) $ - ---- -// Cross -$a + cancel(b + c + d, cross: #true, stroke: #red) + e$ -$ a + cancel(b + c + d, cross: #true) + e $ - ---- -// Resized and styled -#set page(width: 200pt, height: auto) -$a + cancel(x, length: #200%) - cancel(x, length: #50%, stroke: #(red + 1.1pt))$ -$ b + cancel(x, length: #150%) - cancel(a + b + c, length: #50%, stroke: #(blue + 1.2pt)) $ - ---- -// Specifying cancel line angle with an absolute angle -$cancel(x, angle: #0deg) + cancel(x, angle: #45deg) + cancel(x, angle: #90deg) + cancel(x, angle: #135deg)$ - ---- -// Specifying cancel line angle with a function -$x + cancel(y, angle: #{angle => angle + 90deg}) - cancel(z, angle: #(angle => angle + 135deg))$ -$ e + cancel((j + e)/(f + e)) - cancel((j + e)/(f + e), angle: #(angle => angle + 30deg)) $ diff --git a/tests/typ/math/cases.typ b/tests/typ/math/cases.typ deleted file mode 100644 index d591ae50..00000000 --- a/tests/typ/math/cases.typ +++ /dev/null @@ -1,9 +0,0 @@ -// Test case distinction. - ---- -$ f(x, y) := cases( - 1 quad &"if" (x dot y)/2 <= 0, - 2 &"if" x divides 2, - 3 &"if" x in NN, - 4 &"else", -) $ diff --git a/tests/typ/math/class.typ b/tests/typ/math/class.typ deleted file mode 100644 index a5901b31..00000000 --- a/tests/typ/math/class.typ +++ /dev/null @@ -1,47 +0,0 @@ -// Test math classes. - ---- -// Test characters. -$ a class("normal", +) b \ - a class("binary", .) b \ - lr(class("opening", \/) a/b class("closing", \\)) \ - { x class("fence", \;) x > 0} \ - a class("large", \/) b \ - a class("punctuation", :) b \ - a class("relation", ~) b \ - a + class("unary", times) b \ - class("vary", :) a class("vary", :) b $ - ---- -// Test custom content. -#let dotsq = square( - size: 0.7em, - stroke: 0.5pt, - align(center+horizon, circle(radius: 0.15em, fill: black)) -) - -$ a dotsq b \ - a class("normal", dotsq) b \ - a class("vary", dotsq) b \ - a + class("vary", dotsq) b \ - a class("punctuation", dotsq) b $ - ---- -// Test nested. -#let normal = math.class.with("normal") -#let pluseq = $class("binary", normal(+) normal(=))$ -$ a pluseq 5 $ - ---- -// Test exceptions. -$ sqrt(3)\/2 quad d_0.d_1d_2 dots $ - ---- -// Test if the math class changes the limit configuration. -$ class("normal", ->)_a $ -$class("relation", x)_a$ -$ class("large", x)_a $ -$class("large", ->)_a$ - -$limits(class("normal", ->))_a$ -$ scripts(class("relation", x))_a $ diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ deleted file mode 100644 index 739377ae..00000000 --- a/tests/typ/math/content.typ +++ /dev/null @@ -1,33 +0,0 @@ -// Test arbitrary content in math. - ---- -// Test images and font fallback. -#let monkey = move(dy: 0.2em, image("/assets/images/monkey.svg", height: 1em)) -$ sum_(i=#emoji.apple)^#emoji.apple.red i + monkey/2 $ - ---- -// Test tables. -$ x := #table(columns: 2)[x][y]/mat(1, 2, 3) - = #table[A][B][C] $ ---- -// Test non-equation math directly in content. -#math.attach($a$, t: [b]) - ---- -// Test font switch. -#let here = text.with(font: "Noto Sans") -$#here[f] := #here[Hi there]$. - ---- -// Test boxes without a baseline act as if the baseline is at the base -#{ - box(stroke: 0.2pt, $a #box(stroke: 0.2pt, $a$)$) - h(12pt) - box(stroke: 0.2pt, $a #box(stroke: 0.2pt, $g$)$) - h(12pt) - box(stroke: 0.2pt, $g #box(stroke: 0.2pt, $g$)$) -} - ---- -// Test boxes with a baseline are respected -#box(stroke: 0.2pt, $a #box(baseline:0.5em, stroke: 0.2pt, $a$)$) diff --git a/tests/typ/math/delimited.typ b/tests/typ/math/delimited.typ deleted file mode 100644 index 8500aec2..00000000 --- a/tests/typ/math/delimited.typ +++ /dev/null @@ -1,59 +0,0 @@ -// Test delimiter matching and scaling. - ---- -// Test automatic matching. -#set page(width:122pt) -$ (a) + {b/2} + abs(a)/2 + (b) $ -$f(x/2) < zeta(c^2 + abs(a + b/2))$ - ---- -// Test unmatched. -$[1,2[ = [1,2) != zeta\(x/2\) $ - ---- -// Test manual matching. -$ [|a/b|] != lr(|]a/b|]) != [a/b) $ -$ lr(| ]1,2\[ + 1/2|) $ - ---- -// Test fence confusion. -$ |x + |y| + z/a| \ - lr(|x + |y| + z/a|) $ - ---- -// Test that symbols aren't matched automatically. -$ bracket.l a/b bracket.r - = lr(bracket.l a/b bracket.r) $ - ---- -// Test half LRs. -$ lr(a/b\]) = a = lr(\{a/b) $ - ---- -// Test manual scaling. -$ lr(]sum_(x=1)^n x], size: #70%) - < lr((1, 2), size: #200%) $ - ---- -// Test predefined delimiter pairings. -$floor(x/2), ceil(x/2), abs(x), norm(x)$ - ---- -// Test colored delimiters -$ lr( - text("(", fill: #green) a/b - text(")", fill: #blue) - ) $ - ---- -// Test middle functions -$ { x mid(|) sum_(i=1)^oo phi_i (x) < 1 } \ - { integral |x| dif x - mid(bar.v.double) - floor(hat(A) mid(|) { x mid(|) y } mid(|) A) } $ - ---- -// Test ignoring weak spacing immediately after the opening -// and immediately before the closing. - -$ [#h(1em, weak: true)A(dif x, f(x) dif x)sum#h(1em, weak: true)] $ diff --git a/tests/typ/math/equation-block-align.typ b/tests/typ/math/equation-block-align.typ deleted file mode 100644 index c6c9cd89..00000000 --- a/tests/typ/math/equation-block-align.typ +++ /dev/null @@ -1,33 +0,0 @@ -// Test alignment of block equations. - ---- -// Test unnumbered -#let eq(alignment) = { - show math.equation: set align(alignment) - $ a + b = c $ -} - -#eq(center) -#eq(left) -#eq(right) - -#set text(dir: rtl) -#eq(start) -#eq(end) - ---- -// Test numbered -#let eq(alignment) = { - show math.equation: set align(alignment) - $ a + b = c $ -} - -#set math.equation(numbering: "(1)") - -#eq(center) -#eq(left) -#eq(right) - -#set text(dir: rtl) -#eq(start) -#eq(end) diff --git a/tests/typ/math/equation-number.typ b/tests/typ/math/equation-number.typ deleted file mode 100644 index 3de611b3..00000000 --- a/tests/typ/math/equation-number.typ +++ /dev/null @@ -1,145 +0,0 @@ -// Test equation number, and its interaction with equation -// block's alignment and text direction. - ---- -#set math.equation(numbering: "(1)") - -$ a + b = c $ - -#show math.equation: set align(center) -$ a + b = c $ -#show math.equation: set align(left) -$ a + b = c $ -#show math.equation: set align(right) -$ a + b = c $ - -#set text(dir: rtl) -#show math.equation: set align(start) -$ a + b = c $ -#show math.equation: set align(end) -$ a + b = c $ - ---- -#set math.equation(numbering: "(1)", number-align: start) - -$ a + b = c $ - -#show math.equation: set align(center) -$ a + b = c $ -#show math.equation: set align(left) -$ a + b = c $ -#show math.equation: set align(right) -$ a + b = c $ - -#set text(dir: rtl) -#show math.equation: set align(start) -$ a + b = c $ -#show math.equation: set align(end) -$ a + b = c $ - ---- -#set math.equation(numbering: "(1)", number-align: end) - -$ a + b = c $ - -#show math.equation: set align(center) -$ a + b = c $ -#show math.equation: set align(left) -$ a + b = c $ -#show math.equation: set align(right) -$ a + b = c $ - -#set text(dir: rtl) -#show math.equation: set align(start) -$ a + b = c $ -#show math.equation: set align(end) -$ a + b = c $ - ---- -#set math.equation(numbering: "(1)", number-align: left) - -$ a + b = c $ - -#show math.equation: set align(center) -$ a + b = c $ -#show math.equation: set align(left) -$ a + b = c $ -#show math.equation: set align(right) -$ a + b = c $ - -#set text(dir: rtl) -#show math.equation: set align(start) -$ a + b = c $ -#show math.equation: set align(end) -$ a + b = c $ - ---- -#set math.equation(numbering: "(1)", number-align: right) - -$ a + b = c $ - -#show math.equation: set align(center) -$ a + b = c $ -#show math.equation: set align(left) -$ a + b = c $ -#show math.equation: set align(right) -$ a + b = c $ - -#set text(dir: rtl) -#show math.equation: set align(start) -$ a + b = c $ -#show math.equation: set align(end) -$ a + b = c $ - ---- -// Error: 52-58 expected `start`, `left`, `right`, or `end`, found center -#set math.equation(numbering: "(1)", number-align: center) - ---- -// Error: 52-67 expected `start`, `left`, `right`, or `end`, found center -#set math.equation(numbering: "(1)", number-align: center + bottom) - ---- -#set math.equation(numbering: "(1)") - -$ p &= ln a b \ - &= ln a + ln b $ - ---- -#set math.equation(numbering: "(1)", number-align: top+start) - -$ p &= ln a b \ - &= ln a + ln b $ - ---- -#show math.equation: set align(left) -#set math.equation(numbering: "(1)", number-align: bottom) - -$ q &= ln sqrt(a b) \ - &= 1/2 (ln a + ln b) $ - ---- -// Tests that if the numbering's layout box vertically exceeds the box of -// the equation frame's boundary, the latter's frame is resized correctly -// to encompass the numbering. #box() below delineates the resized frame. -// -// A row with "-" only has a height that's smaller than the height of the -// numbering's layout box. Note we use pattern "1" here, not "(1)", since -// the parenthesis exceeds the numbering's layout box, due to the default -// settings of top-edge and bottom-edge of the TextElem that laid it out. -#set math.equation(numbering: "1", number-align: top) -#box( -$ - &- - \ - a &= b $, -fill: silver) - -#set math.equation(numbering: "1", number-align: horizon) -#box( -$ - - - $, -fill: silver) - -#set math.equation(numbering: "1", number-align: bottom) -#box( -$ a &= b \ - - &- - $, -fill: silver) diff --git a/tests/typ/math/equation-show.typ b/tests/typ/math/equation-show.typ deleted file mode 100644 index 9334c54e..00000000 --- a/tests/typ/math/equation-show.typ +++ /dev/null @@ -1,7 +0,0 @@ -// Test show rules on equations. - ---- -This is small: $sum_(i=0)^n$ - -#show math.equation: math.display -This is big: $sum_(i=0)^n$ diff --git a/tests/typ/math/font-features.typ b/tests/typ/math/font-features.typ deleted file mode 100644 index ffdd1924..00000000 --- a/tests/typ/math/font-features.typ +++ /dev/null @@ -1,10 +0,0 @@ -// Test that setting font features in math.equation has an effect. - ---- -$ nothing $ -$ "hi ∅ hey" $ -$ sum_(i in NN) 1 + i $ -#show math.equation: set text(features: ("cv01",), fallback: false) -$ nothing $ -$ "hi ∅ hey" $ -$ sum_(i in NN) 1 + i $ diff --git a/tests/typ/math/frac.typ b/tests/typ/math/frac.typ deleted file mode 100644 index fc7dd14b..00000000 --- a/tests/typ/math/frac.typ +++ /dev/null @@ -1,43 +0,0 @@ -// Test fractions. - ---- -// Test that denominator baseline matches in the common case. -$ x = 1/2 = a/(a h) = a/a = a/(1/2) $ - ---- -// Test parenthesis removal. -$ (|x| + |y|)/2 < [1+2]/3 $ - ---- -// Test large fraction. -$ x = (-b plus.minus sqrt(b^2 - 4a c))/(2a) $ - ---- -// Test binomial. -$ binom(circle, square) $ - ---- -// Test multinomial coefficients. -$ binom(n, k_1, k_2, k_3) $ - ---- -// Error: 3-13 missing argument: lower -$ binom(x^2) $ - ---- -// Test dif. -$ (dif y)/(dif x), dif/x, x/dif, dif/dif \ - frac(dif y, dif x), frac(dif, x), frac(x, dif), frac(dif, dif) $ - ---- -// Test associativity. -$ 1/2/3 = (1/2)/3 = 1/(2/3) $ - ---- -// Test precedence. -$ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \ - 1.2/3.7, 2.3^3.4 \ - 🏳️🌈[x]/2, f [x]/2, phi [x]/2, 🏳️🌈 [x]/2 \ - +[x]/2, 1(x)/2, 2[x]/2 \ - (a)b/2, b(a)[b]/2 \ - n!/2, 5!/2, n !/2, 1/n!, 1/5! $ diff --git a/tests/typ/math/linebreak.typ b/tests/typ/math/linebreak.typ deleted file mode 100644 index 88ce69d2..00000000 --- a/tests/typ/math/linebreak.typ +++ /dev/null @@ -1,50 +0,0 @@ -// 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/matrix-alignment.typ b/tests/typ/math/matrix-alignment.typ deleted file mode 100644 index 0b3aa456..00000000 --- a/tests/typ/math/matrix-alignment.typ +++ /dev/null @@ -1,58 +0,0 @@ -// Test matrix alignment math. - ---- -// Test alternating alignment in a vector. -$ vec( - "a" & "a a a" & "a a", - "a a" & "a a" & "a", - "a a a" & "a" & "a a a", -) $ - ---- -// Test alternating explicit alignment in a matrix. -$ mat( - "a" & "a a a" & "a a"; - "a a" & "a a" & "a"; - "a a a" & "a" & "a a a"; -) $ - ---- -// Test alignment in a matrix. -$ mat( - "a", "a a a", "a a"; - "a a", "a a", "a"; - "a a a", "a", "a a a"; -) $ - ---- -// Test explicit left alignment in a matrix. -$ mat( - &"a", &"a a a", &"a a"; - &"a a", &"a a", &"a"; - &"a a a", &"a", &"a a a"; -) $ - ---- -// Test explicit right alignment in a matrix. -$ mat( - "a"&, "a a a"&, "a a"&; - "a a"&, "a a"&, "a"&; - "a a a"&, "a"&, "a a a"&; -) $ - ---- -// Test #460 equations. -#let stop = { - math.class("punctuation",$.$) -} -$ mat(&a+b,c;&d, e) $ -$ mat(&a+b&,c;&d&, e) $ -$ mat(&&&a+b,c;&&&d, e) $ -$ mat(stop &a+b&stop,c;...stop stop&d&...stop stop, e) $ - ---- -// Test #454 equations. -$ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1) $ -$ mat(-1&, 1&, 1&; 1&, -1&, 1&; 1&, 1&, -1&) $ -$ mat(-1&, 1&, 1&; 1, -1, 1; 1, 1, -1) $ -$ mat(&-1, &1, &1; 1, -1, 1; 1, 1, -1) $ diff --git a/tests/typ/math/matrix-gaps.typ b/tests/typ/math/matrix-gaps.typ deleted file mode 100644 index ef33b518..00000000 --- a/tests/typ/math/matrix-gaps.typ +++ /dev/null @@ -1,17 +0,0 @@ -// Test matrices, cases and vec gaps - ---- -#set math.mat(row-gap: 1em, column-gap: 2em) -$ mat(1, 2; 3, 4) $ - ---- -#set math.mat(gap: 1em) -$ mat(1, 2; 3, 4) $ - ---- -#set math.cases(gap: 1em) -$ x = cases(1, 2) $ - ---- -#set math.vec(gap: 1em) -$ vec(1, 2) $ diff --git a/tests/typ/math/matrix.typ b/tests/typ/math/matrix.typ deleted file mode 100644 index 57ecd85f..00000000 --- a/tests/typ/math/matrix.typ +++ /dev/null @@ -1,97 +0,0 @@ -// Test matrices. - ---- -// Test semicolon syntax. -#set align(center) -$mat() dot - mat(;) dot - mat(1, 2) dot - mat(1, 2;) \ - mat(1; 2) dot - mat(1, 2; 3, 4) dot - mat(1 + &2, 1/2; &3, 4)$ - ---- -// Test sparse matrix. -$ mat( - 1, 2, ..., 10; - 2, 2, ..., 10; - dots.v, dots.v, dots.down, dots.v; - 10, 10, ..., 10; -) $ - ---- -// Test baseline alignment. -$ mat( - a, b^2; - sum_(x \ y) x, a^(1/2); - zeta, alpha; -) $ - ---- -// Test alternative delimiter with set rule. -#set math.mat(delim: "[") -$ mat(1, 2; 3, 4) $ -$ a + mat(delim: #none, 1, 2; 3, 4) + b $ - ---- -// Test alternative math delimiter directly in call. -#set align(center) -#grid( - columns: 3, - gutter: 10pt, - - $ mat(1, 2, delim: "[") $, - $ mat(1, 2; delim: "[") $, - $ mat(delim: "[", 1, 2) $, - - $ mat(1; 2; delim: "[") $, - $ mat(1; delim: "[", 2) $, - $ mat(delim: "[", 1; 2) $, - - $ mat(1, 2; delim: "[", 3, 4) $, - $ mat(delim: "[", 1, 2; 3, 4) $, - $ mat(1, 2; 3, 4; delim: "[") $, -) - ---- -// Error: 13-14 expected array, found content -$ mat(1, 2; 3, 4, delim: "[") $, - ---- -$ mat(B, A B) $ -$ mat(B, A B, dots) $ -$ mat(B, A B, dots;) $ -$ mat(#1, #(foo: "bar")) $ - ---- - -// Test matrix line drawing (augmentation). -#grid( - columns: 2, - gutter: 10pt, - - $ mat(10, 2, 3, 4; 5, 6, 7, 8; augment: #3) $, - $ mat(10, 2, 3, 4; 5, 6, 7, 8; augment: #(-1)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: 2)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: -1)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: 1, vline: 1)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: -2, vline: -2)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(vline: 2, stroke: 1pt + blue)) $, - $ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(vline: -1, stroke: 1pt + blue)) $, -) - ---- - -// Test using matrix line drawing with a set rule. -#set math.mat(augment: (hline: 2, vline: 1, stroke: 2pt + green)) -$ mat(1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 1) $ - -#set math.mat(augment: 2) -$ mat(1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 1) $ - -#set math.mat(augment: none) - ---- -// Error: 3-37 cannot draw a vertical line after column 3 of a matrix with 3 columns -$ mat(1, 0, 0; 0, 1, 1; augment: #3) $, diff --git a/tests/typ/math/multiline.typ b/tests/typ/math/multiline.typ deleted file mode 100644 index b1f43800..00000000 --- a/tests/typ/math/multiline.typ +++ /dev/null @@ -1,56 +0,0 @@ -// Test multiline math. - ---- -// Test basic alignment. -$ x &= x + y \ - &= x + 2z \ - &= sum x dot 2z $ - ---- -// Test text before first alignment point. -$ x + 1 &= a^2 + b^2 \ - y &= a + b^2 \ - z &= alpha dot beta $ - ---- -// Test space between inner alignment points. -$ a + b &= 2 + 3 &= 5 \ - b &= c &= 3 $ - ---- -// Test in case distinction. -$ f := cases( - 1 + 2 &"iff" &x, - 3 &"if" &y, -) $ - ---- -// Test mixing lines with and some without alignment points. -$ "abc" &= c \ - &= d + 1 \ - = x $ - ---- -// Test multiline subscript. -$ sum_(n in NN \ n <= 5) n = (5(5+1))/2 = 15 $ - ---- -// Test no trailing line break. -$ -"abc" &= c -$ -No trailing line break. - ---- -// Test single trailing line break. -$ -"abc" &= c \ -$ -One trailing line break. - ---- -// Test multiple trailing line breaks. -$ -"abc" &= c \ \ \ -$ -Multiple trailing line breaks. diff --git a/tests/typ/math/numbering.typ b/tests/typ/math/numbering.typ deleted file mode 100644 index fd303ff2..00000000 --- a/tests/typ/math/numbering.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test equation numbering. - ---- -#set page(width: 150pt) -#set math.equation(numbering: "(I)") - -We define $x$ in preparation of @fib: -$ phi.alt := (1 + sqrt(5)) / 2 $ <ratio> - -With @ratio, we get -$ F_n = round(1 / sqrt(5) phi.alt^n) $ <fib> diff --git a/tests/typ/math/op.typ b/tests/typ/math/op.typ deleted file mode 100644 index 14e1c6e6..00000000 --- a/tests/typ/math/op.typ +++ /dev/null @@ -1,30 +0,0 @@ -// Test text operators. - ---- -// Test predefined. -$ max_(1<=n<=m) n $ - ---- -// With or without parens. -$ &sin x + log_2 x \ - = &sin(x) + log_2(x) $ - ---- -// Test scripts vs limits. -#set page(width: auto) -#set text(font: "New Computer Modern") -Discuss $lim_(n->oo) 1/n$ now. -$ lim_(n->infinity) 1/n = 0 $ - ---- -// Test custom operator. -$ op("myop", limits: #false)_(x:=1) x \ - op("myop", limits: #true)_(x:=1) x $ - ---- -// Test styled operator. -$ bold(op("bold", limits: #true))_x y $ - ---- -// With non-text content -$ op(#underline[ul]) a $ diff --git a/tests/typ/math/opticalsize.typ b/tests/typ/math/opticalsize.typ deleted file mode 100644 index 83e2ce3d..00000000 --- a/tests/typ/math/opticalsize.typ +++ /dev/null @@ -1,69 +0,0 @@ -// test optical sized variants in sub/superscripts - ---- - -// Test transition from script to scriptscript. -#[ -#set text(size:20pt) -$ e^(e^(e^(e))) $ -] -A large number: $e^(e^(e^(e)))$. - ---- -// Test prime/double prime via scriptsize -#let prime = [ \u{2032} ] -#let dprime = [ \u{2033} ] -#let tprime = [ \u{2034} ] -$ y^dprime-2y^prime + y = 0 $ -$y^dprime-2y^prime + y = 0$ -$ y^tprime_3 + g^(prime 2) $ - ---- -// Test prime superscript on large symbol -$ scripts(sum_(k in NN))^prime 1/k^2 $ -$sum_(k in NN)^prime 1/k^2$ - ---- -// Test script-script in a fraction. -$ 1/(x^A) $ -#[#set text(size:18pt); $1/(x^A)$] vs. #[#set text(size:14pt); $x^A$] - ---- -// Test dedicated syntax for primes -$a'$, $a'''_b$, $'$, $'''''''$ - ---- -// Test spaces between -$a' ' '$, $' ' '$, $a' '/b$ - ---- -// 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'$ - -$∫'$, $∑'$, $ ∑'_S' $ - ---- -// Test attaching primes only -$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: ') $ diff --git a/tests/typ/math/prime.typ b/tests/typ/math/prime.typ deleted file mode 100644 index 61e0c0b2..00000000 --- a/tests/typ/math/prime.typ +++ /dev/null @@ -1,9 +0,0 @@ -// Test prime symbols after code mode. -#let g = $f$ -#let gg = $f$ - -$ - #(g)' #g' #g ' \ - #g''''''''''''''''' \ - gg' -$ diff --git a/tests/typ/math/root.typ b/tests/typ/math/root.typ deleted file mode 100644 index 6eba1275..00000000 --- a/tests/typ/math/root.typ +++ /dev/null @@ -1,45 +0,0 @@ -// Test roots. - ---- -// Test root with more than one character. -$A = sqrt(x + y) = c$ - ---- -// Test root size with radicals containing attachments. -$ sqrt(a) quad - sqrt(f) quad - sqrt(q) quad - sqrt(a^2) \ - sqrt(n_0) quad - sqrt(b^()) quad - sqrt(b^2) quad - sqrt(q_1^2) $ - ---- -// Test precomposed vs constructed roots. -// 3 and 4 are precomposed. -$sqrt(x)$ -$root(2, x)$ -$root(3, x)$ -$root(4, x)$ -$root(5, x)$ - ---- -// Test large bodies -$ sqrt([|x|]^2 + [|y|]^2) < [|z|] $ -$ v = sqrt((1/2) / (4/5)) - = root(3, (1/2/3) / (4/5/6)) - = root(4, ((1/2) / (3/4)) / ((1/2) / (3/4))) $ - ---- -// Test large index. -$ root(2, x) quad - root(3/(2/1), x) quad - root(1/11, x) quad - root(1/2/3, 1) $ - ---- -// Test shorthand. -$ √2^3 = sqrt(2^3) $ -$ √(x+y) quad ∛x quad ∜x $ -$ (√2+3) = (sqrt(2)+3) $ diff --git a/tests/typ/math/spacing.typ b/tests/typ/math/spacing.typ deleted file mode 100644 index 63a60ae1..00000000 --- a/tests/typ/math/spacing.typ +++ /dev/null @@ -1,48 +0,0 @@ -// Test spacing in math formulas. - ---- -// Test spacing cases. -$ä, +, c, (, )$ \ -$=), (+), {times}$ \ -$⟧<⟦, abs(-), [=$ \ -$a=b, a==b$ \ -$-a, +a$ \ -$a not b$ \ -$a+b, a*b$ \ -$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)$ \ -$[a|b], [a | b]$ \ -$a"is"b, a "is" b$ - ---- -// Test predefined spacings. -$a thin b, a med b, a thick b, a quad b$ \ -$a = thin b$ \ -$a - b equiv c quad (mod 2)$ - ---- -// Test spacing for set comprehension. -#set page(width: auto) -$ { x in RR | x "is natural" and x < 10 } $ - ---- -// Test spacing for operators with decorations and modifiers on them -#set page(width: auto) -$a equiv b + c - d => e log 5 op("ln") 6$ \ -$a cancel(equiv) b overline(+) c arrow(-) d hat(=>) e cancel(log) 5 dot(op("ln")) 6$ \ -$a overbrace(equiv) b underline(+) c grave(-) d underbracket(=>) e circle(log) 5 caron(op("ln")) 6$ \ -\ -$a attach(equiv, tl: a, tr: b) b attach(limits(+), t: a, b: b) c tilde(-) d breve(=>) e attach(limits(log), t: a, b: b) 5 attach(op("ln"), tr: a, bl: b) 6$ ---- -// Test weak spacing -$integral f(x) dif x$, -// Not weak -$integral f(x) thin dif x$, -// Both are weak, collide -$integral f(x) #h(0.166em, weak: true)dif x$ diff --git a/tests/typ/math/style.typ b/tests/typ/math/style.typ deleted file mode 100644 index f1a38405..00000000 --- a/tests/typ/math/style.typ +++ /dev/null @@ -1,52 +0,0 @@ -// Test text styling in math. - ---- -// Test italic defaults. -$a, A, delta, ϵ, diff, Delta, ϴ$ - ---- -// Test forcing a specific style. -$A, italic(A), upright(A), bold(A), bold(upright(A)), \ - serif(A), sans(A), cal(A), frak(A), mono(A), bb(A), \ - italic(diff), upright(diff), \ - bb("hello") + bold(cal("world")), \ - mono("SQRT")(x) wreath mono(123 + 456)$ - ---- -// Test forcing math size -$a/b, display(a/b), display(a)/display(b), inline(a/b), script(a/b), sscript(a/b) \ - mono(script(a/b)), script(mono(a/b))\ - script(a^b, cramped: #true), script(a^b, cramped: #false)$ - ---- -// Test a few style exceptions. -$h, bb(N), cal(R), Theta, italic(Theta), sans(Theta), sans(italic(Theta)) \ - bb(d), bb(italic(d)), italic(bb(d)), bb(e), bb(italic(e)), italic(bb(e)) \ - bb(i), bb(italic(i)), italic(bb(i)), bb(j), bb(italic(j)), italic(bb(j)) \ - bb(D), bb(italic(D)), italic(bb(D))$ - ---- -// Test a few greek exceptions. -$bb(Gamma) , bb(gamma), bb(Pi), bb(pi), bb(sum)$ - ---- -// Test hebrew exceptions. -$aleph, beth, gimel, daleth$ - ---- -// Test font fallback. -$ よ and 🏳️🌈 $ - ---- -// Test text properties. -$text(#red, "time"^2) + sqrt("place")$ - ---- -// Test different font. -#show math.equation: set text(font: "Fira Math") -$ v := vec(1 + 2, 2 - 4, sqrt(3), arrow(x)) + 1 $ - ---- -// Test using rules for symbols -#show sym.tack: it => $#h(1em) it #h(1em)$ -$ a tack b $ diff --git a/tests/typ/math/syntax.typ b/tests/typ/math/syntax.typ deleted file mode 100644 index 503d3031..00000000 --- a/tests/typ/math/syntax.typ +++ /dev/null @@ -1,22 +0,0 @@ -// Test math syntax. - ---- -// Test Unicode math. -$ ∑_(i=0)^ℕ a ∘ b = \u{2211}_(i=0)^NN a compose b $ - ---- -// Test a few shorthands. -$ underline(f' : NN -> RR) \ - n |-> cases( - [|1|] &"if" n >>> 10, - 2 * 3 &"if" n != 5, - 1 - 0 thick &..., - ) $ - ---- -// Test common symbols. -$ dot \ dots \ ast \ tilde \ star $ - ---- -// Error: 1-2 unclosed delimiter -$a diff --git a/tests/typ/math/unbalanced.typ b/tests/typ/math/unbalanced.typ deleted file mode 100644 index 9eeb3bfc..00000000 --- a/tests/typ/math/unbalanced.typ +++ /dev/null @@ -1,6 +0,0 @@ -// Test unbalanced delimiters. - ---- -$ 1/(2 (x) $ -$ 1_(2 y (x) () $ -$ 1/(2 y (x) (2(3)) $ diff --git a/tests/typ/math/underover.typ b/tests/typ/math/underover.typ deleted file mode 100644 index f0f67308..00000000 --- a/tests/typ/math/underover.typ +++ /dev/null @@ -1,21 +0,0 @@ -// Test under/over things. - ---- -// Test braces. -$ x = underbrace( - 1 + 2 + ... + 5, - underbrace("numbers", x + y) -) $ - ---- -// Test lines and brackets. -$ x = overbracket( - overline(underline(x + y)), - 1 + 2 + ... + 5, -) $ - ---- -// Test brackets. -$ underbracket([1, 2/3], "relevant stuff") - arrow.l.r.double.long - overbracket([4/5,6], "irrelevant stuff") $ diff --git a/tests/typ/math/vec.typ b/tests/typ/math/vec.typ deleted file mode 100644 index 445b8104..00000000 --- a/tests/typ/math/vec.typ +++ /dev/null @@ -1,14 +0,0 @@ -// Test vectors. - ---- -// Test wide cell. -$ v = vec(1, 2+3, 4) $ - ---- -// Test alternative delimiter. -#set math.vec(delim: "[") -$ vec(1, 2) $ - ---- -// Error: 22-25 expected "(", "[", "{", "|", "||", or none -#set math.vec(delim: "%") |
