### Bug description

The slide numbering gets messed up by h1 (i.e., `#`) sections when using `print-pdf` with RevealJS. If you create a MWE presentation using the code below, it will correctly number the slides 1 to 4 in the IDE and web browser. But when you go to `http://localhost:6600/?print-pdf` (or whatever your port is) or open the presentation in Chrome and hit `e` on the keyboard, each h1 section will increment the slide number by 2 instead of 1. It will also change back to the `c` format, even if you change it in YAML, and it will add an empty page at the end.

```` qmd
---
format: 
  revealjs:
    slide-number: c/t
    show-slide-number: all
---

# Section 1

## Slide

# Section 2

## Slide

````

Correct display in RStudio IDE: (i.e., `1 / 4`, `2 / 4`, `3 / 4`, `4 / 4`)

![image](https://user-images.githubusercontent.com/6829033/213012002-7c6b53f7-b5db-4bed-a37e-4cce7bb789c0.png)

Incorrect numbering and format in PDF Output: (i.e., `2`, `3`, `5`, `6`, Blank)

![image](https://user-images.githubusercontent.com/6829033/213012641-d7de5ada-9aea-479e-8422-1337f7172882.png)


See the PDF here generated by Chrome
[mwe.pdf](https://github.com/quarto-dev/quarto-cli/files/10439373/mwe.pdf)

---

### Versions

RStudio 2022.12.0+353 "Elsbeth Geranium" Release (7d165dcfc1b6d300eb247738db2c7076234f6ef0, 2022-12-03) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2022.12.0+353 Chrome/102.0.5005.167 Electron/19.1.3 Safari/537.36

Microsoft Windows version 22H2 (OS Build 22623.1095) (64-bit)

Google Chrome version 109.0.5414.75 (Official Build) (64-bit)

Quarto CLI 1.2.269

---

### 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.
cderv
2023-01-17T21:14:21Z
jmgirard
bug revealjs
v1.4
open
Slide Number Issues with RevealJS's print-pdf and h1 sections
https://github.com/quarto-dev/quarto-cli/issues/3997