Partials

Extending Quarto workshop @ posit::conf(2025)

Charlotte Wickham
&  
Mine Çetinkaya-Rundel

Templates and template partials

Templates

  • Quarto uses Pandoc templates to generate the rendered output from a markdown file.

  • A Pandoc template is a mix of format specific content and variables, where the variables are replaced with their values from a rendered document

  • Usage: Provide your custom template for complete control of the final output:

format:
  pdf:
    template-partials:
      - my-awesome-template.tex

Example: Basic LaTeX template

Input:

article.qmd
Hello **world**!

Template:

my-awesome-template.tex
\documentclass{scrartcl}
\begin{document}
$body$
\end{document}

Output:

article.tex
\documentclass{scrartcl}
\begin{document}
Hello \textbf{world}!
\end{document}

$body$ replaced with LaTeX generated from body of document

Full or partial?

  • Replacing an entire template offers full control of output but comes with the risk of omitting required variables that can break Pandoc/Quarto features.

  • Safer approaches:

    • Selectively replace partials that exist within the master LaTeX or HTML template

    • Replace the entire LaTeX or HTML template, but then include partials provided with Quarto to ensure that your template takes advantage of all Pandoc and Quarto features

Working with partials

Replacing partials

  • Quarto provides built in templates that are composed of a set of partial template files for LaTeX / PDF and HTML output

  • You can replace portions of Quarto’s built in template which allows you to customize just a portion of the template without needing to replace it entirely

Example: Basic LaTeX partial

When using a partial for modifying the title in LaTeX, Quarto will use the built in template but replace the title portion of the template with the provided partial:

Partial:

title.tex
\title{$title$}
\author{$for(author)$$author$$sep$ \and $endfor$}
\date{$date$}

Usage:

my-document.qmd
format:
  pdf:
    template-partials:
      - title.tex

What’s in a name? 🌹

The name of the partial file must match the name of the partial in the built in template that you want to replace.

my-document.qmd
format:
  revealjs:
    template-partials:
      - better-title-slide.html
ERROR: The format 'revealjs' only supports 
the following partials:
metadata.html
title-block.html
toc.html
styles.html
toc-slide.html
title-slide.html

Please provide one or more of these 
partials.

Tip

Provide an empty file as a partial to opt out of some features without modifying the whole main template.

Including partials

Use built in partials when composing your own template, which allows you to include specific features from Quarto and Pandoc without copying and maintaining the entire template code:

my-template.tex
\documentclass{scrartcl}
$pandoc.tex()$  
\begin{document}
$body$          
\end{document}  
  • Use the $pandoc.tex()$ partial to include pandoc configuration for text highlighting, tables, graphics, tight lists, citations, and header include.
  • Add your custom template for $body$.

Partials for various formats

They exist! https://quarto.org/docs/journals/templates.html

babel-lang.tex
before-bib.tex
biblio.tex
biblio-config.tex
citations.tex
doc-class.tex
graphics.tex
after-body.tex
before-body.tex
pandoc.tex
tables.tex
tightlist.tex
before-title.tex
title.tex
toc.tex
after-header-includes.latex
common.latex
font-settings.latex
fonts.latex
hypersetup.latex
passoptions.latex
definitions.typ
typst-template.typ
page.typ
typst-show.typ
notes.typ
biblio.typ
html.styles
html.template
metadata.html
styles.html
template.html
title-block.html
toc.html
metadata.html
title-block.html
toc.html
styles.html
toc-slide.html
title-slide.html

Zhuzh up your title-slide 💅

Example 1: A title slide…

with plenty of meta data

title: The Best Title Ever
subtitle: and a mediocre subtitle
author:
  - name: Mine Çetinkaya-Rundel
    url: https://mine-cr.com
    orcid: 0000-0001-6452-2420
    email: mine@posit.co
    affiliations:
      - name: Duke University
      - name: Posit, PBC
  - name: Charlotte Wickham
    url: https://cwick.co.nz
    orcid: 0000-0002-6365-5499
    email: charlotte@posit.co
    affiliation:
      - name: Posit, PBC
date: 2025-09-16
footer: "[pos.it/quarto-extend-conf25](https://pos.it/quarto-extend-conf25)"
format: revealjs

Example: 02-partials/examples/1-start-here

Your turn 1: Default title-slide partial

  • Find the default title-slide.html partial in the Quarto GitHub repo, copy it to your exercise folder, and include it as a template-partial in your YAML.

  • Render your slides and observe the difference, or lack thereof!

Exercise: 02-partials/your-turns/1-default-title-slide

03:00

Example 2: Modify date & author email

Example: 02-partials/examples/2-modify-date-author-email

Your turn 2: Modify ORCID

Modify how the ORCID logo shown to match the color scheme of the title slide; use this one instead: https://icon-sets.iconify.design/simple-icons/?icon-filter=orcid.

Exercise: 02-partials/your-turn/2-modify-orcid

05:00

Your turn 3: Modify affiliations

Display multiple affiliations on the same line, separated by +.

Exercise: 02-partials/your-turn/3-modify-affiliations

03:00

Your turn 4: Modify author URL

Display author url on the title slide, next to a home icon, e.g., https://icon-sets.iconify.design/line-md/?icon-filter=home.

Exercise: 02-partials/your-turn/4-modify-author-url

07:00

Example 3: Add venue

Add a new field, venue, to the YAML and place it under the date.

Exercise: 02-partials/examples/3-add-venue

Your turn 5: Add GitHub usernames

  • Add GitHub usernames to the document YAML with a field called github under author.

  • Update title-slide.html to place GitHub usernames along with the GitHub logo under affiliations.

Exercise: 02-partials/your-turn/5-add-github

07:00

Your turn 6: Style

Make the title slide match the screenshot in below. Specifically:

  • Make the title small caps.
  • Use handwriting font for the subtitle.
  • Adjust font sizes of various fields: date, affiliation, author URL, GitHub username, and email are smaller.
  • Adjust font colors: subtitle and affiliations are gray.

Exercise: 02-partials/your-turn/6-style

07:00

Questions?