跳到主要内容

bundle-assets

bundle-assets(pretty: true)(source)

Write the pdfpc metadata of every presentation in a bundle export to a .pdfpc file next to it.

Since Typst 0.15 a single compilation can emit a whole bundle of files, which is how a .pdfpc file can be produced without the extra typst eval invocation documented on pdfpc-file:

typst compile --features bundle --format bundle --root . ./example.typ ./out

Call this at the top level of the file, i.e. outside of every #document(..): an asset belongs to the bundle rather than to one of its documents, and Typst rejects asset(..) inside a document body. The call may sit before or after the documents; introspection sees the whole bundle either way.

Each PDF document of the bundle that carries pdfpc metadata (every touying presentation with enable-pdfpc: true) gets one .pdfpc file, named after the document itself: slides/deck.pdf is accompanied by slides/deck.pdfpc. Documents without pdfpc metadata are skipped, and so are non-PDF documents, because pdfpc presents PDFs.

Outside of a bundle export this does nothing at all, so a file containing the call still compiles to a plain PDF. That applies to this call only - #document(..) itself is bundle-only and Typst rejects it in any other target.

Example:

#import "@preview/touying:0.8.0": *
#import themes.simple: *

#pdfpc.bundle-assets()

#document("deck.pdf", [
#show: simple-theme

== A slide
#speaker-note[Only the speaker sees this.]
])
Parameters

pretty : bool    default: true​

Whether to pretty-print the JSON. Default is true.

Returns: content