Generate both .pdf and .pdfpc

When writing a presentation with Touying, it’s very helpful to be able to view the current artifact in GitHub - pdfpc/pdfpc: A presenter console with multi-monitor support for PDF files. · GitHub , by making use of it’s (non-auto)
reload feature.
To be able to keep the speaker notes, which pdfpc reads from a JSON file with the .pdfpc extention, updated as well, one would’ve needed something like that:

while true
    inotifywait example.typ
    typst query --features bundle --target bundle --root . ./example.typ --field value --one "<pdfpc-file>"
end

(See the Touying documentation.) typst query would take a significant amount of time on larger presentations.

Fortunately, since Release Version 0.15.0 (June 15, 2026) · typst/typst · GitHub , multiple output files can be emitted from a single Typst project by using bundle export. That way, both the .pdf and .pdfpc can be emitted from a single typst command, making use of incremental compilation!

Here’s an example presentation

#document("example.pdf")[
  #import "@preview/touying:0.7.4": *
  #import themes.simple: *

  #show: simple-theme.with(
    aspect-ratio: "16-9",
  )


  == Example
  #speaker-note[
    Hello!
  ]

  Presentation goes here!
]

#context {
  asset(
    "example.pdfpc",
      json.encode(query(<pdfpc-file>).first().value),
  )
}

and the corresponding command

typst watch --no-serve --features bundle --format bundle example.typ

.

2 Likes