1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
// Test matrices.
--- math-mat-semicolon ---
// Test semicolon syntax.
#set align(center)
$mat() dot
mat(;) dot
mat(1, 2) dot
mat(1, 2;) \
mat(1; 2) dot
mat(1, 2; 3, 4) dot
mat(1 + &2, 1/2; &3, 4)$
--- math-mat-sparse ---
// Test sparse matrix.
$ mat(
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10;
) $
--- math-mat-baseline ---
// Test baseline alignment.
$ mat(
a, b^2;
sum_(x \ y) x, a^(1/2);
zeta, alpha;
) $
--- math-mat-delim-set ---
// Test alternative delimiter with set rule.
#set math.mat(delim: "[")
$ mat(1, 2; 3, 4) $
$ a + mat(delim: #none, 1, 2; 3, 4) + b $
--- math-mat-delim-direct ---
// Test alternative math delimiter directly in call.
#set align(center)
#grid(
columns: 3,
gutter: 10pt,
$ mat(1, 2, delim: "[") $,
$ mat(1, 2; delim: "[") $,
$ mat(delim: "[", 1, 2) $,
$ mat(1; 2; delim: "[") $,
$ mat(1; delim: "[", 2) $,
$ mat(delim: "[", 1; 2) $,
$ mat(1, 2; delim: "[", 3, 4) $,
$ mat(delim: "[", 1, 2; 3, 4) $,
$ mat(1, 2; 3, 4; delim: "[") $,
)
--- math-mat-gap ---
#set math.mat(gap: 1em)
$ mat(1, 2; 3, 4) $
--- math-mat-gaps ---
#set math.mat(row-gap: 1em, column-gap: 2em)
$ mat(1, 2; 3, 4) $
--- math-mat-augment ---
// Test matrix line drawing (augmentation).
#grid(
columns: 2,
gutter: 10pt,
$ mat(10, 2, 3, 4; 5, 6, 7, 8; augment: #3) $,
$ mat(10, 2, 3, 4; 5, 6, 7, 8; augment: #(-1)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: 2)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: -1)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: 1, vline: 1)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(hline: -2, vline: -2)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(vline: 2, stroke: 1pt + blue)) $,
$ mat(100, 2, 3; 4, 5, 6; 7, 8, 9; augment: #(vline: -1, stroke: 1pt + blue)) $,
)
--- math-mat-augment-set ---
// Test using matrix line drawing with a set rule.
#set math.mat(augment: (hline: 2, vline: 1, stroke: 2pt + green))
$ mat(1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 1) $
#set math.mat(augment: 2)
$ mat(1, 0, 0, 0; 0, 1, 0, 0; 0, 0, 1, 1) $
#set math.mat(augment: none)
--- math-mat-augment-line-out-of-bounds ---
// Error: 3-37 cannot draw a vertical line after column 3 of a matrix with 3 columns
$ mat(1, 0, 0; 0, 1, 1; augment: #3) $,
--- math-mat-align-explicit--alternating ---
// 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";
) $
--- math-mat-align-implicit ---
// Test alignment in a matrix.
$ mat(
"a", "a a a", "a a";
"a a", "a a", "a";
"a a a", "a", "a a a";
) $
--- math-mat-align-explicit-left ---
// 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";
) $
--- math-mat-align-explicit-right ---
// 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"&;
) $
--- math-mat-align-complex ---
// Test #460 equations.
#let stop = {
math.class("punctuation",$.$)
}
$ mat(&a+b,c;&d, e) $
$ mat(&a+b&,c;&d&, e) $
$ mat(&&&a+b,c;&&&d, e) $
$ mat(stop &a+b&stop,c;...stop stop&d&...stop stop, e) $
--- math-mat-align-signed-numbers ---
// 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) $
--- math-mat-bad-comma ---
// This error message is bad.
// Error: 13-14 expected array, found content
$ mat(1, 2; 3, 4, delim: "[") $,
--- issue-852-mat-type ---
$ mat(B, A B) $
$ mat(B, A B, dots) $
$ mat(B, A B, dots;) $
$ mat(#1, #(foo: "bar")) $
--- issue-2268-mat-augment-color ---
// The augment line should be of the same color as the text
#set text(
font: "New Computer Modern",
lang: "en",
fill: yellow,
)
$mat(augment: #1, M, v) arrow.r.squiggly mat(augment: #1, R, b)$
|