### Bug description

I have been struggling with this for a while now. I came to the understanding that there is a bug. Depending on the position at which the chapters are defined, a cross-referencing to them will work or not. Please have a look at the two following configuration, where one file has some text and tries to corss-ref to chapters which are defined in another file. By the way, up to now I only saw this behavior with chapters, i.e. one dash header, not sections two or more dash headers.

### First configuration
_trial.qmd_
```
Further check [@sec-chap_1_Intro] -- Unable to resolve crossref 

chapter [-@sec-chap_1_Abc] -- will be found
```
_other_File.qmd_
```
# Introduction {#sec-chap_1_Intro}
Here is some more text

# Chap Test_4 {#sec-chap_1_Abc}
Here is some more text
```
### Second configuration
Here only the order of chapter declaration has been changed, i.e., the chapter **Chap Test_4** is defined first and the chapter Introduction
_trial.qmd_
```
Further check [@sec-chap_1_Intro] -- is found now (able to resolve crossref) 

chapter [-@sec-chap_1_Abc] -- now this becomes the issue (will not be found anymore)
```
_other_File.qmd_
```
# Chap Test_4 {#sec-chap_1_Abc}
Here is some more text

# Introduction {#sec-chap_1_Intro}
Here is some more text
```

```
quarto --version
1.3.330
```
Operating system: Linux Manjaro

```
quarto check                  

[✓] 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.330
      Path: /home/jav/Progs/quarto/quarto-1.3.330/bin

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

[✓] Checking Python 3 installation....OK
      Version: 3.10.10
      Path: /usr/bin/python3
      Jupyter: (None)

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

[✓] Checking R installation...........(None)

      Unable to locate an installed version of R.
      Install R from https://cloud.r-project.org/
```
### Show me the full project
The reason why the bug is important to me is because of a bigger project. I have some cross-refs which are not found. If you want to have a look at them, feel free to have a look at the bigger project:

```
git clone https://huggingface.co/spaces/JavedA/master_Thesis/
cd master_Thesis
quarto preview
```
In case there is any issue with obtaining the bigger project, please let me know.

Thank you for your time and effort


### 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.
cscheid
2023-04-19T04:28:21Z
jav-ed
bug crossref triaged-to
v1.4
open
Unable to resolve crossref for chapters
https://github.com/quarto-dev/quarto-cli/issues/5237