情報アイコン
情報 / Info
当サイトは、Typst GmbHの許諾を得て、日本語コミュニティ「Typst Japan Community」がTypst v0.13.1の公式ドキュメントを翻訳したものです。誤訳や古い情報が含まれている可能性があるため、公式ドキュメントとの併用を推奨します。翻訳の改善やサイトの機能向上について、GitHubでのIssueやPull Requestを歓迎します。コミュニティにご興味のある方はDiscordサーバー「くみはんクラブ」にぜひご参加ください。
This site provides a Japanese translation of the Typst v0.13.1 documentation maintained by the "Typst Japan Community" with permission from Typst GmbH. We recommend using this alongside the official documentation. We welcome contributions through Issues and Pull Requests on our GitHub repository for both translation improvements and website enhancements. Feel free to join our Discord server "Kumihan Club".
言語アイコン
未翻訳

このページはまだ翻訳されていません。原文の内容が表示されています。

math

Typst has special syntax and library functions to typeset mathematical formulas. Math formulas can be displayed inline with text or as separate blocks. They will be typeset into their own block if they start and end with at least one space (e.g. $ x^2 $).

Variables

In math, single letters are always displayed as is. Multiple letters, however, are interpreted as variables and functions. To display multiple letters verbatim, you can place them into quotes and to access single letter variables, you can use the hash syntax.

$ A = pi r^2 $
$ "area" = pi dot "radius"^2 $
$ cal(A) :=
    { x in RR | x "is natural" } $
#let x = 5
$ #x < 17 $
Preview

Symbols

Math mode makes a wide selection of symbols like pi, dot, or RR available. Many mathematical symbols are available in different variants. You can select between different variants by applying modifiers to the symbol. Typst further recognizes a number of shorthand sequences like => that approximate a symbol. When such a shorthand exists, the symbol's documentation lists it.

$ x < y => x gt.eq.not y $
Preview

Line Breaks

Formulas can also contain line breaks. Each line can contain one or multiple alignment points (&) which are then aligned.

$ sum_(k=0)^n k
    &= 1 + ... + n \
    &= (n(n+1)) / 2 $
Preview

Function calls

Math mode supports special function calls without the hash prefix. In these "math calls", the argument list works a little differently than in code:

  • Within them, Typst is still in "math mode". Thus, you can write math directly into them, but need to use hash syntax to pass code expressions (except for strings, which are available in the math syntax).
  • They support positional and named arguments, as well as argument spreading.
  • They don't support trailing content blocks.
  • They provide additional syntax for 2-dimensional argument lists. The semicolon (;) merges preceding arguments separated by commas into an array argument.
$ frac(a^2, 2) $
$ vec(1, 2, delim: "[") $
$ mat(1, 2; 3, 4) $
$ mat(..#range(1, 5).chunks(2)) $
$ lim_x =
    op("lim", limits: #true)_x $
Preview

To write a verbatim comma or semicolon in a math call, escape it with a backslash. The colon on the other hand is only recognized in a special way if directly preceded by an identifier, so to display it verbatim in those cases, you can just insert a space before it.

Functions calls preceded by a hash are normal code function calls and not affected by these rules.

Alignment

When equations include multiple alignment points (&), this creates blocks of alternatingly right- and left-aligned columns. In the example below, the expression (3x + y) / 7 is right-aligned and = 9 is left-aligned. The word "given" is also left-aligned because && creates two alignment points in a row, alternating the alignment twice. & & and && behave exactly the same way. Meanwhile, "multiply by 7" is right-aligned because just one & precedes it. Each alignment point simply alternates between right-aligned/left-aligned.

$ (3x + y) / 7 &= 9 && "given" \
  3x + y &= 63 & "multiply by 7" \
  3x &= 63 - y && "subtract y" \
  x &= 21 - y/3 & "divide by 3" $
Preview

Math fonts

You can set the math font by with a show-set rule as demonstrated below. Note that only special OpenType math fonts are suitable for typesetting maths.

#show math.equation: set text(font: "Fira Math")
$ sum_(i in NN) 1 + i $
Preview

Math module

All math functions are part of the math module, which is available by default in equations. Outside of equations, they can be accessed with the math. prefix.

定義

  • 対象の要素にアクセント記号を付ける。
  • Subscript, superscripts, and limits.
  • A binomial expression.
  • Displays a diagonal line over a part of an equation.
  • A case distinction.
  • Forced use of a certain math class.
  • 数式。
  • 分数。
  • Delimiter matching.
  • A matrix.
  • A text operator in an equation.
  • Grouped primes.
  • 平方根とその他の累乗根。
  • Forced size styles for expressions within formulas.
  • Stretches a glyph.
  • Alternate letterforms within formulas.
  • Delimiters above or below parts of an equation.
  • Alternate typefaces within formulas.
  • A column vector.

検索