Development build 586e1bd4
Typst文档简体中文版v0.15.1 + dev 586e1bd4

mat元素
Question mark
自始可用Go to source

A matrix.

The elements of a row should be separated by commas, while the rows themselves should be separated by semicolons. The semicolon syntax merges preceding arguments separated by commas into an array. You can also use this special syntax of math function calls to define custom functions that take 2D data.

Content in cells can be aligned with the align parameter, or content in cells that are in the same row can be aligned with the & symbol.

Example

$ mat( 1, 2, ..., 10; 2, 2, ..., 10; dots.v, dots.v, dots.down, dots.v; 10, 10, ..., 10; ) $

参数
Question mark

delim
none or str or symbol or array
可用set规则
Question mark
默认值:("(", ")")

The delimiter to use.

Can be a single character specifying the left delimiter, in which case the right delimiter is inferred. Otherwise, can be an array containing a left and a right delimiter.

Expand展开示例
#set math.mat(delim: "[") $ mat(1, 2; 3, 4) $

align
alignment
可用set规则
Question mark
默认值:center

The horizontal alignment that each cell should have.

Expand展开示例
#set math.mat(align: right) $ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1) $

augment
none or int or dictionary
可用set规则
Question mark
默认值:none

Draws augmentation lines in a matrix.

Expand展开示例:Basic usage
$ mat(1, 0, 1; 0, 1, 2; augment: #2) $ // Equivalent to: $ mat(1, 0, 1; 0, 1, 2; augment: #(-1)) $
Expand展开示例:Customizing the augmentation line
$ mat(0, 0, 0; 1, 1, 1; augment: #(hline: 1, stroke: 2pt + green)) $

gap默认值:0% + 0pt

The gap between rows and columns.

This is a shorthand to set row-gap and column-gap to the same value.

Expand展开示例
#set math.mat(gap: 1em) $ mat(1, 2; 3, 4) $

row-gap
relative
可用set规则
Question mark
默认值:0% + 0.2em

The gap between rows.

Expand展开示例
#set math.mat(row-gap: 1em) $ mat(1, 2; 3, 4) $

column-gap
relative
可用set规则
Question mark
默认值:0% + 0.5em

The gap between columns.

Expand展开示例
#set math.mat(column-gap: 1em) $ mat(1, 2; 3, 4) $

rows
array
必需参数
Question mark
位置参数
Question mark
变长参数
Question mark

An array of arrays with the rows of the matrix.

Expand展开示例
#let data = ((1, 2, 3), (4, 5, 6)) #let matrix = math.mat(..data) $ v := matrix $