HTML, Word, PDF, and LaTeX
March 25, 2026
.tex trade-offsWhich 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
Render to a single format by specifying it in the YAML format: block:
Add options by replacing default with indented key-value pairs; here we add table of contents:
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.
Specify all formats together to render all at once with quarto render manuscript.qmd in the Terminal (or individually via the Render button):
Warning
Indentation is critical. toc: true must be indented under html:, pdf:, or docx:, not at the same level as the format name.
The most flexible output format
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-resourcesembed-resources: true bundles everything into a single .html fileWarning
embed-resources: true increases file size and slows rendering. For a book or website hosted online, leave it as false.
Co-authors and journal submission
.docx output.bib file.qmd as the source of truthTip
If co-authors need to edit citations in Word, use Zoteroβs Word plugin for the final submission copy.
Do your co-authors use Word?
How do you currently handle citation editing across collaborators?
~3 minutes
html to docx in your YAML. Does it render?PDF and LaTeX output
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 spacingkeep-texkeep-tex: true saves the intermediate .tex file alongside the PDF.tex file| Feature | HTML | 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 |
Open exercises/session1.qmd and follow the exercises for .
~15 minutes
.qmd file renders to HTML, Word, and PDFembed-resources: true for shareable standalone HTML.qmd as source of truthkeep-tex: true for Overleaf workflows.tex involves trade-offs β choose based on your prioritySummary tables and inline reporting
R for Publication - Day 1: Output Formats