quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.98k stars 328 forks source link

Figure reference not processed in manuscript notebook using fenced div #11443

Open andjar opened 1 week ago

andjar commented 1 week ago

Bug description

I was trying to make subfigures in a notebook to be embedded in my main article, preferably as supplemental figures. However, I was unable to get the figure references in the notebook to render properly when rendering the project from the command line.

Possibly related to #8956?

Steps to reproduce

Create an empty main document/article and a notebook containing:

---
title: Test notebook
---

## Section

::: {#fig-example}

```{r}
plot(1)

Caption :::

@fig-example is an example.


Then run `quarto render` from the command line to generate an html file.

### Expected behavior

I expect the figure reference to render as: `Figure 1 is an example.`

### Actual behavior

The figure reference is rendered as: `@fig-example is an example.`

### Your environment

- IDE: Rstudio 2023.06.2 Build 561
- OS: Windows 10

### Quarto check output

```bash
Quarto 1.6.32
[>] Checking environment information...
      Quarto cache location: C:\Users\user\AppData\Local\quarto
[>] Checking versions of quarto binary dependencies...
      Pandoc version 3.4.0: OK
      Dart Sass version 1.70.0: OK
      Deno version 1.46.3: OK
      Typst version 0.11.0: OK
[>] Checking versions of quarto dependencies......OK
[>] Checking Quarto installation......OK
      Version: 1.6.32
      Path: C:\Users\user\AppData\Local\Programs\Quarto\bin
      CodePage: 1252

[>] Checking tools....................OK
      TinyTeX: (external install)
      Chromium: (not installed)

[>] Checking LaTeX....................OK
      Using: TinyTex
      Path: C:\Users\user\AppData\Roaming\TinyTeX\bin\win32\
      Version: 2022

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

[>] Checking Python 3 installation....OK
      Version: 3.12.2
      Path: C:/Users/user/AppData/Local/Programs/Python/Python312/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.3.1
      Path: C:/PROGRA~1/R/R-43~1.1
      LibPaths:
        - C:/Users/user/AppData/Local/R/win-library/4.3
        - C:/Program Files/R/R-4.3.1/library
      knitr: 1.48
      rmarkdown: 2.28

[>] Checking Knitr engine render......OK
cscheid commented 1 week ago

I can't repro:

Image

andjar commented 1 week ago

I have uploaded the raw and rendered files to a github repo for reproduction: https://github.com/andjar/quarto-bug-figure-ref

To preview the rendered html notebook page: https://html-preview.github.io/?url=https://github.com/andjar/quarto-bug-figure-ref/blob/main/_manuscript/test-preview.html

cscheid commented 1 week ago

Sorry, that's still not enough. What about quarto render index.qmd is failing? That's what I ran and that's the result I got. Can you provide more details?

andjar commented 1 week ago

So, the error is only present in the extra notebooks, not the main manuscript. If the code in the original post is put into the main manuscript file index.qmd, it renders correctly to Figure 1 is an example.

For the notebook test.qmd, the reference is rendered as @fig-example is an example. This happens with both quarto render and quarto render test.qmd. The commands run fine without warnings or error messages:

> quarto render test.qmd

processing file: test.qmd
1/3
2/3 [unnamed-chunk-1]
3/3
output file: test.knit.md

Rendering qmd embeds [test.qmd]
Rendering output notebook [test.qmd]
Rendering HTML preview [test.qmd]
Output created: _manuscript\test-preview.html
cscheid commented 1 week ago

Ok, that clarifies things. Thanks!

andjar commented 1 week ago

Thanks for your patience and for looking into this!

cscheid commented 1 week ago

Just to set expectations: we won't have time to look into this in the near future, but we have a backlog of manuscript issues that we will take on all at once, hopefully in 1.7 or 1.8.