The issue here is that when repeatedly using child documents with figures/tables all references are to the last version of the figure/table in the document/site. My question: is there is any way to help quarto figure out which figure/table should be referenced?
I set up a github repo to make a minimum reproducible example, since it’s too much code to dump here. Just clone the repo and run quarto render
.
Details:
I have a quarto book project that uses the knitr
engine. It conducts an analysis on several different days of data. To do this I have a quarto document for each day with parameters in the YAML header, e.g.,
params:
date: "2024-08-28"
In the body of the document I have
```{r}
options(knitr.duplicate.label = "allow")
```
```{r child='day-template.qmd'}
```
I generate a book (HTML or PDF) using quarto render
. There is a chapter for each day, and the day-template.qmd
analysis executed for each chapter. The problem is that even though I’m allowing duplicate labels, the figure references using those labels are not correct.
E.g., if there is a code chunk in day-template.qmd
that generates a plot with the label fig-a
. I can reference that figure in the body of day-template.qmd
using @fig-a
. However if day-template.qmd
is creating content for chapters 2 and 3, then the @fig-a
reference that is in chapter 2 will reference the version of the figure in chapter 3.
Here is what it looks like when rendered to PDF:
Is there a way to help quarto figure out how to properly configure figure labels in this case?