Skip to content

Subcaption issues with and without labels with KableExtra #4517

@matthewgson

Description

@matthewgson

Bug description

I'm not sure if this issue belongs to quarto or kableExtra, but leaving the report here. Please let me know if this should be reported to kableExtra.

Please see below for reprex.

Edit: The issue is related to pdf output.

---
title: "test_quarto"
format: pdf
---

Knitr

Without label

#| tbl-cap: "Example1"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 1

knitr::kable(head(iris))
knitr::kable(tail(iris))

Works fine

With label

#| label: tbl-example1
#| tbl-cap: "Example2"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 1

knitr::kable(head(iris))
knitr::kable(tail(iris))

Works fine

KableExtra

Without label

It generates two additional empty labels: (a),(b),(c),(d)

#| tbl-cap: "Example3"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 1

kableExtra::kable(head(iris))
kableExtra::kable(tail(iris))

With label

#| label: tbl-example4
#| tbl-cap: "Example4"
#| tbl-subcap: 
#|   - "Cars"
#|   - "Pressure"
#| layout-ncol: 1

kableExtra::kable(head(iris))
kableExtra::kable(tail(iris))

Works now.

Running on RStudio build 353 / R4.2.2

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

Assignees

Labels

crossrefenhancementNew feature or requestthird-partyIssues involving interaction with a third-party library

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions