summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeedehai <18319900+Leedehai@users.noreply.github.com>2023-04-25 05:24:07 -0400
committerGitHub <noreply@github.com>2023-04-25 11:24:07 +0200
commit62361b4127c39fc1b165b81f24f52b14ddaa41db (patch)
tree830f1ef69e77c9e9fbab2337f05136fa69ed0755 /tests
parentfb99090208c9aface707f9d4526f411fcb67f705 (diff)
Support indices preceding the base symbol, revamping #699 (#825)
Breaking change: abbreviate attach() attachment params, top -> t, bottom -> b
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/math/attach.pngbin11366 -> 21307 bytes
-rw-r--r--tests/typ/compiler/content-field.typ4
-rw-r--r--tests/typ/math/attach.typ60
-rw-r--r--tests/typ/math/content.typ2
4 files changed, 55 insertions, 11 deletions
diff --git a/tests/ref/math/attach.png b/tests/ref/math/attach.png
index 956199ca..e65a1691 100644
--- a/tests/ref/math/attach.png
+++ b/tests/ref/math/attach.png
Binary files differ
diff --git a/tests/typ/compiler/content-field.typ b/tests/typ/compiler/content-field.typ
index 031a65b8..1d3dceb7 100644
--- a/tests/typ/compiler/content-field.typ
+++ b/tests/typ/compiler/content-field.typ
@@ -15,8 +15,8 @@
}
} else if func == math.attach {
let value = f(elem.base)
- if elem.has("top") {
- value = calc.pow(value, f(elem.top))
+ if elem.has("t") {
+ value = calc.pow(value, f(elem.t))
}
value
} else if elem.has("children") {
diff --git a/tests/typ/math/attach.typ b/tests/typ/math/attach.typ
index 3963c9c8..070b9eca 100644
--- a/tests/typ/math/attach.typ
+++ b/tests/typ/math/attach.typ
@@ -1,9 +1,45 @@
-// Test top and bottom attachments.
+// Test t and b attachments.
---
-// Test basics.
-$f_x + t^b + V_1^2
- + attach(A, top: alpha, bottom: beta)$
+// 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.
@@ -12,13 +48,21 @@ $pi_1(Y), a_f(x), a^zeta(x) \
---
// Test associativity and scaling.
-$ 1/(V^2^3^4^5) $
+$ 1/(V^2^3^4^5),
+ 1/attach(V, tl: attach(2, tl: attach(3, tl: attach(4, tl: 5)))),
+ 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))),
+ )
+$
---
// Test high subscript and superscript.
-$sqrt(a_(1/2)^zeta)$
-$sqrt(a_alpha^(1/2))$
-$sqrt(a_(1/2)^(3/4))$
+$ 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 frame base.
diff --git a/tests/typ/math/content.typ b/tests/typ/math/content.typ
index a36960ff..765e0ec3 100644
--- a/tests/typ/math/content.typ
+++ b/tests/typ/math/content.typ
@@ -11,7 +11,7 @@ $ x := #table(columns: 2)[x][y]/mat(1, 2, 3)
= #table[A][B][C] $
---
// Test non-equation math directly in content.
-#math.attach($a$, top: [b])
+#math.attach($a$, t: [b])
---
// Test font switch.