### Bug description

When rendering book project to pdf, the first sub heading in a chapter is ignored. However, the second subheading is rendered and included in the final pdf file.

The minimal example consists of the following two files.
The `_quarto.qml` file:
```
project:
  type: book

book:
  title: Test
  subtitle: Sub
  output-file: test

  chapters:
    - index.qmd

format:
  pdf:
    toc: true
    toc-depth: 2
    keep-tex: true
```

The `index.qmd` file:
```
---
title: "Chapter 1"
---
## Sub Heading

## Sub Heading Again
```

### Expected outcome: 
When rendering the document with `quarto render --to pdf`, the document should contain **1.1 Sub Heading** in **Chapter 1**.
### Actual outcome:
The final document does not contain **1.1 Sub Heading**, but instead **1.1 Sub Heading Again** only in **Chapter 1**.

## User Environment
OS: `Ubuntu 20.04.5 LTS`

`quarto check` output:
```
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 2.19.2: OK
      Dart Sass version 1.32.8: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.49
      Path: /opt/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.10.6 (Conda)
      Path: /home/schroer/mambaforge/envs/quarto/bin/python
      Jupyter: 4.11.2
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
```




### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
dragonstyle
2022-12-13T14:37:03Z
jensschroer
bug
v1.3
closed
Book / PDF output: First subheading in a chapter is missing
https://github.com/quarto-dev/quarto-cli/issues/3653