6.1 Book Structure
book type projects are designed for authoring books.
It combines multiple documents (chapters) into a single manuscript.
It supports a variety of formats: PDF, HTML, EPUB, DOCX, etc.
Best to use book if you want both PDF and HTML outputs.
The _quarto.yml file contains the book project structure.
project:
type: book
output-dir: docs
resources:
- "filters/emoji/*.png"
# only render changed files
execute:
freeze: auto
book:
title: "Title of the Book"
site-url: "https://your-username.github.io/your-repo-name/"
chapters:
- index.qmd
- preface.qmd
- part: dice.qmd
chapters:
- basics.qmd
- packages.qmd
- part: cards.qmd
chapters:
- objects.qmd
- notation.qmd
- modifying.qmd
- environments.qmd
- references.qmd
appendices:
- tools.qmd
- resources.qmd
bibliography: references.bib
format:
html:
theme: cosmo
pdf:
documentclass: scrreprt
epub:
cover-image: cover.pngThe
index.qmdfile is required (because Quarto books also produce a website in HTML format). This page should include the preface, acknowledgements, etc.site-url: support RSS feeds, generatesdocs/sitemap.xml(for Google indexing).bookspecifies title, author, chatperters, and other book-level metadata.chaptersproperty includes one or more book chapters.
You can divide your book into parts using
partwithin the bookchapters.- The
references.qmdfile will include the generated bibliography (see References below for details).
Note that the markdown files
dice.qmdandcards.qmdcontain the part title (as a level one heading) as well as some introductory content for the part.If you just need a part title then you can alternatively use this syntax:
formatspecifies output formats and their options.For example, you can specify themes for HTML and pdf macros.
If you would like to specify common metadata for documents inside a sub-directory our your project, you can do so by adding a file called _metadata.yml to the sub-directory. Read more in the Quarto Documentation at Directory Metadata.
_metadata.ymlwill be merged to root_quarto.ymlfile, and will override any conflicting options in the root_quarto.ymlfile. → You can have distinct metadata for different sub-directories in your project.- Another option is to use subfolder
_quarto.yml. This will isolate your subfolder into a standalone project, and will not inherit any metadata from the root_quarto.ymlfile.
ref: