Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

docs: improve param documentation #98

Merged
merged 6 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions examples/default.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
),
Expand Down
2 changes: 1 addition & 1 deletion examples/dewdrop.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
49 changes: 26 additions & 23 deletions examples/example.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -76,26 +76,29 @@ 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

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
Expand All @@ -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")
})


Expand All @@ -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),
)


Expand All @@ -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.
]
Expand Down
2 changes: 1 addition & 1 deletion examples/metropolis.typ
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
41 changes: 41 additions & 0 deletions lib.typ
Original file line number Diff line number Diff line change
@@ -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"
Loading