Vectors, matrices, semicolumn syntax
Vectors
By vector we mean a column there.
To write arrow notations for letters, use$arrow(v)$
I recommend to create shortcut for this, like#let arr = math.arrow
To write columns, use vec
command:
$
vec(a, b, c) + vec(1, 2, 3) = vec(a + 1, b + 2, c + 3)
$
Delimiter
You can change parentheses around the column or even remove them:
$
vec(1, 2, 3, delim: "{") \
vec(1, 2, 3, delim: bar.double) \
vec(1, 2, 3, delim: #none)
$
Gap
You can change the size of gap between rows:
$
vec(a, b, c)
vec(a, b, c, gap:#0em)
vec(a, b, c, gap:#1em)
$
Making gap even
You can easily note that the gap isn't necessarily even or the same in different vectors:
$
vec(a/b, a/b, a/b) = vec(1, 1, 1)
$
That happens because gap
refers to spacing between elements, not the distance between their centers.
To fix this, you can use this snippet.
Matrix
Matrix is very similar to vec
, but accepts rows, separated by ;
:
$
mat(
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10; // `;` in the end is optional
)
$
Delimiters and gaps
You can specify them the same way as for vectors.
$
mat(
delim: "|",
1, 2, ..., 10;
2, 2, ..., 10;
dots.v, dots.v, dots.down, dots.v;
10, 10, ..., 10;
gap: #0.3em
)
$
Semicolon syntax
When you use semicolons, the arguments between the semicolons are merged into arrays. See yourself:
#let fun(..args) = {
args.pos()
}
$
fun(1, 2;3, 4; 6, ; 8)
$
If you miss some of elements, they will be replaced by none
-s.
You can mix semicolon syntax and named arguments, but be careful!
#let fun(..args) = {
repr(args.pos())
repr(args.named())
}
$
fun(1, 2; gap: #3em, 4)
$
For example, this will not work:
$
// ↓ there is no `;`, so it tries to add (gap:) to array
mat(1, 2; 4, gap: #3em)
$