Output Formats

HTML, Word, PDF, and LaTeX

Daniela Palleschi

March 25, 2026

Overview

  • Rendering to multiple formats from one source file
  • HTML: sharing and the web
  • Word: co-authors and journal submission
  • PDF: LaTeX and Overleaf
  • APA 7 and .tex trade-offs

πŸ’¬ Think about your workflow

Which output format do you need most?

Do your co-authors use Word, LaTeX, or something else?

Has format incompatibility ever caused you problems?

~3 minutes

Rendering formats

Render to a single format by specifying it in the YAML format: block:

HTML

format:
  html: default

PDF

format:
  pdf: default

Word

format:
  docx: default

Format options

Add options by replacing default with indented key-value pairs; here we add table of contents:

HTML

format:
  html:
    toc: true

PDF

format:
  pdf:
    toc: true

Word

format:
  docx:
    toc: true

Warning

Indentation is critical in YAML. Options must be indented consistently under the format name. Mixing spaces and tabs, or inconsistent indentation, will cause render errors.

Multiple formats

Specify all formats together to render all at once with quarto render manuscript.qmd in the Terminal (or individually via the Render button):

Minimal

format:
  html: default
  pdf: default
  docx: default

With options

format:
  html:
    toc: true
  pdf:
    toc: true
  docx:
    toc: true

Warning

Indentation is critical. toc: true must be indented under html:, pdf:, or docx:, not at the same level as the format name.

HTML

The most flexible output format

YAML options

  • without options:
format: html
  • with some useful options:
format:
  html:
    toc: true              # include table of contents
    toc-depth: 3           # show headings up to H3 in the TOC
    toc-float: true        # keep the TOC visible as you scroll (floating sidebar)
    number-sections: true  # number all sections and subsections
    embed-resources: true  # bundle everything into a single .html file
    theme: flatly          # Bootswatch theme (flatly = clean, modern look)

embed-resources

  • By default, Quarto renders HTML with external dependencies stored in a separate folder
  • Setting embed-resources: true bundles everything into a single .html file
  • Easy to share by email or upload without missing assets

Warning

embed-resources: true increases file size and slows rendering. For a book or website hosted online, leave it as false.

Word

Co-authors and journal submission

YAML options

  • without options:
format: docx
  • with some useful options
format:
  docx:
    reference-doc: custom-reference.docx  # Word template defining fonts, margins, and heading styles
    toc: false                             # no table of contents in the Word output
    number-sections: false                 # no section numbering in the Word output

A reference .docx sets the styles (fonts, margins, heading levels) for the output. Generate a default one:

quarto pandoc -o custom-reference.docx \
  --print-default-data-file reference.docx

Then open in Word and modify styles to match your journal.

Citations

  • Citations are rendered as plain formatted text in .docx output
  • They are not live fields linked to your .bib file
  • Any edits made directly to citations in Word will be overwritten on re-render
  • Always treat the .qmd as the source of truth

Tip

If co-authors need to edit citations in Word, use Zotero’s Word plugin for the final submission copy.

πŸ’¬ Turn & talk

Do your co-authors use Word?

How do you currently handle citation editing across collaborators?

~3 minutes

✏️ Exercise 2: Rendering a Word Doc

  1. Change html to docx in your YAML. Does it render?

PDF

PDF and LaTeX output

YAML options

  • without options:
format: pdf
  • with some useful options
format:
  pdf:
    documentclass: article  # document class: article, scrartcl (KOMA), or apa7
    papersize: a4            # paper size
    fontsize: 12pt           # base font size
    geometry: margin=2.5cm  # page margins (requires geometry LaTeX package)
    linestretch: 1.5         # line spacing (1.5 = one-and-a-half, 2 = double)
    number-sections: true    # number all sections and subsections
    keep-tex: true           # save intermediate .tex file alongside the PDF
    include-in-header:
      text: |
        \usepackage{booktabs}   % professional table rules (required for kableExtra)
        \usepackage{longtable}  % tables that span multiple pages
        \usepackage{microtype}  % improved text justification and spacing

keep-tex

  • keep-tex: true saves the intermediate .tex file alongside the PDF
  • Useful for making final tweaks in Overleaf before submission
  • Required if the journal needs a raw .tex file
format:
  pdf:
    keep-tex: true

Format comparison

At a glance

Feature HTML PDF Word
Citations βœ… .bib βœ… .bib ⚠️ plain text
Live .bib in .tex βœ… depends ❌
Cross-references βœ… βœ… βœ…
Equations βœ… MathJax βœ… LaTeX ⚠️ limited
Table package gt kableExtra flextable
Custom styles CSS LaTeX reference .docx
Self-contained embed-resources always always

✏️ Your turn

Open exercises/session1.qmd and follow the exercises for .

~15 minutes

Summary

  • One .qmd file renders to HTML, Word, and PDF
  • embed-resources: true for shareable standalone HTML
  • Word output has plain text citations β€” treat .qmd as source of truth
  • keep-tex: true for Overleaf workflows
  • APA 7 in .tex involves trade-offs β€” choose based on your priority

Up next…

Incorporating Data

Summary tables and inline reporting