### Bug description

Adding the `filename` chunk option to a beamer document creates an error. Reprex:

````md
---
format: 
  beamer:
    keep-tex: true
---

```{r}
#| filename: "file"
#| echo: true
5 + 5
```
````
You get:


```
compilation failed- error
LaTeX Error: Not in outer par mode.
```

Diffing with and without the `filename` chunk you get: 

```diff
\begin{frame}[fragile]
+\begin{codelisting}

+\caption{\texttt{file}}

\begin{Shaded}
\begin{Highlighting}[]
\DecValTok{5} \SpecialCharTok{+} \DecValTok{5}
\end{Highlighting}
\end{Shaded}

+\end{codelisting}

\begin{verbatim}
[1] 10
\end{verbatim}
\end{frame}
```
The error is to do with the `codelisting` environment, specifically inside beamer (the exact same code works on `format: pdf`). I don't know enough LaTeX to say what the solution would be.

This is on Fedora 38, latest nightly release.

<details>
  <summary>Quarto Check</summary>
  
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.2: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 99.9.9
      Path: /home/wojtek/bin/quarto-cli/package/dist/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.11.3
      Path: /usr/bin/python3
      Jupyter: 5.3.0
      Kernels: python3, octave, julia-1.9

(\) Checking Jupyter engine render....0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.0
      Path: /opt/R/4.3.0/lib64/R
      LibPaths:
        - /home/wojtek/R/x86_64-pc-linux-gnu-library/4.3
        - /opt/R/4.3.0/lib64/R/library
      knitr: 1.42
      rmarkdown: 2.21

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

</details>

### 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.
- [ ] 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.
cderv
2023-05-14T20:23:06Z
wklimowicz
bug latex beamer
closed
code `filename` in beamer is not supported (errors out)
https://github.com/quarto-dev/quarto-cli/issues/5536