quarto::quarto_render("diamond-sizes.qmd",output_format="docx")
Chapter 29. Quarto Formats
Introduction
So far, you’ve seen Quarto used to produce HTML documents. This chapter gives a brief overview of some of the many other types of output you can produce with Quarto.
There are two ways to set the output of a document:
-
Permanently, by modifying the YAML header:
title:"Diamondsizes"format:html -
Transiently, by calling
quarto::quarto_render()by hand:This is useful if you want to programmatically produce multiple types of output since the
output_formatargument can also take a list of values:quarto::quarto_render("diamond-sizes.qmd",output_format=c("docx","pdf"))
Output Options
Quarto offers a wide range of output formats. You can find the complete list on the Quarto documentation on all formats. Many formats share some output options (e.g., toc: true for including a table of contents), but others have options that are format specific (e.g., code-fold: true collapses code chunks into a <details> tag for HTML output so the user can display it on demand; it’s not applicable in a PDF or Word document).
To override the default options, you need to use an expanded format field. For example, if you wanted to render an HTML document, with a floating table of contents, you’d use:
format:html:toc:truetoc_float:true
You can even render to multiple outputs by supplying a list of formats:
format:html:toc:truetoc_float:true:defaultdocx:default ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access