跳到主要内容
版本:0.4.2

节与小节

结构

与 Beamer 相同,Touying 同样有着 section 和 subsection 的概念。

一般而言,1 级、2 级和 3 级标题分别用来对应 section、subsection 和 title,例如 dewdrop 主题。

#import "@preview/touying:0.4.2": *

#let s = themes.dewdrop.register()
#let (init, slides) = utils.methods(s)
#show: init

#let (slide, empty-slide) = utils.slides(s)
#show: slides

= Section

== Subsection

=== Title

Hello, Touying!

image

但是很多时候我们并不需要 subsection,因此也会使用 1 级和 2 级标题来分别对应 section 和 title,例如 university 主题。

#import "@preview/touying:0.4.2": *

#let s = themes.university.register()
#let (init, slides) = utils.methods(s)
#show: init

#let (slide, empty-slide) = utils.slides(s)
#show: slides

= Section

== Title

Hello, Touying!

image

实际上,我们可以通过 slides 函数的 slide-level 参数来控制这里的行为。slide-level 代表着嵌套结构的复杂度,从 0 开始计算。例如 #show: slides.with(slide-level: 2) 等价于 sectionsubsectiontitle 结构;而 #show: slides.with(slide-level: 1) 等价于 sectiontitle 结构。

编号

为了给节与小节加入编号,我们只需要使用

#let s = (s.methods.numbering)(self: s, section: "1.", "1.1")

即可设置默认编号为 1.1,且 section 对应的编号为 1.

目录

在 Touying 中显示目录很简单:

#import "@preview/touying:0.4.2": *

#let s = themes.simple.register()
#let (init, slides, alert, touying-outline) = utils.methods(s)
#show: init

#let (slide, empty-slide) = utils.slides(s)
#show: slides.with(slide-level: 2)

= Section

== Subsection

=== Title

==== Table of contents

#touying-outline()

image

其中 touying-oultine() 的定义为:

#let touying-outline(enum-args: (:), padding: 0pt) = { .. }

你可以通过 enum-args 修改内部 enum 的参数。

你当然也可以使用 Typst 原生的目录:

#outline(title: none, indent: 2em)

image

如果你对目录有着复杂的自定义需求,你可以使用

#states.touying-final-sections(sections => ..)

正如 dewdrop 主题所做的那样。