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

Fix the error when kable()'s caption value is of length > 1 #2312

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ kable_caption = function(label, caption, format) {
# create a label for bookdown if applicable
if (is.null(label)) label = opts_current$get('label')
if (is.null(label)) label = NA
if (!is.null(caption) && !is.na(caption) && !is.na(label)) caption = paste0(
is_na = function(v) {
length(v) == 0 || (length(v) == 1 && is.na(v))
}
if (!is.null(caption) && !is_na(caption) && !is_na(label)) caption = paste0(
yihui marked this conversation as resolved.
Show resolved Hide resolved
create_label(
opts_knit$get('label.prefix')[['table']],
label, latex = (format == 'latex')
Expand Down
Loading