From e00e3e4fbfb9432061d176fb0a3e6b4bf2430fc6 Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 26 Sep 2024 14:46:26 +0000 Subject: Add `math.stretch` element function (#5030) --- tests/ref/math-stretch-attach-nested-equation.png | Bin 0 -> 180 bytes tests/ref/math-stretch-attach.png | Bin 0 -> 2245 bytes tests/ref/math-stretch-basic.png | Bin 0 -> 787 bytes tests/ref/math-stretch-complex.png | Bin 0 -> 1457 bytes tests/ref/math-stretch-horizontal.png | Bin 0 -> 591 bytes tests/ref/math-stretch-nested.png | Bin 0 -> 253 bytes tests/ref/math-stretch-shorthand.png | Bin 0 -> 375 bytes tests/ref/math-stretch-vertical.png | Bin 0 -> 481 bytes tests/suite/math/stretch.typ | 72 ++++++++++++++++++++++ 9 files changed, 72 insertions(+) create mode 100644 tests/ref/math-stretch-attach-nested-equation.png create mode 100644 tests/ref/math-stretch-attach.png create mode 100644 tests/ref/math-stretch-basic.png create mode 100644 tests/ref/math-stretch-complex.png create mode 100644 tests/ref/math-stretch-horizontal.png create mode 100644 tests/ref/math-stretch-nested.png create mode 100644 tests/ref/math-stretch-shorthand.png create mode 100644 tests/ref/math-stretch-vertical.png create mode 100644 tests/suite/math/stretch.typ (limited to 'tests') diff --git a/tests/ref/math-stretch-attach-nested-equation.png b/tests/ref/math-stretch-attach-nested-equation.png new file mode 100644 index 00000000..5ab4fbb5 Binary files /dev/null and b/tests/ref/math-stretch-attach-nested-equation.png differ diff --git a/tests/ref/math-stretch-attach.png b/tests/ref/math-stretch-attach.png new file mode 100644 index 00000000..179281a5 Binary files /dev/null and b/tests/ref/math-stretch-attach.png differ diff --git a/tests/ref/math-stretch-basic.png b/tests/ref/math-stretch-basic.png new file mode 100644 index 00000000..3144b11f Binary files /dev/null and b/tests/ref/math-stretch-basic.png differ diff --git a/tests/ref/math-stretch-complex.png b/tests/ref/math-stretch-complex.png new file mode 100644 index 00000000..be694b71 Binary files /dev/null and b/tests/ref/math-stretch-complex.png differ diff --git a/tests/ref/math-stretch-horizontal.png b/tests/ref/math-stretch-horizontal.png new file mode 100644 index 00000000..9b30be59 Binary files /dev/null and b/tests/ref/math-stretch-horizontal.png differ diff --git a/tests/ref/math-stretch-nested.png b/tests/ref/math-stretch-nested.png new file mode 100644 index 00000000..4583cab9 Binary files /dev/null and b/tests/ref/math-stretch-nested.png differ diff --git a/tests/ref/math-stretch-shorthand.png b/tests/ref/math-stretch-shorthand.png new file mode 100644 index 00000000..59db832a Binary files /dev/null and b/tests/ref/math-stretch-shorthand.png differ diff --git a/tests/ref/math-stretch-vertical.png b/tests/ref/math-stretch-vertical.png new file mode 100644 index 00000000..1f60506d Binary files /dev/null and b/tests/ref/math-stretch-vertical.png differ diff --git a/tests/suite/math/stretch.typ b/tests/suite/math/stretch.typ new file mode 100644 index 00000000..e6817ee5 --- /dev/null +++ b/tests/suite/math/stretch.typ @@ -0,0 +1,72 @@ +// Test math stretch. + +--- math-stretch-basic --- +// Test basic stretch. +$ P -> Q stretch(->, size: #200%) R \ + R stretch(->) S stretch(->, size: #50%)^"epimorphism" T $ + +--- math-stretch-complex --- +// Test complex stretch. +$ H stretch(=)^"define" U + p V \ + x stretch(harpoons.ltrb, size: #3em) y + stretch(\[, size: #150%) z \ + f : X stretch(arrow.hook, size: #150%)_"injective" Y \ + V stretch(->, size: #(100% + 1.5em))^("surjection") ZZ $ + +--- math-stretch-attach --- +// Test stretch interactions with attachments. +#set page(width: auto) + +$stretch(stretch(=, size: #4em))_A$ +$stretch(arrow.hook, size: #5em)^"injective map"$ +$stretch(arrow.hook, size: #200%)^"injective map"$ + +$ P = Q + stretch(=)^(k = 0)_(forall i) R + stretch(=, size: #150%)^(k = 0)_(forall i) S + stretch(=, size: #2mm)^(k = 0)_(forall i) T \ + U stretch(equiv)^(forall i)_"Chern-Weil" V + stretch(equiv, size: #(120% + 2mm))^(forall i)_"Chern-Weil" W $ + +--- math-stretch-horizontal --- +// Test stretching along horizontal axis. +#let ext(sym) = math.stretch(sym, size: 2em) +$ ext(arrow.r) quad ext(arrow.l.double.bar) \ + ext(harpoon.rb) quad ext(harpoons.ltrb) \ + ext(paren.t) quad ext(shell.b) \ + ext(eq) quad ext(equiv) $ + +--- math-stretch-vertical --- +// Test stretching along vertical axis. +#let ext(sym) = math.stretch(sym, size: 2em) +$ ext(bar.v) quad ext(bar.v.double) quad + ext(angle.l) quad ext(angle.r) quad + ext(paren.l) quad ext(paren.r) \ + ext(bracket.l.double) quad ext(bracket.r.double) quad + ext(brace.l) quad ext(brace.r) quad + ext(bracket.l) quad ext(bracket.r) $ + +--- math-stretch-shorthand --- +// Test stretch when base is given with shorthand. +$stretch(||, size: #2em)$ +$stretch(\(, size: #2em)$ +$stretch("⟧", size: #2em)$ +$stretch("|", size: #2em)$ +$stretch(->, size: #2em)$ +$stretch(↣, size: #2em)$ + +--- math-stretch-nested --- +// Test nested stretch calls. +$ stretch(=, size: #2em) \ + stretch(stretch(=, size: #4em), size: #50%) $ + +#let base = math.stretch($=$, size: 4em) +$ stretch(base, size: #50%) $ + +#let base = $stretch(=, size: #4em) $ +$ stretch(base, size: #50%) $ + +--- math-stretch-attach-nested-equation --- +// Test stretching with attachments when nested in an equation. +#let body = $stretch(=)$ +$ body^"text" $ -- cgit v1.2.3