quarto-preprint: A Quarto extension for creating PDF documents with Typst

Quarto
Typst
extension
typesetting
preprint
Author
Affiliation

Tilburg University

Published

July 2, 2025

Abstract

quarto-preprint is a Quarto extension for creating PDF documents from markdown content with Typst. It provides one Quarto output format, preprint-typst, that aims to Just Work (Typst doesn’t require LaTeX installations and ships with Quarto), be fast (Typst creates PDF files very quickly), and be 100% Quarto standards compliant (write documents without worrying about formatting & metadata, switch to other Quarto formatd without changing anything but the output format). preprint-typst builds on the standard Quarto Typst template and enables separated author-affiliation formatting, additional (Quarto, Typst, and custom) metadata variables, opinionated typesetting, improved two-column layouts (including full-width floats), appendices, and more. Its intended use cases are worry-free but flexible typesetting of Quarto documents to PDF, especially when users might want to easily switch to other (e.g. journal-specific) formats.

“An article about computational science in a scientific publication is not the scholarship itself, it is merely advertising of the scholarship. The actual scholarship is the complete software development environment and the complete set of instructions which generated the figures.” –Buckheit and Donoho (1995, paraphrasing Jon Claerbout)

Quarto is “An open-source scientific and technical publishing system” (Allaire et al., 2025) for writing reproducible documents that combine computations and prose written in markdown into HTML, PDF, Word, and other outputs. For many R users, Quarto is a successor of R Markdown but with a broader scope and better support for different output formats and computational content in other languages.

quarto-preprint is a Quarto extension that provides one such output format, called preprint-typst. When using this format, Quarto renders your document into PDF using Typst, a modern replacement for LaTeX. preprint-typst builds on the standard Quarto Typst template and enables separated author-affiliation formatting, additional (Quarto, Typst, and custom) metadata variables, opinionated typesetting, improved two-column layouts (including full-width floats), appendices, and more (read below).

This document explains how to install, use and customize the output of Quarto documents created with the preprint-typst format. Example manuscripts using preprint-typst format include:

Install

You can use this Quarto extension in two ways. First, you can add it to an existing project with

quarto add mvuorre/quarto-preprint

The quarto add command, which you use on the command line and not the R console, creates a _extensions/preprint/ directory in your project. The preprint-typst format is then ready to use in any Quarto document in that project.

Second, you can start a new Quarto project that uses quarto-preprint with quarto-use:

quarto use template mvuorre/quarto-preprint

You will then answer a series of questions (project name etc.) and end up with a new project directory with a {project-name}.qmd file that provides a starter Quarto document template that uses the preprint-typst format. It also creates a boilerplate _quarto.yml file where you can specify the Quarto project’s metadata, and an example bibliography.bib file.

Use & configuration

The output of Quarto documents is configured through YAML front matter metadata. To specify an output format for your document, include (for example) format: preprint-typst in the front matter. Here is a minimal example YAML front matter that specifies a title, a table of contents, and two output formats:

---
title: A document
# Top-level options apply to all formats,
# such as this table of contents
toc: true
format:
  preprint-typst:
    # Options under a format apply only to that format
    wordcount: true
  html:
    title-block-banner: true
---
Document content goes here...

Note that many front matter variables can be specified for all output formats (such as toc above) or for only some of them (like wordcount above). To learn more about Quarto’s front matter options, see Quarto’s guide to writing scholarly documents, and Quarto’s Typst format documentation.

preprint-typst aims to include all standard Quarto front matter options for scholarly writing. In addition to standard Quarto YAML variables, preprint-typst supports additional fields and Typst variables, such as author notes and paragraph formatting. Below, we list available YAML configuration options roughly organized by their specificity to different Quarto output formats.

Universal Quarto options

These work across all Quarto output formats (HTML, PDF, Word, etc.)

