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

book:
  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.png
  • The index.qmd file is required (because Quarto books also produce a website in HTML format). This page should include the preface, acknowledgements, etc.

  • book specifies title, author, chatperters, and other book-level metadata.

    • chapters property includes one or more book chapters.

    You can divide your book into parts using part within the book chapters.

    • The references.qmd file will include the generated bibliography (see References below for details).

    Note that the markdown files dice.qmd and cards.qmd contain 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:

    book:
      chapters:
        - index.qmd
        - preface.qmd
        - part: "Dice"
          chapters: 
            - basics.qmd
            - packages.qmd
  • format specifies output formats and their options.

    For example, you can specify themes for HTML and pdf macros.

ref: