summaryrefslogtreecommitdiff
path: root/tests/typ/math
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-12-07 12:33:48 +0100
committerLaurenz <laurmaedje@gmail.com>2022-12-07 14:01:20 +0100
commit11c7ceb29e762f6dd1d093d9fdb57e9612a92df0 (patch)
treecf68d1d206a4718dd20f4dd8de8e6edc931012e1 /tests/typ/math
parente1c0cda6c8505ad2efc347afc80868296e56cb62 (diff)
Extend math library
Diffstat (limited to 'tests/typ/math')
-rw-r--r--tests/typ/math/accents.typ28
-rw-r--r--tests/typ/math/matrix.typ15
-rw-r--r--tests/typ/math/simple.typ6
-rw-r--r--tests/typ/math/style.typ15
4 files changed, 59 insertions, 5 deletions
diff --git a/tests/typ/math/accents.typ b/tests/typ/math/accents.typ
new file mode 100644
index 00000000..04e6e723
--- /dev/null
+++ b/tests/typ/math/accents.typ
@@ -0,0 +1,28 @@
+// Test math accents.
+
+---
+#set page(width: auto)
+
+$ acc(a,`),
+ acc(a,´),
+ acc(a,\^),
+ acc(a,~),
+ acc(a,¯),
+ acc(a,‾),
+ acc(a,˘),
+ acc(a,.),
+ acc(a,¨),
+ acc(a,ˇ),
+ acc(a,->) $
+
+$ acc(a, grave),
+ acc(a, acute),
+ acc(a, circum),
+ acc(a, tilde),
+ acc(a, macron),
+ acc(a, overline),
+ acc(a, breve),
+ acc(a, dot),
+ acc(a, dia),
+ acc(a, caron),
+ acc(a, arrow) $
diff --git a/tests/typ/math/matrix.typ b/tests/typ/math/matrix.typ
index ec84778c..3d67800d 100644
--- a/tests/typ/math/matrix.typ
+++ b/tests/typ/math/matrix.typ
@@ -4,12 +4,11 @@
$ v = vec(1, 2+3, 4) $
---
-#set vec(delim: "|")
-$ vec(1, 2) $
+$ binom(n, 1) = 1/2 n (n-1) $
---
-// Error: 17-20 expected "(", "[", "{", or "|"
-#set vec(delim: "%")
+#set vec(delim: "|")
+$ vec(1, 2) $
---
$ f(x, y) := cases(
@@ -18,3 +17,11 @@ $ f(x, y) := cases(
3 "if" x "is even",
4 "else",
) $
+
+---
+// Error: 17-20 expected "(", "[", "{", or "|"
+#set vec(delim: "%")
+
+---
+// Error: 9-12 missing argument: lower index
+$ binom(x^2) $
diff --git a/tests/typ/math/simple.typ b/tests/typ/math/simple.typ
index 55a853cf..1b63cbfc 100644
--- a/tests/typ/math/simple.typ
+++ b/tests/typ/math/simple.typ
@@ -12,8 +12,12 @@ Prove by induction:
$ sum_(k=0)^n k = (n(n+1))/2 $
---
+We know that:
+$ floor(x/2) <= ceil(x/2) $
+
+---
// Test that blackboard style looks nice.
-$ f: NN arrow RR $
+$ f: NN -> RR $
---
// Error: 1:3 expected dollar sign
diff --git a/tests/typ/math/style.typ b/tests/typ/math/style.typ
new file mode 100644
index 00000000..c9238a9a
--- /dev/null
+++ b/tests/typ/math/style.typ
@@ -0,0 +1,15 @@
+#let part = $ a b A B $
+#let kinds = (serif, sans, cal, frak, mono, bb)
+#let modifiers = (v => v, ital, bold, v => ital(bold(v)))
+
+#let cells = ([:triangle:nested:], [--], [`ital`], [`bold`], [both])
+#for k in kinds {
+ cells.push(raw(repr(k).trim("<function ").trim(">")))
+ for m in modifiers {
+ cells.push($ #m(#k(part)) $)
+ }
+}
+
+#set page(width: auto)
+#set par(align: center)
+#table(columns: 1 + modifiers.len(), ..cells)