Document information

  • title (string) - Document title [Documentation: Quarto]
    • Example: title: "My Paper"
  • author (string/array) - Author details with name, affiliation, email, etc. [Quarto]
  • affiliations (array) - Author affiliations with id, name, department [Quarto]
  • subtitle (string) - Document subtitle [Quarto]
    • Example: subtitle: "A Study"
  • abstract (string) - Document abstract [Quarto]
    • Example: abstract: "This study..."
  • categories (array) - Keywords/categories for the document [Quarto]
    • Example: categories: ["science", "study"]
  • date (string) - Publication date [Quarto]
    • Example: date: "2024-01-01"
  • toc (boolean) - Include table of contents [Quarto]
    • Example: toc: true
  • toc-title (string) - Customize TOC title [Quarto]
    • Example: toc-title: "Contents"
  • toc-depth (integer) - Number of heading levels in TOC [Quarto]
    • Example: toc-depth: 2
  • number-sections (boolean) - Number section headings [Quarto]
    • Example: number-sections: true

Bibliography & citations

  • bibliography (string/array) - Bibliography file [Quarto]
    • Example: bibliography: "bibliography.bib"
  • csl (string) - Citation Style Language file or URL [Quarto]
    • Example: csl: https://www.zotero.org/styles/apa or csl: apa.csl
  • citeproc (boolean; Tip 1) - Use Pandoc citation processing [Quarto]
    • Example: citeproc: true
Note 1: Quarto, Typst, and bibliography processing

Typst has its own citation processing system, but by default preprint-typst turns it off by using citeproc: true to allow better bibliography customization and use of Quarto’s #refs div. In your document, include

# References

