### Bug description

The following code in a .qmd document
```tex
<!-- Problem -->
``abc" \(123\) ``def"

<!-- Problem -->
``abc"
``def"

<!-- No problem -->
``abc"

``def"
```
produces (when rendered with the R-code `quarto::quarto_render("mydocument.qmd")` the following TeX code
```tex
\texttt{abc"\ \textbackslash{}(123\textbackslash{})}def''

\texttt{abc"}def''

``abc''

``def''
```
and this in turn produces the following PDF
![Quarto TeX problem](https://user-images.githubusercontent.com/63608009/225698838-033a5887-e3ab-4892-a354-84b04ef0562a.jpg)

I have no idea what is happening, but Overleaf does not have this problem, so I think this is a Quarto problem.

### Computer setup
RStudio version: 2022.12.0 Build 353
Operating system: Windows 10
```bash
$ quarto check

[>] Checking Quarto installation......OK
      Version: 1.2.269
      Path: C:\Users\xxxxx\AppData\Local\Programs\RStudio\resources\app\bin\quarto\bin
      CodePage: 1252

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

[>] Checking Python 3 installation....OK
      Version: 3.11.2
      Path: C:/Users/xxxxx/AppData/Local/Programs/Python/Python311/python.exe
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with py -m pip install jupyter

[>] Checking R installation...........OK
      Version: 4.2.2
      Path: C:/PROGRA~1/R/R-42~1.2
      LibPaths:
        - C:/Program Files/R/R-4.2.2/library
      rmarkdown: 2.20

[>] Checking Knitr engine render......OK
```

### 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.
- [X] Please provide the output of `quarto check` so we know which version of quarto and its dependencies you're running.

----

## EDIT

RMarkdown also has this problem, so the problem is likely on `knitr`, I will post the issue there. I was too quick to blame Quarto for this :P
I will keep the issue here until it gets resolved in case someone else has the same problem.
2023-03-16T17:17:14Z
timothee-bacri
closed
Multiple quotation marks on the same line get mishandled
https://github.com/quarto-dev/quarto-cli/issues/4857