Skip to content

Float crossrefs with unlabeled subfloats #2246

@HelenaLC

Description

@HelenaLC

Bug description

summary

current behavior:

  • a code chunk that renders multiple plots with #| fig-cap: set duplicates the caption
  • consequently, the figure counter is incremented twice

expected/desired behavior:

  • sub-captions are optional: not specifying #| fig-subcap: gives a main caption only, without sub-panels being labeled (a)-(z)
  • alternatively, there's a chunk option to mark figures as not/having labeled sub-panels
  • an incorrect number of #| fig-subcap: items gives an error
  • in either case, the figure counter is incremented once only (since there's one #| fig-cap: that can be cross-referenced)

repex

.qmd:

```{r}
#| label: fig-histograms-1
#| fig-cap: "this caption is duplicated"
#| fig-show: hold
#| fig-width: 4
#| fig-height: 3
#| layout-nrow: 1
hist(runif(100))
hist(rnorm(100))
```

```{r}
#| label: fig-histograms-2
#| fig-cap: "this caption is unique"
#| fig-subcap: 
#|   - ""
#|   - ""
#| fig-show: hold
#| fig-width: 4
#| fig-height: 3
#| layout-nrow: 1
hist(runif(100))
hist(rnorm(100))
```

output:

image

software

  • Quarto version 1.1.168
  • macOS Monterey version 12.2
  • RStudio IDE version "Prairie Trillium" Release
    (1db809b8, 2022-05-16) for macOS

Checklist

  • 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.
  • Please format your issue 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?
  • Please document the operating system you're running. If on Linux, please provide the specific distribution.

Metadata

Metadata

Labels

bugSomething isn't workingcrossref

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions