Skip to content

/docs/reference/math/variantsの翻訳 #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 20, 2025
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
44 changes: 20 additions & 24 deletions crates/typst-library/src/math/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,42 @@ pub fn italic(
body.styled(EquationElem::set_italic(Smart::Custom(true)))
}

/// Serif (roman) font style in math.
/// 数式中のセリフ(ローマン)フォントスタイル。
///
/// This is already the default.
/// これがデフォルトです。
#[func(keywords = ["mathrm"])]
pub fn serif(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Serif))
}

/// Sans-serif font style in math.
/// 数式中のサンセリフフォントスタイル。
///
/// ```example
/// $ sans(A B C) $
/// ```
#[func(title = "Sans Serif", keywords = ["mathsf"])]
pub fn sans(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Sans))
}

/// Calligraphic font style in math.
/// 数式中のカリグラフィーフォントスタイル。
///
/// ```example
/// Let $cal(P)$ be the set of ...
/// ```
///
/// This corresponds both to LaTeX's `\mathcal` and `\mathscr` as both of these
/// styles share the same Unicode codepoints. Switching between the styles is
/// thus only possible if supported by the font via
/// [font features]($text.features).
/// このスタイルはLaTeXの`\mathcal`と`\mathscr`の両方に対応します。
/// これは両スタイルが同じUnicodeのコードポイントを共有しているためです。
/// このため、スタイル間の切り替えは[フォントフィーチャー]($text.features)を用いてサポートされているフォントでのみ可能です。
///
/// For the default math font, the roundhand style is available through the
/// `ss01` feature. Therefore, you could define your own version of `\mathscr`
/// like this:
/// デフォルトの数式フォントでは、ラウンドハンドスタイル(丸みを帯びた筆記体)が`ss01`フィーチャーとして利用可能です。
/// したがって、以下のように独自の`\mathscr`が定義できます。
///
/// ```example
/// #let scr(it) = text(
Expand All @@ -86,46 +84,44 @@ pub fn sans(
/// We establish $cal(P) != scr(P)$.
/// ```
///
/// (The box is not conceptually necessary, but unfortunately currently needed
/// due to limitations in Typst's text style handling in math.)
/// (ボックスは概念的には不要ですが、現在のTypstの数式テキストスタイル処理の制約により必要です)
#[func(title = "Calligraphic", keywords = ["mathcal", "mathscr"])]
pub fn cal(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Cal))
}

/// Fraktur font style in math.
/// 数式中のフラクトゥールフォントスタイル。
///
/// ```example
/// $ frak(P) $
/// ```
#[func(title = "Fraktur", keywords = ["mathfrak"])]
pub fn frak(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Frak))
}

/// Monospace font style in math.
/// 数式中の等幅フォントスタイル。
///
/// ```example
/// $ mono(x + y = z) $
/// ```
#[func(title = "Monospace", keywords = ["mathtt"])]
pub fn mono(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Mono))
}

/// Blackboard bold (double-struck) font style in math.
/// 数式中の黒板太字(double-struck)フォントスタイル。
///
/// For uppercase latin letters, blackboard bold is additionally available
/// through [symbols]($category/symbols/sym) of the form `NN` and `RR`.
/// 大文字のラテン文字では、黒板太字は、[symbols]($category/symbols/sym)にあるように、`NN`や`RR`のような形式でも使用できます。
///
/// ```example
/// $ bb(b) $
Expand All @@ -134,7 +130,7 @@ pub fn mono(
/// ```
#[func(title = "Blackboard Bold", keywords = ["mathbb"])]
pub fn bb(
/// The content to style.
/// スタイルを適用するコンテンツ。
body: Content,
) -> Content {
body.styled(EquationElem::set_variant(MathVariant::Bb))
Expand Down
5 changes: 2 additions & 3 deletions docs/reference/groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
path: ["math"]
filter: ["serif", "sans", "frak", "mono", "bb", "cal"]
details: |
Alternate typefaces within formulas.
数式中の別書体。

These functions are distinct from the [`text`] function because math fonts
contain multiple variants of each letter.
数式フォントは各文字に対して複数の異体字を備えているため、これらの関数は[`text`]関数とは異なります。

- name: styles
title: Styles
Expand Down
2 changes: 1 addition & 1 deletion website/translation-status.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"/docs/reference/math/styles/": "untranslated",
"/docs/reference/math/op/": "translated",
"/docs/reference/math/underover/": "untranslated",
"/docs/reference/math/variants/": "untranslated",
"/docs/reference/math/variants/": "translated",
"/docs/reference/math/vec/": "translated",
"/docs/reference/symbols/": "untranslated",
"/docs/reference/symbols/sym/": "untranslated",
Expand Down