Skip to content

*cap-location at code cell level is not respected without label #11342

Open

Description

@mcanouil

*cap-location at code cell level is not respected without label. (tested on 28bfc55)

It seems related to a previous fix:

But It seems the fix did not make it all the way in 1.5 regarding the issue.

Adding a label makes the code cell option work.

Note: both fig and tbl are impacted.

InputOutput
---
title: "Untitled"
format: html
---

```{r}
#| tbl-cap: MTCARS
#| tbl-cap-location: top
library(gt)
mtcars[1:5, ] |> gt()
```

```{r}
#| tbl-cap: MTCARS
#| tbl-cap-location: bottom
library(gt)
mtcars[1:5, ] |> gt()
```
image
---
title: "Untitled"
format: html
---

```{r}
#| label: tbl-one
#| tbl-cap: MTCARS
#| tbl-cap-location: top
library(gt)
mtcars[1:5, ] |> gt()
```

```{r}
#| label: tbl-two
#| tbl-cap: MTCARS
#| tbl-cap-location: bottom
library(gt)
mtcars[1:5, ] |> gt()
```
image

Originally posted by @mcanouil in #11341 (comment)

Activity

  1. added
    bug
    triaged-to
    on Nov 8, 2024
  2. added
    tables
    on Nov 8, 2024
  3. cderv commented on Nov 8, 2024

    @cderv
    Member

    But It seems the fix did not make it all the way in 1.5 regarding the issue.

    I think the fix targeted the markdown syntax for this and it works ok (not consider a style regression on border I am looking into 🤕 )

    ---
    title: Table caption location
    tbl-cap-location: bottom
    format: html
    ---
    
    | Col1 | Col2 | Col3 |
    |------|------|------|
    | A    | B    | C    |
    | E    | F    | G    |
    
    : A non-labelled table with a caption
    

    Also it was "fixed" only for HTML.

    Here this is related to engine, and tbl-cap-location passed at cell level and not at global level.

    The discussion from #9734 still apply here: Most of the tbl- option are happening for FloatRefTarget. So it requires a label.

    @cscheid will confirm but I don't think this is a bug here. And it is not a regression as this cell option does not seem to have ever worked from any Quarto version.

  4. mcanouil commented on Nov 8, 2024

    @mcanouil
    CollaboratorAuthor

    The "issue" is that the behaviour is not consistent tbl-cap-location:

    • works at the global level on non-labelled tables/figures.
    • does not at the code cell level on non-labelled tables/figures.

    (My first thought was "there should be a label there".)

  5. mcanouil commented on Nov 8, 2024

    @mcanouil
    CollaboratorAuthor

    This could go as a linter issue (for "future") rather than a bug: warn users if they set *cap-location without label in a code cell.

    It could also be considered as a documentation issue, i.e., update the reference pages (if possible) to mention that those options require a label to be set: https://quarto.org/docs/reference/cells/cells-knitr.html#page-columns / https://quarto.org/docs/reference/cells/cells-jupyter.html#page-columns

  6. added this to the Future milestone on Nov 8, 2024
  7. cderv commented on Nov 8, 2024

    @cderv
    Member

    The "issue" is that the behaviour is not consistent tbl-cap-location:

    • works at the global level on non-labelled tables/figures.
    • does not at the code cell level on non-labelled tables/figures.

    This makes me think this is a case where should probably not have done #9734 😅 It created this inconsitency with engine, and across format.

    So I believe in this case, we wanted this inconsistency for now.

    This could go as a linter issue (for "future") rather than a bug: warn users if they set *cap-location without label in a code cell.

    This is a good idea if this is doable ! We have probably several combination of options where we could give nice warning / advice.

    It could also be considered as a documentation issue, i.e., update the reference pages (if possible) to mention that those options require a label to be set: quarto.org/docs/reference/cells/cells-knitr.html#page-columns / quarto.org/docs/reference/cells/cells-jupyter.html#page-columns

    Yes good point now that this is there. More generally, I think this is about the feature for FloatRefTarget only. I think this is not the only one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcrossreffigurestablestriaged-to

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions