Matti Vuorre 2025-07-01
- Install
- Use & configuration
- Example content
- Get help & contribute
- References
- Appendix A: Tips and tricks
Example preprint-typst document.
“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:
- Vuorre, M. (2025). Estimating Signal Detection Models with regression using the brms R package. OSF. https://doi.org/10.31234/osf.io/vtfc3_v1
- Vuorre, M., Johannes, N., & Przybylski, A. (2025). Three objections to a novel paradigm in social media effects research. OSF. https://doi.org/10.31234/osf.io/dpuya_v2
- Vuorre, M., Kay, M., & Bolger, N. (2024). Communicating causal effect heterogeneity. OSF. https://doi.org/10.31234/osf.io/mwg4f
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.
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.
These work across all Quarto output formats (HTML, PDF, Word, etc.)
title
(string) - Document title [Documentation: Quarto]- Example:
title: "My Paper"
- Example:
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"
- Example:
abstract
(string) - Document abstract [Quarto]- Example:
abstract: "This study..."
- Example:
categories
(array) - Keywords/categories for the document [Quarto]- Example:
categories: ["science", "study"]
- Example:
date
(string) - Publication date [Quarto]- Example:
date: "2024-01-01"
- Example:
toc
(boolean) - Include table of contents [Quarto]- Example:
toc: true
- Example:
toc-title
(string) - Customize TOC title [Quarto]- Example:
toc-title: "Contents"
- Example:
toc-depth
(integer) - Number of heading levels in TOC [Quarto]- Example:
toc-depth: 2
- Example:
number-sections
(boolean) - Number section headings [Quarto]- Example:
number-sections: true
- Example:
bibliography
(string/array) - Bibliography file [Quarto]- Example:
bibliography: "bibliography.bib"
- Example:
csl
(string) - Citation Style Language file or URL [Quarto]- Example:
csl: https://www.zotero.org/styles/apa
orcsl: apa.csl
- Example:
citeproc
(boolean; Tip 1) - Use Pandoc citation processing [Quarto]- Example:
citeproc: true
- Example:
Note
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.
fontsize
(string) - Base font size for document text [Quarto]- Example:
fontsize: "11pt"
- Example:
mainfont
(string) - Main document font [Quarto]- Example:
mainfont: "Libertinus Serif"
- Example:
monofont
(string) - Font family for code [Quarto]- Example:
monofont: "Monacy"
- Note: Currently does not work (Quarto issue)
- Example:
linkcolor
(string) - Color for hyperlinks [Quarto, Typst]- Example:
linkcolor: "blue"
orlinkcolor: "#0066cc"
- Example:
font-paths
(array) - Additional font search directories [Quarto]- Example:
font-paths: ["myfonts"]
- Example:
lang
(string) - Document language [Quarto]- Example:
lang: "en"
orlang: "de"
- Example:
region
(string) - Document region [Quarto]- Example:
region: "US"
orregion: "GB"
- Example:
fig-format
(string) - Figure output format [Quarto]- Example:
fig-format: "svg"
orfig-format: "png"
- Example:
These work in Quarto’s Typst output formats but may not work in HTML, Word, etc.
papersize
(string) - Page size specification [Quarto]- Example:
papersize: a4
- Example:
margin
(object/string) - Page margins [Quarto]- Example:
margin: {x: 2.8cm, y: 2.6cm}
- Example:
columns
(integer) - Number of content columns [Quarto]- Example:
columns: 2
- Example:
page-numbering
(string) - Page numbering pattern [Typst]- Example:
page-numbering: "1"
orpage-numbering: "i"
- Example:
section-numbering
(string) - Section numbering pattern [Quarto]- Example:
section-numbering: "1.1.a"
orsection-numbering: "1.A.a"
- Example:
These are native Typst variables exposed through the extension
line-number
(boolean) - Enable line numbers [Typst]- Example:
line-number: true
- Example:
leading
(string) - Line height/spacing between lines [Typst]- Example:
leading: "0.5em"
- Example:
spacing
(string) - Vertical spacing between paragraphs [Typst]- Example:
spacing: "0.6em"
- Example:
first-line-indent
(string) - Indentation for paragraph first lines [Typst]- Example:
first-line-indent: "1.8em"
- Example:
all
(boolean) - Whether to indent all paragraphs (including first in section) [Typst]- Example:
all: false
- Example:
col-gutter
(string) - Horizontal spacing between columns [Typst]- Example:
col-gutter: "4.2%"
orcol-gutter: "2em"
- Example:
toc-indent
(string) - TOC indentation [Typst]- Example:
toc-indent: "1.5em"
- Example:
These are custom features specific to this extension
running-head
(string) - Short title text displayed in page headers- Example:
running-head: "Short Title"
- Example:
authornote
(string) - Text appearing after corresponding author information- Example:
authornote: "Author affiliations and contact"
- Example:
wordcount
(boolean) - Display word count below abstract- Example:
wordcount: true
- Example:
theme-jou
(boolean) - Apply journal theme with 2-column layout and compact spacing- Example:
theme-jou: true
- Example:
functions
(array) - Enable Typst functions in divs [typst-function]- Example:
functions: ["place", "appendix"]
- Example:
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.
Below, we highlight some useful Quarto content features to show how they work with the preprint-typst output format.
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 are centered by default.
Figure 1 is a figure.
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.)
LaTeX math notation is automatically converted to Typst and as such works just fine either inline (
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.
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/
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]
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.
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.
Run quarto typst fonts
in your terminal (not R console) to list all available fonts.
Appendices have appropriate float references like Figure 3, Table 2, Listing 2.
Listing 2: Example R code.
sqrt(1 + 1)
## [1] 1.414214
Equations (Equation 2) work too but their numbering continues from main document.