Skip to content

Commit

Permalink
also try the chunk option tbl.cap when tab.cap is NULL (quarto-dev/qu…
Browse files Browse the repository at this point in the history
  • Loading branch information
yihui committed Nov 13, 2023
1 parent 638d3ec commit c9473ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: knitr
Type: Package
Title: A General-Purpose Package for Dynamic Report Generation in R
Version: 1.45.3
Version: 1.45.4
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down
3 changes: 3 additions & 0 deletions R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ kable = function(
if (!missing(align) && length(align) == 1L && !grepl('[^lcr]', align))
align = strsplit(align, '')[[1]]

# Quarto uses the option name tbl-cap instead of tab-cap
if (missing(caption) && is.null(caption)) caption = opts_current$get('tbl.cap')

This comment has been minimized.

Copy link
@cderv

cderv Dec 15, 2023

Collaborator

I don't think we normalize tbl-cap to tbl.cap so here this option is never set in quarto context.

but I am not sure knitr should do anything with tbl-cap option as it will handle it no matter what knitr is doing.

```{r}
#| tbl-cap: test
knitr::kable(head(cars))
```

This will produce a caption
image

So I believe this commit could be revert if we consider tbl-cap is only quarto context.

Unless we want to support tbl-cap as an alias in knitr too. In that case we need to add to known options so that it is normalize. Or check for tbl-cap here.
We could also just map tbl-cap to tab-cap in the normalization among aliases as we do for fig-format

This comment has been minimized.

Copy link
@yihui

yihui Dec 18, 2023

Author Owner

Good points. 429e596 has mapped tbl-cap to tab.cap. Does that look good to you?


if (inherits(x, 'list')) {
format = kable_format_latex(format)
res = lapply(
Expand Down

0 comments on commit c9473ad

Please sign in to comment.