::: {#refs}
:::

to display the bibliography section anywhere in the document. Read more at Quarto’s citations documentation.

  • When citeproc is off (citeproc: false)
    • bibliography-title (string) - Bibliography section title
      • Example: bibliography-title: "References"
    • bibliographystyle (string) - Citation style [Quarto, Typst]
      • Example: bibliographystyle: "apa"

Typography

  • fontsize (string) - Base font size for document text [Quarto]
    • Example: fontsize: "11pt"
  • mainfont (string) - Main document font [Quarto]
    • Example: mainfont: "Libertinus Serif"
  • monofont (string) - Font family for code [Quarto]
    • Example: monofont: "Monacy"
    • Note: Currently does not work (Quarto issue)
  • linkcolor (string) - Color for hyperlinks [Quarto, Typst]
    • Example: linkcolor: "blue" or linkcolor: "#0066cc"
  • font-paths (array) - Additional font search directories [Quarto]
    • Example: font-paths: ["myfonts"]

Language & localization

  • lang (string) - Document language [Quarto]
    • Example: lang: "en" or lang: "de"
  • region (string) - Document region [Quarto]
    • Example: region: "US" or region: "GB"

Figures

  • fig-format (string) - Figure output format [Quarto]
    • Example: fig-format: "svg" or fig-format: "png"

Quarto Typst options

These work in Quarto’s Typst output formats but may not work in HTML, Word, etc.

Page layout

  • papersize (string) - Page size specification [Quarto]
    • Example: papersize: a4
  • margin (object/string) - Page margins [Quarto]
    • Example: margin: {x: 2.8cm, y: 2.6cm}
  • columns (integer) - Number of content columns [Quarto]
    • Example: columns: 2
  • page-numbering (string) - Page numbering pattern [Typst]
    • Example: page-numbering: "1" or page-numbering: "i"

Section numbering

  • section-numbering (string) - Section numbering pattern [Quarto]
    • Example: section-numbering: "1.1.a" or section-numbering: "1.A.a"

Advanced Typst formatting

These are native Typst variables exposed through the extension

  • line-number (boolean) - Enable line numbers [Typst]
    • Example: line-number: true
  • leading (string) - Line height/spacing between lines [Typst]
    • Example: leading: "0.5em"
  • spacing (string) - Vertical spacing between paragraphs [Typst]
    • Example: spacing: "0.6em"
  • first-line-indent (string) - Indentation for paragraph first lines [Typst]
    • Example: first-line-indent: "1.8em"
  • all (boolean) - Whether to indent all paragraphs (including first in section) [Typst]
    • Example: all: false
  • col-gutter (string) - Horizontal spacing between columns [Typst]
    • Example: col-gutter: "4.2%" or col-gutter: "2em"
  • toc-indent (string) - TOC indentation [Typst]
    • Example: toc-indent: "1.5em"

preprint-typst extension options

These are custom features specific to this extension

  • running-head (string) - Short title text displayed in page headers
    • Example: running-head: "Short Title"
  • authornote (string) - Text appearing after corresponding author information
    • Example: authornote: "Author affiliations and contact"
  • wordcount (boolean) - Display word count below abstract
    • Example: wordcount: true
  • theme-jou (boolean) - Apply journal theme with 2-column layout and compact spacing
    • Example: theme-jou: true
  • functions (array) - Enable Typst functions in divs [typst-function]
    • Example: functions: ["place", "appendix"]

When starting a new project that uses the quarto-preprint template (quarto use template mvuorre/quarto-preprint), the template Quarto file already includes some useful variables and their values. See Quarto’s Typst documentation for standard options and Typst documentation for styling details.

Example content

Below, we highlight some useful Quarto content features to show how they work with the preprint-typst output format.

Floats

Tables

Listing 1 shows an example R (R Core Team, 2025) code snippet for creating tables (Table 1) with the tinytable R package (Arel-Bundock, 2025).

Listing 1: R code example.
library(tinytable)
tt(mtcars[1:3, 1:5])
Table 1: Information on various cars.
mpg cyl disp hp drat
21.0 6 160 110 3.90
21.0 6 160 110 3.90
22.8 4 108 93 3.85

Figures

Figures are centered by default.

Figure 1: Example figure.

Figure 1 is a figure.

Full-width content

You can also include page-wide figures (or any other content) in documents that have more than one column. See Figure 2 for an example. First, include

functions: place

in the document’s YAML. Then, wrap your figure in a Quarto div like this:

::: {.place arguments='auto, scope: "parent", float: true'}
Everything here will span the whole page.
:::

The above uses the Typst’s place() function through the typst-function Quarto extension to place the div’s content in "parent" scope (the document page is the column’s parent) and must specify that Typst should treat the content as a float. auto indicates where the figure should be on the page, and can be either auto, bottom, or top. (Note auto and bottom can make the figure appear below footnotes.)

Figure 2

Maths

LaTeX math notation is automatically converted to Typst and as such works just fine either inline (\(y_i = \alpha + \beta x_i + \epsilon_i\)) or in display mode (Equation 1).

\[ f(x \mid \mu, \sigma^2) = \frac{1}{\sqrt{2\pi \sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \tag{1}\]

Get help & contribute

Send your comments, bug reports, and pull requests to https://github.com/mvuorre/quarto-preprint. If you’re reporting a bug, please include a reproducible example / full details of what you’re trying to do, how, and what goes wrong.

References

Allaire, J. J., Teague, C., Scheidegger, C., Xie, Y., Dervieux, C., & Woodhull, G. (2025). Quarto. https://doi.org/10.5281/zenodo.5960048
Arel-Bundock, V. (2025). Tinytable: Simple and configurable tables in ’HTML’, ’LaTeX’, ’markdown’, ’word’, ’PNG’, ’PDF’, and ’typst’ formats. https://vincentarelbundock.github.io/tinytable/
R Core Team. (2025). R: A Language and Environment for Statistical Computing. Version 4.4.3 (Version 4.4.3) [Computer software]. R Foundation for Statistical Computing. https://www.R-project.org/

Appendix A: Tips and tricks

To include and appendix (Tip 2), place it at the end of the document and wrap all its content in an .appendix Quarto div:

::: {.appendix}
# Appendix: Computational details
Here we describe the computational details of our approach...
:::
Tip 2

Appendices are an experimental feature. They are provided through a custom Typst function using the typst-function Quarto extension, and their implementation and functionality may change as Quarto’s Typst integration matures.

Citation management

Quarto documents require citations in a separate .bib file. The vscode-zotero VS Code plugin helps with inserting in-text citations and managing the .bib file. The plugin works in all VS Code based editors, including Positron.

Fonts

Run quarto typst fonts in your terminal (not R console) to list all available fonts.

Example appendix content

Appendices have appropriate float references like Figure 3, Table 2, Listing 2.

Figure 3: A gray rectangle.
Table 2: Another gray rectangle.

Listing 2: Example R code.
sqrt(1 + 1)
## [1] 1.414214

Equations (Equation 2) work too but their numbering continues from main document.

\[ f(x \mid \mu, \sigma^2) = \frac{1}{\sqrt{2\pi \sigma^2}} \exp\left(-\frac{(x-\mu)^2}{2\sigma^2}\right) \tag{2}\]