关于 touying-author
touying-author 为使用 Touying 和 Typst 编写演示文稿提供结构与配置指南,适合需要组织多文件幻灯片、布局和动画的作者。内容涵盖配置模式、幻灯片结构及演讲者备注。
主要功能
- 01单文件与多文件组织建议
- 02集中式主题和页面配置
- 03标题驱动的幻灯片结构
- 04动态内容与动画模式
- 05演讲者备注及 PDFPC 元数据
适用场景
- 01规划大型演示文稿的文件结构
- 02配置主题、页眉和页脚
- 03创建渐进显示或公式动画
- 04为演示添加演讲者备注
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ apcamargo/ typst-skills --skill touying-author安装后在 Claude Code 中输入/touying-author确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
docs/build-your-own-theme.mdchangelog.mdcode-styles.mdglobal-settings.mdintro.mdlayout.mdmulti-file.mdsections.mdstart.mddocs/dynamic/complex.mdcover.mdequation.mdhandout.mdother.mdsimple.mddocs/external/pdfpc.mdpympress.mdtypst-preview.mddocs/integration/cetz.mdcodly.mdfletcher.mdmitex.mdpinit.mdtheorion.mddocs/progress/counters.mdsections.mddocs/themes/aqua.mdcustom.mddewdrop.mdmetropolis.md详细介绍
Touying 作者指南
使用 Touying 编写 Typst 演示文稿,重点关注清晰的结构、可重复的配置和适用于幻灯片的模式。
快速入门
- 导入 Touying 和一个主题,然后使用
#show: <theme>.with(...)应用主题。 - 将配置集中管理;从单独的文件中引入幻灯片内容。
- 使用标题创建幻灯片;对于自定义布局或动画,请使用
#slide。 - 从
examples/simple.typ开始制作最简演示文稿,或从examples/default.typ开始使用基础主题。
examples/simple.typ 中的代码片段:
#import "@preview/touying:0.6.1": *
#import themes.simple: *
#show: simple-theme.with(
aspect-ratio: "16-9",
footer: [Simple slides],
)
最佳实践和代码结构
- 使用单个入口文件(例如
main.typ),在其中应用#show和所有config-*调用。 - 对于多文件演示文稿,请遵循
globals.typ+main.typ+content.typ模式;使用#include引入内容,使用#import引入全局变量,以避免循环引用。 - 文档对共享配置文件同时使用
config.typ(参见docs/start.md)和globals.typ(参见docs/multi-file.md);选择一个名称,并在项目中保持一致。 - 对于大型演示文稿,将
content.typ移至sections/,并从main.typ引入sections/content.typ(以及可选的sections/another-section.typ)。 - 优先使用
config-page、config-common、config-info、config-colors、config-methods和config-store,而不是直接使用set page或临时添加全局show。 - 大多数幻灯片使用标题;使用
config-common(slide-level: n)选择哪些标题级别会创建幻灯片。 - 仅在需要自定义布局或动画时使用
#slide;始终使用touying-slide-wrapper包装幻灯片函数。 - 对于回调式动画(
#slide(repeat: n, self => [...])),请显式设置repeat,并使用utils.methods(self)访问uncover、only和alternatives。
单文件结构
.
├── globals.typ
├── main.typ
└── content.typ
多文件结构
.
├── globals.typ
├── main.typ
└── sections/
├── content.typ
└── another-section.typ
核心 API 概览(导出项)
- 幻灯片:
touying-slides、slide、touying-slide、touying-slide-wrapper、empty-slide - 动效:
pause、meanwhile、uncover、only、effect、alternatives、alternatives-match、alternatives-fn、alternatives-cases - 配置:
config-common、config-page、config-info、config-colors、config-methods、config-store、default-config、touying-set-config、appendix - 实用工具:
utils.*(适应高度、适应宽度、封面辅助工具、进度、标题辅助工具) - 组件:
components.side-by-side、components.adaptive-columns、components.progressive-outline、components.custom-progressive-outline - 集成:
touying-reducer、touying-equation、touying-mitex、speaker-note、pdfpc.* - 回顾:
touying-recall、touying-fn-wrapper
幻灯片结构和标题
- 使用标题标签控制编号、纲要和书签:使用
<touying:hidden>(参见docs/code-styles.md);有关<touying:unnumbered>、<touying:unoutlined>、<touying:unbookmarked>和<touying:skip>,请参见docs/changelog.md。 - 使用
components.adaptive-columns(outline(...))创建目录幻灯片;使用components.progressive-outline创建可感知进度的纲要。 - 使用
== <touying:hidden>插入空白标题幻灯片,并清除之前的标题上下文。 - 使用
#pagebreak()或---拆分幻灯片,而不更改标题。 - 对于不带页眉和页脚的幻灯片,请使用
#empty-slide[...]。 - 使用
config-common(handout: true),使讲义输出中每张幻灯片只保留最后一个子幻灯片。 - 使用
#show: appendix,在主演示文稿结束后固定最后一张幻灯片的计数。
examples/default.typ 中的代码片段:
= Outline <touying:hidden>
#components.adaptive-columns(outline(title: none, indent: 1em))
动画和动态内容
- 使用
#pause和#meanwhile实现简单的逐步显示;避免在不支持标记的context中使用它们。 - 使用
#uncover预留布局空间;使用#only在隐藏时移除布局空间。 - 如果标记导致警告,请使用带有
repeat和utils.methods(self)的回调式幻灯片。 - 对于数学动画,在
$ ... $中使用pause/meanwhile;如果需要辅助函数来处理行内公式文本,请使用touying-equation(也可以使用#pause或#pause;)。 - 简单、复杂、回调式动画以及公式动画示例,请参阅
examples/example.typ。
摘自 examples/simple.typ:
== Dynamic slide
Did you know that...
#pause
...you can see the current section at the top of the slide?
摘自 examples/example.typ:
#slide(
repeat: 3,
self => [
#let (uncover, only, alternatives) = utils.methods(self)
At subslide #self.subslide, we can
use #uncover("2-")[`#uncover` function] for 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.
],
)
布局和主题
- 保持视觉风格一致:新布局、图形、表格和绘图必须沿用文档现有的字体、颜色和排版层级(除非另有要求)。内部风格也应保持一致(相同函数 → 相同尺寸和颜色)。
- 在
#slide中使用composer创建分栏;传入(1fr, 2fr)或自定义的grid函数。 - 使用
config-page设置边距、页眉、页脚和背景;不要直接使用set page。 - 仅在允许更改布局时,使用
config-methods(cover: utils.semi-transparent-cover.with(alpha: 85%))。 - 使用
config-store存放主题专属的页眉/页脚或导航元素值。 - 使用
config-common(new-section-slide-fn: none)禁用自动生成的章节幻灯片,或提供自定义函数替换它们。 - 在
#show: <theme>.with(...)周围应用全局样式,或在主题中通过config-methods(init: ...)应用。 - 使用
config-info(...)设置标题/作者/日期,并使用config-common(datetime-format: ...)控制日期格式。
摘自 examples/default.typ:
#import "@preview/touying:0.6.1": *
#import themes.default: *
#import "@preview/numbly:0.1.0": numbly
#show: default-theme.with(
aspect-ratio: "16-9",
config-common(
slide-level: 3,
zero-margin-header: false,
),
config-colors(primary: blue),
config-methods(alert: utils.alert-with-primary-color),
config-page(
header: text(gray, utils.display-current-short-heading(level: 2)),
),
)
演讲者备注和演示工具
- 使用
#speaker-note[...]添加备注。 - 使用
config-common(show-notes-on-second-screen: right)或bottom在第二屏幕上显示备注。 - 使用
enable-pdfpc: true和typst query --field value --on "<pdfpc-file>"导出 pdfpc 元数据。
使用随附的文档和示例
- 只阅读任务所需的特定文档;避免加载整个文档树。
- 阅读
docs/start.md和docs/intro.md,了解基础知识和导入模式。 - 阅读
docs/multi-file.md,了解多文件布局和包含模式。 - 阅读
docs/layout.md和docs/sections.md,了解幻灯片级布局和标题行为。 - 阅读
docs/code-styles.md,了解简单样式与块样式,以及分页技巧。 - 阅读
docs/global-settings.md,了解全局样式和config-info的用法。 - 阅读
docs/dynamic/*.md,了解pause、meanwhile、覆盖行为和公式动画。 - 阅读
docs/themes/*.md,了解主题专属 API 和默认值。 - 阅读
docs/external/*.md,了解 pdfpc 和 Pympress 的用法。 - 阅读
docs/integration/*.md,了解 CeTZ/Fletcher/Theorion/MiTeX 集成。 - 将
examples/*.typ用作各主题的可运行模板。
文件树(文档和示例)
docs/
├── build-your-own-theme.md
├── changelog.md
├── code-styles.md
├── dynamic
│ ├── complex.md
│ ├── cover.md
│ ├── equation.md
│ ├── handout.md
│ ├── other.md
│ └── simple.md
├── external
│ ├── pdfpc.md
│ ├── pympress.md
│ └── typst-preview.md
├── global-settings.md
├── integration
│ ├── cetz.md
│ ├── codly.md
│ ├── fletcher.md
│ ├── mitex.md
│ ├── pinit.md
│ └── theorion.md
├── intro.md
├── layout.md
├── multi-file.md
├── progress
│ ├── counters.md
│ └── sections.md
├── sections.md
├── start.md
├── themes
│ ├── aqua.md
│ ├── custom.md
│ ├── dewdrop.md
│ ├── metropolis.md
│ ├── simple.md
│ ├── stargazer.md
│ └── university.md
└── utilities
└── fit-to.md
examples/
├── aqua-zh.typ
├── aqua.typ
├── default.typ
├── dewdrop.typ
├── example.typ
├── metropolis.typ
├── simple.typ
├── stargazer.typ
└── university.typ
评论
支持 Markdown