From 5ccc6876194a3f9329021bf22e7c8d0ed6bf74a1 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Mon, 24 Apr 2023 02:04:04 -0700 Subject: Obey alignment in matrices (#892) --- tests/ref/math/alignment.png | Bin 9752 -> 23935 bytes tests/typ/math/alignment.typ | 79 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 72 insertions(+), 7 deletions(-) (limited to 'tests') diff --git a/tests/ref/math/alignment.png b/tests/ref/math/alignment.png index 45b0cd86..2e3c3d5d 100644 Binary files a/tests/ref/math/alignment.png and b/tests/ref/math/alignment.png differ 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) $ -- cgit v1.2.3