### Bug description

I'm having a problem with the headings of unnumbered sections if they are after a numbered section (or table of contents). Somehow they inherit the headings from the last numbered section (or table of contents).

Here is a reproducible example:

![1-TOC](https://user-images.githubusercontent.com/8647343/210754251-aeef4643-cce6-4565-90c2-fc7271884cce.png)


**Second Preface page inherits "Table of contents" heading**
![2-Preface](https://user-images.githubusercontent.com/8647343/210754255-ee72c10c-2403-4501-9d49-a3978e16c35e.png)

**Second References page inherits "Table of contents" heading**
![3-References](https://user-images.githubusercontent.com/8647343/210754256-f5a14a1b-410e-4dc3-9420-2a527cb02e94.png)

This is my _quarto.yml file, and I'm using the standard content created with a Quarto book:

```
project:
  type: book
  output-dir: _book

book:
  chapters:
    - index.qmd
    - references.qmd
    - summary.qmd
    
bibliography: references.bib

format:
  pdf:
    documentclass: book
    toc: true

```

One "solution" is to number the section. However I do not want some sections (e.g., preface, acknowledgments) to be numbered chapters.

Here is some additional information:

R version 4.2.1 (2022-06-23) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

Rstudio:

RStudio 2022.07.1+554 "Spotted Wakerobin" Release (7872775ebddc40635780ca1ed238934c3345c5de, 2022-07-22) for Ubuntu Jammy
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

**Ubuntu 22.04 LTS**




### 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.
2023-01-05T10:17:54Z
SbastianGarzon
bug
closed
Heading bug (PDF-unnumbered sections)
https://github.com/quarto-dev/quarto-cli/issues/3854