Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 42 additions & 51 deletions docs/reference/library/math.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
Typst has special [syntax]($syntax/#math) 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 $]`).
Typstには数式を組版するための特別な[構文]($syntax/#math)とライブラリ関数があります。
数式は、テキスト中にインラインで、あるいは独立したブロックのいずれかで表示できます。
始まりと終わりに少なくとも1つの空白がある場合(例えば、`[$ 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]($scripting/#expressions).
# 変数
数式モードでは1文字は常にそのまま表示されます。
しかし、複数の文字は変数か関数として解釈されます。
複数の文字を文字通りに表示するには引用符で囲んでください。
1文字の変数にアクセスしたい場合は[ハッシュ構文]($scripting/#expressions)を使用してください。

```example
$ A = pi r^2 $
Expand All @@ -18,39 +17,37 @@ $ cal(A) :=
$ #x < 17 $
```

# Symbols
Math mode makes a wide selection of [symbols]($category/symbols/sym) like `pi`,
`dot`, or `RR` available. Many mathematical symbols are available in different
variants. You can select between different variants by applying
[modifiers]($symbol) 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.
# 記号
数式モードでは`pi`、`dot`、`RR`などのさまざまな[記号]($category/symbols/sym)が利用可能です。
多くの数式記号ではバリアントが利用可能です。
記号に[修飾子]($symbol)を適用することで異なるバリアントを選択できます。
Typstはさらに`=>`のような、記号を近似するいくつかの省略記法を認識します。
そのような省略記法が存在する場合、記号ドキュメントのリストに記載されています。

```example
$ x < y => x gt.eq.not y $
```

# Line Breaks
Formulas can also contain line breaks. Each line can contain one or multiple
_alignment points_ (`&`) which are then aligned.
# 改行
数式には改行を含めることもできます。
各行には、その場所で配置することを指定する、1つまたは複数の _配置点_(`&`)を含めることができます。

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

# 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.
- その中では、Typstは依然として「数式モード」です。
したがって、その中で数式を直接書くことができますが、コード式を渡すには(数式構文で利用可能なstringを除いて)ハッシュ構文を使う必要があります。
- 位置引数、キーワード引数、引数展開をサポートしています。
- 後続のコンテンツブロックはサポートされていません。
- 2次元引数リストのための追加の構文があります。
セミコロン(`;`)はその前のカンマ区切りの引数を配列引数へとマージします。

```example
$ frac(a^2, 2) $
Expand All @@ -61,22 +58,18 @@ $ lim_x =
op("lim", limits: #true)_x $
```

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"という単語も左揃えです。これは`&&`が行内に2つの配置点を作成し、2回配置方法が切り替わるためです。
`& &`と`&&`は全く同じように振る舞います。
一方、"multiply by 7"は、その前に`&`がただ1つあるため右揃えです。
各配置点は単に右揃えと左揃えを交互に切り替えます。

```example
$ (3x + y) / 7 &= 9 && "given" \
Expand All @@ -85,17 +78,15 @@ $ (3x + y) / 7 &= 9 && "given" \
x &= 21 - y/3 & "divide by 3" $
```

# Math fonts
You can set the math font by with a [show-set rule]($styling/#show-rules) as
demonstrated below. Note that only special OpenType math fonts are suitable for
typesetting maths.
# 数式フォント
以下に示すように、[show-setルール]($styling/#show-rules)を用いて数式フォントの設定が可能です。
数式組版に適しているのは一部の特別なOpenType数式フォントのみであることに注意してください。

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

# Math module
All math functions are part of the `math` [module]($scripting/#modules), which
is available by default in equations. Outside of equations, they can be accessed
with the `math.` prefix.
# mathモジュール
全ての数学関数は、数式中ではデフォルトで利用できる`math`[モジュール]($scripting/#modules)に属しています。
数式外では、`math.`プレフィックスを付けるとアクセスできます。
2 changes: 1 addition & 1 deletion website/translation-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"/docs/reference/text/text/": "untranslated",
"/docs/reference/text/underline/": "untranslated",
"/docs/reference/text/upper/": "untranslated",
"/docs/reference/math/": "untranslated",
"/docs/reference/math/": "translated",
"/docs/reference/math/accent/": "translated",
"/docs/reference/math/attach/": "untranslated",
"/docs/reference/math/binom/": "untranslated",
Expand Down