Skip to content

Commit

Permalink
docs: update docs for 0.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed May 13, 2024
1 parent 63828b9 commit 56a5638
Show file tree
Hide file tree
Showing 40 changed files with 89 additions and 89 deletions.
18 changes: 9 additions & 9 deletions docs/docs/build-your-own-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ If you wish to modify a theme within the Touying package locally instead of crea

1. Copy the [theme code](https://github.com/touying-typ/touying/tree/main/themes) from the `themes` directory to your local machine. For example, copy `themes/university.typ` to a local file named `university.typ`.
2. Remove all `#import "../xxx.typ"` commands at the top of the `university.typ` file.
3. Add `#import "@preview/touying:0.4.0": *` at the top of the `university.typ` file to import all modules.
3. Add `#import "@preview/touying:0.4.1": *` at the top of the `university.typ` file to import all modules.
4. Replace `self: s` in the `register` function with `self: themes.default.register()` **(Important)**.

You can then import and use the theme by:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "university.typ"
#let s = university.register(aspect-ratio: "16-9")
Expand All @@ -47,7 +47,7 @@ Depending on whether the theme is for personal use or part of Touying, you can i
If for personal use:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
```

If part of Touying themes:
Expand All @@ -73,7 +73,7 @@ Generally, the first step in creating slides is to determine font size and page

```typst
// bamboo.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let register(
self: themes.default.register(),
Expand All @@ -90,7 +90,7 @@ Generally, the first step in creating slides is to determine font size and page
}
// main.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "bamboo.typ"
#let s = bamboo.register(aspect-ratio: "16-9")
Expand Down Expand Up @@ -190,7 +190,7 @@ We also need to customize a `slide` method that accepts `slide(self: none, title

```typst
// bamboo.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let slide(self: none, title: auto, ..args) = {
if title != auto {
Expand Down Expand Up @@ -251,7 +251,7 @@ We also need to customize a `slide` method that accepts `slide(self: none, title
// main.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "bamboo.typ"
#let s = bamboo.register(aspect-ratio: "16-9", footer: self => self.info.institution)
Expand Down Expand Up @@ -290,7 +290,7 @@ Finally, we update the `slides(self: none, title-slide: true, slide-level: 1, ..

```
// bamboo.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let slide(self: none, title: auto, ..args) = {
if title != auto {
Expand Down Expand Up @@ -406,7 +406,7 @@ Finally, we update the `slides(self: none, title-slide: true, slide-level: 1, ..
// main.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "bamboo.typ"
#let s = bamboo.register(aspect-ratio: "16-9", footer: self => self.info.institution)
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/code-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sidebar_position: 4
If we only need simplicity, we can directly input content under the heading, just like writing a normal Typst document. The heading here serves to divide the pages, and we can use commands like `#pause` to achieve animation effects.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#let (init, slides) = utils.methods(s)
Expand Down Expand Up @@ -42,7 +42,7 @@ Many times, using simple style alone cannot achieve all the functions we need. F
For example, the previous example can be transformed into:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#let (init, slides) = utils.methods(s)
Expand Down Expand Up @@ -80,7 +80,7 @@ You may have noticed that when using the simple theme, using a level-one heading
If we don't want it to automatically create such a section slide, we can delete this method:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#(s.methods.touying-new-section-slide = none)
Expand Down Expand Up @@ -108,7 +108,7 @@ As you can see, there are only two pages left, and the default section slide is
Similarly, we can register a new section slide:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#(s.methods.touying-new-section-slide = (self: none, section, ..args) => {
Expand Down Expand Up @@ -149,7 +149,7 @@ Also, since `#slide[...]` is registered in `s.slides = ("slide",)`, the `section
In fact, you can also not use `#show: slides` and `utils.slides(s)`, but only use `utils.methods(s)`, for example:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#let (init, touying-outline, slide) = utils.methods(s)
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/dynamic/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Touying also provides `touying-reducer`, which adds `pause` and `meanwhile` anim
Here's an example:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.4" as fletcher: node, edge
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/external/pdfpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ typst query --root . ./example.typ --field value --one "<pdfpc-file>" > ./exampl
With the compatibility of Touying and Polylux, you can make Polylux also support direct export by adding the following code:

```typst
#import "@preview/touying:0.4.0"
#import "@preview/touying:0.4.1"
#locate(loc => touying.pdfpc.pdfpc-file(loc))
```
2 changes: 1 addition & 1 deletion docs/docs/external/pympress.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ sidebar_position: 2
## 笔记支持

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.university.register(aspect-ratio: "16-9")
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/global-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Now you can understand the purpose of the `utils.methods()` function: to bind `s
In general, the two ways mentioned above are sufficient for adding global settings. However, there are still situations where we need to initialize counters or states. If you place this code before `#show: slides`, a blank page will be created, which is something we don't want to see. In such cases, you can use the `s.methods.append-preamble` method. For example, when using the codly package:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/codly:0.2.0": *
#let s = themes.simple.register(aspect-ratio: "16-9")
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integration/cetz.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Touying provides the `touying-reducer`, which adds `pause` and `meanwhile` anima
An example:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.4" as fletcher: node, edge
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integration/codly.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 5
When using Codly, we should initialize it using the `s.methods.append-preamble` method.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/codly:0.2.0": *
#let s = themes.simple.register(aspect-ratio: "16-9")
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integration/ctheorems.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Touying can work seamlessly with the `ctheorems` package, allowing you to direct
Moreover, you can utilize `#let s = (s.methods.numbering)(self: s, section: "1.", "1.1")` to set numbering for sections and subsections.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/ctheorems:1.1.2": *
// Register university theme
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integration/fletcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Touying provides the `touying-reducer`, which adds `pause` and `meanwhile` anima
An example:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.4" as fletcher: node, edge
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integration/pinit.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Another [example](https://github.com/OrangeX4/typst-pinit/blob/main/examples/equ
An example of shared usage with Touying:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/pinit:0.1.3": *
#(s.page-args.paper = "presentation-4-3")
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/layout.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Adding a logo to slides is a very common but also a very versatile requirement.
For example, suppose we decide to add the GitHub icon to the metropolis theme. We can implement it like this:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/octique:0.1.0": *
#let s = themes.metropolis.register(aspect-ratio: "16-9")
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/multi-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ These three files are separated to allow both `main.typ` and `content.typ` to im

```typst
// globals.typ
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.university.register(aspect-ratio: "16-9")
#let s = (s.methods.numbering)(self: s, section: "1.", "1.1")
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/sections.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Similar to Beamer, Touying also has the concept of sections and subsections.
Generally, level 1, level 2, and level 3 headings correspond to section, subsection, and title, respectively, as in the dewdrop theme.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.dewdrop.register()
#let (init, slides) = utils.methods(s)
Expand All @@ -34,7 +34,7 @@ Hello, Touying!
However, often we don't need subsections, and we can use level 1 and level 2 headings to correspond to section and title, as in the university theme.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.university.register()
#let (init, slides) = utils.methods(s)
Expand Down Expand Up @@ -69,7 +69,7 @@ This sets the default numbering to `1.1`, with the section corresponding to `1.`
Displaying a table of contents in Touying is straightforward:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#let (init, slides, alert, touying-outline) = utils.methods(s)
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/start.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Before you begin, make sure you have the Typst environment installed. If not, yo
To use Touying, you just need to include the following in your document:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register()
#let (init, slides) = utils.methods(s)
Expand Down Expand Up @@ -52,7 +52,7 @@ Touying offers many built-in themes to easily create beautiful slides. For examp
you can use the university theme. For more detailed tutorials on themes, you can refer to the following sections.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#import "@preview/cetz:0.2.2"
#import "@preview/fletcher:0.4.4" as fletcher: node, edge
#import "@preview/ctheorems:1.1.2": *
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/themes/aqua.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This theme is created by [@pride7](https://github.com/pride7), featuring beautif
You can initialize it with the following code:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.aqua.register(aspect-ratio: "16-9", lang: "en")
#let s = (s.methods.info)(
Expand Down Expand Up @@ -124,7 +124,7 @@ PS: The outline title can be modified via `#(s.outline-title = [Outline])`.
Additionally, you can disable the automatic inclusion of `new-section-slide` functionality by `#(s.methods.touying-new-section-slide = none)`.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.aqua.register(aspect-ratio: "16-9", lang: "en")
#let s = (s.methods.info)(
Expand Down Expand Up @@ -159,7 +159,7 @@ Hello, Typst!
## Example

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.aqua.register(aspect-ratio: "16-9", lang: "en")
#let s = (s.methods.info)(
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/themes/dewdrop.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Dewdrop theme features an elegantly designed navigation, including two modes
You can initialize it using the following code:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.dewdrop.register(
aspect-ratio: "16-9",
Expand Down Expand Up @@ -152,7 +152,7 @@ PS: You can modify the outline title using `#(s.outline-title = [Outline])`.
And the function of automatically adding `new-section-slide` can be turned off by `#(s.methods.touying-new-section-slide = none)`.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.dewdrop.register(aspect-ratio: "16-9", footer: [Dewdrop])
#let s = (s.methods.info)(
Expand Down Expand Up @@ -188,7 +188,7 @@ Hello, Typst!
## Example

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.dewdrop.register(
aspect-ratio: "16-9",
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/themes/metropolis.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The Metropolis theme is elegant and suitable for everyday use. It is recommended
You can initialize it using the following code:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.metropolis.register(aspect-ratio: "16-9", footer: self => self.info.institution)
#let s = (s.methods.info)(
Expand Down Expand Up @@ -124,7 +124,7 @@ PS: You can modify the outline title using `#(s.outline-title = [Outline])`.
And the function of automatically adding `new-section-slide` can be turned off by `#(s.methods.touying-new-section-slide = none)`.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.metropolis.register(aspect-ratio: "16-9", footer: self => self.info.institution)
#let s = (s.methods.info)(
Expand Down Expand Up @@ -160,7 +160,7 @@ Hello, Typst!
## Example

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.metropolis.register(aspect-ratio: "16-9", footer: self => self.info.institution)
#let s = (s.methods.info)(
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/themes/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Considered a relatively straightforward theme, you can use it to create simple s
You can initialize it using the following code:

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register(aspect-ratio: "16-9", footer: [Simple slides])
#let s = (s.methods.enable-transparent-cover)(self: s)
Expand Down Expand Up @@ -96,7 +96,7 @@ You can set it using `#show: slides.with(..)`.
And the function of automatically adding `new-section-slide` can be turned off by `#(s.methods.touying-new-section-slide = none)`.

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register(aspect-ratio: "16-9", footer: [Simple slides])
#let s = (s.methods.enable-transparent-cover)(self: s)
Expand All @@ -123,7 +123,7 @@ Hello, Typst!
## Example

```typst
#import "@preview/touying:0.4.0": *
#import "@preview/touying:0.4.1": *
#let s = themes.simple.register(aspect-ratio: "16-9", footer: [Simple slides])
#let (init, slides) = utils.methods(s)
Expand Down
Loading

0 comments on commit 56a5638

Please sign in to comment.