注意 当サイトは、Typst v0.12.0 公式ドキュメントを、日本語コミュニティが非公式に翻訳したものです。誤訳・未訳・古い情報が含まれている可能性があるため、公式ドキュメント との併用を推奨します。このサイトの内容に誤りを発見された方は、GitHubリポジトリまでご報告を頂けましたら幸いです。我々のコミュニティにご興味のある方は、ぜひ非公式Discordサーバー「くみはんクラブ」にご参加ください。
Warning: This site provides an unofficial translation of the Typst v0.12.0 documentation by the Japanese Community. Please note that there may be some inaccuracies, untranslated sections or outdated information. We highly recommend referring to the latest official documentation as well. If you find any errors in the content, please let us know through our GitHub repository. If you are interested in our community, feel free to join our unofficial Discord server, “Kumihan Club.”
Typst ドキュメント日本語版

mat Element
Element functions can be customized with set and show rules.

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;
) $
Preview

Parameters
Parameters are the inputs to a function. They are specified in parentheses after the function name.

delim
none str array symbol
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

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.

Default:("(", ")")

View example
#set math.mat(delim: "[")
$ mat(1, 2; 3, 4) $
Preview

align
alignment
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The horizontal alignment that each cell should have.

Default:center

View example
#set math.mat(align: right)
$ mat(-1, 1, 1; 1, -1, 1; 1, 1, -1) $
Preview

augment
none int dictionary
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

Draws augmentation lines in a matrix.

Default:none

View example
$ mat(1, 0, 1; 0, 1, 2; augment: #2) $
// Equivalent to:
$ mat(1, 0, 1; 0, 1, 2; augment: #(-1)) $
Preview
$ mat(0, 0, 0; 1, 1, 1; augment: #(hline: 1, stroke: 2pt + green)) $
Preview

gap
relative
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The gap between rows and columns.

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

Default:0% + 0pt

View example
#set math.mat(gap: 1em)
$ mat(1, 2; 3, 4) $
Preview

row-gap
relative
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The gap between rows.

Default:0% + 0.2em

View example
#set math.mat(row-gap: 1em)
$ mat(1, 2; 3, 4) $
Preview

column-gap
relative
Settable
Settable parameters can be customized for all following uses of the function with a set rule.

The gap between columns.

Default:0% + 0.5em

View example
#set math.mat(column-gap: 1em)
$ mat(1, 2; 3, 4) $
Preview

rows
array
RequiredPositional
Positional parameters are specified in order, without names.
Variadic
Variadic parameters can be specified multiple times.

An array of arrays with the rows of the matrix.

View example
#let data = ((1, 2, 3), (4, 5, 6))
#let matrix = math.mat(..data)
$ v := matrix $
Preview