mirror of
https://github.com/typst/typst
synced 2025-07-27 06:17:53 +08:00
Merge f54268c1cc42a0d91b439735e511908a44dd5ac7 into e9f1b5825a9d37ca0c173a7b2830ba36a27ca9e0
This commit is contained in:
commit
1df343fa43
@ -415,6 +415,8 @@ impl Counter {
|
|||||||
/// - If it is a [selector], counts through elements that matches with the
|
/// - If it is a [selector], counts through elements that matches with the
|
||||||
/// selector. For example,
|
/// selector. For example,
|
||||||
/// - provide an element function: counts elements of that type,
|
/// - provide an element function: counts elements of that type,
|
||||||
|
/// - provide a [`where`]($function.where) selector:
|
||||||
|
/// counts a type of elements with specific fields,
|
||||||
/// - provide a [`{<label>}`]($label): counts elements with that label.
|
/// - provide a [`{<label>}`]($label): counts elements with that label.
|
||||||
key: CounterKey,
|
key: CounterKey,
|
||||||
) -> Counter {
|
) -> Counter {
|
||||||
|
@ -397,6 +397,12 @@ impl LocalName for PageElem {
|
|||||||
/// == Compound Theory
|
/// == Compound Theory
|
||||||
/// In 1984, the first ...
|
/// In 1984, the first ...
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// Note that even without manual page breaks, the content will be automatically
|
||||||
|
/// paginated based on the size of the content and the page. You could adjust
|
||||||
|
/// [costs]($text.costs) to fine-tune the algorithm that prevents widows and
|
||||||
|
/// orphans. You can also set [the page height]($page.height) to `{auto}` to
|
||||||
|
/// let the page grow dynamically until a manual page break occurs.
|
||||||
#[elem(title = "Page Break")]
|
#[elem(title = "Page Break")]
|
||||||
pub struct PagebreakElem {
|
pub struct PagebreakElem {
|
||||||
/// If `{true}`, the page break is skipped if the current page is already
|
/// If `{true}`, the page break is skipped if the current page is already
|
||||||
|
@ -189,6 +189,37 @@ pub struct FigureElem {
|
|||||||
/// supplement: [Atom],
|
/// supplement: [Atom],
|
||||||
/// )
|
/// )
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// If you want to modify a counter to skip a number or reset the counter,
|
||||||
|
/// you can access the [counter] of each kind of figures from
|
||||||
|
/// a [`where`]($function.where) selector:
|
||||||
|
///
|
||||||
|
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
|
||||||
|
/// - For [images]($image): `{counter(figure.where(kind: image))}`
|
||||||
|
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
|
||||||
|
///
|
||||||
|
/// ```example
|
||||||
|
/// #figure(
|
||||||
|
/// table(columns: 2, $n$, $1$),
|
||||||
|
/// caption: [The first table.],
|
||||||
|
/// )
|
||||||
|
///
|
||||||
|
/// #counter(figure.where(kind: table)).update(41)
|
||||||
|
///
|
||||||
|
/// #figure(
|
||||||
|
/// table(columns: 2, $n$, $42$),
|
||||||
|
/// caption: [Jumped to the 42nd table.],
|
||||||
|
/// )
|
||||||
|
///
|
||||||
|
/// #figure(
|
||||||
|
/// rect[Image],
|
||||||
|
/// caption: [And it doesn't affect images.],
|
||||||
|
/// )
|
||||||
|
/// ```
|
||||||
|
///
|
||||||
|
/// There is also a convenience field called `counter` to simplify general
|
||||||
|
/// [show rules]($styling/#show-rules). There is an example
|
||||||
|
/// [show rule that customizes `figure.caption`]($figure.caption.body) below.
|
||||||
pub kind: Smart<FigureKind>,
|
pub kind: Smart<FigureKind>,
|
||||||
|
|
||||||
/// The figure's supplement.
|
/// The figure's supplement.
|
||||||
@ -228,8 +259,8 @@ pub struct FigureElem {
|
|||||||
/// Convenience field to get access to the counter for this figure.
|
/// Convenience field to get access to the counter for this figure.
|
||||||
///
|
///
|
||||||
/// The counter only depends on the `kind`:
|
/// The counter only depends on the `kind`:
|
||||||
/// - For (tables)[@table]: `{counter(figure.where(kind: table))}`
|
/// - For [tables]($table): `{counter(figure.where(kind: table))}`
|
||||||
/// - For (images)[@image]: `{counter(figure.where(kind: image))}`
|
/// - For [images]($image): `{counter(figure.where(kind: image))}`
|
||||||
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
|
/// - For a custom kind: `{counter(figure.where(kind: kind))}`
|
||||||
///
|
///
|
||||||
/// These are the counters you'll need to modify if you want to skip a
|
/// These are the counters you'll need to modify if you want to skip a
|
||||||
|
@ -411,6 +411,9 @@ pub struct TextElem {
|
|||||||
/// = Einleitung
|
/// = Einleitung
|
||||||
/// In diesem Dokument, ...
|
/// In diesem Dokument, ...
|
||||||
/// ```
|
/// ```
|
||||||
|
///
|
||||||
|
/// The language code is case-insensitive, and will be normalized to
|
||||||
|
/// lowercase before made available to the [context]($context).
|
||||||
#[default(Lang::ENGLISH)]
|
#[default(Lang::ENGLISH)]
|
||||||
#[ghost]
|
#[ghost]
|
||||||
pub lang: Lang,
|
pub lang: Lang,
|
||||||
@ -418,6 +421,9 @@ pub struct TextElem {
|
|||||||
/// An [ISO 3166-1 alpha-2 region code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
/// An [ISO 3166-1 alpha-2 region code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
|
||||||
///
|
///
|
||||||
/// This lets the text processing pipeline make more informed choices.
|
/// This lets the text processing pipeline make more informed choices.
|
||||||
|
///
|
||||||
|
/// The region code is case-insensitive, and will be normalized to
|
||||||
|
/// uppercase before made available to the [context]($context).
|
||||||
#[ghost]
|
#[ghost]
|
||||||
pub region: Option<Region>,
|
pub region: Option<Region>,
|
||||||
|
|
||||||
|
@ -2,4 +2,5 @@ These two modules give names to symbols and emoji to make them easy to insert
|
|||||||
with a normal keyboard. Alternatively, you can also always directly enter
|
with a normal keyboard. Alternatively, you can also always directly enter
|
||||||
Unicode symbols into your text and formulas. In addition to the symbols listed
|
Unicode symbols into your text and formulas. In addition to the symbols listed
|
||||||
below, math mode defines `dif` and `Dif`. These are not normal symbol values
|
below, math mode defines `dif` and `Dif`. These are not normal symbol values
|
||||||
because they also affect spacing and font style.
|
because they also affect spacing and font style. Furthermore, you can define
|
||||||
|
custom symbols with the constructor function of the [symbol]($symbol) type.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user