Skip to content

Repository files navigation

projector Format

A Quarto format for making Typst slides with Polylux or Touying. This template tries to replicate the Quarto-side syntax for Beamer, PowerPoint, and Revealjs slides.

template.qmd

Design principles

In order of importance:

  1. Replicate the syntax of existing Quarto beamer slides so that projector can be used as a drop-in extension for the beamer type, up to any additional LaTeX-specific styling.

  2. Support multiple Typst slide backends without changing the Quarto-facing syntax.

  3. Minimize nonstandard defaults. By setting as few features up automatically as possible, this should be customizeable using a header .typ file. When an option would be hard to control otherwise, it should be controlled via a YAML option in the Quarto doc.

Installing

quarto use template christopherkenny/projector

This will install the format extension and create an example .qmd file that you can use as a starting place for your slides.

Using projector to make slides

This template includes several custom arguments that can be supplied in the YAML header.

  • mainfont: sets font (see options with quarto typst fonts)
  • margin: sets page margins
  • papersize: the paper size to use (choices listed here)
  • toc: whether to display the table of contents
  • toc-title: title of the table of contents
  • background-image: the path to an image to put as the background
  • handout: display as a handout, removing incrementals
  • theme: a file name containing your customizations
  • backend: the slide backend to use (polylux is the default; touying is also supported)
  • touying-theme: an optional built-in theme for Touying

Theme hooks receive a backend-neutral api record. Use its slide functions and toolbox fields instead of importing Polylux or Touying directly.

To customize a built-in backend theme, define projector-backend(api) in your theme. It can return theme-args and theme-config; api.backend exposes the selected backend and its backend-specific helpers.

For example, with Touying's simple theme, this moves the current section to the top right:

#let projector-backend(api) = (
  theme-args: (
    header: none,
    header-right: self => [
      #(api.backend.utils.display-current-heading)(
        level: 1,
        depth: self.slide-level,
      )
    ],
  ),
)

Controlling Title, ToC, and Sections Slides

To modify these three particular slides, you need to adjust them in your template file. Simply redefine the functions that produce them with your own version.

The function signatures should be as follows:

  • title-slide(api, title, subtitle, authors, date)
  • toc-slide(api, toc_title)
  • section-slide(api, name)

Using _brand.yml

Projector uses Quarto's standard Typst brand processing. Brand colors, logos, and typography are applied to the page, headings, links, and code; explicit projector options such as mainfont and fontsize take precedence where they are supplied. Quarto's brand-mode: dark selects the dark brand when rendering.

Custom themes can access the resolved brand through api.brand:

  • api.brand.colors: semantic and named colors from color
  • api.brand.background-colors: lighter background variants
  • api.brand.logos: resolved small, medium, and large logos
  • api.brand.typography: normalized base, heading, and monospace settings

Using other Typst functions

This extension comes preloaded with my typst-function Quarto extension to make it easy to use bits of Typst for formatting. This feature is entirely optional, but may simplify making tweaks to your slides.

Divs and spans that match names listed in the functions key are translated to Typst functions of the same name. Adding this to your metadata:

functions: align

Allows you to write:

::: {.align arguments="right"}
this
:::

Spans function similarly, so you can style like:

[other text]{.align arguments=right}

License

This template is licensed under the MIT License. See the LICENSE file for details.

Thoughts from the author

I actually quite dislike beamer and similar slide styles that are automatically generated. I find that they are (1) typically ugly and (2) encourage bad presenting habits. If it's too easy to go from the paper to the presentation, people rarely think through the presentation. My view is that presentations and papers have different goals. A paper needs to convey all of the scientific components that support why your work advances knowledge. A presentation is more of an infomercial for the paper. That means you can tell the story of the paper. It should be truthful and scientific, but it should also be interesting. Tell the practical pieces, tell the hiccups along the way, make it clear how you came up with the project. Finally, it's okay if it looks nice: don't be worried that an aesthetically pleasing presentation implies you spent a little time on form instead of just function. Hopefully, this extension helps bridge the gap between form and function, by using the prettier polylux with the simplicity of beamer via Quarto.

The logo for this project (haha) is inspired by polylux's logo. The name is also inspired bypolylux's name origin story, where to me, an updated "beamer" is a "projector".

About

A Quarto template using Typst's Polylux to make slides

Topics

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages