### Bug description

System: Debian 11

RStudio: RStudio 2022.12.0+353 "Elsbeth Geranium". All packages up to date, using default quarto version (could not check version)

In the yml file:

```
format:
  pdf:
    papersize: a4
      
    include-in-header: 
      text: |
        \usepackage{titlesec}
        \titleformat{\chapter}[display]{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}   
        \titlespacing*{\chapter}{0pt}{-50pt}{40pt}
```

Use of titlesec package produces a compilation error:

```
compilation failed- error
Argument of \paragraph has an extra }.
<inserted text> 
                \par 
l.1636 \ttl@extract\paragraph
```



### Checklist

- [ ] 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-27T16:36:32Z
vfacta
bug
closed
Titlesec error
https://github.com/quarto-dev/quarto-cli/issues/4126