@@ -3,50 +3,41 @@ use typst_utils::Numeric;
33use crate :: foundations:: { cast, elem, Content } ;
44use crate :: layout:: { Abs , Em , Fr , Length , Ratio , Rel } ;
55
6- /// Inserts horizontal spacing into a paragraph.
6+ /// パラグラフに水平方向の間隔を挿入。
77///
8- /// The spacing can be absolute, relative, or fractional. In the last case, the
9- /// remaining space on the line is distributed among all fractional spacings
10- /// according to their relative fractions.
8+ /// 間隔の大きさは絶対的な値、相対的な値、または比率で指定できます。
9+ /// 比率指定の場合は、比率指定されたそれぞれの間隔に、行の残りの間隔がその相対比率に応じて配分されます。
1110///
12- /// # Example
11+ /// # 例
1312/// ```example
1413/// First #h(1cm) Second \
1514/// First #h(30%) Second
1615/// ```
1716///
18- /// # Fractional spacing
19- /// With fractional spacing, you can align things within a line without forcing
20- /// a paragraph break (like [`align`] would). Each fractionally sized element
21- /// gets space based on the ratio of its fraction to the sum of all fractions.
17+ /// # 比率指定の間隔
18+ /// 比率指定の間隔を用いると、([`align`]のように)段落区切りを強制することなく行内の配置が可能です。
19+ /// 要素の大きさが比率で指定された場合、それぞれの要素には、比率の総和に対する自身の比率の割合に応じた間隔が割り当てられます。
2220///
2321/// ```example
2422/// First #h(1fr) Second \
2523/// First #h(1fr) Second #h(1fr) Third \
2624/// First #h(2fr) Second #h(1fr) Third
2725/// ```
2826///
29- /// # Mathematical Spacing { #math-spacing }
30- /// In [mathematical formulas]($category/math), you can additionally use these
31- /// constants to add spacing between elements: `thin` (1/6 em), `med` (2/9 em),
32- /// `thick` (5/18 em), `quad` (1 em), `wide` (2 em).
27+ /// # 数式用の間隔 { #math-spacing }
28+ /// [数式]($category/math)中では、要素間に間隔を挿入するための定数として、`thin`(1/6 em)、`med`(2/9 em)、`thick`(5/18 em)、`quad`(1 em)および`wide`(2 em)も利用可能です。
3329#[ elem( title = "Spacing (H)" ) ]
3430pub struct HElem {
35- /// How much spacing to insert.
31+ /// 挿入する間隔の大きさ。
3632 #[ required]
3733 pub amount : Spacing ,
3834
39- /// If `{true}`, the spacing collapses at the start or end of a paragraph.
40- /// Moreover, from multiple adjacent weak spacings all but the largest one
41- /// collapse.
35+ /// `{true}`の場合、段落の始まりと終わりの空白は削除されます。
36+ /// さらに、弱い間隔が隣接していると最大のもの以外は削除されます。
4237 ///
43- /// Weak spacing in markup also causes all adjacent markup spaces to be
44- /// removed, regardless of the amount of spacing inserted. To force a space
45- /// next to weak spacing, you can explicitly write `[#" "]` (for a normal
46- /// space) or `[~]` (for a non-breaking space). The latter can be useful to
47- /// create a construct that always attaches to the preceding word with one
48- /// non-breaking space, independently of whether a markup space existed in
49- /// front or not.
38+ /// マークアップ中に弱い間隔があると、挿入された間隔の総量によらず、全ての隣接するマークアップの間隔が削除されます。
39+ /// 明示的に(通常の間隔の場合は)`[#" "]`と書くか、(改行しない間隔の場合は)`[~]`と書くことで弱い間隔の隣に間隔を強制することができます。
40+ /// 後者は、マークアップで直前に間隔があったかどうかに関係なく、直前の単語に改行しない間隔を常に1つ追加する構造を作成する際に便利かもしれません。
5041 ///
5142 /// ```example
5243 /// #h(1cm, weak: true)
@@ -72,13 +63,12 @@ impl HElem {
7263 }
7364}
7465
75- /// Inserts vertical spacing into a flow of blocks.
66+ /// ブロックの流れに垂直方向の間隔を挿入。
7667///
77- /// The spacing can be absolute, relative, or fractional. In the last case,
78- /// the remaining space on the page is distributed among all fractional spacings
79- /// according to their relative fractions.
68+ /// 間隔の大きさは絶対的な値、相対的な値、または比率で指定できます。
69+ /// 比率指定の場合は、比率指定されたそれぞれの間隔に、ページの残りの間隔がその相対比率に応じて配分されます。
8070///
81- /// # Example
71+ /// # 例
8272/// ```example
8373/// #grid(
8474/// rows: 3cm,
@@ -94,14 +84,13 @@ impl HElem {
9484/// ```
9585#[ elem( title = "Spacing (V)" ) ]
9686pub struct VElem {
97- /// How much spacing to insert.
87+ /// 挿入する間隔の大きさ。
9888 #[ required]
9989 pub amount : Spacing ,
10090
101- /// If `{true}`, the spacing collapses at the start or end of a flow.
102- /// Moreover, from multiple adjacent weak spacings all but the largest one
103- /// collapse. Weak spacings will always collapse adjacent paragraph spacing,
104- /// even if the paragraph spacing is larger.
91+ /// `{true}`の場合、流れの始まりと終わりの空白は削除されます。
92+ /// さらに、弱い間隔が隣接していると最大のもの以外は削除されます。
93+ /// たとえ段落間隔の方が大きかったとしても、弱い間隔に隣接する段落間隔は常に削除されます。
10594 ///
10695 /// ```example
10796 /// The following theorem is
0 commit comments