Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mcanouil opened this issue Nov 8, 2024 · 4 comments
Open

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

mcanouil opened this issue Nov 8, 2024 · 4 comments
Assignees
Labels
bug Something isn't working crossref figures tables Issues with Tables including the gt integration triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Milestone

Comments

@mcanouil
Copy link
Collaborator

mcanouil commented Nov 8, 2024

*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)

@mcanouil mcanouil added bug Something isn't working crossref triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone. labels Nov 8, 2024
@mcanouil mcanouil added tables Issues with Tables including the gt integration figures labels Nov 8, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 8, 2024

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.

@mcanouil
Copy link
Collaborator Author

mcanouil commented Nov 8, 2024

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".)

@mcanouil
Copy link
Collaborator Author

mcanouil commented Nov 8, 2024

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

@cscheid cscheid added this to the Future milestone Nov 8, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 8, 2024

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
Labels
bug Something isn't working crossref figures tables Issues with Tables including the gt integration triaged-to Issues that were not self-assigned, signals that an issue was assigned to someone.
Projects
None yet
Development

No branches or pull requests

3 participants