Skip to content

Commit

Permalink
docs: freeze version for 0.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeX4 committed May 27, 2024
1 parent 00c43ab commit 6012e78
Show file tree
Hide file tree
Showing 80 changed files with 7,953 additions and 0 deletions.

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions docs/i18n/zh/docusaurus-plugin-content-docs/version-0.4.2/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
sidebar_position: 15
---

# 更新日志

## v0.4.2

- theme(metropolis): decoupled text color with `neutral-dark` (Breaking change)
- feat: add mark-style uncover, only and alternatives
- feat: add warning for styled block for slides
- feat: add warning for touying-temporary-mark
- feat: add markup-text for speaker-note
- fix: fix bug of slides


## v0.4.1

### Features

- feat: support builtin outline and bookmark
- feat: support speaker note for dual-screen
- feat: add touying-mitex function
- feat: touying offers [a gallery page](https://github.com/touying-typ/touying/wiki) via wiki

### Fixes

- fix: add outline-slide for dewdrop theme
- fix: fix regression of default value "auto" for repeat

### Miscellaneous Improvements

- feat: add list support for `touying-outline` function
- feat: add auto-reset-footnote
- feat: add `freeze-in-empty-page` for better page counter
- feat: add `..args` for register method to capture unused arguments


## v0.4.0

### Features

- **feat:** support `#footnote[]` for all themes.
- **feat:** access subslide and repeat in footer and header by `self => self.subslide`.
- **feat:** support numbered theorem environments by [ctheorems](https://typst.app/universe/package/ctheorems).
- **feat:** support numbering for sections and subsections.

### Fixes

- **fix:** make nested includes work correctly.
- **fix:** disable multi-page slides from creating the same section multiple times.

## Breaking changes

- **refactor:** remove `self.padding` and add `self.full-header` `self.full-footer` config.


## v0.3.3

- **template:** move template to `touying-aqua` package, make Touying searchable in [Typst Universe Packages](https://typst.app/universe/search?kind=packages)
- **themes:** fix bugs in university and dewdrop theme
- **feat:** make set-show rule work without `setting` parameter
- **feat:** make `composer` parameter more simpler
- **feat:** add `empty-slide` function

## v0.3.2

- **fix critical bug:** fix `is-sequence` function, make `grid` and `table` work correctly in touying
- **theme:** add aqua theme, thanks for pride7
- **theme:** make university theme more configurable
- **refactor:** don't export variable `s` by default anymore, it will be extracted by `register` function (**Breaking Change**)
- **meta:** add `categories` and `template` config to `typst.toml` for Typst 0.11


## v0.3.1

- fix some typos
- fix slide-level bug
- fix bug of pdfpc label


## v0.3.0

### Features

- better show-slides mode.
- support align and pad.

### Documentation

- Add more detailed documentation.

### Refactor

- simplify theme.

### Fix

- fix many bugs.

## v0.2.1

### Features

- **Touying-reducer**: support cetz and fletcher animation
- **university theme**: add university theme

### Fix

- fix footer progress in metropolis theme
- fix some bugs in simple and dewdrop themes
- fix bug that outline does not display more than 4 sections


## v0.2.0

- **Object-oriented programming:** Singleton `s`, binding methods `utils.methods(s)` and `(self: obj, ..) => {..}` methods.
- **Page arguments management:** Instead of using `#set page(..)`, you should use `self.page-args` to retrieve or set page parameters, thereby avoiding unnecessary creation of new pages.
- **`#pause` for sequence content:** You can use #pause at the outermost level of a slide, including inline and list.
- **`#pause` for layout functions:** You can use the `composer` parameter to add yourself layout function like `utils.side-by-side`, and simply use multiple pos parameters like `#slide[..][..]`.
- **`#meanwhile` for synchronous display:** Provide a `#meanwhile` for resetting subslides counter.
- **`#pause` and `#meanwhile` for math equation:** Provide a `#touying-equation("x + y pause + z")` for math equation animations.
- **Slides:** Create simple slides using standard headings.
- **Callback-style `uncover`, `only` and `alternatives`:** Based on the concise syntax provided by Polylux, allow precise control of the timing for displaying content.
- You should manually control the number of subslides using the `repeat` parameter.
- **Transparent cover:** Enable transparent cover using oop syntax like `#let s = (s.methods.enable-transparent-cover)(self: s)`.
- **Handout mode:** enable handout mode by `#let s = (s.methods.enable-handout-mode)(self: s)`.
- **Fit-to-width and fit-to-height:** Fit-to-width for title in header and fit-to-height for image.
- `utils.fit-to-width(grow: true, shrink: true, width, body)`
- `utils.fit-to-height(width: none, prescale-width: none, grow: true, shrink: true, height, body)`
- **Slides counter:** `states.slide-counter.display() + " / " + states.last-slide-number` and `states.touying-progress(ratio => ..)`.
- **Appendix:** Freeze the `last-slide-number` to prevent the slide number from increasing further.
- **Sections:** Touying's built-in section support can be used to display the current section title and show progress.
- `section` and `subsection` parameter in `#slide` to register a new section or subsection.
- `states.current-section-title` to get the current section.
- `states.touying-outline` or `s.methods.touying-outline` to display a outline of sections.
- `states.touying-final-sections(sections => ..)` for custom outline display.
- `states.touying-progress-with-sections((current-sections: .., final-sections: .., current-slide-number: .., last-slide-number: ..) => ..)` for powerful progress display.
- **Navigation bar**: Navigation bar like [here](https://github.com/zbowang/BeamerTheme) by `states.touying-progress-with-sections(..)`, in `dewdrop` theme.
- **Pdfpc:** pdfpc support and export `.pdfpc` file without external tool by `typst query` command simply.
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---
sidebar_position: 4
---

# 代码风格

## 简单风格

如果我们只是需要简单使用,我们可以直接在标题下输入内容,就像是在编写正常 Typst 文档一样。这里的标题有着分割页面的作用,同时我们也能正常地使用 `#pause` 等命令实现动画效果。

```typst
#import "@preview/touying:0.4.2": *
#let s = themes.simple.register()
#let (init, slides) = utils.methods(s)
#show: init
#let (slide, empty-slide) = utils.slides(s)
#show: slides
= Title
== First Slide
Hello, Touying!
#pause
Hello, Typst!
```

![image](https://github.com/touying-typ/touying/assets/34951714/f5bdbf8f-7bf9-45fd-9923-0fa5d66450b2)

并且你可以使用空标题 `==` 创建一个新页,这个技巧也有助于清除上一个标题的继续应用。

PS:我们可以使用 `#slides-end` 记号来标志 `#show: slides` 的结束。


## 块风格

很多时候,仅仅使用简单风格并不能实现我们需要的所有功能,为了更强大的功能和更清晰的结构,我们同样可以使用 `#slide[...]` 形式的块风格,其中 `#slide` 函数需要使用 `#let (slide, empty-slide) = utils.slides(s)` 语法进行解包,才能正常在 `#show: slides` 后使用。

例如上面的例子就可以改造成

```typst
#import "@preview/touying:0.4.2": *
#let s = themes.simple.register()
#let (init, slides) = utils.methods(s)
#show: init
#let (slide, empty-slide) = utils.slides(s)
#show: slides
= Title
== First Slide
#slide[
Hello, Touying!
#pause
Hello, Typst!
]
```

以及 `#empty-slide[]` 可以创建一个没有 header 和 footer 的空 Slide。

这样做的好处有很多:

1. 很多时候,我们不只是需要默认的 `#slide[...]`,还需要 `#focus-slide[...]` 这些特殊的 `slide` 函数;
2. 不同主题的 `#slide[...]` 函数可能有比默认更多的参数,例如 university 主题的 `#slide[...]` 函数就会有着 `subtitle` 参数;
3. 只有 `slide` 函数才可以通过回调风格的内容块来使用 `#only``#uncover` 函数实现复杂的动画效果。
4. 能有着更清晰的结构,通过辨别 `#slide[...]` 块,我们可以很容易地分辨出 slides 的具体分页效果。


## 约定优于配置

你可能注意到了,在使用 simple 主题时,我们使用一级标题会自动创建一个 section slide,这是因为 simple 主题注册了一个 `s.methods.touying-new-section-slide` 方法,因此 touying 会默认调用这个方法。

如果我们不希望它自动创建这样一个 section slide,我们可以将这个方法删除:

```typst
#import "@preview/touying:0.4.2": *
#let s = themes.simple.register()
#(s.methods.touying-new-section-slide = none)
#let (init, slides) = utils.methods(s)
#show: init
#let (slide, empty-slide) = utils.slides(s)
#show: slides
= Title
== First Slide
Hello, Touying!
#pause
Hello, Typst!
```

![image](https://github.com/touying-typ/touying/assets/34951714/17a89a59-9491-4e1f-95c0-09a22105ab35)

如你所见,这样就只会剩下两页,而默认的 section slide 就会消失了。

同理,我们也可以注册一个新的 section slide:

```typst
#import "@preview/touying:0.4.2": *
#let s = themes.simple.register()
#(s.methods.touying-new-section-slide = (self: none, section, ..args) => {
self = utils.empty-page(self)
(s.methods.touying-slide)(self: self, section: section, {
set align(center + horizon)
set text(size: 2em, fill: s.colors.primary, style: "italic", weight: "bold")
section
}, ..args)
})
#let (init, slides, touying-outline) = utils.methods(s)
#show: init
#let (slide, empty-slide) = utils.slides(s)
#show: slides
= Title
== First Slide
Hello, Touying!
#pause
Hello, Typst!
```

![image](https://github.com/touying-typ/touying/assets/34951714/5305efda-0cd4-42eb-9f2e-89abc30b6ca2)

同样地,我们也可以修改 `s.methods.touying-new-subsection-slide` 来对 `subsection` 做同样的事。

实际上,除了 `s.methods.touying-new-section-slide`,另一个特殊的 `slide` 函数就是 `s.methods.slide` 函数,它会在简单风格里没有显示使用 `#slide[...]` 的情况下默认被调用。

同时,由于 `#slide[...]` 被注册在了 `s.slides = ("slide",)` 里,因此 `section``subsection``title` 参数会被自动传入,而其他的如 `#focus-slide[...]` 则不会自动传入这三个参数。

:::tip[原理]

实际上,你也可以不使用 `#show: slides``utils.slides(s)`,而是只使用 `utils.methods(s)`,例如

```typst
#import "@preview/touying:0.4.2": *
#let s = themes.simple.register()
#let (init, touying-outline, slide) = utils.methods(s)
#show: init
#slide(section: [Title], title: [First Slide])[
Hello, Touying!
#pause
Hello, Typst!
]
```

这时候需要手动传入 `section``subsection``title`,但是会有更好的性能,适合需要更快的性能的情况,例如超过数十数百页的情形。

:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "动态幻灯片",
"position": 8,
"link": {
"type": "generated-index",
"description": "想要在 PDF 中创建动画,我们就需要为同一个 slide 创建多个略有不同的页面,以便通过切换页面的方式实现动画,我们称这些页面为 subslides。"
}
}
Loading

0 comments on commit 6012e78

Please sign in to comment.