### Bug description

Initially discovered when discussing in #5637, formalising as separate bug report.

If the there is a multi-line `![]()` specifying a figure, it will compile successfully, but if the `fig-env` is set globally in the `_quarto.yml` then it fails to compile. If the `fig-env: bp` is remove it compiles successfully.


### `_quarto.yml`
```yaml

project:
  type: book

book:
  title: "testing"
  author: "Norah Jones"
  date: "23/05/2023"
  chapters:
    - index.qmd
    - intro.qmd
    - summary.qmd
    - references.qmd s

bibliography: references.bib

format:
  pdf:
    documentclass: scrreprt
    fig-env: bp
```

### `intro.qmd`
```md
# Introduction

This is a book created from markdown and executable code.

See @knuth84 for additional discussion of literate programming.

![
    A multi-line caption. 
    With the next line here. 
    And and now another line.
](
    cover.png
){
    #fig-logo
}
```

### Compilation Error
```md
compilation failed- error
LaTeX Error: Environment bp undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.211 \begin{bp}
```

### Offending Lines in `index.tex`
```tex
\begin{bp}

{\centering \includegraphics{cover.png}

}

\caption{\label{fig-logo}A multi-line caption. With the next line here.
And and now another line.}

\end{bp}
```

Testing on MacOS 13.2.

### `quarto check`
```md
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.1: OK
      Dart Sass version 1.55.0: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.3.353
      Path: /Applications/quarto/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.10.10 (Conda)
      Path: /usr/local/Caskroom/miniconda/base/bin/python
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with conda install jupyter

[✓] Checking R installation...........OK
      Version: 4.2.1
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2/Resources/library
      knitr: 1.41
      rmarkdown: 2.17

[✓] 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.
2023-05-24T04:46:05Z
BradyAJohnston
bug latex
closed
Multi-line `![]()` Fails to Compile with Global `fig-env`
https://github.com/quarto-dev/quarto-cli/issues/5655