Search code examples
rquarto

Split a chapter into two qmd files in Quarto pdf output


I'm using the pdf book output in Quarto and I want to break a chapter into two qmd files. The first file ch1a.qmd should have a level 1 heading but not ch1b.qmd.

My yaml header:

project:
  type: book

book:
  title: "Temp"
  author: "Norah Jones"
  date: "11/2/2023"
  chapters:
    - index.qmd
    - ch1a.qmd
    - ch1b.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd

bibliography: references.bib

format:
  pdf:
    documentclass: scrreprt
    keep-tex: true
    include-in-header:
      text: |
        \usepackage[subrefformat=simple]{subfig}

Contents of ch1a.qmd:

# Chapter Begins

## Section begins

Some text here.

Contents of ch1b.qmd:

## Remaining Chapter 1

This qmd file has no level 1 heading. 

Yet rendering this turns ch1b.qmd into a separate chapter. How do I tell Quarto to pick up where the previous file ended.

enter image description here


Solution

  • Shout out to Mickaël Canouil who gave the correct answer at github. Leaving it here in case anyone else has the same issue.

    It seems that at present the only way is to create another file ch1.qmd and use short code blocks with include:

    # Chapter Begins
    
    {{< include ch1a.qmd >}}
    {{< include ch1b.qmd >}}