常见问题
关于 Touying 的常见问题解答。
背景与颜色
如何更改幻灯片的背景颜色?
在主题设置中使用 config-page(fill: ...):
#import "@preview/touying:0.6.3": *
#import themes.simple: *
#show: simple-theme.with(
aspect-ratio: "16-9",
config-page(fill: rgb("#f0f4f8")),
)
= Title
== First Slide
Hello, Touying!
对于单页幻灯片,也可以使用 config-common(fill: ...):
#import "@preview/touying:0.6.3": *
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
= Title
== First Slide
#slide(config: config-page(fill: gray))[
Hello, Touying!
]
如何为幻灯片添加背景图片?
将 image(...) 调用传递给 config-page(background: ...):
#import "@preview/touying:0.6.3": *
#import themes.simple: *
#show: simple-theme.with(
aspect-ratio: "16-9",
config-page(
background: rect(width: 100%, height: 100%, fill: gradient.linear(blue.lighten(80%), purple.lighten(80%))),
),
)
= Title
== Gradient Background Slide
Content appears over the background.
对于单页幻灯片,也可以使用 config-common(background: ...):
#import "@preview/touying:0.6.3": *
#import themes.simple: *
#show: simple-theme.with(aspect-ratio: "16-9")
= Title
== Gradient Background Slide
#slide(config: config-page(background: rect(width: 100%, height: 100%, fill: gradient.linear(blue.lighten(80%), purple.lighten(80%)))))[
Hello, Touying!
]
如果使用真实图片文 件,可以这样写:
config-page(
background: image("bg.png", width: 100%, height: 100%),
)
如何更改主题的主色?
使用 config-colors(primary: ...):
#import "@preview/touying:0.6.3": *
#import themes.metropolis: *
#show: metropolis-theme.with(
aspect-ratio: "16-9",
config-colors(primary: rgb("#d94f00")),
config-info(title: [Custom Color], author: [Author]),
)
= Section
== Slide
The header now uses the custom primary color.
布局与分栏
如何创建两栏布局?
使用带 composer 参数的 slide 将内容分成多列:
#slide(composer: (1fr, 1fr))[
== Left Column
Some text on the left side.
][
== Right Column
Some text on the right side.
]
如需不等宽的列,可调整分数比例,例如 (2fr, 1fr)。