summaryrefslogtreecommitdiff
path: root/tests/typ/math
diff options
context:
space:
mode:
authorAlex Saveau <saveau.alexandre@gmail.com>2023-04-24 02:04:04 -0700
committerGitHub <noreply@github.com>2023-04-24 11:04:04 +0200
commit5ccc6876194a3f9329021bf22e7c8d0ed6bf74a1 (patch)
tree672bc2785e52ef643bd7ab20a172af8dfe96ff8e /tests/typ/math
parente5ea3ecbbb2cebe1f602996dff911d07e2f7741d (diff)
Obey alignment in matrices (#892)
Diffstat (limited to 'tests/typ/math')
-rw-r--r--tests/typ/math/alignment.typ79
1 files changed, 72 insertions, 7 deletions
diff --git a/tests/typ/math/alignment.typ b/tests/typ/math/alignment.typ
index 8482d89e..70c52d37 100644
--- a/tests/typ/math/alignment.typ
+++ b/tests/typ/math/alignment.typ
@@ -2,9 +2,8 @@
---
// Test alignment step functions.
-#set page(width: 300pt)
$
-"abc" &= c \
+"a" &= c \
&= c + 1 & "By definition" \
&= d + 100 + 1000 \
&= x && "Even longer" \
@@ -12,17 +11,83 @@ $
---
// Test post-fix alignment.
-#set page(width: 300pt)
$
& "right" \
"a very long line" \
+"left" \
+$
+
+---
+// Test no alignment.
+$
+"right" \
+"a very long line" \
+"left" \
$
---
// Test alternating alignment.
-#set page(width: 300pt)
$
-"abc" & "abc abc abc" & "abc abc" \
-"abc abc" & "abc abc" & "abc" \
-"abc abc abc" & "abc" & "abc abc abc" \
+"a" & "a a a" & "a a" \
+"a a" & "a a" & "a" \
+"a a a" & "a" & "a a a" \
+$
+
+---
+// 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.
+$
+a &=b & quad c&=d \
+e &=f & g&=h
$
+
+$ mat(&a+b,c;&d, e) $
+$ mat(&a+b&,c;&d&, e) $
+$ mat(&&&a+b,c;&&&d, e) $
+$ mat(.&a+b&.,c;.....&d&....., 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) $