diff --git a/examples/default.typ b/examples/default.typ index 6f87dd69..6130a47f 100644 --- a/examples/default.typ +++ b/examples/default.typ @@ -9,12 +9,8 @@ slide-level: 3, zero-margin-header: false, ), - config-colors( - primary: blue, - ), - config-methods( - alert: utils.alert-with-primary-color, - ), + config-colors(primary: blue), + config-methods(alert: utils.alert-with-primary-color), config-page( header: text(gray, utils.display-current-short-heading(level: 2)), ), diff --git a/examples/dewdrop.typ b/examples/dewdrop.typ index 488f12c1..5d614f86 100644 --- a/examples/dewdrop.typ +++ b/examples/dewdrop.typ @@ -26,7 +26,7 @@ == Subsection A.1 -$ x_(n+1) = (x_n + a/x_n) / 2 $ +$ x_(n+1) = (x_n + a / x_n) / 2 $ == Subsection A.2 diff --git a/examples/example.typ b/examples/example.typ index 100c19fd..90600a1a 100644 --- a/examples/example.typ +++ b/examples/example.typ @@ -16,7 +16,7 @@ "corollary", "Corollary", base: "theorem", - titlefmt: strong + titlefmt: strong, ) #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)) #let example = thmplain("example", "Example").with(numbering: none) @@ -76,17 +76,20 @@ use #only("2-")[`#only` function] for not reserving space, == Callback Style Animation -#slide(repeat: 3, self => [ - #let (uncover, only, alternatives) = utils.methods(self) +#slide( + repeat: 3, + self => [ + #let (uncover, only, alternatives) = utils.methods(self) - At subslide #self.subslide, we can + At subslide #self.subslide, we can - use #uncover("2-")[`#uncover` function] for reserving space, + use #uncover("2-")[`#uncover` function] for reserving space, - use #only("2-")[`#only` function] for not reserving space, + use #only("2-")[`#only` function] for not reserving space, - #alternatives[call `#only` multiple times \u{2717}][use `#alternatives` function #sym.checkmark] for choosing one of the alternatives. -]) + #alternatives[call `#only` multiple times \u{2717}][use `#alternatives` function #sym.checkmark] for choosing one of the alternatives. + ], +) == Math Equation Animation @@ -94,8 +97,8 @@ use #only("2-")[`#only` function] for not reserving space, Equation with `pause`: $ - f(x) &= pause x^2 + 2x + 1 \ - &= pause (x + 1)^2 \ + f(x) &= pause x^2 + 2x + 1 \ + &= pause (x + 1)^2 \ $ #meanwhile @@ -113,18 +116,18 @@ CeTZ Animation in Touying: #cetz-canvas({ import cetz.draw: * - - rect((0,0), (5,5)) + + rect((0, 0), (5, 5)) (pause,) - rect((0,0), (1,1)) - rect((1,1), (2,2)) - rect((2,2), (3,3)) + rect((0, 0), (1, 1)) + rect((1, 1), (2, 2)) + rect((2, 2), (3, 3)) (pause,) - line((0,0), (2.5, 2.5), name: "line") + line((0, 0), (2.5, 2.5), name: "line") }) @@ -136,16 +139,16 @@ Fletcher Animation in Touying: node-stroke: .1em, node-fill: gradient.radial(blue.lighten(80%), blue, center: (30%, 20%), radius: 80%), spacing: 4em, - edge((-1,0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center), - node((0,0), `reading`, radius: 2em), - edge((0,0), (0,0), `read()`, "--|>", bend: 130deg), + edge((-1, 0), "r", "-|>", `open(path)`, label-pos: 0, label-side: center), + node((0, 0), `reading`, radius: 2em), + edge((0, 0), (0, 0), `read()`, "--|>", bend: 130deg), pause, edge(`read()`, "-|>"), - node((1,0), `eof`, radius: 2em), + node((1, 0), `eof`, radius: 2em), pause, edge(`close()`, "-|>"), - node((2,0), `closed`, radius: 2em, extrude: (-2.5, 0)), - edge((0,0), (2,0), `close()`, "-|>", bend: -40deg), + node((2, 0), `closed`, radius: 2em, extrude: (-2.5, 0)), + edge((0, 0), (2, 0), `close()`, "-|>", bend: -40deg), ) @@ -168,7 +171,7 @@ Fletcher Animation in Touying: #proof[ Suppose to the contrary that $p_1, p_2, dots, p_n$ is a finite enumeration of all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list, - it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. Since + it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. Since $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = 1$, a contradiction. ] diff --git a/examples/metropolis.typ b/examples/metropolis.typ index 68f21002..03c87daf 100644 --- a/examples/metropolis.typ +++ b/examples/metropolis.typ @@ -36,7 +36,7 @@ A slide without a title but with some *important* information. A slide with equation: -$ x_(n+1) = (x_n + a/x_n) / 2 $ +$ x_(n+1) = (x_n + a / x_n) / 2 $ #lorem(200) diff --git a/lib.typ b/lib.typ index 0ececc9d..c9922670 100644 --- a/lib.typ +++ b/lib.typ @@ -1,2 +1,43 @@ +/// // #image("https://github.com/user-attachments/assets/58a91b14-ae1a-49e2-a3e7-5e3a148e2ba5") +/// +/// #link("https://github.com/touying-typ/touying")[Touying] (投影 in chinese, /tóuyǐng/, meaning projection) is a user-friendly, powerful and efficient package for creating presentation slides in Typst. Partial code is inherited from #link("https://github.com/andreasKroepelin/polylux")[Polylux]. Therefore, some concepts and APIs remain consistent with Polylux. +/// +/// Touying provides automatically injected global configurations, which is convenient for configuring themes. Besides, Touying does not rely on `counter` and `context` to implement `#pause`, resulting in better performance. +/// +/// If you like it, consider #link("https://github.com/touying-typ/touying")[giving a star on GitHub]. Touying is a community-driven project, feel free to suggest any ideas and contribute. +/// +/// == Example +/// +/// Split slides by headings #link("https://touying-typ.github.io/docs/sections")[document] +/// +/// #example(``` +/// #import "@preview/touying:0.5.3": * +/// #import themes.dewdrop: * +/// +/// >>> #let is-dark = sys.inputs.at("x-color-theme", default: none) == "dark"; +/// >>> #let text-color = if is-dark { rgb("#c0caf5") } else { black }; +/// >>> +/// >>> #show: dewdrop-theme.with( +/// >>> aspect-ratio: "16-9", +/// >>> config-colors(neutral-lightest: none, neutral-darkest: text-color), +/// >>> ) +/// <<< #show: dewdrop-theme.with(aspect-ratio: "16-9") +/// +/// = Section +/// +/// == Subsection +/// +/// === Title +/// +/// Hello, Touying! +/// ```) +/// +/// == Example +/// +/// `#pause` and `#meanwhile` animations #link("https://touying-typ.github.io/docs/dynamic/simple")[document] +/// +/// #example(``` +/// ```) + #import "src/exports.typ": * #import "themes/themes.typ" \ No newline at end of file diff --git a/src/components.typ b/src/components.typ index 3e0df89f..5aba787d 100644 --- a/src/components.typ +++ b/src/components.typ @@ -14,11 +14,13 @@ /// /// Example: `side-by-side[a][b][c]` will display `a`, `b`, and `c` side by side. /// -/// - `columns` is the number of columns. Default is `auto`, which means the number of columns is equal to the number of bodies. +/// - columns (auto): The number of columns. Default is `auto`, which means the number of columns is equal to the number of bodies. /// -/// - `gutter` is the space between columns. Default is `1em`. +/// - gutter (length): The space between columns. Default is `1em`. /// -/// - `..bodies` is the contents to display side by side. +/// - bodies (content): The contents to display side by side. +/// +/// -> content #let side-by-side(columns: auto, gutter: 1em, ..bodies) = { let bodies = bodies.pos() if bodies.len() == 1 { @@ -37,15 +39,17 @@ /// /// Example: `components.adaptive-columns(outline())` /// -/// - `gutter` is the space between columns. +/// - gutter (length): The space between columns. +/// +/// - max-count (int): The maximum number of columns. /// -/// - `max-count` is the maximum number of columns. +/// - start (content): The content to place before the columns. /// -/// - `start` is the content to place before the columns. +/// - end (content): The content to place after the columns. /// -/// - `end` is the content to place after the columns. +/// - body (content): The content to place in the columns. /// -/// - `body` is the content to place in the columns. +/// -> content #let adaptive-columns(gutter: 4%, max-count: 3, start: none, end: none, body) = layout(size => { let n = calc.min( calc.ceil(measure(body).height / (size.height - measure(start).height - measure(end).height)), @@ -66,11 +70,13 @@ /// Touying progress bar. /// -/// - `primary` is the color of the progress bar. +/// - primary (color): The color of the progress bar. +/// +/// - secondary (color): The color of the background of the progress bar. /// -/// - `secondary` is the color of the background of the progress bar. +/// - height (length): The height of the progress bar, optional. Default is `2pt`. /// -/// - `height` is the height of the progress bar, optional. Default is `2pt`. +/// -> content #let progress-bar(height: 2pt, primary, secondary) = utils.touying-progress(ratio => { grid( columns: (ratio * 100%, 1fr), @@ -83,9 +89,11 @@ /// Left and right. /// -/// - `left` is the content of the left part. +/// - left (content): The content of the left part. /// -/// - `right` is the content of the right part. +/// - right (content): The content of the right part. +/// +/// -> content #let left-and-right(left, right) = grid( columns: (auto, 1fr, auto), left, none, right, @@ -103,6 +111,8 @@ /// - Check that there are enough rows and columns to fit in all the content blocks. /// /// That means that `#checkerboard[...][...]` stacks horizontally and `#checkerboard(columns: 1)[...][...]` stacks vertically. +/// +/// -> content #let checkerboard(columns: none, rows: none, ..bodies) = { let bodies = bodies.pos() let columns = if type(columns) == int { @@ -155,15 +165,17 @@ /// Show progressive outline. It will make other sections except the current section to be semi-transparent. /// -/// - `alpha` is the transparency of the other sections. Default is `60%`. +/// - alpha (ratio): The transparency of the other sections. Default is `60%`. /// -/// - `level` is the level of the outline. Default is `1`. +/// - level (int): The level of the outline. Default is `1`. /// -/// - `transform` is the transformation applied to the text of the outline. It should take the following arguments: +/// - transform (function): The transformation applied to the text of the outline. It should take the following arguments: /// -/// - `cover` is a boolean indicating whether the current entry should be covered. +/// - cover (boolean): Indicates whether the current entry should be covered. /// -/// - `..args` are the other arguments passed to the `progressive-outline`. +/// - args (content): The other arguments passed to the `progressive-outline`. +/// +/// -> content #let progressive-outline( alpha: 60%, level: 1, @@ -207,41 +219,43 @@ ) -/// Show a custom progressive outline. +/// Custom progressive outline function. +/// +/// - self (none): The self context. /// -/// - `self` is the self context. +/// - alpha (ratio): The transparency of the other headings. Default is `60%`. /// -/// - `alpha` is the transparency of the other headings. Default is `60%`. +/// - level (auto): The level of the outline. Default is `auto`. /// -/// - `level` is the level of the outline. Default is `auto`. +/// - numbered (array): Indicates whether the headings should be numbered. Default is `(false,)`. /// -/// - `numbered` is a boolean array indicating whether the headings should be numbered. Default is `false`. +/// - filled (array): Indicates whether the headings should be filled. Default is `(false,)`. /// -/// - `filled` is a boolean array indicating whether the headings should be filled. Default is `false`. +/// - paged (array): Indicates whether the headings should be paged. Default is `(false,)`. /// -/// - `paged` is a boolean array indicating whether the headings should be paged. Default is `false`. +/// - numbering (array): An array of numbering strings for the headings. Default is `()`. /// -/// - `numbering` is an array of numbering strings for the headings. Default is `()`. +/// - text-fill (array, none): An array of colors for the text fill of the headings. Default is `none`. /// -/// - `text-fill` is an array of colors for the text fill of the headings. Default is `none`. +/// - text-size (array, none): An array of sizes for the text of the headings. Default is `none`. /// -/// - `text-size` is an array of sizes for the text of the headings. Default is `none`. +/// - text-weight (array, none): An array of weights for the text of the headings. Default is `none`. /// -/// - `text-weight` is an array of weights for the text of the headings. Default is `none`. +/// - vspace (array, none): An array of vertical spaces above the headings. Default is `none`. /// -/// - `vspace` is an array of vertical spaces above the headings. Default is `none`. +/// - title (string, none): The title of the outline. Default is `none`. /// -/// - `title` is the title of the outline. Default is `none`. +/// - indent (array): An array of indentations for the headings. Default is `(0em,)`. /// -/// - `indent` is an array of indentations for the headings. Default is `(0em, )`. +/// - fill (array): An array of fills for the headings. Default is `(repeat[.],)`. /// -/// - `fill` is an array of fills for the headings. Default is `repeat[.]`. +/// - short-heading (boolean): Indicates whether the headings should be shortened. Default is `true`. /// -/// - `short-heading` is a boolean indicating whether the headings should be shortened. Default is `true`. +/// - uncover-fn (function): A function that takes the body of the heading and returns the body of the heading when it is uncovered. Default is the identity function. /// -/// - `uncover-fn` is a function that takes the body of the heading and returns the body of the heading when it is uncovered. Default is the identity function. +/// - args (content): The other arguments passed to the `progressive-outline` and `transform`. /// -/// - `..args` are the other arguments passed to the `progressive-outline` and `transform`. +/// -> content #let custom-progressive-outline( self: none, alpha: 60%, @@ -347,19 +361,23 @@ /// Show mini slides. It is usually used to show the navigation of the presentation in header. /// -/// - `self` is the self context, which is used to get the short heading of the headings. +/// - self (none): The self context, which is used to get the short heading of the headings. +/// +/// - fill (color): The fill color of the headings. Default is `rgb("000000")`. /// -/// - `fill` is the fill color of the headings. Default is `rgb("000000")`. +/// - alpha (ratio): The transparency of the headings. Default is `60%`. /// -/// - `alpha` is the transparency of the headings. Default is `60%`. +/// - display-section (boolean): Indicates whether the sections should be displayed. Default is `false`. /// -/// - `display-section` is a boolean indicating whether the sections should be displayed. Default is `false`. +/// - display-subsection (boolean): Indicates whether the subsections should be displayed. Default is `true`. /// -/// - `display-subsection` is a boolean indicating whether the subsections should be displayed. Default is `true`. +/// - linebreaks (boolean): Indicates whether or not to insert linebreaks between links for sections and subsections. /// -/// - `linebreaks` is a boolean indicating whether or not to insert linebreaks between links for sections and subsections +/// - display-subsection (boolean): Indicates whether the subsections should be displayed. Default is `true`. /// -/// - `short-heading` is a boolean indicating whether the headings should be shortened. Default is `true`. +/// - short-heading (boolean): Indicates whether the headings should be shortened. Default is `true`. +/// +/// -> content #let mini-slides( self: none, fill: rgb("000000"), @@ -470,7 +488,21 @@ ) - +/// Simple navigation. +/// +/// - self (none): The self context, which is used to get the short heading of the headings. +/// +/// - short-heading (boolean): Indicates whether the headings should be shortened. Default is `true`. +/// +/// - primary (color): The color of the current section. Default is `white`. +/// +/// - secondary (color): The color of the other sections. Default is `gray`. +/// +/// - background (color): The background color of the navigation. Default is `black`. +/// +/// - logo (none): The logo of the navigation. Default is `none`. +/// +/// -> content #let simple-navigation( self: none, short-heading: true, @@ -528,6 +560,10 @@ /// LaTeX-like knob marker for list /// /// Example: `#set list(marker: components.knob-marker(primary: rgb("005bac")))` +/// +/// - primary (color): The color of the marker. +/// +/// -> content #let knob-marker(primary: rgb("#005bac")) = box( width: 0.5em, place( diff --git a/src/configs.typ b/src/configs.typ index fd2248f7..78ff434d 100644 --- a/src/configs.typ +++ b/src/configs.typ @@ -89,106 +89,101 @@ /// The common configurations of the slides. /// -/// - `handout` (bool): Whether to enable the handout mode. It retains only the last subslide of each slide in handout mode. The default value is `false`. +/// - handout (boolean): Whether to enable the handout mode. It retains only the last subslide of each slide in handout mode. Default is `false`. /// -/// - `slide-level` (int): The level of the slides. The default value is `2`, which means the level 1 and 2 headings will be treated as slides. +/// - slide-level (int): The level of the slides. Default is `2`, which means the level 1 and 2 headings will be treated as slides. /// -/// - `slide-fn` (function): The function to create a new slide. +/// - slide-fn (function): The function to create a new slide. /// -/// - `new-section-slide-fn` (function): The function to create a new slide for a new section. The default value is `none`. +/// - new-section-slide-fn (function): The function to create a new slide for a new section. Default is `none`. /// -/// - `new-subsection-slide-fn` (function): The function to create a new slide for a new subsection. The default value is `none`. +/// - new-subsection-slide-fn (function): The function to create a new slide for a new subsection. Default is `none`. /// -/// - `new-subsubsection-slide-fn` (function): The function to create a new slide for a new subsubsection. The default value is `none`. +/// - new-subsubsection-slide-fn (function): The function to create a new slide for a new subsubsection. Default is `none`. /// -/// - `new-subsubsubsection-slide-fn` (function): The function to create a new slide for a new subsubsubsection. The default value is `none`. +/// - new-subsubsubsection-slide-fn (function): The function to create a new slide for a new subsubsubsection. Default is `none`. /// -/// - `receive-body-for-new-section-slide-fn` (bool): Whether to receive the body for the new section slide function. The default value is `true`. +/// - receive-body-for-new-section-slide-fn (boolean): Whether to receive the body for the new section slide function. Default is `true`. /// -/// - `receive-body-for-new-subsection-slide-fn` (bool): Whether to receive the body for the new subsection slide function. The default value is `true`. +/// - receive-body-for-new-subsection-slide-fn (boolean): Whether to receive the body for the new subsection slide function. Default is `true`. /// -/// - `receive-body-for-new-subsubsection-slide-fn` (bool): Whether to receive the body for the new subsubsection slide function. The default value is `true`. +/// - receive-body-for-new-subsubsection-slide-fn (boolean): Whether to receive the body for the new subsubsection slide function. Default is `true`. /// -/// - `receive-body-for-new-subsubsubsection-slide-fn` (bool): Whether to receive the body for the new subsubsubsection slide function. The default value is `true`. +/// - receive-body-for-new-subsubsubsection-slide-fn (boolean): Whether to receive the body for the new subsubsubsection slide function. Default is `true`. /// -/// - `show-strong-with-alert` (bool): Whether to show strong with alert. The default value is `true`. +/// - show-strong-with-alert (boolean): Whether to show strong with alert. Default is `true`. /// -/// - `datetime-format` (auto, string): The format of the datetime. The default value is `auto`. +/// - datetime-format (auto, string): The format of the datetime. Default is `auto`. /// -/// - `appendix` (bool): Is touying in the appendix mode. The last-slide-counter will be frozen in the appendix mode. The default value is `false`. +/// - appendix (boolean): Is touying in the appendix mode. The last-slide-counter will be frozen in the appendix mode. Default is `false`. /// -/// - `freeze-slide-counter` (bool): Whether to freeze the slide counter. The default value is `false`. +/// - freeze-slide-counter (boolean): Whether to freeze the slide counter. Default is `false`. /// -/// - `zero-margin-header` (bool): Whether to show the full header (with negative padding). The default value is `true`. +/// - zero-margin-header (boolean): Whether to show the full header (with negative padding). Default is `true`. /// -/// - `zero-margin-footer` (bool): Whether to show the full footer (with negative padding). The default value is `true`. +/// - zero-margin-footer (boolean): Whether to show the full footer (with negative padding). Default is `true`. /// -/// - `auto-offset-for-heading` (bool): Whether to add an offset relative to slide-level for headings. The default value is `true`. +/// - auto-offset-for-heading (boolean): Whether to add an offset relative to slide-level for headings. Default is `true`. /// -/// - `enable-pdfpc` (bool): Whether to add `` label for querying. The default value is `true`. +/// - enable-pdfpc (boolean): Whether to add `` label for querying. Default is `true`. /// /// You can export the .pdfpc file directly using: `typst query --root . ./example.typ --field value --one "" > ./example.pdfpc` /// -/// - `enable-mark-warning` (bool): Whether to enable the mark warning. The default value is `true`. +/// - enable-mark-warning (boolean): Whether to enable the mark warning. Default is `true`. /// -/// - `reset-page-counter-to-slide-counter` (bool): Whether to reset the page counter to the slide counter. The default value is `true`. +/// - reset-page-counter-to-slide-counter (boolean): Whether to reset the page counter to the slide counter. Default is `true`. /// -/// ------------------------------------------------------------ -/// The following configurations are some black magics for better slides writing, -/// maybe will be deprecated in the future. -/// ------------------------------------------------------------ +/// - show-notes-on-second-screen (none, alignment): Whether to show the speaker notes on the second screen. Default is `none`. /// -/// - `show-notes-on-second-screen` (none, alignment): Whether to show the speaker notes on the second screen. The default value is `none`. +/// Currently, the alignment can be `none`, `bottom`, and `right`. /// -/// Currently, the alignment can be `none`, `bottom` and `right`. -/// -/// - `horizontal-line-to-pagebreak` (bool): Whether to convert horizontal lines to page breaks. The default value is `true`. +/// - horizontal-line-to-pagebreak (boolean): Whether to convert horizontal lines to page breaks. Default is `true`. /// /// You can use markdown-like syntax `---` to divide slides. /// -/// - `reset-footnote-number-per-slide` (bool): Whether to reset the footnote number per slide. The default value is `true`. +/// - reset-footnote-number-per-slide (boolean): Whether to reset the footnote number per slide. Default is `true`. /// -/// - `nontight-list-enum-and-terms` (bool): Whether to make `tight` argument always be `false` for list, enum, and terms. The default value is `false`. +/// - nontight-list-enum-and-terms (boolean): Whether to make `tight` argument always be `false` for list, enum, and terms. Default is `false`. /// -/// - `align-list-marker-with-baseline` (bool): Whether to align the list marker with the baseline. The default value is `false`. +/// - align-list-marker-with-baseline (boolean): Whether to align the list marker with the baseline. Default is `false`. /// -/// - `align-enum-marker-with-baseline` (bool): Whether to align the enum marker with the baseline. The default value is `false`. It will only work when the enum item has a number like `1.`. +/// - align-enum-marker-with-baseline (boolean): Whether to align the enum marker with the baseline. Default is `false`. It will only work when the enum item has a number like `1.`. /// -/// - `scale-list-items` (none, float): Whether to scale the list items recursively. For example, `scale-list-items: 0.8` will scale the list items by 0.8. The default value is `none`. +/// - scale-list-items (none, float): Whether to scale the list items recursively. For example, `scale-list-items: 0.8` will scale the list items by 0.8. Default is `none`. /// -/// - `enable-frozen-states-and-counters` (bool): Whether to enable the frozen states and counters. It is useful for equations, figures and theorems. The default value is `true`. +/// - enable-frozen-states-and-counters (boolean): Whether to enable the frozen states and counters. It is useful for equations, figures, and theorems. Default is `true`. /// -/// - `show-hide-set-list-marker-none` (bool): Whether to set the list marker to none for hide function. The default value is `true`. +/// - show-hide-set-list-marker-none (boolean): Whether to set the list marker to none for hide function. Default is `true`. /// -/// - `show-bibliography-as-footnote` (bool): Whether to show the bibliography as footnote. The default value is `none`. +/// - show-bibliography-as-footnote (boolean): Whether to show the bibliography as footnote. Default is `none`. /// /// It receives a bibliography function like `bibliography(title: none, "ref.bib")`, or a dict like `(numbering: "[1]", bibliography: bibliography(title: none, "ref.bib"))`. /// -/// - `frozen-states` (array): The frozen states for the frozen states and counters. The default value is `()`. +/// - frozen-states (array): The frozen states for the frozen states and counters. Default is `()`. /// -/// - `default-frozen-states` (function): The default frozen states for the frozen states and counters. The default value is state for `ctheorems` package. +/// - default-frozen-states (function): The default frozen states for the frozen states and counters. Default is state for `ctheorems` package. /// -/// - `frozen-counters` (array): The frozen counters for the frozen states and counters. You can pass some counters like `(counter(math.equation),)`. The default value is `()`. +/// - frozen-counters (array): The frozen counters for the frozen states and counters. You can pass some counters like `(counter(math.equation),)`. Default is `()`. /// -/// - `default-frozen-counters` (array): The default frozen counters for the frozen states and counters. The default value is `(counter(math.equation), counter(figure.where(kind: table)), counter(figure.where(kind: image))`. +/// - default-frozen-counters (array): The default frozen counters for the frozen states and counters. The default value is `(counter(math.equation), counter(figure.where(kind: table)), counter(figure.where(kind: image)))`. /// -/// - `label-only-on-last-subslide` (array): We only label some contents in the last subslide, which is useful for ref equations, figures, and theorems with multiple subslides. The default value is `(figure, math.equation)`. +/// - label-only-on-last-subslide (array): We only label some contents in the last subslide, which is useful for ref equations, figures, and theorems with multiple subslides. Default is `(figure, math.equation)`. /// -/// - `preamble` (function): The function to run before each slide. The default value is `none`. +/// - preamble (function): The function to run before each slide. Default is `none`. /// -/// - `default-preamble` (function): The default preamble for each slide. The default value is a function to check the mark warning and add pdfpc file. +/// - default-preamble (function): The default preamble for each slide. Default is a function to check the mark warning and add pdfpc file. /// -/// - `slide-preamble` (function): The function to run before each slide. The default value is `none`. +/// - slide-preamble (function): The function to run before each slide. Default is `none`. /// -/// - `default-slide-preamble` (function): The default preamble for each slide. The default value is `none`. +/// - default-slide-preamble (function): The default preamble for each slide. Default is `none`. /// -/// - `subslide-preamble` (function): The function to run before each subslide. The default value is `none`. +/// - subslide-preamble (function): The function to run before each subslide. Default is `none`. /// -/// - `default-subslide-preamble` (function): The default preamble for each subslide. The default value is `none`. +/// - default-subslide-preamble (function): The default preamble for each subslide. Default is `none`. /// -/// - `page-preamble` (function): The function to run before each page. The default value is `none`. +/// - page-preamble (function): The function to run before each page. Default is `none`. /// -/// - `default-page-preamble` (function): The default preamble for each page. The default value is a function to reset the footnote number per slide and reset the page counter to the slide counter. +/// - default-page-preamble (function): The default preamble for each page. Default is a function to reset the footnote number per slide and reset the page counter to the slide counter. #let config-common( handout: _default, slide-level: _default, @@ -326,31 +321,31 @@ lbl.replace(regex("^[^:]*:"), "").replace("_", " ").replace("-", " "), ) -/// The configuration of the methods +/// The configuration of the methods. /// -/// - `init` (function): The function to initialize the presentation. It should be `(self: none, body) => { .. }`. +/// - init (function): The function to initialize the presentation. It should be `(self: none, body) => { .. }`. /// -/// - `cover` (function): The function to cover content. The default value is `utils.method-wrapper(hide)` function. +/// - cover (function): The function to cover content. The default value is `utils.method-wrapper(hide)` function. /// /// You can configure it with `cover: utils.semi-transparent-cover` to use the semi-transparent cover. /// -/// - `uncover` (function): The function to uncover content. The default value is `utils.uncover` function. +/// - uncover (function): The function to uncover content. The default value is `utils.uncover` function. /// -/// - `only` (function): The function to show only the content. The default value is `utils.only` function. +/// - only (function): The function to show only the content. The default value is `utils.only` function. /// -/// - `alternatives-match` (function): The function to match alternatives. The default value is `utils.alternatives-match` function. +/// - alternatives-match (function): The function to match alternatives. The default value is `utils.alternatives-match` function. /// -/// - `alternatives` (function): The function to show alternatives. The default value is `utils.alternatives` function. +/// - alternatives (function): The function to show alternatives. The default value is `utils.alternatives` function. /// -/// - `alternatives-fn` (function): The function to show alternatives with a function. The default value is `utils.alternatives-fn` function. +/// - alternatives-fn (function): The function to show alternatives with a function. The default value is `utils.alternatives-fn` function. /// -/// - `alternatives-cases` (function): The function to show alternatives with cases. The default value is `utils.alternatives-cases` function. +/// - alternatives-cases (function): The function to show alternatives with cases. The default value is `utils.alternatives-cases` function. /// -/// - `alert` (function): The function to alert the content. The default value is `utils.method-wrapper(text.with(weight: "bold"))` function. +/// - alert (function): The function to alert the content. The default value is `utils.method-wrapper(text.with(weight: "bold"))` function. /// -/// - `show-notes` (function): The function to show notes on second screen. It should be `(self: none, width: 0pt, height: 0pt) => { .. }` with core code `utils.current-slide-note` and `utils.slide-note-state.update(none)`. +/// - show-notes (function): The function to show notes on second screen. It should be `(self: none, width: 0pt, height: 0pt) => { .. }` with core code `utils.current-slide-note` and `utils.slide-note-state.update(none)`. /// -/// - `convert-label-to-short-heading` (function): The function to convert label to short heading. It is useful for the short heading for heading with label. It will be used in function with `short-heading`. +/// - convert-label-to-short-heading (function): The function to convert label to short heading. It is useful for the short heading for heading with label. It will be used in function with `short-heading`. /// /// The default value is `utils.titlecase(lbl.replace(regex("^[^:]*:"), "").replace("_", " ").replace("-", " "))`. /// @@ -395,7 +390,9 @@ /// The configuration of important information of the presentation. /// -/// #example(``` +/// Example: +/// +/// ```typst /// config-info( /// title: "Title", /// subtitle: "Subtitle", @@ -403,7 +400,7 @@ /// date: datetime.today(), /// institution: "Institution", /// ) -/// ```) +/// ``` /// /// - title (content): The title of the presentation, which will be displayed in the title slide. /// - short-title (content, auto): The short title of the presentation, which will be displayed in the footer of the slides usally. @@ -454,7 +451,9 @@ /// The configuration of the colors used in the theme. /// -/// #example(``` +/// Example: +/// +/// ```typst /// config-colors( /// primary: rgb("#04364A"), /// secondary: rgb("#176B87"), @@ -462,7 +461,7 @@ /// neutral: rgb("#303030"), /// neutral-darkest: rgb("#000000"), /// ) -/// ```) +/// ``` /// /// IMPORTANT: The colors should be defined in the *RGB* format at most cases. /// @@ -538,7 +537,9 @@ /// /// It is equivalent to the `#set page()` rule in Touying. /// -/// #example(``` +/// Example: +/// +/// ```typst /// config-page( /// paper: "presentation-16-9", /// header: none, @@ -546,7 +547,7 @@ /// fill: rgb("#ffffff"), /// margin: (x: 3em, y: 2.8em), /// ) -/// ```) +/// ``` /// /// - paper (string): A standard paper size to set width and height. The default value is "presentation-16-9". /// diff --git a/src/core.typ b/src/core.typ index 6a29db6e..b87627ce 100644 --- a/src/core.typ +++ b/src/core.typ @@ -7,6 +7,7 @@ /// Slides /// ------------------------------------------------ +/// -> content #let _delayed-wrapper(body) = utils.label-it( metadata((kind: "touying-delayed-wrapper", body: body)), "touying-temporary-mark", @@ -16,9 +17,11 @@ /// /// Example: `#let appendix(body) = touying-set-config((appendix: true), body)` and you can use `#show: appendix` to set the appendix for the presentation. /// -/// - `config` (dict): The new configurations for the presentation. +/// - config (dictionary): The new configurations for the presentation. /// -/// - `body` (content): The content of the slide. +/// - body (content): The content of the slide. +/// +/// -> content #let touying-set-config(config, body) = utils.label-it( metadata(( kind: "touying-set-config", @@ -33,18 +36,32 @@ /// /// Example: `#show: appendix` /// -/// - `body` (content): The content of the appendix. +/// - body (content): The content of the appendix. +/// +/// -> content #let appendix(body) = touying-set-config( (appendix: true), body, ) -/// Recall a slide by its label +/// Recall a slide by its label. +/// +/// == Example +/// +/// #example(```typ +/// // #touying-recall() +/// ```) +/// +/// == Example /// -/// Example: `#touying-recall()` or `#touying-recall("recall")` +/// #example(```typ +/// // #touying-recall("recall") +/// ```) +/// +/// - lbl (string): The label of the slide to recall /// -/// - `lbl` (str): The label of the slide to recall +/// -> content #let touying-recall(lbl) = utils.label-it( metadata(( kind: "touying-slide-recaller", @@ -117,6 +134,8 @@ /// Use headings to split a content block into slides +/// +/// -> content #let split-content-into-slides(self: none, recaller-map: (:), new-start: true, is-first-slide: false, body) = { // Extract arguments assert(type(self) == dictionary, message: "`self` must be a dictionary") @@ -414,15 +433,17 @@ /// /// Example: `#let alternatives = touying-fn-wrapper.with(utils.alternatives)` /// -/// - `fn` ((self: none, ..args) => { .. }): The function that will be called. +/// - fn (function): The function that will be called like `(self: none, ..args) => { .. }`. /// -/// - `last-subslide` (int): The max repetitions for the slide. It is useful for functions like `uncover`, `only` and `alternatives-match` that need to update the max repetitions for the slide. +/// - last-subslide (int): The max repetitions for the slide. It is useful for functions like `uncover`, `only` and `alternatives-match` that need to update the max repetitions for the slide. /// /// It is useful for functions like `uncover`, `only` and `alternatives-match` that need to update the max repetitions for the slide. /// -/// - `repetitions` (function): The repetitions for the function. It is useful for functions like `alternatives` with `start: auto`. +/// - repetitions (function): The repetitions for the function. It is useful for functions like `alternatives` with `start: auto`. /// /// It accepts a `(repetitions, args)` and should return a (nextrepetitions, extra-args). +/// +/// -> content #let touying-fn-wrapper(fn, last-subslide: none, repetitions: none, ..args) = utils.label-it( metadata(( kind: "touying-fn-wrapper", @@ -446,7 +467,9 @@ /// }) /// ``` /// -/// - `fn` (self => { .. }): The function that will be called with an argument `self`. +/// - fn (function): The function that will be called with an argument `self` like `self => { .. }`. +/// +/// -> content #let touying-slide-wrapper(fn) = utils.label-it( metadata(( kind: "touying-slide-wrapper", @@ -468,7 +491,7 @@ /// /// Example: `uncover("2-")[abc]` will display `[abc]` if the current slide is 2 or later /// -/// - `visible-subslides` is a single integer, an array of integers, +/// - visible-subslides (int, array, string): `visible-subslides` is a single integer, an array of integers, /// or a string that specifies the visible subslides /// /// Read [polylux book](https://polylux.dev/book/dynamic/complex.html) @@ -480,7 +503,9 @@ /// /// For example, "-2, 4, 6-8, 10-" means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. /// -/// - `uncover-cont` is the content to display when the content is visible in the subslide. +/// - uncover-cont (content): The content to display when the content is visible in the subslide. +/// +/// -> content #let uncover(visible-subslides, uncover-cont) = { touying-fn-wrapper( utils.uncover, @@ -494,7 +519,7 @@ /// Display content in some subslides only. /// Don't reserve space when hidden, content is completely not existing there. /// -/// - `visible-subslides` is a single integer, an array of integers, +/// - visible-subslides (int, array, string): `visible-subslides` is a single integer, an array of integers, /// or a string that specifies the visible subslides /// /// Read [polylux book](https://polylux.dev/book/dynamic/complex.html) @@ -506,7 +531,9 @@ /// /// For example, "-2, 4, 6-8, 10-" means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. /// -/// - `only-cont` is the content to display when the content is visible in the subslide. +/// - only-cont (content): The content to display when the content is visible in the subslide. +/// +/// -> content #let only(visible-subslides, only-cont) = { touying-fn-wrapper( utils.only, @@ -519,20 +546,24 @@ /// `#alternatives` has a couple of "cousins" that might be more convenient in some situations. The first one is `#alternatives-match` that has a name inspired by match-statements in many functional programming languages. The idea is that you give it a dictionary mapping from subslides to content: /// -/// #example(``` +/// Example: +/// +/// ```typst /// #alternatives-match(( /// "1, 3-5": [this text has the majority], /// "2, 6": [this is shown less often] /// )) -/// ```) +/// ``` /// -/// - `subslides-contents` is a dictionary mapping from subslides to content. +/// - subslides-contents (dictionary): A dictionary mapping from subslides to content. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// /// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-match(subslides-contents, position: bottom + left, stretch: true) = { touying-fn-wrapper( utils.alternatives-match, @@ -548,15 +579,17 @@ /// /// Example: `#alternatives[Ann][Bob][Christopher]` will show "Ann" in the first subslide, "Bob" in the second subslide, and "Christopher" in the third subslide. /// -/// - `start` is the starting subslide number. Default is `auto`. +/// - start (int): The starting subslide number. Default is `auto`. /// -/// - `repeat-last` is a boolean indicating whether the last subslide should be repeated. Default is `true`. +/// - repeat-last (boolean): A boolean indicating whether the last subslide should be repeated. Default is `true`. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// /// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives( start: auto, repeat-last: true, @@ -589,17 +622,19 @@ /// /// Example: `#alternatives-fn(start: 2, count: 7, subslide => { numbering("(i)", subslide) })` /// -/// - `start` is the starting subslide number. Default is `1`. +/// - start (int): The starting subslide number. Default is `1`. /// -/// - `end` is the ending subslide number. Default is `none`. +/// - end (none, int): The ending subslide number. Default is `none`. /// -/// - `count` is the number of subslides. Default is `none`. +/// - count (none, int): The number of subslides. Default is `none`. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// /// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-fn( start: 1, end: none, @@ -634,22 +669,26 @@ /// You can use this function if you want to have one piece of content that changes only slightly depending of what "case" of subslides you are in. /// -/// #example(``` +/// Example: +/// +/// ```typst /// #alternatives-cases(("1, 3", "2"), case => [ /// #set text(fill: teal) if case == 1 /// Some text /// ]) -/// ```) +/// ``` /// -/// - `cases` is an array of strings that specify the subslides for each case. +/// - cases (array): An array of strings that specify the subslides for each case. /// -/// - `fn` is a function that maps the case to content. The argument `case` is the index of the cases array you input. +/// - fn (function): A function that maps the case to content. The argument `case` is the index of the cases array you input. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// /// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-cases(cases, fn, position: bottom + left, stretch: true, ..kwargs) = { touying-fn-wrapper( utils.alternatives-cases, @@ -665,42 +704,54 @@ /// Speaker notes are a way to add additional information to your slides that is not visible to the audience. This can be useful for providing additional context or reminders to yourself. /// -/// Example: `#speaker-note[This is a speaker note]` +/// == Example +/// +/// #example(```typ +/// #speaker-note[This is a speaker note] +/// ```) +/// +/// - self (none): The current context. /// -/// - `self` is the current context. +/// - mode (string): The mode of the markup text, either `typ` or `md`. Default is `typ`. /// -/// - `mode` is the mode of the markup text, either `typ` or `md`. Default is `typ`. +/// - setting (function): A function that takes the note as input and returns a processed note. /// -/// - `setting` is a function that takes the note as input and returns a processed note. +/// - note (content): The content of the speaker note. /// -/// - `note` is the content of the speaker note. +/// -> content #let speaker-note(mode: "typ", setting: it => it, note) = { touying-fn-wrapper(utils.speaker-note, mode: mode, setting: setting, note) } /// Alert is a way to display a message to the audience. It can be used to draw attention to important information or to provide instructions. +/// +/// -> content #let alert(body) = touying-fn-wrapper(utils.alert, body) /// Touying also provides a unique and highly useful feature—math equation animations, allowing you to conveniently use pause and meanwhile within math equations. /// -/// #example(``` +/// Example: +/// +/// ```typst /// #touying-equation(` /// f(x) &= pause x^2 + 2x + 1 \ /// &= pause (x + 1)^2 \ /// `) -/// ```) +/// ``` /// -/// - `block` is a boolean indicating whether the equation is a block. Default is `true`. +/// - block (boolean): A boolean indicating whether the equation is a block. Default is `true`. /// -/// - `numbering` is the numbering of the equation. Default is `none`. +/// - numbering (none, string): The numbering of the equation. Default is `none`. /// -/// - `supplement` is the supplement of the equation. Default is `auto`. +/// - supplement (string): The supplement of the equation. Default is `auto`. /// -/// - `scope` is the scope when we use `eval()` function to evaluate the equation. +/// - scope (dictionary): The scope when we use `eval()` function to evaluate the equation. /// -/// - `body` is the content of the equation. It should be a string, a raw text or a function that receives `self` as an argument and returns a string. +/// - body (string, content, function): The content of the equation. It should be a string, a raw text, or a function that receives `self` as an argument and returns a string. +/// +/// -> content #let touying-equation(block: true, numbering: none, supplement: auto, scope: (:), body) = utils.label-it( metadata(( kind: "touying-equation", @@ -727,22 +778,26 @@ /// Touying can integrate with `mitex` to display math equations. /// You can use `#touying-mitex` to display math equations with pause and meanwhile. /// -/// #example(``` +/// Example: +/// +/// ```typst /// #touying-mitex(mitex, ` /// f(x) &= \pause x^2 + 2x + 1 \\ /// &= \pause (x + 1)^2 \\ /// `) -/// ```) +/// ``` /// -/// - `mitex` is the mitex function. You can import it by code like `#import "@preview/mitex:0.2.3": mitex` +/// - mitex (function): The mitex function. You can import it by code like `#import "@preview/mitex:0.2.3": mitex`. /// -/// - `block` is a boolean indicating whether the equation is a block. Default is `true`. +/// - block (boolean): A boolean indicating whether the equation is a block. Default is `true`. /// -/// - `numbering` is the numbering of the equation. Default is `none`. +/// - numbering (none, string): The numbering of the equation. Default is `none`. /// -/// - `supplement` is the supplement of the equation. Default is `auto`. +/// - supplement (string): The supplement of the equation. Default is `auto`. /// -/// - `body` is the content of the equation. It should be a string, a raw text or a function that receives `self` as an argument and returns a string. +/// - body (string, content, function): The content of the equation. It should be a string, a raw text, or a function that receives `self` as an argument and returns a string. +/// +/// -> content #let touying-mitex(block: true, numbering: none, supplement: auto, mitex, body) = utils.label( metadata(( kind: "touying-mitex", @@ -774,11 +829,13 @@ /// /// Fletcher: `#let fletcher-diagram = touying-reducer.with(reduce: fletcher.diagram, cover: fletcher.hide)` /// -/// - `reduce` is the reduce function that will be called. It is usually a function that receives an array of content and returns a content it painted. Just like the `cetz.canvas` or `fletcher.diagram` function. +/// - reduce (function): The reduce function that will be called. It is usually a function that receives an array of content and returns the content it painted. Just like the `cetz.canvas` or `fletcher.diagram` function. +/// +/// - cover (function): The cover function that will be called when some content is hidden. It is usually a function that receives the argument of the content that will be hidden. Just like the `cetz.draw.hide` or `fletcher.hide` function. /// -/// - `cover` is the cover function that will be called when some content is hidden. It is usually a function that receives an the argument of the content that will be hidden. Just like the `cetz.draw.hide` or `fletcher.hide` function. +/// - args (array): The arguments of the reducer function. /// -/// - `..args` is the arguments of the reducer function. +/// -> content #let touying-reducer(reduce: arr => arr.sum(), cover: arr => none, ..args) = utils.label-it( metadata(( kind: "touying-reducer", @@ -1547,27 +1604,29 @@ /// }) /// ``` /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function | array): The composer of the slide. You can use it to set the layout of the slide. /// -/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. +/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// /// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function. /// /// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns. /// -/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]] will make the `Footer` cell take 2 columns. +/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns. /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// +/// -> content #let touying-slide( self: none, config: (:), @@ -1755,27 +1814,29 @@ /// Touying slide function. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dict): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function | array): The composer of the slide. You can use it to set the layout of the slide. /// -/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. +/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// /// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function. /// /// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns. /// -/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]] will make the `Footer` cell take 2 columns. +/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns. /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// +/// -> content #let slide( config: (:), repeat: auto, @@ -1789,27 +1850,29 @@ /// Touying empty slide function. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dict): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function | array): The composer of the slide. You can use it to set the layout of the slide. /// -/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. +/// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// /// If you pass a non-function value like `(1fr, 2fr, 1fr)`, it will be assumed to be the first argument of the `components.side-by-side` function. /// /// The `components.side-by-side` function is a simple wrapper of the `grid` function. It means you can use the `grid.cell(colspan: 2, ..)` to make the cell take 2 columns. /// -/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]] will make the `Footer` cell take 2 columns. +/// For example, `#slide(composer: 2)[A][B][#grid.cell(colspan: 2)[Footer]]` will make the `Footer` cell take 2 columns. /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// +/// -> content #let empty-slide( config: (:), repeat: auto, diff --git a/src/exports.typ b/src/exports.typ index e32bfd74..cd6c26b3 100644 --- a/src/exports.typ +++ b/src/exports.typ @@ -1,6 +1,36 @@ -#import "core.typ": pause, meanwhile, uncover, only, alternatives-match, alternatives, alternatives-fn, alternatives-cases, slide, empty-slide, touying-slide, touying-fn-wrapper, touying-slide-wrapper, touying-equation, touying-mitex, touying-reducer, appendix, touying-set-config, touying-recall, speaker-note, alert +#import "core.typ": ( + pause, + meanwhile, + uncover, + only, + alternatives-match, + alternatives, + alternatives-fn, + alternatives-cases, + slide, + empty-slide, + touying-slide, + touying-fn-wrapper, + touying-slide-wrapper, + touying-equation, + touying-mitex, + touying-reducer, + appendix, + touying-set-config, + touying-recall, + speaker-note, + alert, +) +#import "configs.typ": ( + config-colors, + config-common, + config-info, + config-methods, + config-page, + config-store, + default-config, +) #import "slides.typ": touying-slides -#import "configs.typ": config-colors, config-common, config-info, config-methods, config-page, config-store, default-config #import "utils.typ" #import "magic.typ" #import "pdfpc.typ" diff --git a/src/magic.typ b/src/magic.typ index dbe6540a..3858909b 100644 --- a/src/magic.typ +++ b/src/magic.typ @@ -6,6 +6,8 @@ /// Align the list marker with the baseline of the first line of the list item. /// /// Usage: `#show: align-list-marker-with-baseline` +/// +/// -> content #let align-list-marker-with-baseline(body) = { show list.item: it => { let current-marker = { @@ -37,6 +39,8 @@ /// Align the enum marker with the baseline of the first line of the enum item. It will only work when the enum item has a number like `1.`. /// /// Usage: `#show: align-enum-marker-with-baseline` +/// +/// -> content #let align-enum-marker-with-baseline(body) = { let counting-symbols = "1aAiI一壹あいアイא가ㄱ*" let consume-regex = regex("[^" + counting-symbols + "]*[" + counting-symbols + "][^" + counting-symbols + "]*") @@ -72,7 +76,9 @@ /// /// Usage: `#show: scale-list-items.with(scale: .75)` /// -/// - `scale` (number): The ratio of the font size of the current level to the font size of the upper level. +/// - scale (int, float): The ratio of the font size of the current level to the font size of the upper level. +/// +/// -> content #let scale-list-items( scale: .75, body, @@ -87,6 +93,8 @@ /// Make the list, enum, or terms nontight by default. /// /// Usage: `#show list: nontight(list)` +/// +/// -> content #let nontight(lst) = { let fields = lst.fields() fields.remove("children") @@ -97,6 +105,8 @@ /// Make the list, enum, and terms nontight by default. /// /// Usage: `#show: nontight-list-enum-and-terms` +/// +/// -> content #let nontight-list-enum-and-terms(body) = { show list.where(tight: true): nontight show enum.where(tight: true): nontight @@ -107,6 +117,8 @@ /// Set the list marker to none for hide function. /// /// Usage: `#show: show-hide-set-list-marker-none` +/// +/// -> content #let show-hide-set-list-marker-none(body) = { show hide: it => { set list(marker: none) @@ -129,6 +141,8 @@ #let bibliography-visited = state("footer-bibliography-visited", ()) /// Record the bibliography items. +/// +/// -> content #let record-bibliography(bibliography) = { show grid: it => { bibliography-state.update( @@ -147,26 +161,30 @@ /// - record (boolean): Record the bibliography items or not. If you set it to false, you must call `#record-bibliography(bibliography)` by yourself. /// /// - bibliography (bibliography): The bibliography argument. You should use the `bibliography` function to define the bibliography like `bibliography("ref.bib")`. +/// +/// -> content #let bibliography-as-footnote(numbering: "[1]", record: true, bibliography, body) = { - show cite: it => context { - if it.key not in bibliography-visited.get() { - box({ - place(hide(it)) - context { - let bibitem = bibliography-state.final().at(bibliography-counter.get().at(0)) - footnote(numbering: numbering, bibitem) - bibliography-map.update(map => { - map.insert(str(it.key), bibitem) - map - }) - } - bibliography-counter.step() - bibliography-visited.update(visited => visited + (it.key,)) - }) - } else { - footnote(numbering: numbering, context bibliography-map.final().at(str(it.key))) + show cite: it => ( + context { + if it.key not in bibliography-visited.get() { + box({ + place(hide(it)) + context { + let bibitem = bibliography-state.final().at(bibliography-counter.get().at(0)) + footnote(numbering: numbering, bibitem) + bibliography-map.update(map => { + map.insert(str(it.key), bibitem) + map + }) + } + bibliography-counter.step() + bibliography-visited.update(visited => visited + (it.key,)) + }) + } else { + footnote(numbering: numbering, context bibliography-map.final().at(str(it.key))) + } } - } + ) // Record the bibliography items. if record { @@ -181,6 +199,8 @@ /// You can avoid `multiple bibliographies are not yet supported` error by using this function. /// /// Usage: `#magic.bibliography()` +/// +/// -> content #let bibliography(title: auto) = { context { let title = title diff --git a/src/pdfpc.typ b/src/pdfpc.typ index 1ef47571..50c4a0c2 100644 --- a/src/pdfpc.typ +++ b/src/pdfpc.typ @@ -1,6 +1,9 @@ // Attribution: This file is based on the code from https://github.com/andreasKroepelin/polylux/blob/main/utils/pdfpc.typ // Author: Andreas Kröpelin +/// Generate a pdfpc file for the presentation. +/// +/// -> content #let pdfpc-file(loc) = { let arr = query().map(it => it.value) let (config, ..slides) = arr.split((t: "NewSlide")) @@ -51,6 +54,8 @@ } /// Add some speaker notes to the slide for exporting to pdfpc file. +/// +/// -> content #let speaker-note(text) = { let text = if type(text) == str { text @@ -97,19 +102,21 @@ /// ) /// ``` /// -/// - `duration-minutes` is the duration of the presentation in minutes. +/// - duration-minutes (int): The duration of the presentation in minutes. +/// +/// - start-time (datetime): The start time of the presentation. /// -/// - `start-time` is the start time of the presentation. +/// - end-time (datetime): The end time of the presentation. /// -/// - `end-time` is the end time of the presentation. +/// - last-minutes (int): The number of minutes to show the last slide. /// -/// - `last-minutes` is the number of minutes to show the last slide. +/// - note-font-size (float): The font size of the speaker notes. /// -/// - `note-font-size` is the font size of the speaker notes. +/// - disable-markdown (bool): A flag to disable markdown in the speaker notes. /// -/// - `disable-markdown` is a flag to disable markdown in the speaker notes. +/// - default-transition (string): The default transition for the slides. /// -/// - `default-transition` is the default transition for the slides. +/// -> content #let config( duration-minutes: none, start-time: none, @@ -167,15 +174,12 @@ } let transition-str = ( - default-transition.at("type", default: "replace") - + ":" + - str(default-transition.at("duration-seconds", default: 1)) - + ":" + - dir-to-angle(default-transition.at("angle", default: rtl)) - + ":" + - default-transition.at("alignment", default: "horizontal") - + ":" + - default-transition.at("direction", default: "outward") + default-transition.at("type", default: "replace") + ":" + str( + default-transition.at("duration-seconds", default: 1), + ) + ":" + dir-to-angle(default-transition.at("angle", default: rtl)) + ":" + default-transition.at( + "alignment", + default: "horizontal", + ) + ":" + default-transition.at("direction", default: "outward") ) [ #metadata((t: "DefaultTransition", v: transition-str)) ] diff --git a/src/slides.typ b/src/slides.typ index aa372212..3c2c56e4 100644 --- a/src/slides.typ +++ b/src/slides.typ @@ -5,7 +5,9 @@ /// Touying slides function. /// -/// #example(``` +/// Example: +/// +/// ```typst /// #show: touying-slides.with( /// config-page(paper: "presentation-" + aspect-ratio), /// config-common( @@ -13,11 +15,13 @@ /// ), /// ..args, /// ) -/// ```) +/// ``` +/// +/// - args (arguments): The configurations of the slides. For example, you can use `config-page(paper: "presentation-16-9")` to set the aspect ratio of the slides. /// -/// `..args` is the configurations of the slides. For example, you can use `config-page(paper: "presentation-16-9")` to set the aspect ratio of the slides. +/// - body (content): The contents of the slides. /// -/// `body` is the contents of the slides. +/// -> content #let touying-slides(..args, body) = { // get the default config let args = (configs.default-config,) + args.pos() @@ -56,19 +60,19 @@ } show: body => { - if self.at("align-enum-marker-with-baseline", default: false) { - magic.align-enum-marker-with-baseline(body) - } else { - body - } + if self.at("align-enum-marker-with-baseline", default: false) { + magic.align-enum-marker-with-baseline(body) + } else { + body + } } show: body => { - if self.at("align-list-marker-with-baseline", default: false) { - magic.align-list-marker-with-baseline(body) - } else { - body - } + if self.at("align-list-marker-with-baseline", default: false) { + magic.align-list-marker-with-baseline(body) + } else { + body + } } show: body => { diff --git a/src/utils.typ b/src/utils.typ index 8ff7a283..439a9743 100644 --- a/src/utils.typ +++ b/src/utils.typ @@ -5,6 +5,8 @@ /// Add a dictionary to another dictionary recursively /// /// Example: `add-dicts((a: (b: 1), (a: (c: 2))` returns `(a: (b: 1, c: 2)` +/// +/// -> dictionary #let add-dicts(dict-a, dict-b) = { let res = dict-a for key in dict-b.keys() { @@ -21,6 +23,8 @@ /// Merge some dictionaries recursively /// /// Example: `merge-dicts((a: (b: 1)), (a: (c: 2)))` returns `(a: (b: 1, c: 2))` +/// +/// -> dictionary #let merge-dicts(init-dict, ..dicts) = { assert(dicts.named().len() == 0, message: "You must provide dictionaries as positional arguments") let res = init-dict @@ -39,7 +43,9 @@ /// Get the progress of the current slide. /// -/// - `callback` is the callback function `ratio => { .. }` to get the progress of the current slide. The `ratio` is a float number between 0 and 1. +/// - callback (function): The callback function `ratio => { .. }` to get the progress of the current slide. The `ratio` is a float number between 0 and 1. +/// +/// -> content #let touying-progress(callback) = ( context { if last-slide-counter.final().first() == 0 { @@ -67,9 +73,15 @@ /// Remove leading and trailing empty elements from an array of content /// -/// - `empty-contents` is a array of content that is considered empty -/// /// Example: `trim(([], [ ], parbreak(), linebreak(), [a], [ ], [b], [c], linebreak(), parbreak(), [ ], [ ]))` returns `([a], [ ], [b], [c])` +/// +/// #let arr = `array(content)` +/// +/// - arr (arr): The array of content to trim +/// +/// - empty-contents (array): An array of content that is considered empty +/// +/// -> content #let trim(arr, empty-contents: ([], [ ], parbreak(), linebreak())) = { let i = 0 let j = arr.len() - 1 @@ -87,9 +99,11 @@ /// /// Example: `label-it("key", [a])` is equivalent to `[a ]` /// -/// - `it` is the content to label +/// - it (content): The content to label. /// -/// - `label-name` is the name of the label, or a label +/// - label-name (string, label): The name of the label, or a label. +/// +/// -> content #let label-it(it, label-name) = { if type(label-name) == label { [#it#label-name] @@ -99,17 +113,19 @@ } } -/// Reconstruct a content with a new body +/// Reconstruct a content with a new body. /// -/// - `body-name` is the property name of the body field +/// - body-name (string): The property name of the body field. /// -/// - `labeled` is a boolean indicating whether the fields should be labeled +/// - labeled (boolean): Indicates whether the fields should be labeled. /// -/// - `named` is a boolean indicating whether the fields should be named +/// - named (boolean): Indicates whether the fields should be named. /// -/// - `it` is the content to reconstruct +/// - it (content): The content to reconstruct. +/// +/// - new-body (content): The new body you want to replace the old body with. /// -/// - `new-body` is the new body you want to replace the old body with +/// -> content #let reconstruct(body-name: "body", labeled: true, named: false, it, ..new-body) = { let fields = it.fields() let label = fields.remove("label", default: none) @@ -130,13 +146,15 @@ } -/// Reconstruct a table-like content with new children +/// Reconstruct a table-like content with new children. /// /// - `named` is a boolean indicating whether the fields should be named /// /// - `it` is the content to reconstruct /// /// - `new-children` is the new children you want to replace the old children with +/// +/// -> content #let reconstruct-table-like(named: true, labeled: true, it, new-children) = { reconstruct(body-name: "children", named: named, labeled: labeled, it, ..new-children) } @@ -144,9 +162,11 @@ #let typst-builtin-sequence = ([A] + [ ] + [B]).func() -/// Determine if a content is a sequence +/// Determine if a content is a sequence. /// /// Example: `is-sequence([a])` returns `true` +/// +/// -> bool #let is-sequence(it) = { type(it) == content and it.func() == typst-builtin-sequence } @@ -154,45 +174,57 @@ #let typst-builtin-styled = [#set text(fill: red)].func() -/// Determine if a content is styled +/// Determine if a content is styled. /// /// Example: `is-styled(text(fill: red)[Red])` returns `true` +/// +/// -> bool #let is-styled(it) = { type(it) == content and it.func() == typst-builtin-styled } -/// Reconstruct a styled content with a new body +/// Reconstruct a styled content with a new body. /// -/// - `it` is the content to reconstruct +/// - it (content): The content to reconstruct. /// -/// - `new-child` is the new child you want to replace the old body with +/// - new-child (content): The new child you want to replace the old body with. +/// +/// -> content #let reconstruct-styled(it, new-child) = { typst-builtin-styled(new-child, it.styles) } -/// Determine if a content is a metadata +/// Determine if a content is a metadata. /// /// Example: `is-metadata(metadata((a: 1)))` returns `true` +/// +/// -> bool #let is-metadata(it) = { type(it) == content and it.func() == metadata } -/// Determine if a content is a metadata with a specific kind +/// Determine if a content is a metadata with a specific kind. +/// +/// -> bool #let is-kind(it, kind) = { is-metadata(it) and type(it.value) == dictionary and it.value.at("kind", default: none) == kind } -/// Determine if a content is a heading in a specific depth +/// Determine if a content is a heading in a specific depth. +/// +/// -> bool #let is-heading(it, depth: 9999) = { type(it) == content and it.func() == heading and it.depth <= depth } -/// Call a `self => {..}` function and return the result, or just return the content +/// Call a `self => {..}` function and return the result, or just return the content. +/// +/// -> content #let call-or-display(self, it) = { if type(it) == function { it = it(self) @@ -201,16 +233,18 @@ } -/// Wrap a function with a `self` parameter to make it a method +/// Wrap a function with a `self` parameter to make it a method. /// -/// Example: `#let hide = method-wrapper(hide)` to get a `hide` method +/// Example: `#let hide = method-wrapper(hide)` to get a `hide` method. #let method-wrapper(fn) = (self: none, ..args) => fn(..args) /// Assuming all functions in dictionary have a named `self` parameter, -/// `methods` function is used to get all methods in dictionary object +/// `methods` function is used to get all methods in dictionary object. /// /// Example: `#let (uncover, only) = utils.methods(self)` to get `uncover` and `only` methods. +/// +/// -> dictionary #let methods(self) = { assert(type(self) == dictionary, message: "self must be a dictionary") assert("methods" in self and type(self.methods) == dictionary, message: "self.methods must be a dictionary") @@ -230,6 +264,10 @@ /// Capitalize a string +/// +/// - s (str): The string to convert. +/// +/// -> str #let capitalize(s) = { assert(type(s) == str, message: "s must be a string") if s.len() == 0 { @@ -241,6 +279,10 @@ /// Convert a string into title case +/// +/// - s (str): The string to convert. +/// +/// -> str #let titlecase(s) = { assert(type(s) == str, message: "s must be a string") if s.len() == 0 { @@ -252,7 +294,9 @@ /// Convert a heading with label to short form /// -/// - `it` is the heading +/// - it (str): The heading. +/// +/// -> str #let short-heading(self: none, it) = { if it == none { return @@ -274,13 +318,15 @@ } -/// Get the current heading On or before the current page. +/// Get the current heading on or before the current page. +/// +/// - level (int, auto): The level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. /// -/// - `level` is the level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. +/// - hierachical (boolean): A value to indicate whether to return the heading hierarchically. If `hierachical` is `true`, it will return the last heading according to the hierarchical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. /// -/// - `hierachical` is a boolean value to indicate whether to return the heading hierachically. If `hierachical` is `true`, it will return the last heading according to the hierachical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. +/// - depth (int): The maximum depth of the heading to search. Usually, it should be set as slide-level. /// -/// - `depth` is the maximum depth of the heading to search. Usually, it should be set as slide-level. +/// -> content #let current-heading(level: auto, hierachical: true, depth: 9999) = { let current-page = here().page() if not hierachical and level != auto { @@ -310,18 +356,19 @@ /// Display the current heading on the page. /// -/// - `level` is the level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. +/// - level (int, auto): The level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. /// -/// - `numbered` is a boolean value to indicate whether to display the numbering of the heading. Default is `true`. +/// - numbered (boolean): A value to indicate whether to display the numbering of the heading. Default is `true`. /// -/// - `hierachical` is a boolean value to indicate whether to return the heading hierachically. If `hierachical` is `true`, it will return the last heading according to the hierachical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. +/// - hierachical (boolean): A value to indicate whether to return the heading hierarchically. If `hierachical` is `true`, it will return the last heading according to the hierarchical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. /// -/// - `depth` is the maximum depth of the heading to search. Usually, it should be set as slide-level. +/// - depth (int): The maximum depth of the heading to search. Usually, it should be set as slide-level. /// -/// - `setting` is the setting of the heading. Default is `body => body`. +/// - setting (function): The setting of the heading. Default is `body => body`. /// -/// - `style` is the style of the heading. If `style` is a function, it will use the function to style the heading. -/// For example, `style: current-heading => current-heading.body`. +/// - style (function): The style of the heading. If `style` is a function, it will use the function to style the heading. For example, `style: current-heading => current-heading.body`. +/// +/// -> content #let display-current-heading( self: none, level: auto, @@ -353,13 +400,15 @@ /// Display the current heading number on the page. /// -/// - `level` is the level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. +/// - level (int, auto): The level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. +/// +/// - numbering (string, auto): The numbering of the heading. If `numbering` is `auto`, it will use the numbering of the heading. If `numbering` is a string, it will use the string as the numbering. /// -/// - `numbering` is the numbering of the heading. If `numbering` is `auto`, it will use the numbering of the heading. If `numbering` is a string, it will use the string as the numbering. +/// - hierachical (boolean): A value to indicate whether to return the heading hierarchically. If `hierachical` is `true`, it will return the last heading according to the hierarchical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. /// -/// - `hierachical` is a boolean value to indicate whether to return the heading hierachically. If `hierachical` is `true`, it will return the last heading according to the hierachical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. +/// - depth (int): The maximum depth of the heading to search. Usually, it should be set as slide-level. /// -/// - `depth` is the maximum depth of the heading to search. Usually, it should be set as slide-level. +/// -> content #let display-current-heading-number(level: auto, numbering: auto, hierachical: true, depth: 9999) = ( context { let current-heading = current-heading(level: level, hierachical: hierachical, depth: depth) @@ -374,13 +423,15 @@ /// Display the current short heading on the page. /// -/// - `level` is the level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. +/// - level (int, auto): The level of the heading. If `level` is `auto`, it will return the last heading on or before the current page. If `level` is a number, it will return the last heading on or before the current page with the same level. /// -/// - `hierachical` is a boolean value to indicate whether to return the heading hierachically. If `hierachical` is `true`, it will return the last heading according to the hierachical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. +/// - hierachical (boolean): A value to indicate whether to return the heading hierarchically. If `hierachical` is `true`, it will return the last heading according to the hierarchical structure. If `hierachical` is `false`, it will return the last heading on or before the current page with the same level. /// -/// - `depth` is the maximum depth of the heading to search. Usually, it should be set as slide-level. +/// - depth (int): The maximum depth of the heading to search. Usually, it should be set as slide-level. /// -/// - `sty` is the style of the heading. If `sty` is a function, it will use the function to style the heading. For example, `sty: current-heading => current-heading.body`. +/// - sty (function): The style of the heading. If `sty` is a function, it will use the function to style the heading. For example, `sty: current-heading => current-heading.body`. +/// +/// -> content #let display-current-short-heading( self: none, level: auto, @@ -406,6 +457,8 @@ /// Display the date of `self.info.date` with `self.datetime-format` format. +/// +/// -> str #let display-info-date(self) = { assert("info" in self, message: "self must have an info field") if type(self.info.date) == datetime { @@ -419,11 +472,15 @@ /// Convert content to markup text, partly from /// [typst-examples-book](https://sitandr.github.io/typst-examples-book/book/typstonomicon/extract_markup_text.html). /// -/// - `it` is the content to convert. +/// #let mode = `str or "typ" or "md"` /// -/// - `mode` is the mode of the markup text, either `typ` or `md`. +/// - it (content, str): The content to convert. /// -/// - `indent` is the number of spaces to indent, default is `0`. +/// - mode (str, mode): The mode of the markup text, either `typ` or `md`. +/// +/// - indent (int): The number of spaces to indent. Default is `0`. +/// +/// -> str #let markup-text(it, mode: "typ", indent: 0) = { assert(mode == "typ" or mode == "md", message: "mode must be 'typ' or 'md'") let indent-markup-text = markup-text.with(mode: mode, indent: indent + 2) @@ -528,17 +585,19 @@ /// /// Example: `#utils.fit-to-height(1fr)[BIG]` /// -/// - `width` will determine the width of the content after scaling. So, if you want the scaled content to fill half of the slide width, you can use width: 50%. +/// - width (length, fraction, relative): Will determine the width of the content after scaling. So, if you want the scaled content to fill half of the slide width, you can use `width: 50%`. /// -/// - `prescale-width` allows you to make typst's layout assume that the given content is to be laid out in a container of a certain width before scaling. For example, you can use `prescale-width: 200%` assuming the slide's width is twice the original. +/// - prescale-width (length, fraction, relative): Allows you to make Typst's layout assume that the given content is to be laid out in a container of a certain width before scaling. For example, you can use `prescale-width: 200%` assuming the slide's width is twice the original. /// -/// - `grow` is a boolean indicating whether the content should be scaled up if it is smaller than the available height. Default is `true`. +/// - grow (boolean): Indicates whether the content should be scaled up if it is smaller than the available height. Default is `true`. /// -/// - `shrink` is a boolean indicating whether the content should be scaled down if it is larger than the available height. Default is `true`. +/// - shrink (boolean): Indicates whether the content should be scaled down if it is larger than the available height. Default is `true`. /// -/// - `height` is the height to fit the content to. +/// - height (length): The height to fit the content to. /// -/// - `body` is the content to fit. +/// - body (content): The content to fit. +/// +/// -> content #let fit-to-height( width: none, prescale-width: none, @@ -631,13 +690,15 @@ /// /// Example: `#utils.fit-to-width(1fr)[BIG]` /// -/// - `grow` is a boolean indicating whether the content should be scaled up if it is smaller than the available width. Default is `true`. +/// - grow (boolean): Indicates whether the content should be scaled up if it is smaller than the available width. Default is `true`. +/// +/// - shrink (boolean): Indicates whether the content should be scaled down if it is larger than the available width. Default is `true`. /// -/// - `shrink` is a boolean indicating whether the content should be scaled down if it is larger than the available width. Default is `true`. +/// - width (length, fraction, relative): The width to fit the content to. /// -/// - `width` is the width to fit the content to. +/// - body (content): The content to fit. /// -/// - `body` is the content to fit. +/// -> content #let fit-to-width(grow: true, shrink: true, width, content) = { layout(layout-size => { let content-size = measure(content) @@ -666,13 +727,15 @@ /// /// Example: `#utils.cover-with-rect(fill: "red")[Hidden]` /// -/// - `cover-args` are the arguments to pass to the rectangle. +/// - cover-args (args): The arguments to pass to the rectangle. /// -/// - `fill` is the color to fill the rectangle with. +/// - fill (color): The color to fill the rectangle with. /// -/// - `inline` is a boolean indicating whether the content should be displayed inline. Default is `true`. +/// - inline (boolean): Indicates whether the content should be displayed inline. Default is `true`. /// -/// - `body` is the content to cover. +/// - body (content): The content to cover. +/// +/// -> content #let cover-with-rect(..cover-args, fill: auto, inline: true, body) = { if fill == auto { panic("`auto` fill value is not supported until typst provides utilities to" + " retrieve the current page background") @@ -721,11 +784,13 @@ /// /// Example: `update-alpha(rgb("#ff0000"), 0.5)` returns `rgb(255, 0, 0, 0.5)` /// -/// - `constructor` is the color constructor to use. Default is `rgb`. +/// - constructor (function): The color constructor to use. Default is `rgb`. +/// +/// - color (color): The color to update. /// -/// - `color` is the color to update. +/// - alpha (float): The new alpha value. /// -/// - `alpha` is the new alpha value. +/// -> color #let update-alpha(constructor: rgb, color, alpha) = constructor(..color.components(alpha: true).slice(0, -1), alpha) @@ -747,10 +812,14 @@ /// Alert content with a primary color. /// /// Example: `config-methods(alert: utils.alert-with-primary-color)` +/// +/// -> content #let alert-with-primary-color(self: none, body) = text(fill: self.colors.primary, body) /// Alert content. +/// +/// -> content #let alert(self: none, body) = (self.methods.alert)(self: self, body) @@ -795,9 +864,9 @@ /// /// Example: `check-visible(3, "2-")` returns `true` /// -/// - `idx` is the index of the slide +/// - idx (int): The index of the slide. /// -/// - `visible-subslides` is a single integer, an array of integers, +/// - visible-subslides (int, array): A single integer or an array of integers. /// or a string that specifies the visible subslides /// /// Read [polylux book](https://polylux.dev/book/dynamic/complex.html) @@ -808,6 +877,8 @@ /// You can also use more convenient and complex strings to specify visible slides. /// /// For example, "-2, 4, 6-8, 10-" means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. +/// +/// -> bool #let check-visible(idx, visible-subslides) = { if type(visible-subslides) == int { idx == visible-subslides @@ -865,19 +936,20 @@ /// /// Example: `uncover("2-")[abc]` will display `[abc]` if the current slide is 2 or later /// -/// - `visible-subslides` is a single integer, an array of integers, -/// or a string that specifies the visible subslides +/// - visible-subslides (int, array, string): A single integer, an array of integers, or a string that specifies the visible subslides. /// -/// Read [polylux book](https://polylux.dev/book/dynamic/complex.html) +/// Read [polylux book](https://polylux.dev/book/dynamic/complex.html). /// -/// The simplest extension is to use an array, such as `(1, 2, 4)` indicating that -/// slides 1, 2, and 4 are visible. This is equivalent to the string `"1, 2, 4"`. +/// The simplest extension is to use an array, such as `(1, 2, 4)`, indicating that +/// slides 1, 2, and 4 are visible. This is equivalent to the string `"1, 2, 4"`. /// -/// You can also use more convenient and complex strings to specify visible slides. +/// You can also use more convenient and complex strings to specify visible slides. /// -/// For example, "-2, 4, 6-8, 10-" means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. +/// For example, `"-2, 4, 6-8, 10-"` means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. +/// +/// - uncover-cont (content): The content to display when the content is visible in the subslide. /// -/// - `uncover-cont` is the content to display when the content is visible in the subslide. +/// -> content #let uncover(self: none, visible-subslides, uncover-cont) = { let cover = self.methods.cover.with(self: self) if check-visible(self.subslide, visible-subslides) { @@ -891,19 +963,20 @@ /// Display content in some subslides only. /// Don't reserve space when hidden, content is completely not existing there. /// -/// - `visible-subslides` is a single integer, an array of integers, -/// or a string that specifies the visible subslides +/// - visible-subslides (int, array, string): A single integer, an array of integers, or a string that specifies the visible subslides. /// -/// Read [polylux book](https://polylux.dev/book/dynamic/complex.html) +/// Read [polylux book](https://polylux.dev/book/dynamic/complex.html). /// -/// The simplest extension is to use an array, such as `(1, 2, 4)` indicating that -/// slides 1, 2, and 4 are visible. This is equivalent to the string `"1, 2, 4"`. +/// The simplest extension is to use an array, such as `(1, 2, 4)`, indicating that +/// slides 1, 2, and 4 are visible. This is equivalent to the string `"1, 2, 4"`. /// -/// You can also use more convenient and complex strings to specify visible slides. +/// You can also use more convenient and complex strings to specify visible slides. /// -/// For example, "-2, 4, 6-8, 10-" means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. +/// For example, `"-2, 4, 6-8, 10-"` means slides 1, 2, 4, 6, 7, 8, 10, and slides after 10 are visible. /// -/// - `only-cont` is the content to display when the content is visible in the subslide. +/// - only-cont (content): The content to display when the content is visible in the subslide. +/// +/// -> content #let only(self: none, visible-subslides, only-cont) = { if check-visible(self.subslide, visible-subslides) { only-cont @@ -913,20 +986,24 @@ /// `#alternatives` has a couple of "cousins" that might be more convenient in some situations. The first one is `#alternatives-match` that has a name inspired by match-statements in many functional programming languages. The idea is that you give it a dictionary mapping from subslides to content: /// -/// #example(``` +/// Example: +/// +/// ```typst /// #alternatives-match(( /// "1, 3-5": [this text has the majority], /// "2, 6": [this is shown less often] /// )) -/// ```) +/// ``` /// -/// - `subslides-contents` is a dictionary mapping from subslides to content. +/// - subslides-contents (dictionary): A dictionary mapping from subslides to content. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (alignment): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// -/// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// Important: If you use a zero-length content like a context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-match(self: none, subslides-contents, position: bottom + left, stretch: true) = { let subslides-contents = if type(subslides-contents) == dictionary { subslides-contents.pairs() @@ -965,15 +1042,17 @@ /// /// Example: `#alternatives[Ann][Bob][Christopher]` will show "Ann" in the first subslide, "Bob" in the second subslide, and "Christopher" in the third subslide. /// -/// - `start` is the starting subslide number. Default is `1`. +/// - start (int): The starting subslide number. Default is `1`. +/// +/// - repeat-last (boolean): A boolean indicating whether the last subslide should be repeated. Default is `true`. /// -/// - `repeat-last` is a boolean indicating whether the last subslide should be repeated. Default is `true`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// Important: If you use a zero-length content like a context expression, you should set `stretch: false`. /// -/// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// -> content #let alternatives( self: none, start: 1, @@ -994,17 +1073,19 @@ /// /// Example: `#alternatives-fn(start: 2, count: 7, subslide => { numbering("(i)", subslide) })` /// -/// - `start` is the starting subslide number. Default is `1`. +/// - start (int): The starting subslide number. Default is `1`. /// -/// - `end` is the ending subslide number. Default is `none`. +/// - end (int, none): The ending subslide number. Default is `none`. /// -/// - `count` is the number of subslides. Default is `none`. +/// - count (int, none): The number of subslides. Default is `none`. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// -/// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// Important: If you use a zero-length content like a context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-fn( self: none, start: 1, @@ -1031,22 +1112,26 @@ /// You can use this function if you want to have one piece of content that changes only slightly depending of what "case" of subslides you are in. /// -/// #example(``` +/// Example: +/// +/// ```typst /// #alternatives-cases(("1, 3", "2"), case => [ /// #set text(fill: teal) if case == 1 /// Some text /// ]) -/// ```) +/// ``` /// -/// - `cases` is an array of strings that specify the subslides for each case. +/// - cases (array): An array of strings that specify the subslides for each case. /// -/// - `fn` is a function that maps the case to content. The argument `case` is the index of the cases array you input. +/// - fn (function): A function that maps the case to content. The argument `case` is the index of the cases array you input. /// -/// - `position` is the position of the content. Default is `bottom + left`. +/// - position (string): The position of the content. Default is `bottom + left`. /// -/// - `stretch` is a boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. +/// - stretch (boolean): A boolean indicating whether the content should be stretched to the maximum width and height. Default is `true`. /// -/// Important: If you use a zero-length content like context expression, you should set `stretch: false`. +/// Important: If you use a zero-length content like a context expression, you should set `stretch: false`. +/// +/// -> content #let alternatives-cases(self: none, cases, fn, ..kwargs) = { let idcs = range(cases.len()) let contents = idcs.map(fn) @@ -1058,13 +1143,15 @@ /// /// Example: `#speaker-note[This is a speaker note]` /// -/// - `self` is the current context. +/// - self (content): The current context. +/// +/// - mode (string): The mode of the markup text, either `typ` or `md`. Default is `typ`. /// -/// - `mode` is the mode of the markup text, either `typ` or `md`. Default is `typ`. +/// - setting (function): A function that takes the note as input and returns a processed note. /// -/// - `setting` is a function that takes the note as input and returns a processed note. +/// - note (content): The content of the speaker note. /// -/// - `note` is the content of the speaker note. +/// -> content #let speaker-note(self: none, mode: "typ", setting: it => it, note) = { if self.at("enable-pdfpc", default: true) { let raw-text = if type(note) == content and note.has("text") { @@ -1086,6 +1173,8 @@ /// i18n Outline Title +/// +/// -> content #let i18n-outline-title = context { let mapping = ( ar: "المحتويات", diff --git a/themes/aqua.typ b/themes/aqua.typ index cef309d1..4389d62f 100644 --- a/themes/aqua.typ +++ b/themes/aqua.typ @@ -2,15 +2,15 @@ /// Default slide function for the presentation. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function, array): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -22,7 +22,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (content): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, @@ -108,7 +108,7 @@ /// Outline slide for the presentation. /// -/// - `leading` is the leading of paragraphs in the outline. Default is `50pt`. +/// - leading (length): The leading of paragraphs in the outline. Default is `50pt`. #let outline-slide(leading: 50pt) = touying-slide-wrapper(self => { set text(size: 30pt, fill: self.colors.primary) set par(leading: leading) @@ -168,9 +168,9 @@ /// /// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))` /// -/// - `level` is the level of the heading. +/// - level (int): The level of the heading. /// -/// - `body` is the body of the section. It will be pass by touying automatically. +/// - body (content): The body of the section. It will be passed by touying automatically. #let new-section-slide(level: 1, body) = touying-slide-wrapper(self => { let slide-body = { stack( @@ -238,17 +238,9 @@ /// #set par(justify: true) /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `header` is the header of the slides. Default is `self => utils.display-current-heading(depth: self.slide-level)`. -/// -/// - `footer` is the footer of the slides. Default is `context utils.slide-counter.display()`. -/// -/// ---------------------------------------- -/// /// The default colors: /// -/// ```typ +/// ```typst /// config-colors( /// primary: rgb("#003F88"), /// primary-light: rgb("#2159A5"), @@ -256,6 +248,12 @@ /// neutral-lightest: rgb("#FFFFFF") /// ) /// ``` +/// +/// - aspect-ratio (ratio): The aspect ratio of the slides. Default is `16-9`. +/// +/// - header (content): The header of the slides. Default is `self => utils.display-current-heading(depth: self.slide-level)`. +/// +/// - footer (content): The footer of the slides. Default is `context utils.slide-counter.display()`. #let aqua-theme( aspect-ratio: "16-9", header: self => utils.display-current-heading(depth: self.slide-level), diff --git a/themes/default.typ b/themes/default.typ index 3fef2528..96e6844e 100644 --- a/themes/default.typ +++ b/themes/default.typ @@ -2,15 +2,15 @@ /// Touying slide function. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -22,7 +22,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (content): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, @@ -42,7 +42,7 @@ /// #show: default-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))` /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. +/// - aspect-ratio (string): The aspect ratio of the slides. Default is `16-9`. #let default-theme( aspect-ratio: "16-9", ..args, @@ -52,9 +52,7 @@ show: touying-slides.with( config-page(paper: "presentation-" + aspect-ratio), - config-common( - slide-fn: slide, - ), + config-common(slide-fn: slide), ..args, ) diff --git a/themes/dewdrop.typ b/themes/dewdrop.typ index 30033fa4..95d9357f 100644 --- a/themes/dewdrop.typ +++ b/themes/dewdrop.typ @@ -55,15 +55,15 @@ /// Default slide function for the presentation. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function, array): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -75,7 +75,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, @@ -115,7 +115,7 @@ /// #title-slide(subtitle: [Subtitle], extra: [Extra information]) /// ``` /// -/// - `extra` is the extra information you want to display on the title slide. +/// - extra (string, none): The extra information you want to display on the title slide. #let title-slide( extra: none, ..args, @@ -198,9 +198,9 @@ /// /// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))` /// -/// - `title` is the title of the slide. Default is `utils.i18n-outline-title`. +/// - title (string): The title of the slide. Default is `utils.i18n-outline-title`. /// -/// - `body` is the contents of the slide. +/// - body (array): The contents of the slide. #let new-section-slide(title: utils.i18n-outline-title, ..args, body) = touying-slide-wrapper(self => { self = utils.merge-dicts( self, @@ -255,39 +255,6 @@ /// #show: dewdrop-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))` /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `navigation` is the navigation of the slides. You can choose from `"sidebar"`, `"mini-slides"`, and `none`. Default is `"sidebar"`. -/// -/// - `sidebar` is the configuration of the sidebar. You can set the width, filled, numbered, indent, and short-heading of the sidebar. Default is `(width: 10em, filled: false, numbered: false, indent: .5em, short-heading: true)`. -/// - `width` is the width of the sidebar. -/// - `filled` is whether the outline in the sidebar is filled. -/// - `numbered` is whether the outline in the sidebar is numbered. -/// - `indent` is the indent of the outline in the sidebar. -/// - `short-heading` is whether the outline in the sidebar is short. -/// -/// - `mini-slides` is the configuration of the mini-slides. You can set the height, x, display-section, display-subsection, and short-heading of the mini-slides. Default is `(height: 4em, x: 2em, display-section: false, display-subsection: true, linebreaks: true, short-heading: true)`. -/// - `height` is the height of the mini-slides. -/// - `x` is the x of the mini-slides. -/// - `display-section` is whether the slides of section is displayed in the mini-slides. -/// - `display-subsection` is whether the slides of subsections is displayed in the mini-slides. -/// - `linebreaks` is whether or linebreaks are in between links for sections and subsections in the mini-slides. -/// - `short-heading` is whether the mini-slides is short. Default is `true`. -/// -/// - `footer` is the footer of the slides. Default is `none`. -/// -/// - `footer-right` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. -/// -/// - `primary` is the primary color of the slides. Default is `rgb("#0c4842")`. -/// -/// - `alpha` is the alpha of transparency. Default is `60%`. -/// -/// - `outline-title` is the title of the outline. Default is `utils.i18n-outline-title`. -/// -/// - `subslide-preamble` is the preamble of the subslide. Default is `self => block(text(1.2em, weight: "bold", fill: self.colors.primary, utils.display-current-heading(depth: self.slide-level)))`. -/// -/// ---------------------------------------- -/// /// The default colors: /// /// ```typ @@ -299,6 +266,37 @@ /// primary: rgb("#0c4842"), /// ) /// ``` +/// +/// - aspect-ratio (string): The aspect ratio of the slides. Default is `16-9`. +/// +/// - navigation (string): The navigation of the slides. You can choose from `"sidebar"`, `"mini-slides"`, and `none`. Default is `"sidebar"`. +/// +/// - sidebar (dictionary): The configuration of the sidebar. You can set the width, filled, numbered, indent, and short-heading of the sidebar. Default is `(width: 10em, filled: false, numbered: false, indent: .5em, short-heading: true)`. +/// - width (string): The width of the sidebar. +/// - filled (boolean): Whether the outline in the sidebar is filled. +/// - numbered (boolean): Whether the outline in the sidebar is numbered. +/// - indent (length): The indent of the outline in the sidebar. +/// - short-heading (boolean): Whether the outline in the sidebar is short. +/// +/// - mini-slides (dictionary): The configuration of the mini-slides. You can set the height, x, display-section, display-subsection, and short-heading of the mini-slides. Default is `(height: 4em, x: 2em, display-section: false, display-subsection: true, linebreaks: true, short-heading: true)`. +/// - height (length): The height of the mini-slides. +/// - x (length): The x position of the mini-slides. +/// - display-section (boolean): Whether the slides of sections are displayed in the mini-slides. +/// - display-subsection (boolean): Whether the slides of subsections are displayed in the mini-slides. +/// - linebreaks (boolean): Whether line breaks are in between links for sections and subsections in the mini-slides. +/// - short-heading (boolean): Whether the mini-slides are short. Default is `true`. +/// +/// - footer (content, function): The footer of the slides. Default is `none`. +/// +/// - footer-right (content, function): The right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. +/// +/// - primary (color): The primary color of the slides. Default is `rgb("#0c4842")`. +/// +/// - alpha (fraction, float): The alpha of transparency. Default is `60%`. +/// +/// - outline-title (content, function): The title of the outline. Default is `utils.i18n-outline-title`. +/// +/// - subslide-preamble (content, function): The preamble of the subslide. Default is `self => block(text(1.2em, weight: "bold", fill: self.colors.primary, utils.display-current-heading(depth: self.slide-level)))`. #let dewdrop-theme( aspect-ratio: "16-9", navigation: "sidebar", diff --git a/themes/metropolis.typ b/themes/metropolis.typ index 424bab90..0870777f 100644 --- a/themes/metropolis.typ +++ b/themes/metropolis.typ @@ -7,17 +7,17 @@ /// Default slide function for the presentation. /// -/// - `title` is the title of the slide. Default is `auto`. +/// - title (string): The title of the slide. Default is `auto`. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For several configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, string): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function, array): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -29,7 +29,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( title: auto, align: auto, @@ -107,7 +107,7 @@ /// #title-slide(subtitle: [Subtitle], extra: [Extra information]) /// ``` /// -/// - `extra` is the extra information you want to display on the title slide. +/// - extra (string, none): The extra information you want to display on the title slide. #let title-slide( extra: none, ..args, @@ -161,11 +161,11 @@ /// /// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))` /// -/// - `level` is the level of the heading. +/// - level (int): The level of the heading. /// -/// - `numbered` is whether the heading is numbered. +/// - numbered (boolean): Indicates whether the heading is numbered. /// -/// - `body` is the body of the section. It will be pass by touying automatically. +/// - body (auto): The body of the section. It will be passed by touying automatically. #let new-section-slide(level: 1, numbered: true, body) = touying-slide-wrapper(self => { let slide-body = { set align(horizon) @@ -196,7 +196,7 @@ /// /// Example: `#focus-slide[Wake up!]` /// -/// - `align` is the alignment of the content. Default is `horizon + center`. +/// - align (alignment): The alignment of the content. Default is `horizon + center`. #let focus-slide(align: horizon + center, body) = touying-slide-wrapper(self => { let _align = align let align = _typst-builtin-align @@ -227,22 +227,6 @@ /// #set par(justify: true) /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `align` is the alignment of the content. Default is `horizon`. -/// -/// - `header` is the header of the slide. Default is `self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level)`. -/// -/// - `header-right` is the right part of the header. Default is `self => self.info.logo`. -/// -/// - `footer` is the footer of the slide. Default is `none`. -/// -/// - `footer-right` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. -/// -/// - `footer-progress` is whether to show the progress bar in the footer. Default is `true`. -/// -/// ---------------------------------------- -/// /// The default colors: /// /// ```typ @@ -255,10 +239,27 @@ /// neutral-darkest: rgb("#23373b"), /// ) /// ``` +/// +/// - aspect-ratio (string): The aspect ratio of the slides. Default is `16-9`. +/// +/// - align (alignment): The alignment of the content. Default is `horizon`. +/// +/// - header (content, function): The header of the slide. Default is `self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level)`. +/// +/// - header-right (content, function): The right part of the header. Default is `self => self.info.logo`. +/// +/// - footer (content, function): The footer of the slide. Default is `none`. +/// +/// - footer-right (content, function): The right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. +/// +/// - footer-progress (boolean): Whether to show the progress bar in the footer. Default is `true`. #let metropolis-theme( aspect-ratio: "16-9", align: horizon, - header: self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level), + header: self => utils.display-current-heading( + setting: utils.fit-to-width.with(grow: false, 100%), + depth: self.slide-level, + ), header-right: self => self.info.logo, footer: none, footer-right: context utils.slide-counter.display() + " / " + utils.last-slide-number, diff --git a/themes/simple.typ b/themes/simple.typ index 8261bf69..9084b551 100644 --- a/themes/simple.typ +++ b/themes/simple.typ @@ -5,15 +5,15 @@ /// Default slide function for the presentation. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// -/// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. +//// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (function): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -25,7 +25,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (array): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, @@ -111,25 +111,9 @@ /// #show: simple-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))` /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `header` is the header of the slides. Default is `self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level)`. -/// -/// - `header-right` is the right part of the header. Default is `self.info.logo`. -/// -/// - `footer` is the footer of the slides. Default is `none`. -/// -/// - `footer-right` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. -/// -/// - `primary` is the primary color of the slides. Default is `aqua.darken(50%)`. -/// -/// - `subslide-preamble` is the preamble of the subslides. Default is `block(below: 1.5em, text(1.2em, weight: "bold", utils.display-current-heading(level: 2)))`. -/// -/// ---------------------------------------- -/// /// The default colors: /// -/// ```typ +/// ```typst /// config-colors( /// neutral-light: gray, /// neutral-lightest: rgb("#ffffff"), @@ -137,6 +121,20 @@ /// primary: aqua.darken(50%), /// ) /// ``` +/// +/// - aspect-ratio (string): The aspect ratio of the slides. Default is `16-9`. +/// +/// - header (function): The header of the slides. Default is `self => utils.display-current-heading(setting: utils.fit-to-width.with(grow: false, 100%), depth: self.slide-level)`. +/// +/// - header-right (content): The right part of the header. Default is `self.info.logo`. +/// +/// - footer (content): The footer of the slides. Default is `none`. +/// +/// - footer-right (content): The right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. +/// +/// - primary (color): The primary color of the slides. Default is `aqua.darken(50%)`. +/// +/// - subslide-preamble (content): The preamble of the subslides. Default is `block(below: 1.5em, text(1.2em, weight: "bold", utils.display-current-heading(level: 2)))`. #let simple-theme( aspect-ratio: "16-9", header: self => utils.display-current-heading( diff --git a/themes/stargazer.typ b/themes/stargazer.typ index a802c8af..d49186f2 100644 --- a/themes/stargazer.typ +++ b/themes/stargazer.typ @@ -37,25 +37,25 @@ /// Theorem block for the presentation. /// -/// - `title` is the title of the theorem. Default is `none`. +/// - title (string): The title of the theorem. Default is `none`. /// -/// - `it` is the content of the theorem. +/// - it (content): The content of the theorem. #let tblock(title: none, it) = touying-fn-wrapper(_tblock.with(title: title, it)) /// Default slide function for the presentation. /// -/// - `title` is the title of the slide. Default is `auto`. +/// - title (string): The title of the slide. Default is `auto`. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): The configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (auto): The number of subslides. Default is `auto`, which means touying will automatically calculate the number of subslides. /// /// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. +/// - setting (dictionary): The setting of the slide. You can use it to add some set/show rules for the slide. /// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (function): The composer of the slide. You can use it to set the layout of the slide. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -67,7 +67,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (content): The contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( title: auto, header: auto, @@ -181,11 +181,11 @@ /// Outline slide for the presentation. /// -/// - `title` is the title of the outline. Default is `utils.i18n-outline-title`. +/// - title (string): is the title of the outline. Default is `utils.i18n-outline-title`. /// -/// - `level` is the level of the outline. Default is `none`. +/// - level (int, none): is the level of the outline. Default is `none`. /// -/// - `numbered` is whether the outline is numbered. Default is `true`. +/// - numbered (boolean): is whether the outline is numbered. Default is `true`. #let outline-slide( title: utils.i18n-outline-title, numbered: true, @@ -225,13 +225,13 @@ /// /// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))` /// -/// - `title` is the title of the section. The default is `utils.i18n-outline-title`. +/// - title (content, function): is the title of the section. The default is `utils.i18n-outline-title`. /// -/// - `level` is the level of the heading. The default is `1`. +/// - level (int): is the level of the heading. The default is `1`. /// -/// - `numbered` is whether the heading is numbered. The default is `true`. +/// - numbered (boolean): is whether the heading is numbered. The default is `true`. /// -/// - `body` is the body of the section. It will be pass by touying automatically. +/// - body (none): is the body of the section. It will be passed by touying automatically. #let new-section-slide( title: utils.i18n-outline-title, level: 1, @@ -246,7 +246,7 @@ /// /// Example: `#focus-slide[Wake up!]` /// -/// - `align` is the alignment of the content. Default is `horizon + center`. +/// - align (alignment): is the alignment of the content. The default is `horizon + center`. #let focus-slide(align: horizon + center, body) = touying-slide-wrapper(self => { self = utils.merge-dicts( self, @@ -265,9 +265,9 @@ /// End slide for the presentation. /// -/// - `title` is the title of the slide. Default is `none`. +/// - title (string): is the title of the slide. The default is `none`. /// -/// - `body` is the content of the slide. +/// - body (array): is the content of the slide. #let ending-slide(title: none, body) = touying-slide-wrapper(self => { let content = { set align(center + horizon) @@ -301,45 +301,43 @@ /// #set strong(delta: 100) /// #set par(justify: true) /// ``` +/// The default colors: /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `align` is the alignment of the content. Default is `horizon`. /// -/// - `title` is the title in header of the slide. Default is `self => utils.display-current-heading(depth: self.slide-level)`. +/// ```typst +/// config-colors( +/// primary: rgb("#005bac"), +/// primary-dark: rgb("#004078"), +/// secondary: rgb("#ffffff"), +/// tertiary: rgb("#005bac"), +/// neutral-lightest: rgb("#ffffff"), +/// neutral-darkest: rgb("#000000"), +/// ) +/// ``` /// -/// - `header-right` is the right part of the header. Default is `self => self.info.logo`. +/// - aspect-ratio (string): is the aspect ratio of the slides. The default is `16-9`. /// -/// - `footer` is the footer of the slide. Default is `none`. +/// - align (alignment): is the alignment of the content. The default is `horizon`. /// -/// - `footer-right` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. +/// - title (content, function): is the title in the header of the slide. The default is `self => utils.display-current-heading(depth: self.slide-level)`. /// -/// - `progress-bar` is whether to show the progress bar in the footer. Default is `true`. +/// - header-right (content, function): is the right part of the header. The default is `self => self.info.logo`. /// -/// - `footer-columns` is the columns of the footer. Default is `(25%, 25%, 1fr, 5em)`. +/// - footer (content, function): is the footer of the slide. The default is `none`. /// -/// - `footer-a` is the left part of the footer. Default is `self => self.info.author`. +/// - footer-right (content, function): is the right part of the footer. The default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. /// -/// - `footer-b` is the second left part of the footer. Default is `self => utils.display-info-date(self)`. +/// - progress-bar (boolean): is whether to show the progress bar in the footer. The default is `true`. /// -/// - `footer-c` is the second right part of the footer. Default is `self => if self.info.short-title == auto { self.info.title } else { self.info.short-title }`. +/// - footer-columns (array): is the columns of the footer. The default is `(25%, 25%, 1fr, 5em)`. /// -/// - `footer-d` is the right part of the footer. Default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. +/// - footer-a (content, function): is the left part of the footer. The default is `self => self.info.author`. /// -/// ---------------------------------------- +/// - footer-b (content, function): is the second left part of the footer. The default is `self => utils.display-info-date(self)`. /// -/// The default colors: +/// - footer-c (content, function): is the second right part of the footer. The default is `self => if self.info.short-title == auto { self.info.title } else { self.info.short-title }`. /// -/// ```typ -/// config-colors( -/// primary: rgb("#005bac"), -/// primary-dark: rgb("#004078"), -/// secondary: rgb("#ffffff"), -/// tertiary: rgb("#005bac"), -/// neutral-lightest: rgb("#ffffff"), -/// neutral-darkest: rgb("#000000"), -/// ) -/// ``` +/// - footer-d (content, function): is the right part of the footer. The default is `context utils.slide-counter.display() + " / " + utils.last-slide-number`. #let stargazer-theme( aspect-ratio: "16-9", align: horizon, diff --git a/themes/university.typ b/themes/university.typ index 5bb83df4..b5a5f5d2 100644 --- a/themes/university.typ +++ b/themes/university.typ @@ -6,15 +6,13 @@ /// Default slide function for the presentation. /// -/// - `config` is the configuration of the slide. You can use `config-xxx` to set the configuration of the slide. For more several configurations, you can use `utils.merge-dicts` to merge them. +/// - config (dictionary): is the configuration of the slide. Use `config-xxx` to set individual configurations for the slide. To apply multiple configurations, use `utils.merge-dicts` to combine them. /// -/// - `repeat` is the number of subslides. Default is `auto`,which means touying will automatically calculate the number of subslides. +/// - repeat (int, auto): is the number of subslides. The default is `auto`, allowing touying to automatically calculate the number of subslides. The `repeat` argument is required when using `#slide(repeat: 3, self => [ .. ])` style code to create a slide, as touying cannot automatically detect callback-style `uncover` and `only`. /// -/// The `repeat` argument is necessary when you use `#slide(repeat: 3, self => [ .. ])` style code to create a slide. The callback-style `uncover` and `only` cannot be detected by touying automatically. +/// - setting (dictionary): is the setting of the slide, which can be used to apply set/show rules for the slide. /// -/// - `setting` is the setting of the slide. You can use it to add some set/show rules for the slide. -/// -/// - `composer` is the composer of the slide. You can use it to set the layout of the slide. +/// - composer (array, function): is the layout composer of the slide, allowing you to define the slide layout. /// /// For example, `#slide(composer: (1fr, 2fr, 1fr))[A][B][C]` to split the slide into three parts. The first and the last parts will take 1/4 of the slide, and the second part will take 1/2 of the slide. /// @@ -26,7 +24,7 @@ /// /// If you want to customize the composer, you can pass a function to the `composer` argument. The function should receive the contents of the slide and return the content of the slide, like `#slide(composer: grid.with(columns: 2))[A][B]`. /// -/// - `..bodies` is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. +/// - bodies (arguments): is the contents of the slide. You can call the `slide` function with syntax like `#slide[A][B][C]` to create a slide. #let slide( config: (:), repeat: auto, @@ -96,7 +94,7 @@ /// #title-slide(subtitle: [Subtitle]) /// ``` /// -/// - `extra` is the extra information of the slide. You can pass the extra information to the `title-slide` function. +/// - extra (string, none): is the extra information for the slide. This can be passed to the `title-slide` function to display additional information on the title slide. #let title-slide( extra: none, ..args, @@ -164,11 +162,11 @@ /// /// Example: `config-common(new-section-slide-fn: new-section-slide.with(numbered: false))` /// -/// - `level` is the level of the heading. +/// - level (int, none): is the level of the heading. /// -/// - `numbered` is whether the heading is numbered. +/// - numbered (boolean): is whether the heading is numbered. /// -/// - `body` is the body of the section. It will be pass by touying automatically. +/// - body (auto): is the body of the section. This will be passed automatically by Touying. #let new-section-slide(level: 1, numbered: true, body) = touying-slide-wrapper(self => { let slide-body = { set align(horizon) @@ -199,9 +197,9 @@ /// /// Example: `#focus-slide[Wake up!]` /// -/// - `background-color` is the background color of the slide. Default is the primary color. +/// - background-color (color, none): is the background color of the slide. Default is the primary color. /// -/// - `background-img` is the background image of the slide. Default is none. +/// - background-img (string, none): is the background image of the slide. Default is none. #let focus-slide(background-color: none, background-img: none, body) = touying-slide-wrapper(self => { let background-color = if background-img == none and background-color == none { rgb(self.colors.primary) @@ -257,24 +255,6 @@ /// #show: university-theme.with(aspect-ratio: "16-9", config-colors(primary: blue))` /// ``` /// -/// - `aspect-ratio` is the aspect ratio of the slides. Default is `16-9`. -/// -/// - `progress-bar` is whether to show the progress bar. Default is `true`. -/// -/// - `header` is the header of the slides. Default is `utils.display-current-heading(level: 2)`. -/// -/// - `header-right` is the right part of the header. Default is `self.info.logo`. -/// -/// - `footer-columns` is the columns of the footer. Default is `(25%, 1fr, 25%)`. -/// -/// - `footer-a` is the left part of the footer. Default is `self.info.author`. -/// -/// - `footer-b` is the middle part of the footer. Default is `self.info.short-title` or `self.info.title`. -/// -/// - `footer-c` is the right part of the footer. Default is `self => h(1fr) + utils.display-info-date(self) + h(1fr) + context utils.slide-counter.display() + " / " + utils.last-slide-number + h(1fr)`. -/// -/// ---------------------------------------- -/// /// The default colors: /// /// ```typ @@ -286,6 +266,22 @@ /// neutral-darkest: rgb("#000000"), /// ) /// ``` +/// +/// - aspect-ratio (string): is the aspect ratio of the slides. Default is `16-9`. +/// +/// - progress-bar (boolean): is whether to show the progress bar. Default is `true`. +/// +/// - header (content, function): is the header of the slides. Default is `utils.display-current-heading(level: 2)`. +/// +/// - header-right (content, function): is the right part of the header. Default is `self.info.logo`. +/// +/// - footer-columns (tuple): is the columns of the footer. Default is `(25%, 1fr, 25%)`. +/// +/// - footer-a (content, function): is the left part of the footer. Default is `self.info.author`. +/// +/// - footer-b (content, function): is the middle part of the footer. Default is `self.info.short-title` or `self.info.title`. +/// +/// - footer-c (content, function): is the right part of the footer. Default is `self => h(1fr) + utils.display-info-date(self) + h(1fr) + context utils.slide-counter.display() + " / " + utils.last-slide-number + h(1fr)`. #let university-theme( aspect-ratio: "16-9", progress-bar: true, @@ -323,7 +319,7 @@ init: (self: none, body) => { set text(fill: self.colors.neutral-darkest, size: 25pt) show heading: set text(fill: self.colors.primary) - + body }, alert: utils.alert-with-primary-color,